// Code generated by msgraph-generate.go DO NOT EDIT. package msgraph import ( "context" "fmt" "io/ioutil" "net/http" "github.com/matterbridge/msgraph.go/jsonx" ) // EventRequestBuilder is request builder for Event type EventRequestBuilder struct{ BaseRequestBuilder } // Request returns EventRequest func (b *EventRequestBuilder) Request() *EventRequest { return &EventRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // EventRequest is request for Event type EventRequest struct{ BaseRequest } // Get performs GET request for Event func (r *EventRequest) Get(ctx context.Context) (resObj *Event, err error) { var query string if r.query != nil { query = "?" + r.query.Encode() } err = r.JSONRequest(ctx, "GET", query, nil, &resObj) return } // Update performs PATCH request for Event func (r *EventRequest) Update(ctx context.Context, reqObj *Event) error { return r.JSONRequest(ctx, "PATCH", "", reqObj, nil) } // Delete performs DELETE request for Event func (r *EventRequest) Delete(ctx context.Context) error { return r.JSONRequest(ctx, "DELETE", "", nil, nil) } // 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 func (r *EventAttachmentsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]Attachment, error) { 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 { defer res.Body.Close() if res.StatusCode != http.StatusOK { b, _ := ioutil.ReadAll(res.Body) 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) if err != nil { return nil, err } err = jsonx.Unmarshal(paging.Value, &value) if err != nil { return nil, err } values = append(values, value...) if len(paging.NextLink) == 0 { 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 } } } // Get performs GET request for Attachment collection func (r *EventAttachmentsCollectionRequest) Get(ctx context.Context) ([]Attachment, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // 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 func (r *EventExtensionsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]Extension, error) { 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 { defer res.Body.Close() if res.StatusCode != http.StatusOK { b, _ := ioutil.ReadAll(res.Body) 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) if err != nil { return nil, err } err = jsonx.Unmarshal(paging.Value, &value) if err != nil { return nil, err } values = append(values, value...) if len(paging.NextLink) == 0 { 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 } } } // Get performs GET request for Extension collection func (r *EventExtensionsCollectionRequest) Get(ctx context.Context) ([]Extension, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // 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 func (r *EventInstancesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]Event, error) { 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 { defer res.Body.Close() if res.StatusCode != http.StatusOK { b, _ := ioutil.ReadAll(res.Body) 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) if err != nil { return nil, err } err = jsonx.Unmarshal(paging.Value, &value) if err != nil { return nil, err } values = append(values, value...) if len(paging.NextLink) == 0 { 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 } } } // Get performs GET request for Event collection func (r *EventInstancesCollectionRequest) Get(ctx context.Context) ([]Event, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // 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 func (r *EventMultiValueExtendedPropertiesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]MultiValueLegacyExtendedProperty, error) { 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 { defer res.Body.Close() if res.StatusCode != http.StatusOK { b, _ := ioutil.ReadAll(res.Body) 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) if err != nil { return nil, err } err = jsonx.Unmarshal(paging.Value, &value) if err != nil { return nil, err } values = append(values, value...) if len(paging.NextLink) == 0 { 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 } } } // Get performs GET request for MultiValueLegacyExtendedProperty collection func (r *EventMultiValueExtendedPropertiesCollectionRequest) Get(ctx context.Context) ([]MultiValueLegacyExtendedProperty, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // 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 func (r *EventSingleValueExtendedPropertiesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]SingleValueLegacyExtendedProperty, error) { 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 { defer res.Body.Close() if res.StatusCode != http.StatusOK { b, _ := ioutil.ReadAll(res.Body) 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) if err != nil { return nil, err } err = jsonx.Unmarshal(paging.Value, &value) if err != nil { return nil, err } values = append(values, value...) if len(paging.NextLink) == 0 { 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 } } } // Get performs GET request for SingleValueLegacyExtendedProperty collection func (r *EventSingleValueExtendedPropertiesCollectionRequest) Get(ctx context.Context) ([]SingleValueLegacyExtendedProperty, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // 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 }