diff options
author | Wim <wim@42.be> | 2020-03-08 17:08:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-08 17:08:18 +0100 |
commit | 9785edd26366be8eb11c2435f50f90a5c8eea7fc (patch) | |
tree | e8e236b5b273e7535c607507cc059f3b957068a1 /vendor/github.com/yaegashi/msgraph.go/beta/DeviceManagementIntentRequest.go | |
parent | 2a0bc11b684f63305258e338c5f1d0e91eb24414 (diff) | |
download | matterbridge-msglm-9785edd26366be8eb11c2435f50f90a5c8eea7fc.tar.gz matterbridge-msglm-9785edd26366be8eb11c2435f50f90a5c8eea7fc.tar.bz2 matterbridge-msglm-9785edd26366be8eb11c2435f50f90a5c8eea7fc.zip |
Remove replace directives and use own fork to make go get work again (#1028)
See https://github.com/golang/go/issues/30354
go get doesn't honor the go.mod replace options.
Diffstat (limited to 'vendor/github.com/yaegashi/msgraph.go/beta/DeviceManagementIntentRequest.go')
-rw-r--r-- | vendor/github.com/yaegashi/msgraph.go/beta/DeviceManagementIntentRequest.go | 623 |
1 files changed, 0 insertions, 623 deletions
diff --git a/vendor/github.com/yaegashi/msgraph.go/beta/DeviceManagementIntentRequest.go b/vendor/github.com/yaegashi/msgraph.go/beta/DeviceManagementIntentRequest.go deleted file mode 100644 index 42ef1a58..00000000 --- a/vendor/github.com/yaegashi/msgraph.go/beta/DeviceManagementIntentRequest.go +++ /dev/null @@ -1,623 +0,0 @@ -// Code generated by msgraph-generate.go DO NOT EDIT. - -package msgraph - -import ( - "context" - "fmt" - "io/ioutil" - "net/http" - - "github.com/yaegashi/msgraph.go/jsonx" -) - -// DeviceManagementIntentRequestBuilder is request builder for DeviceManagementIntent -type DeviceManagementIntentRequestBuilder struct{ BaseRequestBuilder } - -// Request returns DeviceManagementIntentRequest -func (b *DeviceManagementIntentRequestBuilder) Request() *DeviceManagementIntentRequest { - return &DeviceManagementIntentRequest{ - BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, - } -} - -// DeviceManagementIntentRequest is request for DeviceManagementIntent -type DeviceManagementIntentRequest struct{ BaseRequest } - -// Get performs GET request for DeviceManagementIntent -func (r *DeviceManagementIntentRequest) Get(ctx context.Context) (resObj *DeviceManagementIntent, 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 DeviceManagementIntent -func (r *DeviceManagementIntentRequest) Update(ctx context.Context, reqObj *DeviceManagementIntent) error { - return r.JSONRequest(ctx, "PATCH", "", reqObj, nil) -} - -// Delete performs DELETE request for DeviceManagementIntent -func (r *DeviceManagementIntentRequest) Delete(ctx context.Context) error { - return r.JSONRequest(ctx, "DELETE", "", nil, nil) -} - -// Assignments returns request builder for DeviceManagementIntentAssignment collection -func (b *DeviceManagementIntentRequestBuilder) Assignments() *DeviceManagementIntentAssignmentsCollectionRequestBuilder { - bb := &DeviceManagementIntentAssignmentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} - bb.baseURL += "/assignments" - return bb -} - -// DeviceManagementIntentAssignmentsCollectionRequestBuilder is request builder for DeviceManagementIntentAssignment collection -type DeviceManagementIntentAssignmentsCollectionRequestBuilder struct{ BaseRequestBuilder } - -// Request returns request for DeviceManagementIntentAssignment collection -func (b *DeviceManagementIntentAssignmentsCollectionRequestBuilder) Request() *DeviceManagementIntentAssignmentsCollectionRequest { - return &DeviceManagementIntentAssignmentsCollectionRequest{ - BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, - } -} - -// ID returns request builder for DeviceManagementIntentAssignment item -func (b *DeviceManagementIntentAssignmentsCollectionRequestBuilder) ID(id string) *DeviceManagementIntentAssignmentRequestBuilder { - bb := &DeviceManagementIntentAssignmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} - bb.baseURL += "/" + id - return bb -} - -// DeviceManagementIntentAssignmentsCollectionRequest is request for DeviceManagementIntentAssignment collection -type DeviceManagementIntentAssignmentsCollectionRequest struct{ BaseRequest } - -// Paging perfoms paging operation for DeviceManagementIntentAssignment collection -func (r *DeviceManagementIntentAssignmentsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]DeviceManagementIntentAssignment, 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 []DeviceManagementIntentAssignment - 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 []DeviceManagementIntentAssignment - ) - 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 DeviceManagementIntentAssignment collection -func (r *DeviceManagementIntentAssignmentsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementIntentAssignment, error) { - var query string - if r.query != nil { - query = "?" + r.query.Encode() - } - return r.Paging(ctx, "GET", query, nil) -} - -// Add performs POST request for DeviceManagementIntentAssignment collection -func (r *DeviceManagementIntentAssignmentsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementIntentAssignment) (resObj *DeviceManagementIntentAssignment, err error) { - err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) - return -} - -// Categories returns request builder for DeviceManagementIntentSettingCategory collection -func (b *DeviceManagementIntentRequestBuilder) Categories() *DeviceManagementIntentCategoriesCollectionRequestBuilder { - bb := &DeviceManagementIntentCategoriesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} - bb.baseURL += "/categories" - return bb -} - -// DeviceManagementIntentCategoriesCollectionRequestBuilder is request builder for DeviceManagementIntentSettingCategory collection -type DeviceManagementIntentCategoriesCollectionRequestBuilder struct{ BaseRequestBuilder } - -// Request returns request for DeviceManagementIntentSettingCategory collection -func (b *DeviceManagementIntentCategoriesCollectionRequestBuilder) Request() *DeviceManagementIntentCategoriesCollectionRequest { - return &DeviceManagementIntentCategoriesCollectionRequest{ - BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, - } -} - -// ID returns request builder for DeviceManagementIntentSettingCategory item -func (b *DeviceManagementIntentCategoriesCollectionRequestBuilder) ID(id string) *DeviceManagementIntentSettingCategoryRequestBuilder { - bb := &DeviceManagementIntentSettingCategoryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} - bb.baseURL += "/" + id - return bb -} - -// DeviceManagementIntentCategoriesCollectionRequest is request for DeviceManagementIntentSettingCategory collection -type DeviceManagementIntentCategoriesCollectionRequest struct{ BaseRequest } - -// Paging perfoms paging operation for DeviceManagementIntentSettingCategory collection -func (r *DeviceManagementIntentCategoriesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]DeviceManagementIntentSettingCategory, 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 []DeviceManagementIntentSettingCategory - 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 []DeviceManagementIntentSettingCategory - ) - 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 DeviceManagementIntentSettingCategory collection -func (r *DeviceManagementIntentCategoriesCollectionRequest) Get(ctx context.Context) ([]DeviceManagementIntentSettingCategory, error) { - var query string - if r.query != nil { - query = "?" + r.query.Encode() - } - return r.Paging(ctx, "GET", query, nil) -} - -// Add performs POST request for DeviceManagementIntentSettingCategory collection -func (r *DeviceManagementIntentCategoriesCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementIntentSettingCategory) (resObj *DeviceManagementIntentSettingCategory, err error) { - err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) - return -} - -// DeviceSettingStateSummaries returns request builder for DeviceManagementIntentDeviceSettingStateSummary collection -func (b *DeviceManagementIntentRequestBuilder) DeviceSettingStateSummaries() *DeviceManagementIntentDeviceSettingStateSummariesCollectionRequestBuilder { - bb := &DeviceManagementIntentDeviceSettingStateSummariesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} - bb.baseURL += "/deviceSettingStateSummaries" - return bb -} - -// DeviceManagementIntentDeviceSettingStateSummariesCollectionRequestBuilder is request builder for DeviceManagementIntentDeviceSettingStateSummary collection -type DeviceManagementIntentDeviceSettingStateSummariesCollectionRequestBuilder struct{ BaseRequestBuilder } - -// Request returns request for DeviceManagementIntentDeviceSettingStateSummary collection -func (b *DeviceManagementIntentDeviceSettingStateSummariesCollectionRequestBuilder) Request() *DeviceManagementIntentDeviceSettingStateSummariesCollectionRequest { - return &DeviceManagementIntentDeviceSettingStateSummariesCollectionRequest{ - BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, - } -} - -// ID returns request builder for DeviceManagementIntentDeviceSettingStateSummary item -func (b *DeviceManagementIntentDeviceSettingStateSummariesCollectionRequestBuilder) ID(id string) *DeviceManagementIntentDeviceSettingStateSummaryRequestBuilder { - bb := &DeviceManagementIntentDeviceSettingStateSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} - bb.baseURL += "/" + id - return bb -} - -// DeviceManagementIntentDeviceSettingStateSummariesCollectionRequest is request for DeviceManagementIntentDeviceSettingStateSummary collection -type DeviceManagementIntentDeviceSettingStateSummariesCollectionRequest struct{ BaseRequest } - -// Paging perfoms paging operation for DeviceManagementIntentDeviceSettingStateSummary collection -func (r *DeviceManagementIntentDeviceSettingStateSummariesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]DeviceManagementIntentDeviceSettingStateSummary, 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 []DeviceManagementIntentDeviceSettingStateSummary - 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 []DeviceManagementIntentDeviceSettingStateSummary - ) - 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 DeviceManagementIntentDeviceSettingStateSummary collection -func (r *DeviceManagementIntentDeviceSettingStateSummariesCollectionRequest) Get(ctx context.Context) ([]DeviceManagementIntentDeviceSettingStateSummary, error) { - var query string - if r.query != nil { - query = "?" + r.query.Encode() - } - return r.Paging(ctx, "GET", query, nil) -} - -// Add performs POST request for DeviceManagementIntentDeviceSettingStateSummary collection -func (r *DeviceManagementIntentDeviceSettingStateSummariesCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementIntentDeviceSettingStateSummary) (resObj *DeviceManagementIntentDeviceSettingStateSummary, err error) { - err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) - return -} - -// DeviceStateSummary is navigation property -func (b *DeviceManagementIntentRequestBuilder) DeviceStateSummary() *DeviceManagementIntentDeviceStateSummaryRequestBuilder { - bb := &DeviceManagementIntentDeviceStateSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} - bb.baseURL += "/deviceStateSummary" - return bb -} - -// DeviceStates returns request builder for DeviceManagementIntentDeviceState collection -func (b *DeviceManagementIntentRequestBuilder) DeviceStates() *DeviceManagementIntentDeviceStatesCollectionRequestBuilder { - bb := &DeviceManagementIntentDeviceStatesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} - bb.baseURL += "/deviceStates" - return bb -} - -// DeviceManagementIntentDeviceStatesCollectionRequestBuilder is request builder for DeviceManagementIntentDeviceState collection -type DeviceManagementIntentDeviceStatesCollectionRequestBuilder struct{ BaseRequestBuilder } - -// Request returns request for DeviceManagementIntentDeviceState collection -func (b *DeviceManagementIntentDeviceStatesCollectionRequestBuilder) Request() *DeviceManagementIntentDeviceStatesCollectionRequest { - return &DeviceManagementIntentDeviceStatesCollectionRequest{ - BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, - } -} - -// ID returns request builder for DeviceManagementIntentDeviceState item -func (b *DeviceManagementIntentDeviceStatesCollectionRequestBuilder) ID(id string) *DeviceManagementIntentDeviceStateRequestBuilder { - bb := &DeviceManagementIntentDeviceStateRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} - bb.baseURL += "/" + id - return bb -} - -// DeviceManagementIntentDeviceStatesCollectionRequest is request for DeviceManagementIntentDeviceState collection -type DeviceManagementIntentDeviceStatesCollectionRequest struct{ BaseRequest } - -// Paging perfoms paging operation for DeviceManagementIntentDeviceState collection -func (r *DeviceManagementIntentDeviceStatesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]DeviceManagementIntentDeviceState, 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 []DeviceManagementIntentDeviceState - 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 []DeviceManagementIntentDeviceState - ) - 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 DeviceManagementIntentDeviceState collection -func (r *DeviceManagementIntentDeviceStatesCollectionRequest) Get(ctx context.Context) ([]DeviceManagementIntentDeviceState, error) { - var query string - if r.query != nil { - query = "?" + r.query.Encode() - } - return r.Paging(ctx, "GET", query, nil) -} - -// Add performs POST request for DeviceManagementIntentDeviceState collection -func (r *DeviceManagementIntentDeviceStatesCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementIntentDeviceState) (resObj *DeviceManagementIntentDeviceState, err error) { - err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) - return -} - -// Settings returns request builder for DeviceManagementSettingInstance collection -func (b *DeviceManagementIntentRequestBuilder) Settings() *DeviceManagementIntentSettingsCollectionRequestBuilder { - bb := &DeviceManagementIntentSettingsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} - bb.baseURL += "/settings" - return bb -} - -// DeviceManagementIntentSettingsCollectionRequestBuilder is request builder for DeviceManagementSettingInstance collection -type DeviceManagementIntentSettingsCollectionRequestBuilder struct{ BaseRequestBuilder } - -// Request returns request for DeviceManagementSettingInstance collection -func (b *DeviceManagementIntentSettingsCollectionRequestBuilder) Request() *DeviceManagementIntentSettingsCollectionRequest { - return &DeviceManagementIntentSettingsCollectionRequest{ - BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, - } -} - -// ID returns request builder for DeviceManagementSettingInstance item -func (b *DeviceManagementIntentSettingsCollectionRequestBuilder) ID(id string) *DeviceManagementSettingInstanceRequestBuilder { - bb := &DeviceManagementSettingInstanceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} - bb.baseURL += "/" + id - return bb -} - -// DeviceManagementIntentSettingsCollectionRequest is request for DeviceManagementSettingInstance collection -type DeviceManagementIntentSettingsCollectionRequest struct{ BaseRequest } - -// Paging perfoms paging operation for DeviceManagementSettingInstance collection -func (r *DeviceManagementIntentSettingsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]DeviceManagementSettingInstance, 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 []DeviceManagementSettingInstance - 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 []DeviceManagementSettingInstance - ) - 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 DeviceManagementSettingInstance collection -func (r *DeviceManagementIntentSettingsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementSettingInstance, error) { - var query string - if r.query != nil { - query = "?" + r.query.Encode() - } - return r.Paging(ctx, "GET", query, nil) -} - -// Add performs POST request for DeviceManagementSettingInstance collection -func (r *DeviceManagementIntentSettingsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementSettingInstance) (resObj *DeviceManagementSettingInstance, err error) { - err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) - return -} - -// UserStateSummary is navigation property -func (b *DeviceManagementIntentRequestBuilder) UserStateSummary() *DeviceManagementIntentUserStateSummaryRequestBuilder { - bb := &DeviceManagementIntentUserStateSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} - bb.baseURL += "/userStateSummary" - return bb -} - -// UserStates returns request builder for DeviceManagementIntentUserState collection -func (b *DeviceManagementIntentRequestBuilder) UserStates() *DeviceManagementIntentUserStatesCollectionRequestBuilder { - bb := &DeviceManagementIntentUserStatesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} - bb.baseURL += "/userStates" - return bb -} - -// DeviceManagementIntentUserStatesCollectionRequestBuilder is request builder for DeviceManagementIntentUserState collection -type DeviceManagementIntentUserStatesCollectionRequestBuilder struct{ BaseRequestBuilder } - -// Request returns request for DeviceManagementIntentUserState collection -func (b *DeviceManagementIntentUserStatesCollectionRequestBuilder) Request() *DeviceManagementIntentUserStatesCollectionRequest { - return &DeviceManagementIntentUserStatesCollectionRequest{ - BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, - } -} - -// ID returns request builder for DeviceManagementIntentUserState item -func (b *DeviceManagementIntentUserStatesCollectionRequestBuilder) ID(id string) *DeviceManagementIntentUserStateRequestBuilder { - bb := &DeviceManagementIntentUserStateRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} - bb.baseURL += "/" + id - return bb -} - -// DeviceManagementIntentUserStatesCollectionRequest is request for DeviceManagementIntentUserState collection -type DeviceManagementIntentUserStatesCollectionRequest struct{ BaseRequest } - -// Paging perfoms paging operation for DeviceManagementIntentUserState collection -func (r *DeviceManagementIntentUserStatesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]DeviceManagementIntentUserState, 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 []DeviceManagementIntentUserState - 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 []DeviceManagementIntentUserState - ) - 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 DeviceManagementIntentUserState collection -func (r *DeviceManagementIntentUserStatesCollectionRequest) Get(ctx context.Context) ([]DeviceManagementIntentUserState, error) { - var query string - if r.query != nil { - query = "?" + r.query.Encode() - } - return r.Paging(ctx, "GET", query, nil) -} - -// Add performs POST request for DeviceManagementIntentUserState collection -func (r *DeviceManagementIntentUserStatesCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementIntentUserState) (resObj *DeviceManagementIntentUserState, err error) { - err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) - return -} |