// Code generated by msgraph-generate.go DO NOT EDIT. package msgraph import ( "context" "fmt" "io/ioutil" "net/http" "github.com/matterbridge/msgraph.go/jsonx" ) // ManagedDeviceMobileAppConfigurationRequestBuilder is request builder for ManagedDeviceMobileAppConfiguration type ManagedDeviceMobileAppConfigurationRequestBuilder struct{ BaseRequestBuilder } // Request returns ManagedDeviceMobileAppConfigurationRequest func (b *ManagedDeviceMobileAppConfigurationRequestBuilder) Request() *ManagedDeviceMobileAppConfigurationRequest { return &ManagedDeviceMobileAppConfigurationRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ManagedDeviceMobileAppConfigurationRequest is request for ManagedDeviceMobileAppConfiguration type ManagedDeviceMobileAppConfigurationRequest struct{ BaseRequest } // Get performs GET request for ManagedDeviceMobileAppConfiguration func (r *ManagedDeviceMobileAppConfigurationRequest) Get(ctx context.Context) (resObj *ManagedDeviceMobileAppConfiguration, 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 ManagedDeviceMobileAppConfiguration func (r *ManagedDeviceMobileAppConfigurationRequest) Update(ctx context.Context, reqObj *ManagedDeviceMobileAppConfiguration) error { return r.JSONRequest(ctx, "PATCH", "", reqObj, nil) } // Delete performs DELETE request for ManagedDeviceMobileAppConfiguration func (r *ManagedDeviceMobileAppConfigurationRequest) Delete(ctx context.Context) error { return r.JSONRequest(ctx, "DELETE", "", nil, nil) } // Assignments returns request builder for ManagedDeviceMobileAppConfigurationAssignment collection func (b *ManagedDeviceMobileAppConfigurationRequestBuilder) Assignments() *ManagedDeviceMobileAppConfigurationAssignmentsCollectionRequestBuilder { bb := &ManagedDeviceMobileAppConfigurationAssignmentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/assignments" return bb } // ManagedDeviceMobileAppConfigurationAssignmentsCollectionRequestBuilder is request builder for ManagedDeviceMobileAppConfigurationAssignment collection type ManagedDeviceMobileAppConfigurationAssignmentsCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for ManagedDeviceMobileAppConfigurationAssignment collection func (b *ManagedDeviceMobileAppConfigurationAssignmentsCollectionRequestBuilder) Request() *ManagedDeviceMobileAppConfigurationAssignmentsCollectionRequest { return &ManagedDeviceMobileAppConfigurationAssignmentsCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for ManagedDeviceMobileAppConfigurationAssignment item func (b *ManagedDeviceMobileAppConfigurationAssignmentsCollectionRequestBuilder) ID(id string) *ManagedDeviceMobileAppConfigurationAssignmentRequestBuilder { bb := &ManagedDeviceMobileAppConfigurationAssignmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // ManagedDeviceMobileAppConfigurationAssignmentsCollectionRequest is request for ManagedDeviceMobileAppConfigurationAssignment collection type ManagedDeviceMobileAppConfigurationAssignmentsCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for ManagedDeviceMobileAppConfigurationAssignment collection func (r *ManagedDeviceMobileAppConfigurationAssignmentsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]ManagedDeviceMobileAppConfigurationAssignment, 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 []ManagedDeviceMobileAppConfigurationAssignment 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 []ManagedDeviceMobileAppConfigurationAssignment ) 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 ManagedDeviceMobileAppConfigurationAssignment collection func (r *ManagedDeviceMobileAppConfigurationAssignmentsCollectionRequest) Get(ctx context.Context) ([]ManagedDeviceMobileAppConfigurationAssignment, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for ManagedDeviceMobileAppConfigurationAssignment collection func (r *ManagedDeviceMobileAppConfigurationAssignmentsCollectionRequest) Add(ctx context.Context, reqObj *ManagedDeviceMobileAppConfigurationAssignment) (resObj *ManagedDeviceMobileAppConfigurationAssignment, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // DeviceStatusSummary is navigation property func (b *ManagedDeviceMobileAppConfigurationRequestBuilder) DeviceStatusSummary() *ManagedDeviceMobileAppConfigurationDeviceSummaryRequestBuilder { bb := &ManagedDeviceMobileAppConfigurationDeviceSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/deviceStatusSummary" return bb } // DeviceStatuses returns request builder for ManagedDeviceMobileAppConfigurationDeviceStatus collection func (b *ManagedDeviceMobileAppConfigurationRequestBuilder) DeviceStatuses() *ManagedDeviceMobileAppConfigurationDeviceStatusesCollectionRequestBuilder { bb := &ManagedDeviceMobileAppConfigurationDeviceStatusesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/deviceStatuses" return bb } // ManagedDeviceMobileAppConfigurationDeviceStatusesCollectionRequestBuilder is request builder for ManagedDeviceMobileAppConfigurationDeviceStatus collection type ManagedDeviceMobileAppConfigurationDeviceStatusesCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for ManagedDeviceMobileAppConfigurationDeviceStatus collection func (b *ManagedDeviceMobileAppConfigurationDeviceStatusesCollectionRequestBuilder) Request() *ManagedDeviceMobileAppConfigurationDeviceStatusesCollectionRequest { return &ManagedDeviceMobileAppConfigurationDeviceStatusesCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for ManagedDeviceMobileAppConfigurationDeviceStatus item func (b *ManagedDeviceMobileAppConfigurationDeviceStatusesCollectionRequestBuilder) ID(id string) *ManagedDeviceMobileAppConfigurationDeviceStatusRequestBuilder { bb := &ManagedDeviceMobileAppConfigurationDeviceStatusRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // ManagedDeviceMobileAppConfigurationDeviceStatusesCollectionRequest is request for ManagedDeviceMobileAppConfigurationDeviceStatus collection type ManagedDeviceMobileAppConfigurationDeviceStatusesCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for ManagedDeviceMobileAppConfigurationDeviceStatus collection func (r *ManagedDeviceMobileAppConfigurationDeviceStatusesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]ManagedDeviceMobileAppConfigurationDeviceStatus, 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 []ManagedDeviceMobileAppConfigurationDeviceStatus 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 []ManagedDeviceMobileAppConfigurationDeviceStatus ) 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 ManagedDeviceMobileAppConfigurationDeviceStatus collection func (r *ManagedDeviceMobileAppConfigurationDeviceStatusesCollectionRequest) Get(ctx context.Context) ([]ManagedDeviceMobileAppConfigurationDeviceStatus, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for ManagedDeviceMobileAppConfigurationDeviceStatus collection func (r *ManagedDeviceMobileAppConfigurationDeviceStatusesCollectionRequest) Add(ctx context.Context, reqObj *ManagedDeviceMobileAppConfigurationDeviceStatus) (resObj *ManagedDeviceMobileAppConfigurationDeviceStatus, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // UserStatusSummary is navigation property func (b *ManagedDeviceMobileAppConfigurationRequestBuilder) UserStatusSummary() *ManagedDeviceMobileAppConfigurationUserSummaryRequestBuilder { bb := &ManagedDeviceMobileAppConfigurationUserSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/userStatusSummary" return bb } // UserStatuses returns request builder for ManagedDeviceMobileAppConfigurationUserStatus collection func (b *ManagedDeviceMobileAppConfigurationRequestBuilder) UserStatuses() *ManagedDeviceMobileAppConfigurationUserStatusesCollectionRequestBuilder { bb := &ManagedDeviceMobileAppConfigurationUserStatusesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/userStatuses" return bb } // ManagedDeviceMobileAppConfigurationUserStatusesCollectionRequestBuilder is request builder for ManagedDeviceMobileAppConfigurationUserStatus collection type ManagedDeviceMobileAppConfigurationUserStatusesCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for ManagedDeviceMobileAppConfigurationUserStatus collection func (b *ManagedDeviceMobileAppConfigurationUserStatusesCollectionRequestBuilder) Request() *ManagedDeviceMobileAppConfigurationUserStatusesCollectionRequest { return &ManagedDeviceMobileAppConfigurationUserStatusesCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for ManagedDeviceMobileAppConfigurationUserStatus item func (b *ManagedDeviceMobileAppConfigurationUserStatusesCollectionRequestBuilder) ID(id string) *ManagedDeviceMobileAppConfigurationUserStatusRequestBuilder { bb := &ManagedDeviceMobileAppConfigurationUserStatusRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // ManagedDeviceMobileAppConfigurationUserStatusesCollectionRequest is request for ManagedDeviceMobileAppConfigurationUserStatus collection type ManagedDeviceMobileAppConfigurationUserStatusesCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for ManagedDeviceMobileAppConfigurationUserStatus collection func (r *ManagedDeviceMobileAppConfigurationUserStatusesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]ManagedDeviceMobileAppConfigurationUserStatus, 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 []ManagedDeviceMobileAppConfigurationUserStatus 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 []ManagedDeviceMobileAppConfigurationUserStatus ) 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 ManagedDeviceMobileAppConfigurationUserStatus collection func (r *ManagedDeviceMobileAppConfigurationUserStatusesCollectionRequest) Get(ctx context.Context) ([]ManagedDeviceMobileAppConfigurationUserStatus, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for ManagedDeviceMobileAppConfigurationUserStatus collection func (r *ManagedDeviceMobileAppConfigurationUserStatusesCollectionRequest) Add(ctx context.Context, reqObj *ManagedDeviceMobileAppConfigurationUserStatus) (resObj *ManagedDeviceMobileAppConfigurationUserStatus, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return }