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/matterbridge/msgraph.go/beta/DeviceAppManagementRequest.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/matterbridge/msgraph.go/beta/DeviceAppManagementRequest.go')
-rw-r--r-- | vendor/github.com/matterbridge/msgraph.go/beta/DeviceAppManagementRequest.go | 2221 |
1 files changed, 2221 insertions, 0 deletions
diff --git a/vendor/github.com/matterbridge/msgraph.go/beta/DeviceAppManagementRequest.go b/vendor/github.com/matterbridge/msgraph.go/beta/DeviceAppManagementRequest.go new file mode 100644 index 00000000..24d497ad --- /dev/null +++ b/vendor/github.com/matterbridge/msgraph.go/beta/DeviceAppManagementRequest.go @@ -0,0 +1,2221 @@ +// Code generated by msgraph-generate.go DO NOT EDIT. + +package msgraph + +import ( + "context" + "fmt" + "io/ioutil" + "net/http" + + "github.com/matterbridge/msgraph.go/jsonx" +) + +// DeviceAppManagementRequestBuilder is request builder for DeviceAppManagement +type DeviceAppManagementRequestBuilder struct{ BaseRequestBuilder } + +// Request returns DeviceAppManagementRequest +func (b *DeviceAppManagementRequestBuilder) Request() *DeviceAppManagementRequest { + return &DeviceAppManagementRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// DeviceAppManagementRequest is request for DeviceAppManagement +type DeviceAppManagementRequest struct{ BaseRequest } + +// Get performs GET request for DeviceAppManagement +func (r *DeviceAppManagementRequest) Get(ctx context.Context) (resObj *DeviceAppManagement, 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 DeviceAppManagement +func (r *DeviceAppManagementRequest) Update(ctx context.Context, reqObj *DeviceAppManagement) error { + return r.JSONRequest(ctx, "PATCH", "", reqObj, nil) +} + +// Delete performs DELETE request for DeviceAppManagement +func (r *DeviceAppManagementRequest) Delete(ctx context.Context) error { + return r.JSONRequest(ctx, "DELETE", "", nil, nil) +} + +// AndroidManagedAppProtections returns request builder for AndroidManagedAppProtection collection +func (b *DeviceAppManagementRequestBuilder) AndroidManagedAppProtections() *DeviceAppManagementAndroidManagedAppProtectionsCollectionRequestBuilder { + bb := &DeviceAppManagementAndroidManagedAppProtectionsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/androidManagedAppProtections" + return bb +} + +// DeviceAppManagementAndroidManagedAppProtectionsCollectionRequestBuilder is request builder for AndroidManagedAppProtection collection +type DeviceAppManagementAndroidManagedAppProtectionsCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for AndroidManagedAppProtection collection +func (b *DeviceAppManagementAndroidManagedAppProtectionsCollectionRequestBuilder) Request() *DeviceAppManagementAndroidManagedAppProtectionsCollectionRequest { + return &DeviceAppManagementAndroidManagedAppProtectionsCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for AndroidManagedAppProtection item +func (b *DeviceAppManagementAndroidManagedAppProtectionsCollectionRequestBuilder) ID(id string) *AndroidManagedAppProtectionRequestBuilder { + bb := &AndroidManagedAppProtectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementAndroidManagedAppProtectionsCollectionRequest is request for AndroidManagedAppProtection collection +type DeviceAppManagementAndroidManagedAppProtectionsCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for AndroidManagedAppProtection collection +func (r *DeviceAppManagementAndroidManagedAppProtectionsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]AndroidManagedAppProtection, 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 []AndroidManagedAppProtection + 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 []AndroidManagedAppProtection + ) + 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 AndroidManagedAppProtection collection +func (r *DeviceAppManagementAndroidManagedAppProtectionsCollectionRequest) Get(ctx context.Context) ([]AndroidManagedAppProtection, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for AndroidManagedAppProtection collection +func (r *DeviceAppManagementAndroidManagedAppProtectionsCollectionRequest) Add(ctx context.Context, reqObj *AndroidManagedAppProtection) (resObj *AndroidManagedAppProtection, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// DefaultManagedAppProtections returns request builder for DefaultManagedAppProtection collection +func (b *DeviceAppManagementRequestBuilder) DefaultManagedAppProtections() *DeviceAppManagementDefaultManagedAppProtectionsCollectionRequestBuilder { + bb := &DeviceAppManagementDefaultManagedAppProtectionsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/defaultManagedAppProtections" + return bb +} + +// DeviceAppManagementDefaultManagedAppProtectionsCollectionRequestBuilder is request builder for DefaultManagedAppProtection collection +type DeviceAppManagementDefaultManagedAppProtectionsCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for DefaultManagedAppProtection collection +func (b *DeviceAppManagementDefaultManagedAppProtectionsCollectionRequestBuilder) Request() *DeviceAppManagementDefaultManagedAppProtectionsCollectionRequest { + return &DeviceAppManagementDefaultManagedAppProtectionsCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for DefaultManagedAppProtection item +func (b *DeviceAppManagementDefaultManagedAppProtectionsCollectionRequestBuilder) ID(id string) *DefaultManagedAppProtectionRequestBuilder { + bb := &DefaultManagedAppProtectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementDefaultManagedAppProtectionsCollectionRequest is request for DefaultManagedAppProtection collection +type DeviceAppManagementDefaultManagedAppProtectionsCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for DefaultManagedAppProtection collection +func (r *DeviceAppManagementDefaultManagedAppProtectionsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]DefaultManagedAppProtection, 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 []DefaultManagedAppProtection + 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 []DefaultManagedAppProtection + ) + 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 DefaultManagedAppProtection collection +func (r *DeviceAppManagementDefaultManagedAppProtectionsCollectionRequest) Get(ctx context.Context) ([]DefaultManagedAppProtection, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for DefaultManagedAppProtection collection +func (r *DeviceAppManagementDefaultManagedAppProtectionsCollectionRequest) Add(ctx context.Context, reqObj *DefaultManagedAppProtection) (resObj *DefaultManagedAppProtection, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// DeviceAppManagementTasks returns request builder for DeviceAppManagementTask collection +func (b *DeviceAppManagementRequestBuilder) DeviceAppManagementTasks() *DeviceAppManagementDeviceAppManagementTasksCollectionRequestBuilder { + bb := &DeviceAppManagementDeviceAppManagementTasksCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/deviceAppManagementTasks" + return bb +} + +// DeviceAppManagementDeviceAppManagementTasksCollectionRequestBuilder is request builder for DeviceAppManagementTask collection +type DeviceAppManagementDeviceAppManagementTasksCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for DeviceAppManagementTask collection +func (b *DeviceAppManagementDeviceAppManagementTasksCollectionRequestBuilder) Request() *DeviceAppManagementDeviceAppManagementTasksCollectionRequest { + return &DeviceAppManagementDeviceAppManagementTasksCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for DeviceAppManagementTask item +func (b *DeviceAppManagementDeviceAppManagementTasksCollectionRequestBuilder) ID(id string) *DeviceAppManagementTaskRequestBuilder { + bb := &DeviceAppManagementTaskRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementDeviceAppManagementTasksCollectionRequest is request for DeviceAppManagementTask collection +type DeviceAppManagementDeviceAppManagementTasksCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for DeviceAppManagementTask collection +func (r *DeviceAppManagementDeviceAppManagementTasksCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]DeviceAppManagementTask, 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 []DeviceAppManagementTask + 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 []DeviceAppManagementTask + ) + 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 DeviceAppManagementTask collection +func (r *DeviceAppManagementDeviceAppManagementTasksCollectionRequest) Get(ctx context.Context) ([]DeviceAppManagementTask, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for DeviceAppManagementTask collection +func (r *DeviceAppManagementDeviceAppManagementTasksCollectionRequest) Add(ctx context.Context, reqObj *DeviceAppManagementTask) (resObj *DeviceAppManagementTask, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// EnterpriseCodeSigningCertificates returns request builder for EnterpriseCodeSigningCertificate collection +func (b *DeviceAppManagementRequestBuilder) EnterpriseCodeSigningCertificates() *DeviceAppManagementEnterpriseCodeSigningCertificatesCollectionRequestBuilder { + bb := &DeviceAppManagementEnterpriseCodeSigningCertificatesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/enterpriseCodeSigningCertificates" + return bb +} + +// DeviceAppManagementEnterpriseCodeSigningCertificatesCollectionRequestBuilder is request builder for EnterpriseCodeSigningCertificate collection +type DeviceAppManagementEnterpriseCodeSigningCertificatesCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for EnterpriseCodeSigningCertificate collection +func (b *DeviceAppManagementEnterpriseCodeSigningCertificatesCollectionRequestBuilder) Request() *DeviceAppManagementEnterpriseCodeSigningCertificatesCollectionRequest { + return &DeviceAppManagementEnterpriseCodeSigningCertificatesCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for EnterpriseCodeSigningCertificate item +func (b *DeviceAppManagementEnterpriseCodeSigningCertificatesCollectionRequestBuilder) ID(id string) *EnterpriseCodeSigningCertificateRequestBuilder { + bb := &EnterpriseCodeSigningCertificateRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementEnterpriseCodeSigningCertificatesCollectionRequest is request for EnterpriseCodeSigningCertificate collection +type DeviceAppManagementEnterpriseCodeSigningCertificatesCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for EnterpriseCodeSigningCertificate collection +func (r *DeviceAppManagementEnterpriseCodeSigningCertificatesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]EnterpriseCodeSigningCertificate, 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 []EnterpriseCodeSigningCertificate + 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 []EnterpriseCodeSigningCertificate + ) + 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 EnterpriseCodeSigningCertificate collection +func (r *DeviceAppManagementEnterpriseCodeSigningCertificatesCollectionRequest) Get(ctx context.Context) ([]EnterpriseCodeSigningCertificate, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for EnterpriseCodeSigningCertificate collection +func (r *DeviceAppManagementEnterpriseCodeSigningCertificatesCollectionRequest) Add(ctx context.Context, reqObj *EnterpriseCodeSigningCertificate) (resObj *EnterpriseCodeSigningCertificate, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// IOSLobAppProvisioningConfigurations returns request builder for IOSLobAppProvisioningConfiguration collection +func (b *DeviceAppManagementRequestBuilder) IOSLobAppProvisioningConfigurations() *DeviceAppManagementIOSLobAppProvisioningConfigurationsCollectionRequestBuilder { + bb := &DeviceAppManagementIOSLobAppProvisioningConfigurationsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/iosLobAppProvisioningConfigurations" + return bb +} + +// DeviceAppManagementIOSLobAppProvisioningConfigurationsCollectionRequestBuilder is request builder for IOSLobAppProvisioningConfiguration collection +type DeviceAppManagementIOSLobAppProvisioningConfigurationsCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for IOSLobAppProvisioningConfiguration collection +func (b *DeviceAppManagementIOSLobAppProvisioningConfigurationsCollectionRequestBuilder) Request() *DeviceAppManagementIOSLobAppProvisioningConfigurationsCollectionRequest { + return &DeviceAppManagementIOSLobAppProvisioningConfigurationsCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for IOSLobAppProvisioningConfiguration item +func (b *DeviceAppManagementIOSLobAppProvisioningConfigurationsCollectionRequestBuilder) ID(id string) *IOSLobAppProvisioningConfigurationRequestBuilder { + bb := &IOSLobAppProvisioningConfigurationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementIOSLobAppProvisioningConfigurationsCollectionRequest is request for IOSLobAppProvisioningConfiguration collection +type DeviceAppManagementIOSLobAppProvisioningConfigurationsCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for IOSLobAppProvisioningConfiguration collection +func (r *DeviceAppManagementIOSLobAppProvisioningConfigurationsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]IOSLobAppProvisioningConfiguration, 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 []IOSLobAppProvisioningConfiguration + 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 []IOSLobAppProvisioningConfiguration + ) + 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 IOSLobAppProvisioningConfiguration collection +func (r *DeviceAppManagementIOSLobAppProvisioningConfigurationsCollectionRequest) Get(ctx context.Context) ([]IOSLobAppProvisioningConfiguration, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for IOSLobAppProvisioningConfiguration collection +func (r *DeviceAppManagementIOSLobAppProvisioningConfigurationsCollectionRequest) Add(ctx context.Context, reqObj *IOSLobAppProvisioningConfiguration) (resObj *IOSLobAppProvisioningConfiguration, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// IOSManagedAppProtections returns request builder for IOSManagedAppProtection collection +func (b *DeviceAppManagementRequestBuilder) IOSManagedAppProtections() *DeviceAppManagementIOSManagedAppProtectionsCollectionRequestBuilder { + bb := &DeviceAppManagementIOSManagedAppProtectionsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/iosManagedAppProtections" + return bb +} + +// DeviceAppManagementIOSManagedAppProtectionsCollectionRequestBuilder is request builder for IOSManagedAppProtection collection +type DeviceAppManagementIOSManagedAppProtectionsCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for IOSManagedAppProtection collection +func (b *DeviceAppManagementIOSManagedAppProtectionsCollectionRequestBuilder) Request() *DeviceAppManagementIOSManagedAppProtectionsCollectionRequest { + return &DeviceAppManagementIOSManagedAppProtectionsCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for IOSManagedAppProtection item +func (b *DeviceAppManagementIOSManagedAppProtectionsCollectionRequestBuilder) ID(id string) *IOSManagedAppProtectionRequestBuilder { + bb := &IOSManagedAppProtectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementIOSManagedAppProtectionsCollectionRequest is request for IOSManagedAppProtection collection +type DeviceAppManagementIOSManagedAppProtectionsCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for IOSManagedAppProtection collection +func (r *DeviceAppManagementIOSManagedAppProtectionsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]IOSManagedAppProtection, 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 []IOSManagedAppProtection + 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 []IOSManagedAppProtection + ) + 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 IOSManagedAppProtection collection +func (r *DeviceAppManagementIOSManagedAppProtectionsCollectionRequest) Get(ctx context.Context) ([]IOSManagedAppProtection, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for IOSManagedAppProtection collection +func (r *DeviceAppManagementIOSManagedAppProtectionsCollectionRequest) Add(ctx context.Context, reqObj *IOSManagedAppProtection) (resObj *IOSManagedAppProtection, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// ManagedAppPolicies returns request builder for ManagedAppPolicy collection +func (b *DeviceAppManagementRequestBuilder) ManagedAppPolicies() *DeviceAppManagementManagedAppPoliciesCollectionRequestBuilder { + bb := &DeviceAppManagementManagedAppPoliciesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/managedAppPolicies" + return bb +} + +// DeviceAppManagementManagedAppPoliciesCollectionRequestBuilder is request builder for ManagedAppPolicy collection +type DeviceAppManagementManagedAppPoliciesCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for ManagedAppPolicy collection +func (b *DeviceAppManagementManagedAppPoliciesCollectionRequestBuilder) Request() *DeviceAppManagementManagedAppPoliciesCollectionRequest { + return &DeviceAppManagementManagedAppPoliciesCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for ManagedAppPolicy item +func (b *DeviceAppManagementManagedAppPoliciesCollectionRequestBuilder) ID(id string) *ManagedAppPolicyRequestBuilder { + bb := &ManagedAppPolicyRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementManagedAppPoliciesCollectionRequest is request for ManagedAppPolicy collection +type DeviceAppManagementManagedAppPoliciesCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for ManagedAppPolicy collection +func (r *DeviceAppManagementManagedAppPoliciesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]ManagedAppPolicy, 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 []ManagedAppPolicy + 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 []ManagedAppPolicy + ) + 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 ManagedAppPolicy collection +func (r *DeviceAppManagementManagedAppPoliciesCollectionRequest) Get(ctx context.Context) ([]ManagedAppPolicy, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for ManagedAppPolicy collection +func (r *DeviceAppManagementManagedAppPoliciesCollectionRequest) Add(ctx context.Context, reqObj *ManagedAppPolicy) (resObj *ManagedAppPolicy, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// ManagedAppRegistrations returns request builder for ManagedAppRegistration collection +func (b *DeviceAppManagementRequestBuilder) ManagedAppRegistrations() *DeviceAppManagementManagedAppRegistrationsCollectionRequestBuilder { + bb := &DeviceAppManagementManagedAppRegistrationsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/managedAppRegistrations" + return bb +} + +// DeviceAppManagementManagedAppRegistrationsCollectionRequestBuilder is request builder for ManagedAppRegistration collection +type DeviceAppManagementManagedAppRegistrationsCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for ManagedAppRegistration collection +func (b *DeviceAppManagementManagedAppRegistrationsCollectionRequestBuilder) Request() *DeviceAppManagementManagedAppRegistrationsCollectionRequest { + return &DeviceAppManagementManagedAppRegistrationsCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for ManagedAppRegistration item +func (b *DeviceAppManagementManagedAppRegistrationsCollectionRequestBuilder) ID(id string) *ManagedAppRegistrationRequestBuilder { + bb := &ManagedAppRegistrationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementManagedAppRegistrationsCollectionRequest is request for ManagedAppRegistration collection +type DeviceAppManagementManagedAppRegistrationsCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for ManagedAppRegistration collection +func (r *DeviceAppManagementManagedAppRegistrationsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]ManagedAppRegistration, 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 []ManagedAppRegistration + 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 []ManagedAppRegistration + ) + 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 ManagedAppRegistration collection +func (r *DeviceAppManagementManagedAppRegistrationsCollectionRequest) Get(ctx context.Context) ([]ManagedAppRegistration, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for ManagedAppRegistration collection +func (r *DeviceAppManagementManagedAppRegistrationsCollectionRequest) Add(ctx context.Context, reqObj *ManagedAppRegistration) (resObj *ManagedAppRegistration, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// ManagedAppStatuses returns request builder for ManagedAppStatus collection +func (b *DeviceAppManagementRequestBuilder) ManagedAppStatuses() *DeviceAppManagementManagedAppStatusesCollectionRequestBuilder { + bb := &DeviceAppManagementManagedAppStatusesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/managedAppStatuses" + return bb +} + +// DeviceAppManagementManagedAppStatusesCollectionRequestBuilder is request builder for ManagedAppStatus collection +type DeviceAppManagementManagedAppStatusesCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for ManagedAppStatus collection +func (b *DeviceAppManagementManagedAppStatusesCollectionRequestBuilder) Request() *DeviceAppManagementManagedAppStatusesCollectionRequest { + return &DeviceAppManagementManagedAppStatusesCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for ManagedAppStatus item +func (b *DeviceAppManagementManagedAppStatusesCollectionRequestBuilder) ID(id string) *ManagedAppStatusRequestBuilder { + bb := &ManagedAppStatusRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementManagedAppStatusesCollectionRequest is request for ManagedAppStatus collection +type DeviceAppManagementManagedAppStatusesCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for ManagedAppStatus collection +func (r *DeviceAppManagementManagedAppStatusesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]ManagedAppStatus, 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 []ManagedAppStatus + 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 []ManagedAppStatus + ) + 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 ManagedAppStatus collection +func (r *DeviceAppManagementManagedAppStatusesCollectionRequest) Get(ctx context.Context) ([]ManagedAppStatus, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for ManagedAppStatus collection +func (r *DeviceAppManagementManagedAppStatusesCollectionRequest) Add(ctx context.Context, reqObj *ManagedAppStatus) (resObj *ManagedAppStatus, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// ManagedEBookCategories returns request builder for ManagedEBookCategory collection +func (b *DeviceAppManagementRequestBuilder) ManagedEBookCategories() *DeviceAppManagementManagedEBookCategoriesCollectionRequestBuilder { + bb := &DeviceAppManagementManagedEBookCategoriesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/managedEBookCategories" + return bb +} + +// DeviceAppManagementManagedEBookCategoriesCollectionRequestBuilder is request builder for ManagedEBookCategory collection +type DeviceAppManagementManagedEBookCategoriesCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for ManagedEBookCategory collection +func (b *DeviceAppManagementManagedEBookCategoriesCollectionRequestBuilder) Request() *DeviceAppManagementManagedEBookCategoriesCollectionRequest { + return &DeviceAppManagementManagedEBookCategoriesCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for ManagedEBookCategory item +func (b *DeviceAppManagementManagedEBookCategoriesCollectionRequestBuilder) ID(id string) *ManagedEBookCategoryRequestBuilder { + bb := &ManagedEBookCategoryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementManagedEBookCategoriesCollectionRequest is request for ManagedEBookCategory collection +type DeviceAppManagementManagedEBookCategoriesCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for ManagedEBookCategory collection +func (r *DeviceAppManagementManagedEBookCategoriesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]ManagedEBookCategory, 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 []ManagedEBookCategory + 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 []ManagedEBookCategory + ) + 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 ManagedEBookCategory collection +func (r *DeviceAppManagementManagedEBookCategoriesCollectionRequest) Get(ctx context.Context) ([]ManagedEBookCategory, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for ManagedEBookCategory collection +func (r *DeviceAppManagementManagedEBookCategoriesCollectionRequest) Add(ctx context.Context, reqObj *ManagedEBookCategory) (resObj *ManagedEBookCategory, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// ManagedEBooks returns request builder for ManagedEBook collection +func (b *DeviceAppManagementRequestBuilder) ManagedEBooks() *DeviceAppManagementManagedEBooksCollectionRequestBuilder { + bb := &DeviceAppManagementManagedEBooksCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/managedEBooks" + return bb +} + +// DeviceAppManagementManagedEBooksCollectionRequestBuilder is request builder for ManagedEBook collection +type DeviceAppManagementManagedEBooksCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for ManagedEBook collection +func (b *DeviceAppManagementManagedEBooksCollectionRequestBuilder) Request() *DeviceAppManagementManagedEBooksCollectionRequest { + return &DeviceAppManagementManagedEBooksCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for ManagedEBook item +func (b *DeviceAppManagementManagedEBooksCollectionRequestBuilder) ID(id string) *ManagedEBookRequestBuilder { + bb := &ManagedEBookRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementManagedEBooksCollectionRequest is request for ManagedEBook collection +type DeviceAppManagementManagedEBooksCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for ManagedEBook collection +func (r *DeviceAppManagementManagedEBooksCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]ManagedEBook, 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 []ManagedEBook + 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 []ManagedEBook + ) + 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 ManagedEBook collection +func (r *DeviceAppManagementManagedEBooksCollectionRequest) Get(ctx context.Context) ([]ManagedEBook, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for ManagedEBook collection +func (r *DeviceAppManagementManagedEBooksCollectionRequest) Add(ctx context.Context, reqObj *ManagedEBook) (resObj *ManagedEBook, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// MdmWindowsInformationProtectionPolicies returns request builder for MdmWindowsInformationProtectionPolicy collection +func (b *DeviceAppManagementRequestBuilder) MdmWindowsInformationProtectionPolicies() *DeviceAppManagementMdmWindowsInformationProtectionPoliciesCollectionRequestBuilder { + bb := &DeviceAppManagementMdmWindowsInformationProtectionPoliciesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/mdmWindowsInformationProtectionPolicies" + return bb +} + +// DeviceAppManagementMdmWindowsInformationProtectionPoliciesCollectionRequestBuilder is request builder for MdmWindowsInformationProtectionPolicy collection +type DeviceAppManagementMdmWindowsInformationProtectionPoliciesCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for MdmWindowsInformationProtectionPolicy collection +func (b *DeviceAppManagementMdmWindowsInformationProtectionPoliciesCollectionRequestBuilder) Request() *DeviceAppManagementMdmWindowsInformationProtectionPoliciesCollectionRequest { + return &DeviceAppManagementMdmWindowsInformationProtectionPoliciesCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for MdmWindowsInformationProtectionPolicy item +func (b *DeviceAppManagementMdmWindowsInformationProtectionPoliciesCollectionRequestBuilder) ID(id string) *MdmWindowsInformationProtectionPolicyRequestBuilder { + bb := &MdmWindowsInformationProtectionPolicyRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementMdmWindowsInformationProtectionPoliciesCollectionRequest is request for MdmWindowsInformationProtectionPolicy collection +type DeviceAppManagementMdmWindowsInformationProtectionPoliciesCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for MdmWindowsInformationProtectionPolicy collection +func (r *DeviceAppManagementMdmWindowsInformationProtectionPoliciesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]MdmWindowsInformationProtectionPolicy, 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 []MdmWindowsInformationProtectionPolicy + 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 []MdmWindowsInformationProtectionPolicy + ) + 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 MdmWindowsInformationProtectionPolicy collection +func (r *DeviceAppManagementMdmWindowsInformationProtectionPoliciesCollectionRequest) Get(ctx context.Context) ([]MdmWindowsInformationProtectionPolicy, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for MdmWindowsInformationProtectionPolicy collection +func (r *DeviceAppManagementMdmWindowsInformationProtectionPoliciesCollectionRequest) Add(ctx context.Context, reqObj *MdmWindowsInformationProtectionPolicy) (resObj *MdmWindowsInformationProtectionPolicy, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// MobileAppCategories returns request builder for MobileAppCategory collection +func (b *DeviceAppManagementRequestBuilder) MobileAppCategories() *DeviceAppManagementMobileAppCategoriesCollectionRequestBuilder { + bb := &DeviceAppManagementMobileAppCategoriesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/mobileAppCategories" + return bb +} + +// DeviceAppManagementMobileAppCategoriesCollectionRequestBuilder is request builder for MobileAppCategory collection +type DeviceAppManagementMobileAppCategoriesCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for MobileAppCategory collection +func (b *DeviceAppManagementMobileAppCategoriesCollectionRequestBuilder) Request() *DeviceAppManagementMobileAppCategoriesCollectionRequest { + return &DeviceAppManagementMobileAppCategoriesCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for MobileAppCategory item +func (b *DeviceAppManagementMobileAppCategoriesCollectionRequestBuilder) ID(id string) *MobileAppCategoryRequestBuilder { + bb := &MobileAppCategoryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementMobileAppCategoriesCollectionRequest is request for MobileAppCategory collection +type DeviceAppManagementMobileAppCategoriesCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for MobileAppCategory collection +func (r *DeviceAppManagementMobileAppCategoriesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]MobileAppCategory, 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 []MobileAppCategory + 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 []MobileAppCategory + ) + 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 MobileAppCategory collection +func (r *DeviceAppManagementMobileAppCategoriesCollectionRequest) Get(ctx context.Context) ([]MobileAppCategory, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for MobileAppCategory collection +func (r *DeviceAppManagementMobileAppCategoriesCollectionRequest) Add(ctx context.Context, reqObj *MobileAppCategory) (resObj *MobileAppCategory, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// MobileAppConfigurations returns request builder for ManagedDeviceMobileAppConfiguration collection +func (b *DeviceAppManagementRequestBuilder) MobileAppConfigurations() *DeviceAppManagementMobileAppConfigurationsCollectionRequestBuilder { + bb := &DeviceAppManagementMobileAppConfigurationsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/mobileAppConfigurations" + return bb +} + +// DeviceAppManagementMobileAppConfigurationsCollectionRequestBuilder is request builder for ManagedDeviceMobileAppConfiguration collection +type DeviceAppManagementMobileAppConfigurationsCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for ManagedDeviceMobileAppConfiguration collection +func (b *DeviceAppManagementMobileAppConfigurationsCollectionRequestBuilder) Request() *DeviceAppManagementMobileAppConfigurationsCollectionRequest { + return &DeviceAppManagementMobileAppConfigurationsCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for ManagedDeviceMobileAppConfiguration item +func (b *DeviceAppManagementMobileAppConfigurationsCollectionRequestBuilder) ID(id string) *ManagedDeviceMobileAppConfigurationRequestBuilder { + bb := &ManagedDeviceMobileAppConfigurationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementMobileAppConfigurationsCollectionRequest is request for ManagedDeviceMobileAppConfiguration collection +type DeviceAppManagementMobileAppConfigurationsCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for ManagedDeviceMobileAppConfiguration collection +func (r *DeviceAppManagementMobileAppConfigurationsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]ManagedDeviceMobileAppConfiguration, 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 []ManagedDeviceMobileAppConfiguration + 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 []ManagedDeviceMobileAppConfiguration + ) + 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 ManagedDeviceMobileAppConfiguration collection +func (r *DeviceAppManagementMobileAppConfigurationsCollectionRequest) Get(ctx context.Context) ([]ManagedDeviceMobileAppConfiguration, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for ManagedDeviceMobileAppConfiguration collection +func (r *DeviceAppManagementMobileAppConfigurationsCollectionRequest) Add(ctx context.Context, reqObj *ManagedDeviceMobileAppConfiguration) (resObj *ManagedDeviceMobileAppConfiguration, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// MobileApps returns request builder for MobileApp collection +func (b *DeviceAppManagementRequestBuilder) MobileApps() *DeviceAppManagementMobileAppsCollectionRequestBuilder { + bb := &DeviceAppManagementMobileAppsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/mobileApps" + return bb +} + +// DeviceAppManagementMobileAppsCollectionRequestBuilder is request builder for MobileApp collection +type DeviceAppManagementMobileAppsCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for MobileApp collection +func (b *DeviceAppManagementMobileAppsCollectionRequestBuilder) Request() *DeviceAppManagementMobileAppsCollectionRequest { + return &DeviceAppManagementMobileAppsCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for MobileApp item +func (b *DeviceAppManagementMobileAppsCollectionRequestBuilder) ID(id string) *MobileAppRequestBuilder { + bb := &MobileAppRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementMobileAppsCollectionRequest is request for MobileApp collection +type DeviceAppManagementMobileAppsCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for MobileApp collection +func (r *DeviceAppManagementMobileAppsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]MobileApp, 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 []MobileApp + 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 []MobileApp + ) + 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 MobileApp collection +func (r *DeviceAppManagementMobileAppsCollectionRequest) Get(ctx context.Context) ([]MobileApp, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for MobileApp collection +func (r *DeviceAppManagementMobileAppsCollectionRequest) Add(ctx context.Context, reqObj *MobileApp) (resObj *MobileApp, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// PolicySets returns request builder for PolicySet collection +func (b *DeviceAppManagementRequestBuilder) PolicySets() *DeviceAppManagementPolicySetsCollectionRequestBuilder { + bb := &DeviceAppManagementPolicySetsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/policySets" + return bb +} + +// DeviceAppManagementPolicySetsCollectionRequestBuilder is request builder for PolicySet collection +type DeviceAppManagementPolicySetsCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for PolicySet collection +func (b *DeviceAppManagementPolicySetsCollectionRequestBuilder) Request() *DeviceAppManagementPolicySetsCollectionRequest { + return &DeviceAppManagementPolicySetsCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for PolicySet item +func (b *DeviceAppManagementPolicySetsCollectionRequestBuilder) ID(id string) *PolicySetRequestBuilder { + bb := &PolicySetRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementPolicySetsCollectionRequest is request for PolicySet collection +type DeviceAppManagementPolicySetsCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for PolicySet collection +func (r *DeviceAppManagementPolicySetsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]PolicySet, 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 []PolicySet + 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 []PolicySet + ) + 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 PolicySet collection +func (r *DeviceAppManagementPolicySetsCollectionRequest) Get(ctx context.Context) ([]PolicySet, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for PolicySet collection +func (r *DeviceAppManagementPolicySetsCollectionRequest) Add(ctx context.Context, reqObj *PolicySet) (resObj *PolicySet, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// SideLoadingKeys returns request builder for SideLoadingKey collection +func (b *DeviceAppManagementRequestBuilder) SideLoadingKeys() *DeviceAppManagementSideLoadingKeysCollectionRequestBuilder { + bb := &DeviceAppManagementSideLoadingKeysCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/sideLoadingKeys" + return bb +} + +// DeviceAppManagementSideLoadingKeysCollectionRequestBuilder is request builder for SideLoadingKey collection +type DeviceAppManagementSideLoadingKeysCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for SideLoadingKey collection +func (b *DeviceAppManagementSideLoadingKeysCollectionRequestBuilder) Request() *DeviceAppManagementSideLoadingKeysCollectionRequest { + return &DeviceAppManagementSideLoadingKeysCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for SideLoadingKey item +func (b *DeviceAppManagementSideLoadingKeysCollectionRequestBuilder) ID(id string) *SideLoadingKeyRequestBuilder { + bb := &SideLoadingKeyRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementSideLoadingKeysCollectionRequest is request for SideLoadingKey collection +type DeviceAppManagementSideLoadingKeysCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for SideLoadingKey collection +func (r *DeviceAppManagementSideLoadingKeysCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]SideLoadingKey, 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 []SideLoadingKey + 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 []SideLoadingKey + ) + 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 SideLoadingKey collection +func (r *DeviceAppManagementSideLoadingKeysCollectionRequest) Get(ctx context.Context) ([]SideLoadingKey, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for SideLoadingKey collection +func (r *DeviceAppManagementSideLoadingKeysCollectionRequest) Add(ctx context.Context, reqObj *SideLoadingKey) (resObj *SideLoadingKey, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// SymantecCodeSigningCertificate is navigation property +func (b *DeviceAppManagementRequestBuilder) SymantecCodeSigningCertificate() *SymantecCodeSigningCertificateRequestBuilder { + bb := &SymantecCodeSigningCertificateRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/symantecCodeSigningCertificate" + return bb +} + +// TargetedManagedAppConfigurations returns request builder for TargetedManagedAppConfiguration collection +func (b *DeviceAppManagementRequestBuilder) TargetedManagedAppConfigurations() *DeviceAppManagementTargetedManagedAppConfigurationsCollectionRequestBuilder { + bb := &DeviceAppManagementTargetedManagedAppConfigurationsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/targetedManagedAppConfigurations" + return bb +} + +// DeviceAppManagementTargetedManagedAppConfigurationsCollectionRequestBuilder is request builder for TargetedManagedAppConfiguration collection +type DeviceAppManagementTargetedManagedAppConfigurationsCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for TargetedManagedAppConfiguration collection +func (b *DeviceAppManagementTargetedManagedAppConfigurationsCollectionRequestBuilder) Request() *DeviceAppManagementTargetedManagedAppConfigurationsCollectionRequest { + return &DeviceAppManagementTargetedManagedAppConfigurationsCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for TargetedManagedAppConfiguration item +func (b *DeviceAppManagementTargetedManagedAppConfigurationsCollectionRequestBuilder) ID(id string) *TargetedManagedAppConfigurationRequestBuilder { + bb := &TargetedManagedAppConfigurationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementTargetedManagedAppConfigurationsCollectionRequest is request for TargetedManagedAppConfiguration collection +type DeviceAppManagementTargetedManagedAppConfigurationsCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for TargetedManagedAppConfiguration collection +func (r *DeviceAppManagementTargetedManagedAppConfigurationsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]TargetedManagedAppConfiguration, 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 []TargetedManagedAppConfiguration + 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 []TargetedManagedAppConfiguration + ) + 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 TargetedManagedAppConfiguration collection +func (r *DeviceAppManagementTargetedManagedAppConfigurationsCollectionRequest) Get(ctx context.Context) ([]TargetedManagedAppConfiguration, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for TargetedManagedAppConfiguration collection +func (r *DeviceAppManagementTargetedManagedAppConfigurationsCollectionRequest) Add(ctx context.Context, reqObj *TargetedManagedAppConfiguration) (resObj *TargetedManagedAppConfiguration, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// VppTokens returns request builder for VppToken collection +func (b *DeviceAppManagementRequestBuilder) VppTokens() *DeviceAppManagementVppTokensCollectionRequestBuilder { + bb := &DeviceAppManagementVppTokensCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/vppTokens" + return bb +} + +// DeviceAppManagementVppTokensCollectionRequestBuilder is request builder for VppToken collection +type DeviceAppManagementVppTokensCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for VppToken collection +func (b *DeviceAppManagementVppTokensCollectionRequestBuilder) Request() *DeviceAppManagementVppTokensCollectionRequest { + return &DeviceAppManagementVppTokensCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for VppToken item +func (b *DeviceAppManagementVppTokensCollectionRequestBuilder) ID(id string) *VppTokenRequestBuilder { + bb := &VppTokenRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementVppTokensCollectionRequest is request for VppToken collection +type DeviceAppManagementVppTokensCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for VppToken collection +func (r *DeviceAppManagementVppTokensCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]VppToken, 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 []VppToken + 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 []VppToken + ) + 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 VppToken collection +func (r *DeviceAppManagementVppTokensCollectionRequest) Get(ctx context.Context) ([]VppToken, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for VppToken collection +func (r *DeviceAppManagementVppTokensCollectionRequest) Add(ctx context.Context, reqObj *VppToken) (resObj *VppToken, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// WdacSupplementalPolicies returns request builder for WindowsDefenderApplicationControlSupplementalPolicy collection +func (b *DeviceAppManagementRequestBuilder) WdacSupplementalPolicies() *DeviceAppManagementWdacSupplementalPoliciesCollectionRequestBuilder { + bb := &DeviceAppManagementWdacSupplementalPoliciesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/wdacSupplementalPolicies" + return bb +} + +// DeviceAppManagementWdacSupplementalPoliciesCollectionRequestBuilder is request builder for WindowsDefenderApplicationControlSupplementalPolicy collection +type DeviceAppManagementWdacSupplementalPoliciesCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for WindowsDefenderApplicationControlSupplementalPolicy collection +func (b *DeviceAppManagementWdacSupplementalPoliciesCollectionRequestBuilder) Request() *DeviceAppManagementWdacSupplementalPoliciesCollectionRequest { + return &DeviceAppManagementWdacSupplementalPoliciesCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for WindowsDefenderApplicationControlSupplementalPolicy item +func (b *DeviceAppManagementWdacSupplementalPoliciesCollectionRequestBuilder) ID(id string) *WindowsDefenderApplicationControlSupplementalPolicyRequestBuilder { + bb := &WindowsDefenderApplicationControlSupplementalPolicyRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementWdacSupplementalPoliciesCollectionRequest is request for WindowsDefenderApplicationControlSupplementalPolicy collection +type DeviceAppManagementWdacSupplementalPoliciesCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for WindowsDefenderApplicationControlSupplementalPolicy collection +func (r *DeviceAppManagementWdacSupplementalPoliciesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]WindowsDefenderApplicationControlSupplementalPolicy, 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 []WindowsDefenderApplicationControlSupplementalPolicy + 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 []WindowsDefenderApplicationControlSupplementalPolicy + ) + 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 WindowsDefenderApplicationControlSupplementalPolicy collection +func (r *DeviceAppManagementWdacSupplementalPoliciesCollectionRequest) Get(ctx context.Context) ([]WindowsDefenderApplicationControlSupplementalPolicy, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for WindowsDefenderApplicationControlSupplementalPolicy collection +func (r *DeviceAppManagementWdacSupplementalPoliciesCollectionRequest) Add(ctx context.Context, reqObj *WindowsDefenderApplicationControlSupplementalPolicy) (resObj *WindowsDefenderApplicationControlSupplementalPolicy, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// WindowsInformationProtectionDeviceRegistrations returns request builder for WindowsInformationProtectionDeviceRegistration collection +func (b *DeviceAppManagementRequestBuilder) WindowsInformationProtectionDeviceRegistrations() *DeviceAppManagementWindowsInformationProtectionDeviceRegistrationsCollectionRequestBuilder { + bb := &DeviceAppManagementWindowsInformationProtectionDeviceRegistrationsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/windowsInformationProtectionDeviceRegistrations" + return bb +} + +// DeviceAppManagementWindowsInformationProtectionDeviceRegistrationsCollectionRequestBuilder is request builder for WindowsInformationProtectionDeviceRegistration collection +type DeviceAppManagementWindowsInformationProtectionDeviceRegistrationsCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for WindowsInformationProtectionDeviceRegistration collection +func (b *DeviceAppManagementWindowsInformationProtectionDeviceRegistrationsCollectionRequestBuilder) Request() *DeviceAppManagementWindowsInformationProtectionDeviceRegistrationsCollectionRequest { + return &DeviceAppManagementWindowsInformationProtectionDeviceRegistrationsCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for WindowsInformationProtectionDeviceRegistration item +func (b *DeviceAppManagementWindowsInformationProtectionDeviceRegistrationsCollectionRequestBuilder) ID(id string) *WindowsInformationProtectionDeviceRegistrationRequestBuilder { + bb := &WindowsInformationProtectionDeviceRegistrationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementWindowsInformationProtectionDeviceRegistrationsCollectionRequest is request for WindowsInformationProtectionDeviceRegistration collection +type DeviceAppManagementWindowsInformationProtectionDeviceRegistrationsCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for WindowsInformationProtectionDeviceRegistration collection +func (r *DeviceAppManagementWindowsInformationProtectionDeviceRegistrationsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]WindowsInformationProtectionDeviceRegistration, 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 []WindowsInformationProtectionDeviceRegistration + 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 []WindowsInformationProtectionDeviceRegistration + ) + 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 WindowsInformationProtectionDeviceRegistration collection +func (r *DeviceAppManagementWindowsInformationProtectionDeviceRegistrationsCollectionRequest) Get(ctx context.Context) ([]WindowsInformationProtectionDeviceRegistration, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for WindowsInformationProtectionDeviceRegistration collection +func (r *DeviceAppManagementWindowsInformationProtectionDeviceRegistrationsCollectionRequest) Add(ctx context.Context, reqObj *WindowsInformationProtectionDeviceRegistration) (resObj *WindowsInformationProtectionDeviceRegistration, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// WindowsInformationProtectionPolicies returns request builder for WindowsInformationProtectionPolicy collection +func (b *DeviceAppManagementRequestBuilder) WindowsInformationProtectionPolicies() *DeviceAppManagementWindowsInformationProtectionPoliciesCollectionRequestBuilder { + bb := &DeviceAppManagementWindowsInformationProtectionPoliciesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/windowsInformationProtectionPolicies" + return bb +} + +// DeviceAppManagementWindowsInformationProtectionPoliciesCollectionRequestBuilder is request builder for WindowsInformationProtectionPolicy collection +type DeviceAppManagementWindowsInformationProtectionPoliciesCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for WindowsInformationProtectionPolicy collection +func (b *DeviceAppManagementWindowsInformationProtectionPoliciesCollectionRequestBuilder) Request() *DeviceAppManagementWindowsInformationProtectionPoliciesCollectionRequest { + return &DeviceAppManagementWindowsInformationProtectionPoliciesCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for WindowsInformationProtectionPolicy item +func (b *DeviceAppManagementWindowsInformationProtectionPoliciesCollectionRequestBuilder) ID(id string) *WindowsInformationProtectionPolicyRequestBuilder { + bb := &WindowsInformationProtectionPolicyRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementWindowsInformationProtectionPoliciesCollectionRequest is request for WindowsInformationProtectionPolicy collection +type DeviceAppManagementWindowsInformationProtectionPoliciesCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for WindowsInformationProtectionPolicy collection +func (r *DeviceAppManagementWindowsInformationProtectionPoliciesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]WindowsInformationProtectionPolicy, 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 []WindowsInformationProtectionPolicy + 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 []WindowsInformationProtectionPolicy + ) + 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 WindowsInformationProtectionPolicy collection +func (r *DeviceAppManagementWindowsInformationProtectionPoliciesCollectionRequest) Get(ctx context.Context) ([]WindowsInformationProtectionPolicy, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for WindowsInformationProtectionPolicy collection +func (r *DeviceAppManagementWindowsInformationProtectionPoliciesCollectionRequest) Add(ctx context.Context, reqObj *WindowsInformationProtectionPolicy) (resObj *WindowsInformationProtectionPolicy, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// WindowsInformationProtectionWipeActions returns request builder for WindowsInformationProtectionWipeAction collection +func (b *DeviceAppManagementRequestBuilder) WindowsInformationProtectionWipeActions() *DeviceAppManagementWindowsInformationProtectionWipeActionsCollectionRequestBuilder { + bb := &DeviceAppManagementWindowsInformationProtectionWipeActionsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/windowsInformationProtectionWipeActions" + return bb +} + +// DeviceAppManagementWindowsInformationProtectionWipeActionsCollectionRequestBuilder is request builder for WindowsInformationProtectionWipeAction collection +type DeviceAppManagementWindowsInformationProtectionWipeActionsCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for WindowsInformationProtectionWipeAction collection +func (b *DeviceAppManagementWindowsInformationProtectionWipeActionsCollectionRequestBuilder) Request() *DeviceAppManagementWindowsInformationProtectionWipeActionsCollectionRequest { + return &DeviceAppManagementWindowsInformationProtectionWipeActionsCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for WindowsInformationProtectionWipeAction item +func (b *DeviceAppManagementWindowsInformationProtectionWipeActionsCollectionRequestBuilder) ID(id string) *WindowsInformationProtectionWipeActionRequestBuilder { + bb := &WindowsInformationProtectionWipeActionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceAppManagementWindowsInformationProtectionWipeActionsCollectionRequest is request for WindowsInformationProtectionWipeAction collection +type DeviceAppManagementWindowsInformationProtectionWipeActionsCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for WindowsInformationProtectionWipeAction collection +func (r *DeviceAppManagementWindowsInformationProtectionWipeActionsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]WindowsInformationProtectionWipeAction, 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 []WindowsInformationProtectionWipeAction + 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 []WindowsInformationProtectionWipeAction + ) + 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 WindowsInformationProtectionWipeAction collection +func (r *DeviceAppManagementWindowsInformationProtectionWipeActionsCollectionRequest) Get(ctx context.Context) ([]WindowsInformationProtectionWipeAction, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for WindowsInformationProtectionWipeAction collection +func (r *DeviceAppManagementWindowsInformationProtectionWipeActionsCollectionRequest) Add(ctx context.Context, reqObj *WindowsInformationProtectionWipeAction) (resObj *WindowsInformationProtectionWipeAction, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// WindowsManagementApp is navigation property +func (b *DeviceAppManagementRequestBuilder) WindowsManagementApp() *WindowsManagementAppRequestBuilder { + bb := &WindowsManagementAppRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/windowsManagementApp" + return bb +} |