2020-09-04 21:29:13 +00:00
|
|
|
// Code generated by msgraph.go/gen DO NOT EDIT.
|
2019-12-26 22:12:28 +00:00
|
|
|
|
|
|
|
package msgraph
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
|
|
|
"io/ioutil"
|
|
|
|
"net/http"
|
|
|
|
|
2020-03-15 22:43:46 +00:00
|
|
|
"github.com/yaegashi/msgraph.go/jsonx"
|
2019-12-26 22:12:28 +00:00
|
|
|
)
|
|
|
|
|
2020-03-15 22:43:46 +00:00
|
|
|
// EventDismissReminderRequestParameter undocumented
|
|
|
|
type EventDismissReminderRequestParameter struct {
|
|
|
|
}
|
2019-12-26 22:12:28 +00:00
|
|
|
|
2020-03-15 22:43:46 +00:00
|
|
|
// EventSnoozeReminderRequestParameter undocumented
|
|
|
|
type EventSnoozeReminderRequestParameter struct {
|
|
|
|
// NewReminderTime undocumented
|
|
|
|
NewReminderTime *DateTimeTimeZone `json:"NewReminderTime,omitempty"`
|
2019-12-26 22:12:28 +00:00
|
|
|
}
|
|
|
|
|
2020-03-15 22:43:46 +00:00
|
|
|
// EventForwardRequestParameter undocumented
|
|
|
|
type EventForwardRequestParameter struct {
|
|
|
|
// ToRecipients undocumented
|
|
|
|
ToRecipients []Recipient `json:"ToRecipients,omitempty"`
|
|
|
|
// Comment undocumented
|
|
|
|
Comment *string `json:"Comment,omitempty"`
|
|
|
|
}
|
2019-12-26 22:12:28 +00:00
|
|
|
|
2020-03-15 22:43:46 +00:00
|
|
|
// EventAcceptRequestParameter undocumented
|
|
|
|
type EventAcceptRequestParameter struct {
|
|
|
|
// SendResponse undocumented
|
|
|
|
SendResponse *bool `json:"SendResponse,omitempty"`
|
|
|
|
// Comment undocumented
|
|
|
|
Comment *string `json:"Comment,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// EventDeclineRequestParameter undocumented
|
|
|
|
type EventDeclineRequestParameter struct {
|
|
|
|
// ProposedNewTime undocumented
|
|
|
|
ProposedNewTime *TimeSlot `json:"ProposedNewTime,omitempty"`
|
|
|
|
// SendResponse undocumented
|
|
|
|
SendResponse *bool `json:"SendResponse,omitempty"`
|
|
|
|
// Comment undocumented
|
|
|
|
Comment *string `json:"Comment,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// EventTentativelyAcceptRequestParameter undocumented
|
|
|
|
type EventTentativelyAcceptRequestParameter struct {
|
|
|
|
// ProposedNewTime undocumented
|
|
|
|
ProposedNewTime *TimeSlot `json:"ProposedNewTime,omitempty"`
|
|
|
|
// SendResponse undocumented
|
|
|
|
SendResponse *bool `json:"SendResponse,omitempty"`
|
|
|
|
// Comment undocumented
|
|
|
|
Comment *string `json:"Comment,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// EventCancelRequestParameter undocumented
|
|
|
|
type EventCancelRequestParameter struct {
|
|
|
|
// Comment undocumented
|
|
|
|
Comment *string `json:"Comment,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// EventMessageRequestObjectAcceptRequestParameter undocumented
|
|
|
|
type EventMessageRequestObjectAcceptRequestParameter struct {
|
|
|
|
// SendResponse undocumented
|
|
|
|
SendResponse *bool `json:"SendResponse,omitempty"`
|
|
|
|
// Comment undocumented
|
|
|
|
Comment *string `json:"Comment,omitempty"`
|
2019-12-26 22:12:28 +00:00
|
|
|
}
|
|
|
|
|
2020-03-15 22:43:46 +00:00
|
|
|
// EventMessageRequestObjectDeclineRequestParameter undocumented
|
|
|
|
type EventMessageRequestObjectDeclineRequestParameter struct {
|
|
|
|
// ProposedNewTime undocumented
|
|
|
|
ProposedNewTime *TimeSlot `json:"ProposedNewTime,omitempty"`
|
|
|
|
// SendResponse undocumented
|
|
|
|
SendResponse *bool `json:"SendResponse,omitempty"`
|
|
|
|
// Comment undocumented
|
|
|
|
Comment *string `json:"Comment,omitempty"`
|
2019-12-26 22:12:28 +00:00
|
|
|
}
|
|
|
|
|
2020-03-15 22:43:46 +00:00
|
|
|
// EventMessageRequestObjectTentativelyAcceptRequestParameter undocumented
|
|
|
|
type EventMessageRequestObjectTentativelyAcceptRequestParameter struct {
|
|
|
|
// ProposedNewTime undocumented
|
|
|
|
ProposedNewTime *TimeSlot `json:"ProposedNewTime,omitempty"`
|
|
|
|
// SendResponse undocumented
|
|
|
|
SendResponse *bool `json:"SendResponse,omitempty"`
|
|
|
|
// Comment undocumented
|
|
|
|
Comment *string `json:"Comment,omitempty"`
|
2019-12-26 22:12:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Attachments returns request builder for Attachment collection
|
|
|
|
func (b *EventRequestBuilder) Attachments() *EventAttachmentsCollectionRequestBuilder {
|
|
|
|
bb := &EventAttachmentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
|
|
bb.baseURL += "/attachments"
|
|
|
|
return bb
|
|
|
|
}
|
|
|
|
|
|
|
|
// EventAttachmentsCollectionRequestBuilder is request builder for Attachment collection
|
|
|
|
type EventAttachmentsCollectionRequestBuilder struct{ BaseRequestBuilder }
|
|
|
|
|
|
|
|
// Request returns request for Attachment collection
|
|
|
|
func (b *EventAttachmentsCollectionRequestBuilder) Request() *EventAttachmentsCollectionRequest {
|
|
|
|
return &EventAttachmentsCollectionRequest{
|
|
|
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ID returns request builder for Attachment item
|
|
|
|
func (b *EventAttachmentsCollectionRequestBuilder) ID(id string) *AttachmentRequestBuilder {
|
|
|
|
bb := &AttachmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
|
|
bb.baseURL += "/" + id
|
|
|
|
return bb
|
|
|
|
}
|
|
|
|
|
|
|
|
// EventAttachmentsCollectionRequest is request for Attachment collection
|
|
|
|
type EventAttachmentsCollectionRequest struct{ BaseRequest }
|
|
|
|
|
|
|
|
// Paging perfoms paging operation for Attachment collection
|
2020-03-15 22:43:46 +00:00
|
|
|
func (r *EventAttachmentsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]Attachment, error) {
|
2019-12-26 22:12:28 +00:00
|
|
|
req, err := r.NewJSONRequest(method, path, obj)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
if ctx != nil {
|
|
|
|
req = req.WithContext(ctx)
|
|
|
|
}
|
|
|
|
res, err := r.client.Do(req)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
var values []Attachment
|
|
|
|
for {
|
|
|
|
if res.StatusCode != http.StatusOK {
|
|
|
|
b, _ := ioutil.ReadAll(res.Body)
|
2020-09-04 21:29:13 +00:00
|
|
|
res.Body.Close()
|
2019-12-26 22:12:28 +00:00
|
|
|
errRes := &ErrorResponse{Response: res}
|
|
|
|
err := jsonx.Unmarshal(b, errRes)
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
|
|
|
|
}
|
|
|
|
return nil, errRes
|
|
|
|
}
|
|
|
|
var (
|
|
|
|
paging Paging
|
|
|
|
value []Attachment
|
|
|
|
)
|
|
|
|
err := jsonx.NewDecoder(res.Body).Decode(&paging)
|
2020-09-04 21:29:13 +00:00
|
|
|
res.Body.Close()
|
2019-12-26 22:12:28 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
err = jsonx.Unmarshal(paging.Value, &value)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
values = append(values, value...)
|
2020-03-15 22:43:46 +00:00
|
|
|
if n >= 0 {
|
|
|
|
n--
|
|
|
|
}
|
|
|
|
if n == 0 || len(paging.NextLink) == 0 {
|
2019-12-26 22:12:28 +00:00
|
|
|
return values, nil
|
|
|
|
}
|
|
|
|
req, err = http.NewRequest("GET", paging.NextLink, nil)
|
|
|
|
if ctx != nil {
|
|
|
|
req = req.WithContext(ctx)
|
|
|
|
}
|
|
|
|
res, err = r.client.Do(req)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-15 22:43:46 +00:00
|
|
|
// GetN performs GET request for Attachment collection, max N pages
|
|
|
|
func (r *EventAttachmentsCollectionRequest) GetN(ctx context.Context, n int) ([]Attachment, error) {
|
2019-12-26 22:12:28 +00:00
|
|
|
var query string
|
|
|
|
if r.query != nil {
|
|
|
|
query = "?" + r.query.Encode()
|
|
|
|
}
|
2020-03-15 22:43:46 +00:00
|
|
|
return r.Paging(ctx, "GET", query, nil, n)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get performs GET request for Attachment collection
|
|
|
|
func (r *EventAttachmentsCollectionRequest) Get(ctx context.Context) ([]Attachment, error) {
|
|
|
|
return r.GetN(ctx, 0)
|
2019-12-26 22:12:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Add performs POST request for Attachment collection
|
|
|
|
func (r *EventAttachmentsCollectionRequest) Add(ctx context.Context, reqObj *Attachment) (resObj *Attachment, err error) {
|
|
|
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Calendar is navigation property
|
|
|
|
func (b *EventRequestBuilder) Calendar() *CalendarRequestBuilder {
|
|
|
|
bb := &CalendarRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
|
|
bb.baseURL += "/calendar"
|
|
|
|
return bb
|
|
|
|
}
|
|
|
|
|
|
|
|
// Extensions returns request builder for Extension collection
|
|
|
|
func (b *EventRequestBuilder) Extensions() *EventExtensionsCollectionRequestBuilder {
|
|
|
|
bb := &EventExtensionsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
|
|
bb.baseURL += "/extensions"
|
|
|
|
return bb
|
|
|
|
}
|
|
|
|
|
|
|
|
// EventExtensionsCollectionRequestBuilder is request builder for Extension collection
|
|
|
|
type EventExtensionsCollectionRequestBuilder struct{ BaseRequestBuilder }
|
|
|
|
|
|
|
|
// Request returns request for Extension collection
|
|
|
|
func (b *EventExtensionsCollectionRequestBuilder) Request() *EventExtensionsCollectionRequest {
|
|
|
|
return &EventExtensionsCollectionRequest{
|
|
|
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ID returns request builder for Extension item
|
|
|
|
func (b *EventExtensionsCollectionRequestBuilder) ID(id string) *ExtensionRequestBuilder {
|
|
|
|
bb := &ExtensionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
|
|
bb.baseURL += "/" + id
|
|
|
|
return bb
|
|
|
|
}
|
|
|
|
|
|
|
|
// EventExtensionsCollectionRequest is request for Extension collection
|
|
|
|
type EventExtensionsCollectionRequest struct{ BaseRequest }
|
|
|
|
|
|
|
|
// Paging perfoms paging operation for Extension collection
|
2020-03-15 22:43:46 +00:00
|
|
|
func (r *EventExtensionsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]Extension, error) {
|
2019-12-26 22:12:28 +00:00
|
|
|
req, err := r.NewJSONRequest(method, path, obj)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
if ctx != nil {
|
|
|
|
req = req.WithContext(ctx)
|
|
|
|
}
|
|
|
|
res, err := r.client.Do(req)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
var values []Extension
|
|
|
|
for {
|
|
|
|
if res.StatusCode != http.StatusOK {
|
|
|
|
b, _ := ioutil.ReadAll(res.Body)
|
2020-09-04 21:29:13 +00:00
|
|
|
res.Body.Close()
|
2019-12-26 22:12:28 +00:00
|
|
|
errRes := &ErrorResponse{Response: res}
|
|
|
|
err := jsonx.Unmarshal(b, errRes)
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
|
|
|
|
}
|
|
|
|
return nil, errRes
|
|
|
|
}
|
|
|
|
var (
|
|
|
|
paging Paging
|
|
|
|
value []Extension
|
|
|
|
)
|
|
|
|
err := jsonx.NewDecoder(res.Body).Decode(&paging)
|
2020-09-04 21:29:13 +00:00
|
|
|
res.Body.Close()
|
2019-12-26 22:12:28 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
err = jsonx.Unmarshal(paging.Value, &value)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
values = append(values, value...)
|
2020-03-15 22:43:46 +00:00
|
|
|
if n >= 0 {
|
|
|
|
n--
|
|
|
|
}
|
|
|
|
if n == 0 || len(paging.NextLink) == 0 {
|
2019-12-26 22:12:28 +00:00
|
|
|
return values, nil
|
|
|
|
}
|
|
|
|
req, err = http.NewRequest("GET", paging.NextLink, nil)
|
|
|
|
if ctx != nil {
|
|
|
|
req = req.WithContext(ctx)
|
|
|
|
}
|
|
|
|
res, err = r.client.Do(req)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-15 22:43:46 +00:00
|
|
|
// GetN performs GET request for Extension collection, max N pages
|
|
|
|
func (r *EventExtensionsCollectionRequest) GetN(ctx context.Context, n int) ([]Extension, error) {
|
2019-12-26 22:12:28 +00:00
|
|
|
var query string
|
|
|
|
if r.query != nil {
|
|
|
|
query = "?" + r.query.Encode()
|
|
|
|
}
|
2020-03-15 22:43:46 +00:00
|
|
|
return r.Paging(ctx, "GET", query, nil, n)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get performs GET request for Extension collection
|
|
|
|
func (r *EventExtensionsCollectionRequest) Get(ctx context.Context) ([]Extension, error) {
|
|
|
|
return r.GetN(ctx, 0)
|
2019-12-26 22:12:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Add performs POST request for Extension collection
|
|
|
|
func (r *EventExtensionsCollectionRequest) Add(ctx context.Context, reqObj *Extension) (resObj *Extension, err error) {
|
|
|
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Instances returns request builder for Event collection
|
|
|
|
func (b *EventRequestBuilder) Instances() *EventInstancesCollectionRequestBuilder {
|
|
|
|
bb := &EventInstancesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
|
|
bb.baseURL += "/instances"
|
|
|
|
return bb
|
|
|
|
}
|
|
|
|
|
|
|
|
// EventInstancesCollectionRequestBuilder is request builder for Event collection
|
|
|
|
type EventInstancesCollectionRequestBuilder struct{ BaseRequestBuilder }
|
|
|
|
|
|
|
|
// Request returns request for Event collection
|
|
|
|
func (b *EventInstancesCollectionRequestBuilder) Request() *EventInstancesCollectionRequest {
|
|
|
|
return &EventInstancesCollectionRequest{
|
|
|
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ID returns request builder for Event item
|
|
|
|
func (b *EventInstancesCollectionRequestBuilder) ID(id string) *EventRequestBuilder {
|
|
|
|
bb := &EventRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
|
|
bb.baseURL += "/" + id
|
|
|
|
return bb
|
|
|
|
}
|
|
|
|
|
|
|
|
// EventInstancesCollectionRequest is request for Event collection
|
|
|
|
type EventInstancesCollectionRequest struct{ BaseRequest }
|
|
|
|
|
|
|
|
// Paging perfoms paging operation for Event collection
|
2020-03-15 22:43:46 +00:00
|
|
|
func (r *EventInstancesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]Event, error) {
|
2019-12-26 22:12:28 +00:00
|
|
|
req, err := r.NewJSONRequest(method, path, obj)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
if ctx != nil {
|
|
|
|
req = req.WithContext(ctx)
|
|
|
|
}
|
|
|
|
res, err := r.client.Do(req)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
var values []Event
|
|
|
|
for {
|
|
|
|
if res.StatusCode != http.StatusOK {
|
|
|
|
b, _ := ioutil.ReadAll(res.Body)
|
2020-09-04 21:29:13 +00:00
|
|
|
res.Body.Close()
|
2019-12-26 22:12:28 +00:00
|
|
|
errRes := &ErrorResponse{Response: res}
|
|
|
|
err := jsonx.Unmarshal(b, errRes)
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
|
|
|
|
}
|
|
|
|
return nil, errRes
|
|
|
|
}
|
|
|
|
var (
|
|
|
|
paging Paging
|
|
|
|
value []Event
|
|
|
|
)
|
|
|
|
err := jsonx.NewDecoder(res.Body).Decode(&paging)
|
2020-09-04 21:29:13 +00:00
|
|
|
res.Body.Close()
|
2019-12-26 22:12:28 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
err = jsonx.Unmarshal(paging.Value, &value)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
values = append(values, value...)
|
2020-03-15 22:43:46 +00:00
|
|
|
if n >= 0 {
|
|
|
|
n--
|
|
|
|
}
|
|
|
|
if n == 0 || len(paging.NextLink) == 0 {
|
2019-12-26 22:12:28 +00:00
|
|
|
return values, nil
|
|
|
|
}
|
|
|
|
req, err = http.NewRequest("GET", paging.NextLink, nil)
|
|
|
|
if ctx != nil {
|
|
|
|
req = req.WithContext(ctx)
|
|
|
|
}
|
|
|
|
res, err = r.client.Do(req)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-15 22:43:46 +00:00
|
|
|
// GetN performs GET request for Event collection, max N pages
|
|
|
|
func (r *EventInstancesCollectionRequest) GetN(ctx context.Context, n int) ([]Event, error) {
|
2019-12-26 22:12:28 +00:00
|
|
|
var query string
|
|
|
|
if r.query != nil {
|
|
|
|
query = "?" + r.query.Encode()
|
|
|
|
}
|
2020-03-15 22:43:46 +00:00
|
|
|
return r.Paging(ctx, "GET", query, nil, n)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get performs GET request for Event collection
|
|
|
|
func (r *EventInstancesCollectionRequest) Get(ctx context.Context) ([]Event, error) {
|
|
|
|
return r.GetN(ctx, 0)
|
2019-12-26 22:12:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Add performs POST request for Event collection
|
|
|
|
func (r *EventInstancesCollectionRequest) Add(ctx context.Context, reqObj *Event) (resObj *Event, err error) {
|
|
|
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// MultiValueExtendedProperties returns request builder for MultiValueLegacyExtendedProperty collection
|
|
|
|
func (b *EventRequestBuilder) MultiValueExtendedProperties() *EventMultiValueExtendedPropertiesCollectionRequestBuilder {
|
|
|
|
bb := &EventMultiValueExtendedPropertiesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
|
|
bb.baseURL += "/multiValueExtendedProperties"
|
|
|
|
return bb
|
|
|
|
}
|
|
|
|
|
|
|
|
// EventMultiValueExtendedPropertiesCollectionRequestBuilder is request builder for MultiValueLegacyExtendedProperty collection
|
|
|
|
type EventMultiValueExtendedPropertiesCollectionRequestBuilder struct{ BaseRequestBuilder }
|
|
|
|
|
|
|
|
// Request returns request for MultiValueLegacyExtendedProperty collection
|
|
|
|
func (b *EventMultiValueExtendedPropertiesCollectionRequestBuilder) Request() *EventMultiValueExtendedPropertiesCollectionRequest {
|
|
|
|
return &EventMultiValueExtendedPropertiesCollectionRequest{
|
|
|
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ID returns request builder for MultiValueLegacyExtendedProperty item
|
|
|
|
func (b *EventMultiValueExtendedPropertiesCollectionRequestBuilder) ID(id string) *MultiValueLegacyExtendedPropertyRequestBuilder {
|
|
|
|
bb := &MultiValueLegacyExtendedPropertyRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
|
|
bb.baseURL += "/" + id
|
|
|
|
return bb
|
|
|
|
}
|
|
|
|
|
|
|
|
// EventMultiValueExtendedPropertiesCollectionRequest is request for MultiValueLegacyExtendedProperty collection
|
|
|
|
type EventMultiValueExtendedPropertiesCollectionRequest struct{ BaseRequest }
|
|
|
|
|
|
|
|
// Paging perfoms paging operation for MultiValueLegacyExtendedProperty collection
|
2020-03-15 22:43:46 +00:00
|
|
|
func (r *EventMultiValueExtendedPropertiesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]MultiValueLegacyExtendedProperty, error) {
|
2019-12-26 22:12:28 +00:00
|
|
|
req, err := r.NewJSONRequest(method, path, obj)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
if ctx != nil {
|
|
|
|
req = req.WithContext(ctx)
|
|
|
|
}
|
|
|
|
res, err := r.client.Do(req)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
var values []MultiValueLegacyExtendedProperty
|
|
|
|
for {
|
|
|
|
if res.StatusCode != http.StatusOK {
|
|
|
|
b, _ := ioutil.ReadAll(res.Body)
|
2020-09-04 21:29:13 +00:00
|
|
|
res.Body.Close()
|
2019-12-26 22:12:28 +00:00
|
|
|
errRes := &ErrorResponse{Response: res}
|
|
|
|
err := jsonx.Unmarshal(b, errRes)
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
|
|
|
|
}
|
|
|
|
return nil, errRes
|
|
|
|
}
|
|
|
|
var (
|
|
|
|
paging Paging
|
|
|
|
value []MultiValueLegacyExtendedProperty
|
|
|
|
)
|
|
|
|
err := jsonx.NewDecoder(res.Body).Decode(&paging)
|
2020-09-04 21:29:13 +00:00
|
|
|
res.Body.Close()
|
2019-12-26 22:12:28 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
err = jsonx.Unmarshal(paging.Value, &value)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
values = append(values, value...)
|
2020-03-15 22:43:46 +00:00
|
|
|
if n >= 0 {
|
|
|
|
n--
|
|
|
|
}
|
|
|
|
if n == 0 || len(paging.NextLink) == 0 {
|
2019-12-26 22:12:28 +00:00
|
|
|
return values, nil
|
|
|
|
}
|
|
|
|
req, err = http.NewRequest("GET", paging.NextLink, nil)
|
|
|
|
if ctx != nil {
|
|
|
|
req = req.WithContext(ctx)
|
|
|
|
}
|
|
|
|
res, err = r.client.Do(req)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-15 22:43:46 +00:00
|
|
|
// GetN performs GET request for MultiValueLegacyExtendedProperty collection, max N pages
|
|
|
|
func (r *EventMultiValueExtendedPropertiesCollectionRequest) GetN(ctx context.Context, n int) ([]MultiValueLegacyExtendedProperty, error) {
|
2019-12-26 22:12:28 +00:00
|
|
|
var query string
|
|
|
|
if r.query != nil {
|
|
|
|
query = "?" + r.query.Encode()
|
|
|
|
}
|
2020-03-15 22:43:46 +00:00
|
|
|
return r.Paging(ctx, "GET", query, nil, n)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get performs GET request for MultiValueLegacyExtendedProperty collection
|
|
|
|
func (r *EventMultiValueExtendedPropertiesCollectionRequest) Get(ctx context.Context) ([]MultiValueLegacyExtendedProperty, error) {
|
|
|
|
return r.GetN(ctx, 0)
|
2019-12-26 22:12:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Add performs POST request for MultiValueLegacyExtendedProperty collection
|
|
|
|
func (r *EventMultiValueExtendedPropertiesCollectionRequest) Add(ctx context.Context, reqObj *MultiValueLegacyExtendedProperty) (resObj *MultiValueLegacyExtendedProperty, err error) {
|
|
|
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// SingleValueExtendedProperties returns request builder for SingleValueLegacyExtendedProperty collection
|
|
|
|
func (b *EventRequestBuilder) SingleValueExtendedProperties() *EventSingleValueExtendedPropertiesCollectionRequestBuilder {
|
|
|
|
bb := &EventSingleValueExtendedPropertiesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
|
|
bb.baseURL += "/singleValueExtendedProperties"
|
|
|
|
return bb
|
|
|
|
}
|
|
|
|
|
|
|
|
// EventSingleValueExtendedPropertiesCollectionRequestBuilder is request builder for SingleValueLegacyExtendedProperty collection
|
|
|
|
type EventSingleValueExtendedPropertiesCollectionRequestBuilder struct{ BaseRequestBuilder }
|
|
|
|
|
|
|
|
// Request returns request for SingleValueLegacyExtendedProperty collection
|
|
|
|
func (b *EventSingleValueExtendedPropertiesCollectionRequestBuilder) Request() *EventSingleValueExtendedPropertiesCollectionRequest {
|
|
|
|
return &EventSingleValueExtendedPropertiesCollectionRequest{
|
|
|
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ID returns request builder for SingleValueLegacyExtendedProperty item
|
|
|
|
func (b *EventSingleValueExtendedPropertiesCollectionRequestBuilder) ID(id string) *SingleValueLegacyExtendedPropertyRequestBuilder {
|
|
|
|
bb := &SingleValueLegacyExtendedPropertyRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
|
|
bb.baseURL += "/" + id
|
|
|
|
return bb
|
|
|
|
}
|
|
|
|
|
|
|
|
// EventSingleValueExtendedPropertiesCollectionRequest is request for SingleValueLegacyExtendedProperty collection
|
|
|
|
type EventSingleValueExtendedPropertiesCollectionRequest struct{ BaseRequest }
|
|
|
|
|
|
|
|
// Paging perfoms paging operation for SingleValueLegacyExtendedProperty collection
|
2020-03-15 22:43:46 +00:00
|
|
|
func (r *EventSingleValueExtendedPropertiesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]SingleValueLegacyExtendedProperty, error) {
|
2019-12-26 22:12:28 +00:00
|
|
|
req, err := r.NewJSONRequest(method, path, obj)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
if ctx != nil {
|
|
|
|
req = req.WithContext(ctx)
|
|
|
|
}
|
|
|
|
res, err := r.client.Do(req)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
var values []SingleValueLegacyExtendedProperty
|
|
|
|
for {
|
|
|
|
if res.StatusCode != http.StatusOK {
|
|
|
|
b, _ := ioutil.ReadAll(res.Body)
|
2020-09-04 21:29:13 +00:00
|
|
|
res.Body.Close()
|
2019-12-26 22:12:28 +00:00
|
|
|
errRes := &ErrorResponse{Response: res}
|
|
|
|
err := jsonx.Unmarshal(b, errRes)
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
|
|
|
|
}
|
|
|
|
return nil, errRes
|
|
|
|
}
|
|
|
|
var (
|
|
|
|
paging Paging
|
|
|
|
value []SingleValueLegacyExtendedProperty
|
|
|
|
)
|
|
|
|
err := jsonx.NewDecoder(res.Body).Decode(&paging)
|
2020-09-04 21:29:13 +00:00
|
|
|
res.Body.Close()
|
2019-12-26 22:12:28 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
err = jsonx.Unmarshal(paging.Value, &value)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
values = append(values, value...)
|
2020-03-15 22:43:46 +00:00
|
|
|
if n >= 0 {
|
|
|
|
n--
|
|
|
|
}
|
|
|
|
if n == 0 || len(paging.NextLink) == 0 {
|
2019-12-26 22:12:28 +00:00
|
|
|
return values, nil
|
|
|
|
}
|
|
|
|
req, err = http.NewRequest("GET", paging.NextLink, nil)
|
|
|
|
if ctx != nil {
|
|
|
|
req = req.WithContext(ctx)
|
|
|
|
}
|
|
|
|
res, err = r.client.Do(req)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-15 22:43:46 +00:00
|
|
|
// GetN performs GET request for SingleValueLegacyExtendedProperty collection, max N pages
|
|
|
|
func (r *EventSingleValueExtendedPropertiesCollectionRequest) GetN(ctx context.Context, n int) ([]SingleValueLegacyExtendedProperty, error) {
|
2019-12-26 22:12:28 +00:00
|
|
|
var query string
|
|
|
|
if r.query != nil {
|
|
|
|
query = "?" + r.query.Encode()
|
|
|
|
}
|
2020-03-15 22:43:46 +00:00
|
|
|
return r.Paging(ctx, "GET", query, nil, n)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get performs GET request for SingleValueLegacyExtendedProperty collection
|
|
|
|
func (r *EventSingleValueExtendedPropertiesCollectionRequest) Get(ctx context.Context) ([]SingleValueLegacyExtendedProperty, error) {
|
|
|
|
return r.GetN(ctx, 0)
|
2019-12-26 22:12:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Add performs POST request for SingleValueLegacyExtendedProperty collection
|
|
|
|
func (r *EventSingleValueExtendedPropertiesCollectionRequest) Add(ctx context.Context, reqObj *SingleValueLegacyExtendedProperty) (resObj *SingleValueLegacyExtendedProperty, err error) {
|
|
|
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
|
|
|
return
|
|
|
|
}
|
2020-03-15 22:43:46 +00:00
|
|
|
|
|
|
|
// Event is navigation property
|
|
|
|
func (b *EventMessageRequestBuilder) Event() *EventRequestBuilder {
|
|
|
|
bb := &EventRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
|
|
bb.baseURL += "/event"
|
|
|
|
return bb
|
|
|
|
}
|