forked from jshiffer/matterbridge
795a8705c3
Documentation on https://github.com/42wim/matterbridge/wiki/MS-Teams-setup
530 lines
19 KiB
Go
530 lines
19 KiB
Go
// Code generated by msgraph-generate.go DO NOT EDIT.
|
|
|
|
package msgraph
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"io/ioutil"
|
|
"net/http"
|
|
|
|
"github.com/yaegashi/msgraph.go/jsonx"
|
|
)
|
|
|
|
// DeviceCompliancePolicyRequestBuilder is request builder for DeviceCompliancePolicy
|
|
type DeviceCompliancePolicyRequestBuilder struct{ BaseRequestBuilder }
|
|
|
|
// Request returns DeviceCompliancePolicyRequest
|
|
func (b *DeviceCompliancePolicyRequestBuilder) Request() *DeviceCompliancePolicyRequest {
|
|
return &DeviceCompliancePolicyRequest{
|
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
|
}
|
|
}
|
|
|
|
// DeviceCompliancePolicyRequest is request for DeviceCompliancePolicy
|
|
type DeviceCompliancePolicyRequest struct{ BaseRequest }
|
|
|
|
// Get performs GET request for DeviceCompliancePolicy
|
|
func (r *DeviceCompliancePolicyRequest) Get(ctx context.Context) (resObj *DeviceCompliancePolicy, 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 DeviceCompliancePolicy
|
|
func (r *DeviceCompliancePolicyRequest) Update(ctx context.Context, reqObj *DeviceCompliancePolicy) error {
|
|
return r.JSONRequest(ctx, "PATCH", "", reqObj, nil)
|
|
}
|
|
|
|
// Delete performs DELETE request for DeviceCompliancePolicy
|
|
func (r *DeviceCompliancePolicyRequest) Delete(ctx context.Context) error {
|
|
return r.JSONRequest(ctx, "DELETE", "", nil, nil)
|
|
}
|
|
|
|
// Assignments returns request builder for DeviceCompliancePolicyAssignment collection
|
|
func (b *DeviceCompliancePolicyRequestBuilder) Assignments() *DeviceCompliancePolicyAssignmentsCollectionRequestBuilder {
|
|
bb := &DeviceCompliancePolicyAssignmentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
bb.baseURL += "/assignments"
|
|
return bb
|
|
}
|
|
|
|
// DeviceCompliancePolicyAssignmentsCollectionRequestBuilder is request builder for DeviceCompliancePolicyAssignment collection
|
|
type DeviceCompliancePolicyAssignmentsCollectionRequestBuilder struct{ BaseRequestBuilder }
|
|
|
|
// Request returns request for DeviceCompliancePolicyAssignment collection
|
|
func (b *DeviceCompliancePolicyAssignmentsCollectionRequestBuilder) Request() *DeviceCompliancePolicyAssignmentsCollectionRequest {
|
|
return &DeviceCompliancePolicyAssignmentsCollectionRequest{
|
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
|
}
|
|
}
|
|
|
|
// ID returns request builder for DeviceCompliancePolicyAssignment item
|
|
func (b *DeviceCompliancePolicyAssignmentsCollectionRequestBuilder) ID(id string) *DeviceCompliancePolicyAssignmentRequestBuilder {
|
|
bb := &DeviceCompliancePolicyAssignmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
bb.baseURL += "/" + id
|
|
return bb
|
|
}
|
|
|
|
// DeviceCompliancePolicyAssignmentsCollectionRequest is request for DeviceCompliancePolicyAssignment collection
|
|
type DeviceCompliancePolicyAssignmentsCollectionRequest struct{ BaseRequest }
|
|
|
|
// Paging perfoms paging operation for DeviceCompliancePolicyAssignment collection
|
|
func (r *DeviceCompliancePolicyAssignmentsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]DeviceCompliancePolicyAssignment, 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 []DeviceCompliancePolicyAssignment
|
|
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 []DeviceCompliancePolicyAssignment
|
|
)
|
|
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 DeviceCompliancePolicyAssignment collection
|
|
func (r *DeviceCompliancePolicyAssignmentsCollectionRequest) Get(ctx context.Context) ([]DeviceCompliancePolicyAssignment, error) {
|
|
var query string
|
|
if r.query != nil {
|
|
query = "?" + r.query.Encode()
|
|
}
|
|
return r.Paging(ctx, "GET", query, nil)
|
|
}
|
|
|
|
// Add performs POST request for DeviceCompliancePolicyAssignment collection
|
|
func (r *DeviceCompliancePolicyAssignmentsCollectionRequest) Add(ctx context.Context, reqObj *DeviceCompliancePolicyAssignment) (resObj *DeviceCompliancePolicyAssignment, err error) {
|
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
|
return
|
|
}
|
|
|
|
// DeviceSettingStateSummaries returns request builder for SettingStateDeviceSummary collection
|
|
func (b *DeviceCompliancePolicyRequestBuilder) DeviceSettingStateSummaries() *DeviceCompliancePolicyDeviceSettingStateSummariesCollectionRequestBuilder {
|
|
bb := &DeviceCompliancePolicyDeviceSettingStateSummariesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
bb.baseURL += "/deviceSettingStateSummaries"
|
|
return bb
|
|
}
|
|
|
|
// DeviceCompliancePolicyDeviceSettingStateSummariesCollectionRequestBuilder is request builder for SettingStateDeviceSummary collection
|
|
type DeviceCompliancePolicyDeviceSettingStateSummariesCollectionRequestBuilder struct{ BaseRequestBuilder }
|
|
|
|
// Request returns request for SettingStateDeviceSummary collection
|
|
func (b *DeviceCompliancePolicyDeviceSettingStateSummariesCollectionRequestBuilder) Request() *DeviceCompliancePolicyDeviceSettingStateSummariesCollectionRequest {
|
|
return &DeviceCompliancePolicyDeviceSettingStateSummariesCollectionRequest{
|
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
|
}
|
|
}
|
|
|
|
// ID returns request builder for SettingStateDeviceSummary item
|
|
func (b *DeviceCompliancePolicyDeviceSettingStateSummariesCollectionRequestBuilder) ID(id string) *SettingStateDeviceSummaryRequestBuilder {
|
|
bb := &SettingStateDeviceSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
bb.baseURL += "/" + id
|
|
return bb
|
|
}
|
|
|
|
// DeviceCompliancePolicyDeviceSettingStateSummariesCollectionRequest is request for SettingStateDeviceSummary collection
|
|
type DeviceCompliancePolicyDeviceSettingStateSummariesCollectionRequest struct{ BaseRequest }
|
|
|
|
// Paging perfoms paging operation for SettingStateDeviceSummary collection
|
|
func (r *DeviceCompliancePolicyDeviceSettingStateSummariesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]SettingStateDeviceSummary, 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 []SettingStateDeviceSummary
|
|
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 []SettingStateDeviceSummary
|
|
)
|
|
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 SettingStateDeviceSummary collection
|
|
func (r *DeviceCompliancePolicyDeviceSettingStateSummariesCollectionRequest) Get(ctx context.Context) ([]SettingStateDeviceSummary, error) {
|
|
var query string
|
|
if r.query != nil {
|
|
query = "?" + r.query.Encode()
|
|
}
|
|
return r.Paging(ctx, "GET", query, nil)
|
|
}
|
|
|
|
// Add performs POST request for SettingStateDeviceSummary collection
|
|
func (r *DeviceCompliancePolicyDeviceSettingStateSummariesCollectionRequest) Add(ctx context.Context, reqObj *SettingStateDeviceSummary) (resObj *SettingStateDeviceSummary, err error) {
|
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
|
return
|
|
}
|
|
|
|
// DeviceStatusOverview is navigation property
|
|
func (b *DeviceCompliancePolicyRequestBuilder) DeviceStatusOverview() *DeviceComplianceDeviceOverviewRequestBuilder {
|
|
bb := &DeviceComplianceDeviceOverviewRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
bb.baseURL += "/deviceStatusOverview"
|
|
return bb
|
|
}
|
|
|
|
// DeviceStatuses returns request builder for DeviceComplianceDeviceStatus collection
|
|
func (b *DeviceCompliancePolicyRequestBuilder) DeviceStatuses() *DeviceCompliancePolicyDeviceStatusesCollectionRequestBuilder {
|
|
bb := &DeviceCompliancePolicyDeviceStatusesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
bb.baseURL += "/deviceStatuses"
|
|
return bb
|
|
}
|
|
|
|
// DeviceCompliancePolicyDeviceStatusesCollectionRequestBuilder is request builder for DeviceComplianceDeviceStatus collection
|
|
type DeviceCompliancePolicyDeviceStatusesCollectionRequestBuilder struct{ BaseRequestBuilder }
|
|
|
|
// Request returns request for DeviceComplianceDeviceStatus collection
|
|
func (b *DeviceCompliancePolicyDeviceStatusesCollectionRequestBuilder) Request() *DeviceCompliancePolicyDeviceStatusesCollectionRequest {
|
|
return &DeviceCompliancePolicyDeviceStatusesCollectionRequest{
|
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
|
}
|
|
}
|
|
|
|
// ID returns request builder for DeviceComplianceDeviceStatus item
|
|
func (b *DeviceCompliancePolicyDeviceStatusesCollectionRequestBuilder) ID(id string) *DeviceComplianceDeviceStatusRequestBuilder {
|
|
bb := &DeviceComplianceDeviceStatusRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
bb.baseURL += "/" + id
|
|
return bb
|
|
}
|
|
|
|
// DeviceCompliancePolicyDeviceStatusesCollectionRequest is request for DeviceComplianceDeviceStatus collection
|
|
type DeviceCompliancePolicyDeviceStatusesCollectionRequest struct{ BaseRequest }
|
|
|
|
// Paging perfoms paging operation for DeviceComplianceDeviceStatus collection
|
|
func (r *DeviceCompliancePolicyDeviceStatusesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]DeviceComplianceDeviceStatus, 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 []DeviceComplianceDeviceStatus
|
|
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 []DeviceComplianceDeviceStatus
|
|
)
|
|
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 DeviceComplianceDeviceStatus collection
|
|
func (r *DeviceCompliancePolicyDeviceStatusesCollectionRequest) Get(ctx context.Context) ([]DeviceComplianceDeviceStatus, error) {
|
|
var query string
|
|
if r.query != nil {
|
|
query = "?" + r.query.Encode()
|
|
}
|
|
return r.Paging(ctx, "GET", query, nil)
|
|
}
|
|
|
|
// Add performs POST request for DeviceComplianceDeviceStatus collection
|
|
func (r *DeviceCompliancePolicyDeviceStatusesCollectionRequest) Add(ctx context.Context, reqObj *DeviceComplianceDeviceStatus) (resObj *DeviceComplianceDeviceStatus, err error) {
|
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
|
return
|
|
}
|
|
|
|
// ScheduledActionsForRule returns request builder for DeviceComplianceScheduledActionForRule collection
|
|
func (b *DeviceCompliancePolicyRequestBuilder) ScheduledActionsForRule() *DeviceCompliancePolicyScheduledActionsForRuleCollectionRequestBuilder {
|
|
bb := &DeviceCompliancePolicyScheduledActionsForRuleCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
bb.baseURL += "/scheduledActionsForRule"
|
|
return bb
|
|
}
|
|
|
|
// DeviceCompliancePolicyScheduledActionsForRuleCollectionRequestBuilder is request builder for DeviceComplianceScheduledActionForRule collection
|
|
type DeviceCompliancePolicyScheduledActionsForRuleCollectionRequestBuilder struct{ BaseRequestBuilder }
|
|
|
|
// Request returns request for DeviceComplianceScheduledActionForRule collection
|
|
func (b *DeviceCompliancePolicyScheduledActionsForRuleCollectionRequestBuilder) Request() *DeviceCompliancePolicyScheduledActionsForRuleCollectionRequest {
|
|
return &DeviceCompliancePolicyScheduledActionsForRuleCollectionRequest{
|
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
|
}
|
|
}
|
|
|
|
// ID returns request builder for DeviceComplianceScheduledActionForRule item
|
|
func (b *DeviceCompliancePolicyScheduledActionsForRuleCollectionRequestBuilder) ID(id string) *DeviceComplianceScheduledActionForRuleRequestBuilder {
|
|
bb := &DeviceComplianceScheduledActionForRuleRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
bb.baseURL += "/" + id
|
|
return bb
|
|
}
|
|
|
|
// DeviceCompliancePolicyScheduledActionsForRuleCollectionRequest is request for DeviceComplianceScheduledActionForRule collection
|
|
type DeviceCompliancePolicyScheduledActionsForRuleCollectionRequest struct{ BaseRequest }
|
|
|
|
// Paging perfoms paging operation for DeviceComplianceScheduledActionForRule collection
|
|
func (r *DeviceCompliancePolicyScheduledActionsForRuleCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]DeviceComplianceScheduledActionForRule, 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 []DeviceComplianceScheduledActionForRule
|
|
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 []DeviceComplianceScheduledActionForRule
|
|
)
|
|
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 DeviceComplianceScheduledActionForRule collection
|
|
func (r *DeviceCompliancePolicyScheduledActionsForRuleCollectionRequest) Get(ctx context.Context) ([]DeviceComplianceScheduledActionForRule, error) {
|
|
var query string
|
|
if r.query != nil {
|
|
query = "?" + r.query.Encode()
|
|
}
|
|
return r.Paging(ctx, "GET", query, nil)
|
|
}
|
|
|
|
// Add performs POST request for DeviceComplianceScheduledActionForRule collection
|
|
func (r *DeviceCompliancePolicyScheduledActionsForRuleCollectionRequest) Add(ctx context.Context, reqObj *DeviceComplianceScheduledActionForRule) (resObj *DeviceComplianceScheduledActionForRule, err error) {
|
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
|
return
|
|
}
|
|
|
|
// UserStatusOverview is navigation property
|
|
func (b *DeviceCompliancePolicyRequestBuilder) UserStatusOverview() *DeviceComplianceUserOverviewRequestBuilder {
|
|
bb := &DeviceComplianceUserOverviewRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
bb.baseURL += "/userStatusOverview"
|
|
return bb
|
|
}
|
|
|
|
// UserStatuses returns request builder for DeviceComplianceUserStatus collection
|
|
func (b *DeviceCompliancePolicyRequestBuilder) UserStatuses() *DeviceCompliancePolicyUserStatusesCollectionRequestBuilder {
|
|
bb := &DeviceCompliancePolicyUserStatusesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
bb.baseURL += "/userStatuses"
|
|
return bb
|
|
}
|
|
|
|
// DeviceCompliancePolicyUserStatusesCollectionRequestBuilder is request builder for DeviceComplianceUserStatus collection
|
|
type DeviceCompliancePolicyUserStatusesCollectionRequestBuilder struct{ BaseRequestBuilder }
|
|
|
|
// Request returns request for DeviceComplianceUserStatus collection
|
|
func (b *DeviceCompliancePolicyUserStatusesCollectionRequestBuilder) Request() *DeviceCompliancePolicyUserStatusesCollectionRequest {
|
|
return &DeviceCompliancePolicyUserStatusesCollectionRequest{
|
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
|
}
|
|
}
|
|
|
|
// ID returns request builder for DeviceComplianceUserStatus item
|
|
func (b *DeviceCompliancePolicyUserStatusesCollectionRequestBuilder) ID(id string) *DeviceComplianceUserStatusRequestBuilder {
|
|
bb := &DeviceComplianceUserStatusRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
bb.baseURL += "/" + id
|
|
return bb
|
|
}
|
|
|
|
// DeviceCompliancePolicyUserStatusesCollectionRequest is request for DeviceComplianceUserStatus collection
|
|
type DeviceCompliancePolicyUserStatusesCollectionRequest struct{ BaseRequest }
|
|
|
|
// Paging perfoms paging operation for DeviceComplianceUserStatus collection
|
|
func (r *DeviceCompliancePolicyUserStatusesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]DeviceComplianceUserStatus, 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 []DeviceComplianceUserStatus
|
|
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 []DeviceComplianceUserStatus
|
|
)
|
|
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 DeviceComplianceUserStatus collection
|
|
func (r *DeviceCompliancePolicyUserStatusesCollectionRequest) Get(ctx context.Context) ([]DeviceComplianceUserStatus, error) {
|
|
var query string
|
|
if r.query != nil {
|
|
query = "?" + r.query.Encode()
|
|
}
|
|
return r.Paging(ctx, "GET", query, nil)
|
|
}
|
|
|
|
// Add performs POST request for DeviceComplianceUserStatus collection
|
|
func (r *DeviceCompliancePolicyUserStatusesCollectionRequest) Add(ctx context.Context, reqObj *DeviceComplianceUserStatus) (resObj *DeviceComplianceUserStatus, err error) {
|
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
|
return
|
|
}
|