5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-14 08:30:27 +00:00
matterbridge/vendor/github.com/yaegashi/msgraph.go/beta/ActionDevice.go
2020-03-22 00:02:48 +01:00

14359 lines
525 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"
)
// DeviceCompliancePolicyCollectionHasPayloadLinksRequestParameter undocumented
type DeviceCompliancePolicyCollectionHasPayloadLinksRequestParameter struct {
// PayloadIDs undocumented
PayloadIDs []string `json:"payloadIds,omitempty"`
}
// DeviceCompliancePolicyCollectionRefreshDeviceComplianceReportSummarizationRequestParameter undocumented
type DeviceCompliancePolicyCollectionRefreshDeviceComplianceReportSummarizationRequestParameter struct {
}
// DeviceConfigurationCollectionHasPayloadLinksRequestParameter undocumented
type DeviceConfigurationCollectionHasPayloadLinksRequestParameter struct {
// PayloadIDs undocumented
PayloadIDs []string `json:"payloadIds,omitempty"`
}
// DeviceConfigurationCollectionGetTargetedUsersAndDevicesRequestParameter undocumented
type DeviceConfigurationCollectionGetTargetedUsersAndDevicesRequestParameter struct {
// DeviceConfigurationIDs undocumented
DeviceConfigurationIDs []string `json:"deviceConfigurationIds,omitempty"`
}
// DeviceEnrollmentConfigurationCollectionHasPayloadLinksRequestParameter undocumented
type DeviceEnrollmentConfigurationCollectionHasPayloadLinksRequestParameter struct {
// PayloadIDs undocumented
PayloadIDs []string `json:"payloadIds,omitempty"`
}
// DeviceManagementScriptCollectionHasPayloadLinksRequestParameter undocumented
type DeviceManagementScriptCollectionHasPayloadLinksRequestParameter struct {
// PayloadIDs undocumented
PayloadIDs []string `json:"payloadIds,omitempty"`
}
// DeviceAppManagementSyncMicrosoftStoreForBusinessAppsRequestParameter undocumented
type DeviceAppManagementSyncMicrosoftStoreForBusinessAppsRequestParameter struct {
}
// DeviceAppManagementTaskUpdateStatusRequestParameter undocumented
type DeviceAppManagementTaskUpdateStatusRequestParameter struct {
// Status undocumented
Status *DeviceAppManagementTaskStatus `json:"status,omitempty"`
// Note undocumented
Note *string `json:"note,omitempty"`
}
// DeviceCompliancePolicyAssignRequestParameter undocumented
type DeviceCompliancePolicyAssignRequestParameter struct {
// Assignments undocumented
Assignments []DeviceCompliancePolicyAssignment `json:"assignments,omitempty"`
}
// DeviceCompliancePolicyScheduleActionsForRulesRequestParameter undocumented
type DeviceCompliancePolicyScheduleActionsForRulesRequestParameter struct {
// DeviceComplianceScheduledActionForRules undocumented
DeviceComplianceScheduledActionForRules []DeviceComplianceScheduledActionForRule `json:"deviceComplianceScheduledActionForRules,omitempty"`
}
// DeviceConfigurationAssignRequestParameter undocumented
type DeviceConfigurationAssignRequestParameter struct {
// DeviceConfigurationGroupAssignments undocumented
DeviceConfigurationGroupAssignments []DeviceConfigurationGroupAssignment `json:"deviceConfigurationGroupAssignments,omitempty"`
// Assignments undocumented
Assignments []DeviceConfigurationAssignment `json:"assignments,omitempty"`
}
// DeviceConfigurationWindowsPrivacyAccessControlsRequestParameter undocumented
type DeviceConfigurationWindowsPrivacyAccessControlsRequestParameter struct {
// WindowsPrivacyAccessControls undocumented
WindowsPrivacyAccessControls []WindowsPrivacyDataAccessControlItem `json:"windowsPrivacyAccessControls,omitempty"`
}
// DeviceConfigurationAssignedAccessMultiModeProfilesRequestParameter undocumented
type DeviceConfigurationAssignedAccessMultiModeProfilesRequestParameter struct {
// AssignedAccessMultiModeProfiles undocumented
AssignedAccessMultiModeProfiles []WindowsAssignedAccessProfile `json:"assignedAccessMultiModeProfiles,omitempty"`
}
// DeviceEnrollmentConfigurationSetPriorityRequestParameter undocumented
type DeviceEnrollmentConfigurationSetPriorityRequestParameter struct {
// Priority undocumented
Priority *int `json:"priority,omitempty"`
}
// DeviceEnrollmentConfigurationAssignRequestParameter undocumented
type DeviceEnrollmentConfigurationAssignRequestParameter struct {
// EnrollmentConfigurationAssignments undocumented
EnrollmentConfigurationAssignments []EnrollmentConfigurationAssignment `json:"enrollmentConfigurationAssignments,omitempty"`
}
// DeviceHealthScriptAssignRequestParameter undocumented
type DeviceHealthScriptAssignRequestParameter struct {
// DeviceHealthScriptAssignments undocumented
DeviceHealthScriptAssignments []DeviceHealthScriptAssignment `json:"deviceHealthScriptAssignments,omitempty"`
}
// DeviceManagementEnableLegacyPcManagementRequestParameter undocumented
type DeviceManagementEnableLegacyPcManagementRequestParameter struct {
}
// DeviceManagementEnableAndroidDeviceAdministratorEnrollmentRequestParameter undocumented
type DeviceManagementEnableAndroidDeviceAdministratorEnrollmentRequestParameter struct {
}
// DeviceManagementSendCustomNotificationToCompanyPortalRequestParameter undocumented
type DeviceManagementSendCustomNotificationToCompanyPortalRequestParameter struct {
// NotificationTitle undocumented
NotificationTitle *string `json:"notificationTitle,omitempty"`
// NotificationBody undocumented
NotificationBody *string `json:"notificationBody,omitempty"`
// GroupsToNotify undocumented
GroupsToNotify []string `json:"groupsToNotify,omitempty"`
}
// DeviceManagementExchangeConnectorSyncRequestParameter undocumented
type DeviceManagementExchangeConnectorSyncRequestParameter struct {
// SyncType undocumented
SyncType *DeviceManagementExchangeConnectorSyncType `json:"syncType,omitempty"`
}
// DeviceManagementIntentUpdateSettingsRequestParameter undocumented
type DeviceManagementIntentUpdateSettingsRequestParameter struct {
// Settings undocumented
Settings []DeviceManagementSettingInstance `json:"settings,omitempty"`
}
// DeviceManagementIntentMigrateToTemplateRequestParameter undocumented
type DeviceManagementIntentMigrateToTemplateRequestParameter struct {
// NewTemplateID undocumented
NewTemplateID *string `json:"newTemplateId,omitempty"`
// PreserveCustomValues undocumented
PreserveCustomValues *bool `json:"preserveCustomValues,omitempty"`
}
// DeviceManagementIntentAssignRequestParameter undocumented
type DeviceManagementIntentAssignRequestParameter struct {
// Assignments undocumented
Assignments []DeviceManagementIntentAssignment `json:"assignments,omitempty"`
}
// DeviceManagementReportsGetDeviceNonComplianceReportRequestParameter undocumented
type DeviceManagementReportsGetDeviceNonComplianceReportRequestParameter struct {
// Name undocumented
Name *string `json:"name,omitempty"`
// Select undocumented
Select []string `json:"select,omitempty"`
// Search undocumented
Search *string `json:"search,omitempty"`
// GroupBy undocumented
GroupBy []string `json:"groupBy,omitempty"`
// OrderBy undocumented
OrderBy []string `json:"orderBy,omitempty"`
// Skip undocumented
Skip *int `json:"skip,omitempty"`
// Top undocumented
Top *int `json:"top,omitempty"`
// SessionID undocumented
SessionID *string `json:"sessionId,omitempty"`
// Filter undocumented
Filter *string `json:"filter,omitempty"`
}
// DeviceManagementReportsGetPolicyNonComplianceReportRequestParameter undocumented
type DeviceManagementReportsGetPolicyNonComplianceReportRequestParameter struct {
// Name undocumented
Name *string `json:"name,omitempty"`
// Select undocumented
Select []string `json:"select,omitempty"`
// Search undocumented
Search *string `json:"search,omitempty"`
// GroupBy undocumented
GroupBy []string `json:"groupBy,omitempty"`
// OrderBy undocumented
OrderBy []string `json:"orderBy,omitempty"`
// Skip undocumented
Skip *int `json:"skip,omitempty"`
// Top undocumented
Top *int `json:"top,omitempty"`
// SessionID undocumented
SessionID *string `json:"sessionId,omitempty"`
// Filter undocumented
Filter *string `json:"filter,omitempty"`
}
// DeviceManagementReportsGetPolicyNonComplianceMetadataRequestParameter undocumented
type DeviceManagementReportsGetPolicyNonComplianceMetadataRequestParameter struct {
// Name undocumented
Name *string `json:"name,omitempty"`
// Select undocumented
Select []string `json:"select,omitempty"`
// Search undocumented
Search *string `json:"search,omitempty"`
// GroupBy undocumented
GroupBy []string `json:"groupBy,omitempty"`
// OrderBy undocumented
OrderBy []string `json:"orderBy,omitempty"`
// Skip undocumented
Skip *int `json:"skip,omitempty"`
// Top undocumented
Top *int `json:"top,omitempty"`
// SessionID undocumented
SessionID *string `json:"sessionId,omitempty"`
// Filter undocumented
Filter *string `json:"filter,omitempty"`
}
// DeviceManagementReportsGetHistoricalReportRequestParameter undocumented
type DeviceManagementReportsGetHistoricalReportRequestParameter struct {
// Name undocumented
Name *string `json:"name,omitempty"`
// Select undocumented
Select []string `json:"select,omitempty"`
// Search undocumented
Search *string `json:"search,omitempty"`
// GroupBy undocumented
GroupBy []string `json:"groupBy,omitempty"`
// OrderBy undocumented
OrderBy []string `json:"orderBy,omitempty"`
// Skip undocumented
Skip *int `json:"skip,omitempty"`
// Top undocumented
Top *int `json:"top,omitempty"`
// Filter undocumented
Filter *string `json:"filter,omitempty"`
}
// DeviceManagementReportsGetCachedReportRequestParameter undocumented
type DeviceManagementReportsGetCachedReportRequestParameter struct {
// ID undocumented
ID *string `json:"id,omitempty"`
// Select undocumented
Select []string `json:"select,omitempty"`
// Search undocumented
Search *string `json:"search,omitempty"`
// GroupBy undocumented
GroupBy []string `json:"groupBy,omitempty"`
// OrderBy undocumented
OrderBy []string `json:"orderBy,omitempty"`
// Skip undocumented
Skip *int `json:"skip,omitempty"`
// Top undocumented
Top *int `json:"top,omitempty"`
}
// DeviceManagementScriptAssignRequestParameter undocumented
type DeviceManagementScriptAssignRequestParameter struct {
// DeviceManagementScriptGroupAssignments undocumented
DeviceManagementScriptGroupAssignments []DeviceManagementScriptGroupAssignment `json:"deviceManagementScriptGroupAssignments,omitempty"`
// DeviceManagementScriptAssignments undocumented
DeviceManagementScriptAssignments []DeviceManagementScriptAssignment `json:"deviceManagementScriptAssignments,omitempty"`
}
// DeviceManagementTemplateCreateInstanceRequestParameter undocumented
type DeviceManagementTemplateCreateInstanceRequestParameter struct {
// DisplayName undocumented
DisplayName *string `json:"displayName,omitempty"`
// Description undocumented
Description *string `json:"description,omitempty"`
// SettingsDelta undocumented
SettingsDelta []DeviceManagementSettingInstance `json:"settingsDelta,omitempty"`
// RoleScopeTagIDs undocumented
RoleScopeTagIDs []string `json:"roleScopeTagIds,omitempty"`
}
// Commands returns request builder for Command collection
func (b *DeviceRequestBuilder) Commands() *DeviceCommandsCollectionRequestBuilder {
bb := &DeviceCommandsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/commands"
return bb
}
// DeviceCommandsCollectionRequestBuilder is request builder for Command collection
type DeviceCommandsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for Command collection
func (b *DeviceCommandsCollectionRequestBuilder) Request() *DeviceCommandsCollectionRequest {
return &DeviceCommandsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for Command item
func (b *DeviceCommandsCollectionRequestBuilder) ID(id string) *CommandRequestBuilder {
bb := &CommandRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceCommandsCollectionRequest is request for Command collection
type DeviceCommandsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for Command collection
func (r *DeviceCommandsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]Command, 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 []Command
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 []Command
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for Command collection, max N pages
func (r *DeviceCommandsCollectionRequest) GetN(ctx context.Context, n int) ([]Command, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for Command collection
func (r *DeviceCommandsCollectionRequest) Get(ctx context.Context) ([]Command, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for Command collection
func (r *DeviceCommandsCollectionRequest) Add(ctx context.Context, reqObj *Command) (resObj *Command, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Extensions returns request builder for Extension collection
func (b *DeviceRequestBuilder) Extensions() *DeviceExtensionsCollectionRequestBuilder {
bb := &DeviceExtensionsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/extensions"
return bb
}
// DeviceExtensionsCollectionRequestBuilder is request builder for Extension collection
type DeviceExtensionsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for Extension collection
func (b *DeviceExtensionsCollectionRequestBuilder) Request() *DeviceExtensionsCollectionRequest {
return &DeviceExtensionsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for Extension item
func (b *DeviceExtensionsCollectionRequestBuilder) ID(id string) *ExtensionRequestBuilder {
bb := &ExtensionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceExtensionsCollectionRequest is request for Extension collection
type DeviceExtensionsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for Extension collection
func (r *DeviceExtensionsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]Extension, error) {
req, err := r.NewJSONRequest(method, path, obj)
if err != nil {
return nil, err
}
if ctx != nil {
req = req.WithContext(ctx)
}
res, err := r.client.Do(req)
if err != nil {
return nil, err
}
var values []Extension
for {
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
errRes := &ErrorResponse{Response: res}
err := jsonx.Unmarshal(b, errRes)
if err != nil {
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
}
return nil, errRes
}
var (
paging Paging
value []Extension
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for Extension collection, max N pages
func (r *DeviceExtensionsCollectionRequest) GetN(ctx context.Context, n int) ([]Extension, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for Extension collection
func (r *DeviceExtensionsCollectionRequest) Get(ctx context.Context) ([]Extension, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for Extension collection
func (r *DeviceExtensionsCollectionRequest) Add(ctx context.Context, reqObj *Extension) (resObj *Extension, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// MemberOf returns request builder for DirectoryObject collection
func (b *DeviceRequestBuilder) MemberOf() *DeviceMemberOfCollectionRequestBuilder {
bb := &DeviceMemberOfCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/memberOf"
return bb
}
// DeviceMemberOfCollectionRequestBuilder is request builder for DirectoryObject collection
type DeviceMemberOfCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DirectoryObject collection
func (b *DeviceMemberOfCollectionRequestBuilder) Request() *DeviceMemberOfCollectionRequest {
return &DeviceMemberOfCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DirectoryObject item
func (b *DeviceMemberOfCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder {
bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceMemberOfCollectionRequest is request for DirectoryObject collection
type DeviceMemberOfCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DirectoryObject collection
func (r *DeviceMemberOfCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DirectoryObject, 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 []DirectoryObject
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 []DirectoryObject
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DirectoryObject collection, max N pages
func (r *DeviceMemberOfCollectionRequest) GetN(ctx context.Context, n int) ([]DirectoryObject, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DirectoryObject collection
func (r *DeviceMemberOfCollectionRequest) Get(ctx context.Context) ([]DirectoryObject, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DirectoryObject collection
func (r *DeviceMemberOfCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// RegisteredOwners returns request builder for DirectoryObject collection
func (b *DeviceRequestBuilder) RegisteredOwners() *DeviceRegisteredOwnersCollectionRequestBuilder {
bb := &DeviceRegisteredOwnersCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/registeredOwners"
return bb
}
// DeviceRegisteredOwnersCollectionRequestBuilder is request builder for DirectoryObject collection
type DeviceRegisteredOwnersCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DirectoryObject collection
func (b *DeviceRegisteredOwnersCollectionRequestBuilder) Request() *DeviceRegisteredOwnersCollectionRequest {
return &DeviceRegisteredOwnersCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DirectoryObject item
func (b *DeviceRegisteredOwnersCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder {
bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceRegisteredOwnersCollectionRequest is request for DirectoryObject collection
type DeviceRegisteredOwnersCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DirectoryObject collection
func (r *DeviceRegisteredOwnersCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DirectoryObject, 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 []DirectoryObject
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 []DirectoryObject
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DirectoryObject collection, max N pages
func (r *DeviceRegisteredOwnersCollectionRequest) GetN(ctx context.Context, n int) ([]DirectoryObject, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DirectoryObject collection
func (r *DeviceRegisteredOwnersCollectionRequest) Get(ctx context.Context) ([]DirectoryObject, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DirectoryObject collection
func (r *DeviceRegisteredOwnersCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// RegisteredUsers returns request builder for DirectoryObject collection
func (b *DeviceRequestBuilder) RegisteredUsers() *DeviceRegisteredUsersCollectionRequestBuilder {
bb := &DeviceRegisteredUsersCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/registeredUsers"
return bb
}
// DeviceRegisteredUsersCollectionRequestBuilder is request builder for DirectoryObject collection
type DeviceRegisteredUsersCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DirectoryObject collection
func (b *DeviceRegisteredUsersCollectionRequestBuilder) Request() *DeviceRegisteredUsersCollectionRequest {
return &DeviceRegisteredUsersCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DirectoryObject item
func (b *DeviceRegisteredUsersCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder {
bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceRegisteredUsersCollectionRequest is request for DirectoryObject collection
type DeviceRegisteredUsersCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DirectoryObject collection
func (r *DeviceRegisteredUsersCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DirectoryObject, 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 []DirectoryObject
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 []DirectoryObject
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DirectoryObject collection, max N pages
func (r *DeviceRegisteredUsersCollectionRequest) GetN(ctx context.Context, n int) ([]DirectoryObject, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DirectoryObject collection
func (r *DeviceRegisteredUsersCollectionRequest) Get(ctx context.Context) ([]DirectoryObject, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DirectoryObject collection
func (r *DeviceRegisteredUsersCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// TransitiveMemberOf returns request builder for DirectoryObject collection
func (b *DeviceRequestBuilder) TransitiveMemberOf() *DeviceTransitiveMemberOfCollectionRequestBuilder {
bb := &DeviceTransitiveMemberOfCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/transitiveMemberOf"
return bb
}
// DeviceTransitiveMemberOfCollectionRequestBuilder is request builder for DirectoryObject collection
type DeviceTransitiveMemberOfCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DirectoryObject collection
func (b *DeviceTransitiveMemberOfCollectionRequestBuilder) Request() *DeviceTransitiveMemberOfCollectionRequest {
return &DeviceTransitiveMemberOfCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DirectoryObject item
func (b *DeviceTransitiveMemberOfCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder {
bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceTransitiveMemberOfCollectionRequest is request for DirectoryObject collection
type DeviceTransitiveMemberOfCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DirectoryObject collection
func (r *DeviceTransitiveMemberOfCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DirectoryObject, 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 []DirectoryObject
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 []DirectoryObject
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DirectoryObject collection, max N pages
func (r *DeviceTransitiveMemberOfCollectionRequest) GetN(ctx context.Context, n int) ([]DirectoryObject, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DirectoryObject collection
func (r *DeviceTransitiveMemberOfCollectionRequest) Get(ctx context.Context) ([]DirectoryObject, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DirectoryObject collection
func (r *DeviceTransitiveMemberOfCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// RoleScopeTags returns request builder for RoleScopeTag collection
func (b *DeviceAndAppManagementRoleAssignmentRequestBuilder) RoleScopeTags() *DeviceAndAppManagementRoleAssignmentRoleScopeTagsCollectionRequestBuilder {
bb := &DeviceAndAppManagementRoleAssignmentRoleScopeTagsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/roleScopeTags"
return bb
}
// DeviceAndAppManagementRoleAssignmentRoleScopeTagsCollectionRequestBuilder is request builder for RoleScopeTag collection
type DeviceAndAppManagementRoleAssignmentRoleScopeTagsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for RoleScopeTag collection
func (b *DeviceAndAppManagementRoleAssignmentRoleScopeTagsCollectionRequestBuilder) Request() *DeviceAndAppManagementRoleAssignmentRoleScopeTagsCollectionRequest {
return &DeviceAndAppManagementRoleAssignmentRoleScopeTagsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for RoleScopeTag item
func (b *DeviceAndAppManagementRoleAssignmentRoleScopeTagsCollectionRequestBuilder) ID(id string) *RoleScopeTagRequestBuilder {
bb := &RoleScopeTagRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceAndAppManagementRoleAssignmentRoleScopeTagsCollectionRequest is request for RoleScopeTag collection
type DeviceAndAppManagementRoleAssignmentRoleScopeTagsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for RoleScopeTag collection
func (r *DeviceAndAppManagementRoleAssignmentRoleScopeTagsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]RoleScopeTag, 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 []RoleScopeTag
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 []RoleScopeTag
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for RoleScopeTag collection, max N pages
func (r *DeviceAndAppManagementRoleAssignmentRoleScopeTagsCollectionRequest) GetN(ctx context.Context, n int) ([]RoleScopeTag, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for RoleScopeTag collection
func (r *DeviceAndAppManagementRoleAssignmentRoleScopeTagsCollectionRequest) Get(ctx context.Context) ([]RoleScopeTag, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for RoleScopeTag collection
func (r *DeviceAndAppManagementRoleAssignmentRoleScopeTagsCollectionRequest) Add(ctx context.Context, reqObj *RoleScopeTag) (resObj *RoleScopeTag, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for AndroidManagedAppProtection collection, max N pages
func (r *DeviceAppManagementAndroidManagedAppProtectionsCollectionRequest) GetN(ctx context.Context, n int) ([]AndroidManagedAppProtection, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for AndroidManagedAppProtection collection
func (r *DeviceAppManagementAndroidManagedAppProtectionsCollectionRequest) Get(ctx context.Context) ([]AndroidManagedAppProtection, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DefaultManagedAppProtection collection, max N pages
func (r *DeviceAppManagementDefaultManagedAppProtectionsCollectionRequest) GetN(ctx context.Context, n int) ([]DefaultManagedAppProtection, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DefaultManagedAppProtection collection
func (r *DeviceAppManagementDefaultManagedAppProtectionsCollectionRequest) Get(ctx context.Context) ([]DefaultManagedAppProtection, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceAppManagementTask collection, max N pages
func (r *DeviceAppManagementDeviceAppManagementTasksCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceAppManagementTask, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceAppManagementTask collection
func (r *DeviceAppManagementDeviceAppManagementTasksCollectionRequest) Get(ctx context.Context) ([]DeviceAppManagementTask, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for EnterpriseCodeSigningCertificate collection, max N pages
func (r *DeviceAppManagementEnterpriseCodeSigningCertificatesCollectionRequest) GetN(ctx context.Context, n int) ([]EnterpriseCodeSigningCertificate, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for EnterpriseCodeSigningCertificate collection
func (r *DeviceAppManagementEnterpriseCodeSigningCertificatesCollectionRequest) Get(ctx context.Context) ([]EnterpriseCodeSigningCertificate, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for IOSLobAppProvisioningConfiguration collection, max N pages
func (r *DeviceAppManagementIOSLobAppProvisioningConfigurationsCollectionRequest) GetN(ctx context.Context, n int) ([]IOSLobAppProvisioningConfiguration, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for IOSLobAppProvisioningConfiguration collection
func (r *DeviceAppManagementIOSLobAppProvisioningConfigurationsCollectionRequest) Get(ctx context.Context) ([]IOSLobAppProvisioningConfiguration, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for IOSManagedAppProtection collection, max N pages
func (r *DeviceAppManagementIOSManagedAppProtectionsCollectionRequest) GetN(ctx context.Context, n int) ([]IOSManagedAppProtection, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for IOSManagedAppProtection collection
func (r *DeviceAppManagementIOSManagedAppProtectionsCollectionRequest) Get(ctx context.Context) ([]IOSManagedAppProtection, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for ManagedAppPolicy collection, max N pages
func (r *DeviceAppManagementManagedAppPoliciesCollectionRequest) GetN(ctx context.Context, n int) ([]ManagedAppPolicy, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for ManagedAppPolicy collection
func (r *DeviceAppManagementManagedAppPoliciesCollectionRequest) Get(ctx context.Context) ([]ManagedAppPolicy, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for ManagedAppRegistration collection, max N pages
func (r *DeviceAppManagementManagedAppRegistrationsCollectionRequest) GetN(ctx context.Context, n int) ([]ManagedAppRegistration, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for ManagedAppRegistration collection
func (r *DeviceAppManagementManagedAppRegistrationsCollectionRequest) Get(ctx context.Context) ([]ManagedAppRegistration, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for ManagedAppStatus collection, max N pages
func (r *DeviceAppManagementManagedAppStatusesCollectionRequest) GetN(ctx context.Context, n int) ([]ManagedAppStatus, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for ManagedAppStatus collection
func (r *DeviceAppManagementManagedAppStatusesCollectionRequest) Get(ctx context.Context) ([]ManagedAppStatus, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for ManagedEBookCategory collection, max N pages
func (r *DeviceAppManagementManagedEBookCategoriesCollectionRequest) GetN(ctx context.Context, n int) ([]ManagedEBookCategory, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for ManagedEBookCategory collection
func (r *DeviceAppManagementManagedEBookCategoriesCollectionRequest) Get(ctx context.Context) ([]ManagedEBookCategory, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for ManagedEBook collection, max N pages
func (r *DeviceAppManagementManagedEBooksCollectionRequest) GetN(ctx context.Context, n int) ([]ManagedEBook, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for ManagedEBook collection
func (r *DeviceAppManagementManagedEBooksCollectionRequest) Get(ctx context.Context) ([]ManagedEBook, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for MDMWindowsInformationProtectionPolicy collection, max N pages
func (r *DeviceAppManagementMDMWindowsInformationProtectionPoliciesCollectionRequest) GetN(ctx context.Context, n int) ([]MDMWindowsInformationProtectionPolicy, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for MDMWindowsInformationProtectionPolicy collection
func (r *DeviceAppManagementMDMWindowsInformationProtectionPoliciesCollectionRequest) Get(ctx context.Context) ([]MDMWindowsInformationProtectionPolicy, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for MobileAppCategory collection, max N pages
func (r *DeviceAppManagementMobileAppCategoriesCollectionRequest) GetN(ctx context.Context, n int) ([]MobileAppCategory, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for MobileAppCategory collection
func (r *DeviceAppManagementMobileAppCategoriesCollectionRequest) Get(ctx context.Context) ([]MobileAppCategory, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for ManagedDeviceMobileAppConfiguration collection, max N pages
func (r *DeviceAppManagementMobileAppConfigurationsCollectionRequest) GetN(ctx context.Context, n int) ([]ManagedDeviceMobileAppConfiguration, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for ManagedDeviceMobileAppConfiguration collection
func (r *DeviceAppManagementMobileAppConfigurationsCollectionRequest) Get(ctx context.Context) ([]ManagedDeviceMobileAppConfiguration, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for MobileApp collection, max N pages
func (r *DeviceAppManagementMobileAppsCollectionRequest) GetN(ctx context.Context, n int) ([]MobileApp, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for MobileApp collection
func (r *DeviceAppManagementMobileAppsCollectionRequest) Get(ctx context.Context) ([]MobileApp, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for PolicySet collection, max N pages
func (r *DeviceAppManagementPolicySetsCollectionRequest) GetN(ctx context.Context, n int) ([]PolicySet, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for PolicySet collection
func (r *DeviceAppManagementPolicySetsCollectionRequest) Get(ctx context.Context) ([]PolicySet, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for SideLoadingKey collection, max N pages
func (r *DeviceAppManagementSideLoadingKeysCollectionRequest) GetN(ctx context.Context, n int) ([]SideLoadingKey, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for SideLoadingKey collection
func (r *DeviceAppManagementSideLoadingKeysCollectionRequest) Get(ctx context.Context) ([]SideLoadingKey, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for TargetedManagedAppConfiguration collection, max N pages
func (r *DeviceAppManagementTargetedManagedAppConfigurationsCollectionRequest) GetN(ctx context.Context, n int) ([]TargetedManagedAppConfiguration, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for TargetedManagedAppConfiguration collection
func (r *DeviceAppManagementTargetedManagedAppConfigurationsCollectionRequest) Get(ctx context.Context) ([]TargetedManagedAppConfiguration, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for VPPToken collection, max N pages
func (r *DeviceAppManagementVPPTokensCollectionRequest) GetN(ctx context.Context, n int) ([]VPPToken, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for VPPToken collection
func (r *DeviceAppManagementVPPTokensCollectionRequest) Get(ctx context.Context) ([]VPPToken, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for WindowsDefenderApplicationControlSupplementalPolicy collection, max N pages
func (r *DeviceAppManagementWdacSupplementalPoliciesCollectionRequest) GetN(ctx context.Context, n int) ([]WindowsDefenderApplicationControlSupplementalPolicy, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for WindowsDefenderApplicationControlSupplementalPolicy collection
func (r *DeviceAppManagementWdacSupplementalPoliciesCollectionRequest) Get(ctx context.Context) ([]WindowsDefenderApplicationControlSupplementalPolicy, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for WindowsInformationProtectionDeviceRegistration collection, max N pages
func (r *DeviceAppManagementWindowsInformationProtectionDeviceRegistrationsCollectionRequest) GetN(ctx context.Context, n int) ([]WindowsInformationProtectionDeviceRegistration, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for WindowsInformationProtectionDeviceRegistration collection
func (r *DeviceAppManagementWindowsInformationProtectionDeviceRegistrationsCollectionRequest) Get(ctx context.Context) ([]WindowsInformationProtectionDeviceRegistration, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for WindowsInformationProtectionPolicy collection, max N pages
func (r *DeviceAppManagementWindowsInformationProtectionPoliciesCollectionRequest) GetN(ctx context.Context, n int) ([]WindowsInformationProtectionPolicy, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for WindowsInformationProtectionPolicy collection
func (r *DeviceAppManagementWindowsInformationProtectionPoliciesCollectionRequest) Get(ctx context.Context) ([]WindowsInformationProtectionPolicy, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for WindowsInformationProtectionWipeAction collection, max N pages
func (r *DeviceAppManagementWindowsInformationProtectionWipeActionsCollectionRequest) GetN(ctx context.Context, n int) ([]WindowsInformationProtectionWipeAction, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for WindowsInformationProtectionWipeAction collection
func (r *DeviceAppManagementWindowsInformationProtectionWipeActionsCollectionRequest) Get(ctx context.Context) ([]WindowsInformationProtectionWipeAction, error) {
return r.GetN(ctx, 0)
}
// 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
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceCompliancePolicyAssignment collection, max N pages
func (r *DeviceCompliancePolicyAssignmentsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceCompliancePolicyAssignment, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceCompliancePolicyAssignment collection
func (r *DeviceCompliancePolicyAssignmentsCollectionRequest) Get(ctx context.Context) ([]DeviceCompliancePolicyAssignment, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for SettingStateDeviceSummary collection, max N pages
func (r *DeviceCompliancePolicyDeviceSettingStateSummariesCollectionRequest) GetN(ctx context.Context, n int) ([]SettingStateDeviceSummary, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for SettingStateDeviceSummary collection
func (r *DeviceCompliancePolicyDeviceSettingStateSummariesCollectionRequest) Get(ctx context.Context) ([]SettingStateDeviceSummary, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceComplianceDeviceStatus collection, max N pages
func (r *DeviceCompliancePolicyDeviceStatusesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceComplianceDeviceStatus, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceComplianceDeviceStatus collection
func (r *DeviceCompliancePolicyDeviceStatusesCollectionRequest) Get(ctx context.Context) ([]DeviceComplianceDeviceStatus, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceComplianceScheduledActionForRule collection, max N pages
func (r *DeviceCompliancePolicyScheduledActionsForRuleCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceComplianceScheduledActionForRule, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceComplianceScheduledActionForRule collection
func (r *DeviceCompliancePolicyScheduledActionsForRuleCollectionRequest) Get(ctx context.Context) ([]DeviceComplianceScheduledActionForRule, error) {
return r.GetN(ctx, 0)
}
// 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{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceComplianceUserStatus collection, max N pages
func (r *DeviceCompliancePolicyUserStatusesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceComplianceUserStatus, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceComplianceUserStatus collection
func (r *DeviceCompliancePolicyUserStatusesCollectionRequest) Get(ctx context.Context) ([]DeviceComplianceUserStatus, error) {
return r.GetN(ctx, 0)
}
// 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
}
// DeviceCompliancePolicy is navigation property
func (b *DeviceCompliancePolicyGroupAssignmentRequestBuilder) DeviceCompliancePolicy() *DeviceCompliancePolicyRequestBuilder {
bb := &DeviceCompliancePolicyRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceCompliancePolicy"
return bb
}
// DeviceComplianceSettingStates returns request builder for DeviceComplianceSettingState collection
func (b *DeviceCompliancePolicySettingStateSummaryRequestBuilder) DeviceComplianceSettingStates() *DeviceCompliancePolicySettingStateSummaryDeviceComplianceSettingStatesCollectionRequestBuilder {
bb := &DeviceCompliancePolicySettingStateSummaryDeviceComplianceSettingStatesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceComplianceSettingStates"
return bb
}
// DeviceCompliancePolicySettingStateSummaryDeviceComplianceSettingStatesCollectionRequestBuilder is request builder for DeviceComplianceSettingState collection
type DeviceCompliancePolicySettingStateSummaryDeviceComplianceSettingStatesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceComplianceSettingState collection
func (b *DeviceCompliancePolicySettingStateSummaryDeviceComplianceSettingStatesCollectionRequestBuilder) Request() *DeviceCompliancePolicySettingStateSummaryDeviceComplianceSettingStatesCollectionRequest {
return &DeviceCompliancePolicySettingStateSummaryDeviceComplianceSettingStatesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceComplianceSettingState item
func (b *DeviceCompliancePolicySettingStateSummaryDeviceComplianceSettingStatesCollectionRequestBuilder) ID(id string) *DeviceComplianceSettingStateRequestBuilder {
bb := &DeviceComplianceSettingStateRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceCompliancePolicySettingStateSummaryDeviceComplianceSettingStatesCollectionRequest is request for DeviceComplianceSettingState collection
type DeviceCompliancePolicySettingStateSummaryDeviceComplianceSettingStatesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceComplianceSettingState collection
func (r *DeviceCompliancePolicySettingStateSummaryDeviceComplianceSettingStatesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceComplianceSettingState, 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 []DeviceComplianceSettingState
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 []DeviceComplianceSettingState
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceComplianceSettingState collection, max N pages
func (r *DeviceCompliancePolicySettingStateSummaryDeviceComplianceSettingStatesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceComplianceSettingState, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceComplianceSettingState collection
func (r *DeviceCompliancePolicySettingStateSummaryDeviceComplianceSettingStatesCollectionRequest) Get(ctx context.Context) ([]DeviceComplianceSettingState, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceComplianceSettingState collection
func (r *DeviceCompliancePolicySettingStateSummaryDeviceComplianceSettingStatesCollectionRequest) Add(ctx context.Context, reqObj *DeviceComplianceSettingState) (resObj *DeviceComplianceSettingState, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ScheduledActionConfigurations returns request builder for DeviceComplianceActionItem collection
func (b *DeviceComplianceScheduledActionForRuleRequestBuilder) ScheduledActionConfigurations() *DeviceComplianceScheduledActionForRuleScheduledActionConfigurationsCollectionRequestBuilder {
bb := &DeviceComplianceScheduledActionForRuleScheduledActionConfigurationsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/scheduledActionConfigurations"
return bb
}
// DeviceComplianceScheduledActionForRuleScheduledActionConfigurationsCollectionRequestBuilder is request builder for DeviceComplianceActionItem collection
type DeviceComplianceScheduledActionForRuleScheduledActionConfigurationsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceComplianceActionItem collection
func (b *DeviceComplianceScheduledActionForRuleScheduledActionConfigurationsCollectionRequestBuilder) Request() *DeviceComplianceScheduledActionForRuleScheduledActionConfigurationsCollectionRequest {
return &DeviceComplianceScheduledActionForRuleScheduledActionConfigurationsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceComplianceActionItem item
func (b *DeviceComplianceScheduledActionForRuleScheduledActionConfigurationsCollectionRequestBuilder) ID(id string) *DeviceComplianceActionItemRequestBuilder {
bb := &DeviceComplianceActionItemRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceComplianceScheduledActionForRuleScheduledActionConfigurationsCollectionRequest is request for DeviceComplianceActionItem collection
type DeviceComplianceScheduledActionForRuleScheduledActionConfigurationsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceComplianceActionItem collection
func (r *DeviceComplianceScheduledActionForRuleScheduledActionConfigurationsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceComplianceActionItem, 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 []DeviceComplianceActionItem
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 []DeviceComplianceActionItem
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceComplianceActionItem collection, max N pages
func (r *DeviceComplianceScheduledActionForRuleScheduledActionConfigurationsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceComplianceActionItem, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceComplianceActionItem collection
func (r *DeviceComplianceScheduledActionForRuleScheduledActionConfigurationsCollectionRequest) Get(ctx context.Context) ([]DeviceComplianceActionItem, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceComplianceActionItem collection
func (r *DeviceComplianceScheduledActionForRuleScheduledActionConfigurationsCollectionRequest) Add(ctx context.Context, reqObj *DeviceComplianceActionItem) (resObj *DeviceComplianceActionItem, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Assignments returns request builder for DeviceConfigurationAssignment collection
func (b *DeviceConfigurationRequestBuilder) Assignments() *DeviceConfigurationAssignmentsCollectionRequestBuilder {
bb := &DeviceConfigurationAssignmentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/assignments"
return bb
}
// DeviceConfigurationAssignmentsCollectionRequestBuilder is request builder for DeviceConfigurationAssignment collection
type DeviceConfigurationAssignmentsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceConfigurationAssignment collection
func (b *DeviceConfigurationAssignmentsCollectionRequestBuilder) Request() *DeviceConfigurationAssignmentsCollectionRequest {
return &DeviceConfigurationAssignmentsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceConfigurationAssignment item
func (b *DeviceConfigurationAssignmentsCollectionRequestBuilder) ID(id string) *DeviceConfigurationAssignmentRequestBuilder {
bb := &DeviceConfigurationAssignmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceConfigurationAssignmentsCollectionRequest is request for DeviceConfigurationAssignment collection
type DeviceConfigurationAssignmentsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceConfigurationAssignment collection
func (r *DeviceConfigurationAssignmentsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceConfigurationAssignment, 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 []DeviceConfigurationAssignment
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 []DeviceConfigurationAssignment
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceConfigurationAssignment collection, max N pages
func (r *DeviceConfigurationAssignmentsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceConfigurationAssignment, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceConfigurationAssignment collection
func (r *DeviceConfigurationAssignmentsCollectionRequest) Get(ctx context.Context) ([]DeviceConfigurationAssignment, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceConfigurationAssignment collection
func (r *DeviceConfigurationAssignmentsCollectionRequest) Add(ctx context.Context, reqObj *DeviceConfigurationAssignment) (resObj *DeviceConfigurationAssignment, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DeviceSettingStateSummaries returns request builder for SettingStateDeviceSummary collection
func (b *DeviceConfigurationRequestBuilder) DeviceSettingStateSummaries() *DeviceConfigurationDeviceSettingStateSummariesCollectionRequestBuilder {
bb := &DeviceConfigurationDeviceSettingStateSummariesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceSettingStateSummaries"
return bb
}
// DeviceConfigurationDeviceSettingStateSummariesCollectionRequestBuilder is request builder for SettingStateDeviceSummary collection
type DeviceConfigurationDeviceSettingStateSummariesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for SettingStateDeviceSummary collection
func (b *DeviceConfigurationDeviceSettingStateSummariesCollectionRequestBuilder) Request() *DeviceConfigurationDeviceSettingStateSummariesCollectionRequest {
return &DeviceConfigurationDeviceSettingStateSummariesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for SettingStateDeviceSummary item
func (b *DeviceConfigurationDeviceSettingStateSummariesCollectionRequestBuilder) ID(id string) *SettingStateDeviceSummaryRequestBuilder {
bb := &SettingStateDeviceSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceConfigurationDeviceSettingStateSummariesCollectionRequest is request for SettingStateDeviceSummary collection
type DeviceConfigurationDeviceSettingStateSummariesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for SettingStateDeviceSummary collection
func (r *DeviceConfigurationDeviceSettingStateSummariesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for SettingStateDeviceSummary collection, max N pages
func (r *DeviceConfigurationDeviceSettingStateSummariesCollectionRequest) GetN(ctx context.Context, n int) ([]SettingStateDeviceSummary, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for SettingStateDeviceSummary collection
func (r *DeviceConfigurationDeviceSettingStateSummariesCollectionRequest) Get(ctx context.Context) ([]SettingStateDeviceSummary, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for SettingStateDeviceSummary collection
func (r *DeviceConfigurationDeviceSettingStateSummariesCollectionRequest) Add(ctx context.Context, reqObj *SettingStateDeviceSummary) (resObj *SettingStateDeviceSummary, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DeviceStatusOverview is navigation property
func (b *DeviceConfigurationRequestBuilder) DeviceStatusOverview() *DeviceConfigurationDeviceOverviewRequestBuilder {
bb := &DeviceConfigurationDeviceOverviewRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceStatusOverview"
return bb
}
// DeviceStatuses returns request builder for DeviceConfigurationDeviceStatus collection
func (b *DeviceConfigurationRequestBuilder) DeviceStatuses() *DeviceConfigurationDeviceStatusesCollectionRequestBuilder {
bb := &DeviceConfigurationDeviceStatusesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceStatuses"
return bb
}
// DeviceConfigurationDeviceStatusesCollectionRequestBuilder is request builder for DeviceConfigurationDeviceStatus collection
type DeviceConfigurationDeviceStatusesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceConfigurationDeviceStatus collection
func (b *DeviceConfigurationDeviceStatusesCollectionRequestBuilder) Request() *DeviceConfigurationDeviceStatusesCollectionRequest {
return &DeviceConfigurationDeviceStatusesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceConfigurationDeviceStatus item
func (b *DeviceConfigurationDeviceStatusesCollectionRequestBuilder) ID(id string) *DeviceConfigurationDeviceStatusRequestBuilder {
bb := &DeviceConfigurationDeviceStatusRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceConfigurationDeviceStatusesCollectionRequest is request for DeviceConfigurationDeviceStatus collection
type DeviceConfigurationDeviceStatusesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceConfigurationDeviceStatus collection
func (r *DeviceConfigurationDeviceStatusesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceConfigurationDeviceStatus, 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 []DeviceConfigurationDeviceStatus
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 []DeviceConfigurationDeviceStatus
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceConfigurationDeviceStatus collection, max N pages
func (r *DeviceConfigurationDeviceStatusesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceConfigurationDeviceStatus, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceConfigurationDeviceStatus collection
func (r *DeviceConfigurationDeviceStatusesCollectionRequest) Get(ctx context.Context) ([]DeviceConfigurationDeviceStatus, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceConfigurationDeviceStatus collection
func (r *DeviceConfigurationDeviceStatusesCollectionRequest) Add(ctx context.Context, reqObj *DeviceConfigurationDeviceStatus) (resObj *DeviceConfigurationDeviceStatus, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// GroupAssignments returns request builder for DeviceConfigurationGroupAssignment collection
func (b *DeviceConfigurationRequestBuilder) GroupAssignments() *DeviceConfigurationGroupAssignmentsCollectionRequestBuilder {
bb := &DeviceConfigurationGroupAssignmentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/groupAssignments"
return bb
}
// DeviceConfigurationGroupAssignmentsCollectionRequestBuilder is request builder for DeviceConfigurationGroupAssignment collection
type DeviceConfigurationGroupAssignmentsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceConfigurationGroupAssignment collection
func (b *DeviceConfigurationGroupAssignmentsCollectionRequestBuilder) Request() *DeviceConfigurationGroupAssignmentsCollectionRequest {
return &DeviceConfigurationGroupAssignmentsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceConfigurationGroupAssignment item
func (b *DeviceConfigurationGroupAssignmentsCollectionRequestBuilder) ID(id string) *DeviceConfigurationGroupAssignmentRequestBuilder {
bb := &DeviceConfigurationGroupAssignmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceConfigurationGroupAssignmentsCollectionRequest is request for DeviceConfigurationGroupAssignment collection
type DeviceConfigurationGroupAssignmentsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceConfigurationGroupAssignment collection
func (r *DeviceConfigurationGroupAssignmentsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceConfigurationGroupAssignment, 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 []DeviceConfigurationGroupAssignment
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 []DeviceConfigurationGroupAssignment
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceConfigurationGroupAssignment collection, max N pages
func (r *DeviceConfigurationGroupAssignmentsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceConfigurationGroupAssignment, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceConfigurationGroupAssignment collection
func (r *DeviceConfigurationGroupAssignmentsCollectionRequest) Get(ctx context.Context) ([]DeviceConfigurationGroupAssignment, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceConfigurationGroupAssignment collection
func (r *DeviceConfigurationGroupAssignmentsCollectionRequest) Add(ctx context.Context, reqObj *DeviceConfigurationGroupAssignment) (resObj *DeviceConfigurationGroupAssignment, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// UserStatusOverview is navigation property
func (b *DeviceConfigurationRequestBuilder) UserStatusOverview() *DeviceConfigurationUserOverviewRequestBuilder {
bb := &DeviceConfigurationUserOverviewRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/userStatusOverview"
return bb
}
// UserStatuses returns request builder for DeviceConfigurationUserStatus collection
func (b *DeviceConfigurationRequestBuilder) UserStatuses() *DeviceConfigurationUserStatusesCollectionRequestBuilder {
bb := &DeviceConfigurationUserStatusesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/userStatuses"
return bb
}
// DeviceConfigurationUserStatusesCollectionRequestBuilder is request builder for DeviceConfigurationUserStatus collection
type DeviceConfigurationUserStatusesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceConfigurationUserStatus collection
func (b *DeviceConfigurationUserStatusesCollectionRequestBuilder) Request() *DeviceConfigurationUserStatusesCollectionRequest {
return &DeviceConfigurationUserStatusesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceConfigurationUserStatus item
func (b *DeviceConfigurationUserStatusesCollectionRequestBuilder) ID(id string) *DeviceConfigurationUserStatusRequestBuilder {
bb := &DeviceConfigurationUserStatusRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceConfigurationUserStatusesCollectionRequest is request for DeviceConfigurationUserStatus collection
type DeviceConfigurationUserStatusesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceConfigurationUserStatus collection
func (r *DeviceConfigurationUserStatusesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceConfigurationUserStatus, 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 []DeviceConfigurationUserStatus
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 []DeviceConfigurationUserStatus
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceConfigurationUserStatus collection, max N pages
func (r *DeviceConfigurationUserStatusesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceConfigurationUserStatus, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceConfigurationUserStatus collection
func (r *DeviceConfigurationUserStatusesCollectionRequest) Get(ctx context.Context) ([]DeviceConfigurationUserStatus, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceConfigurationUserStatus collection
func (r *DeviceConfigurationUserStatusesCollectionRequest) Add(ctx context.Context, reqObj *DeviceConfigurationUserStatus) (resObj *DeviceConfigurationUserStatus, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DeviceConfiguration is navigation property
func (b *DeviceConfigurationGroupAssignmentRequestBuilder) DeviceConfiguration() *DeviceConfigurationRequestBuilder {
bb := &DeviceConfigurationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceConfiguration"
return bb
}
// Assignments returns request builder for EnrollmentConfigurationAssignment collection
func (b *DeviceEnrollmentConfigurationRequestBuilder) Assignments() *DeviceEnrollmentConfigurationAssignmentsCollectionRequestBuilder {
bb := &DeviceEnrollmentConfigurationAssignmentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/assignments"
return bb
}
// DeviceEnrollmentConfigurationAssignmentsCollectionRequestBuilder is request builder for EnrollmentConfigurationAssignment collection
type DeviceEnrollmentConfigurationAssignmentsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for EnrollmentConfigurationAssignment collection
func (b *DeviceEnrollmentConfigurationAssignmentsCollectionRequestBuilder) Request() *DeviceEnrollmentConfigurationAssignmentsCollectionRequest {
return &DeviceEnrollmentConfigurationAssignmentsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for EnrollmentConfigurationAssignment item
func (b *DeviceEnrollmentConfigurationAssignmentsCollectionRequestBuilder) ID(id string) *EnrollmentConfigurationAssignmentRequestBuilder {
bb := &EnrollmentConfigurationAssignmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceEnrollmentConfigurationAssignmentsCollectionRequest is request for EnrollmentConfigurationAssignment collection
type DeviceEnrollmentConfigurationAssignmentsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for EnrollmentConfigurationAssignment collection
func (r *DeviceEnrollmentConfigurationAssignmentsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]EnrollmentConfigurationAssignment, 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 []EnrollmentConfigurationAssignment
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 []EnrollmentConfigurationAssignment
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for EnrollmentConfigurationAssignment collection, max N pages
func (r *DeviceEnrollmentConfigurationAssignmentsCollectionRequest) GetN(ctx context.Context, n int) ([]EnrollmentConfigurationAssignment, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for EnrollmentConfigurationAssignment collection
func (r *DeviceEnrollmentConfigurationAssignmentsCollectionRequest) Get(ctx context.Context) ([]EnrollmentConfigurationAssignment, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for EnrollmentConfigurationAssignment collection
func (r *DeviceEnrollmentConfigurationAssignmentsCollectionRequest) Add(ctx context.Context, reqObj *EnrollmentConfigurationAssignment) (resObj *EnrollmentConfigurationAssignment, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Assignments returns request builder for DeviceHealthScriptAssignment collection
func (b *DeviceHealthScriptRequestBuilder) Assignments() *DeviceHealthScriptAssignmentsCollectionRequestBuilder {
bb := &DeviceHealthScriptAssignmentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/assignments"
return bb
}
// DeviceHealthScriptAssignmentsCollectionRequestBuilder is request builder for DeviceHealthScriptAssignment collection
type DeviceHealthScriptAssignmentsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceHealthScriptAssignment collection
func (b *DeviceHealthScriptAssignmentsCollectionRequestBuilder) Request() *DeviceHealthScriptAssignmentsCollectionRequest {
return &DeviceHealthScriptAssignmentsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceHealthScriptAssignment item
func (b *DeviceHealthScriptAssignmentsCollectionRequestBuilder) ID(id string) *DeviceHealthScriptAssignmentRequestBuilder {
bb := &DeviceHealthScriptAssignmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceHealthScriptAssignmentsCollectionRequest is request for DeviceHealthScriptAssignment collection
type DeviceHealthScriptAssignmentsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceHealthScriptAssignment collection
func (r *DeviceHealthScriptAssignmentsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceHealthScriptAssignment, 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 []DeviceHealthScriptAssignment
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 []DeviceHealthScriptAssignment
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceHealthScriptAssignment collection, max N pages
func (r *DeviceHealthScriptAssignmentsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceHealthScriptAssignment, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceHealthScriptAssignment collection
func (r *DeviceHealthScriptAssignmentsCollectionRequest) Get(ctx context.Context) ([]DeviceHealthScriptAssignment, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceHealthScriptAssignment collection
func (r *DeviceHealthScriptAssignmentsCollectionRequest) Add(ctx context.Context, reqObj *DeviceHealthScriptAssignment) (resObj *DeviceHealthScriptAssignment, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DeviceRunStates returns request builder for DeviceHealthScriptDeviceState collection
func (b *DeviceHealthScriptRequestBuilder) DeviceRunStates() *DeviceHealthScriptDeviceRunStatesCollectionRequestBuilder {
bb := &DeviceHealthScriptDeviceRunStatesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceRunStates"
return bb
}
// DeviceHealthScriptDeviceRunStatesCollectionRequestBuilder is request builder for DeviceHealthScriptDeviceState collection
type DeviceHealthScriptDeviceRunStatesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceHealthScriptDeviceState collection
func (b *DeviceHealthScriptDeviceRunStatesCollectionRequestBuilder) Request() *DeviceHealthScriptDeviceRunStatesCollectionRequest {
return &DeviceHealthScriptDeviceRunStatesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceHealthScriptDeviceState item
func (b *DeviceHealthScriptDeviceRunStatesCollectionRequestBuilder) ID(id string) *DeviceHealthScriptDeviceStateRequestBuilder {
bb := &DeviceHealthScriptDeviceStateRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceHealthScriptDeviceRunStatesCollectionRequest is request for DeviceHealthScriptDeviceState collection
type DeviceHealthScriptDeviceRunStatesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceHealthScriptDeviceState collection
func (r *DeviceHealthScriptDeviceRunStatesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceHealthScriptDeviceState, 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 []DeviceHealthScriptDeviceState
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 []DeviceHealthScriptDeviceState
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceHealthScriptDeviceState collection, max N pages
func (r *DeviceHealthScriptDeviceRunStatesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceHealthScriptDeviceState, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceHealthScriptDeviceState collection
func (r *DeviceHealthScriptDeviceRunStatesCollectionRequest) Get(ctx context.Context) ([]DeviceHealthScriptDeviceState, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceHealthScriptDeviceState collection
func (r *DeviceHealthScriptDeviceRunStatesCollectionRequest) Add(ctx context.Context, reqObj *DeviceHealthScriptDeviceState) (resObj *DeviceHealthScriptDeviceState, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// RunSummary is navigation property
func (b *DeviceHealthScriptRequestBuilder) RunSummary() *DeviceHealthScriptRunSummaryRequestBuilder {
bb := &DeviceHealthScriptRunSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/runSummary"
return bb
}
// ManagedDevice is navigation property
func (b *DeviceHealthScriptDeviceStateRequestBuilder) ManagedDevice() *ManagedDeviceRequestBuilder {
bb := &ManagedDeviceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/managedDevice"
return bb
}
// AdvancedThreatProtectionOnboardingStateSummary is navigation property
func (b *DeviceManagementRequestBuilder) AdvancedThreatProtectionOnboardingStateSummary() *AdvancedThreatProtectionOnboardingStateSummaryRequestBuilder {
bb := &AdvancedThreatProtectionOnboardingStateSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/advancedThreatProtectionOnboardingStateSummary"
return bb
}
// AndroidDeviceOwnerEnrollmentProfiles returns request builder for AndroidDeviceOwnerEnrollmentProfile collection
func (b *DeviceManagementRequestBuilder) AndroidDeviceOwnerEnrollmentProfiles() *DeviceManagementAndroidDeviceOwnerEnrollmentProfilesCollectionRequestBuilder {
bb := &DeviceManagementAndroidDeviceOwnerEnrollmentProfilesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/androidDeviceOwnerEnrollmentProfiles"
return bb
}
// DeviceManagementAndroidDeviceOwnerEnrollmentProfilesCollectionRequestBuilder is request builder for AndroidDeviceOwnerEnrollmentProfile collection
type DeviceManagementAndroidDeviceOwnerEnrollmentProfilesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for AndroidDeviceOwnerEnrollmentProfile collection
func (b *DeviceManagementAndroidDeviceOwnerEnrollmentProfilesCollectionRequestBuilder) Request() *DeviceManagementAndroidDeviceOwnerEnrollmentProfilesCollectionRequest {
return &DeviceManagementAndroidDeviceOwnerEnrollmentProfilesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for AndroidDeviceOwnerEnrollmentProfile item
func (b *DeviceManagementAndroidDeviceOwnerEnrollmentProfilesCollectionRequestBuilder) ID(id string) *AndroidDeviceOwnerEnrollmentProfileRequestBuilder {
bb := &AndroidDeviceOwnerEnrollmentProfileRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementAndroidDeviceOwnerEnrollmentProfilesCollectionRequest is request for AndroidDeviceOwnerEnrollmentProfile collection
type DeviceManagementAndroidDeviceOwnerEnrollmentProfilesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for AndroidDeviceOwnerEnrollmentProfile collection
func (r *DeviceManagementAndroidDeviceOwnerEnrollmentProfilesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AndroidDeviceOwnerEnrollmentProfile, 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 []AndroidDeviceOwnerEnrollmentProfile
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 []AndroidDeviceOwnerEnrollmentProfile
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for AndroidDeviceOwnerEnrollmentProfile collection, max N pages
func (r *DeviceManagementAndroidDeviceOwnerEnrollmentProfilesCollectionRequest) GetN(ctx context.Context, n int) ([]AndroidDeviceOwnerEnrollmentProfile, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for AndroidDeviceOwnerEnrollmentProfile collection
func (r *DeviceManagementAndroidDeviceOwnerEnrollmentProfilesCollectionRequest) Get(ctx context.Context) ([]AndroidDeviceOwnerEnrollmentProfile, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for AndroidDeviceOwnerEnrollmentProfile collection
func (r *DeviceManagementAndroidDeviceOwnerEnrollmentProfilesCollectionRequest) Add(ctx context.Context, reqObj *AndroidDeviceOwnerEnrollmentProfile) (resObj *AndroidDeviceOwnerEnrollmentProfile, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// AndroidForWorkAppConfigurationSchemas returns request builder for AndroidForWorkAppConfigurationSchema collection
func (b *DeviceManagementRequestBuilder) AndroidForWorkAppConfigurationSchemas() *DeviceManagementAndroidForWorkAppConfigurationSchemasCollectionRequestBuilder {
bb := &DeviceManagementAndroidForWorkAppConfigurationSchemasCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/androidForWorkAppConfigurationSchemas"
return bb
}
// DeviceManagementAndroidForWorkAppConfigurationSchemasCollectionRequestBuilder is request builder for AndroidForWorkAppConfigurationSchema collection
type DeviceManagementAndroidForWorkAppConfigurationSchemasCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for AndroidForWorkAppConfigurationSchema collection
func (b *DeviceManagementAndroidForWorkAppConfigurationSchemasCollectionRequestBuilder) Request() *DeviceManagementAndroidForWorkAppConfigurationSchemasCollectionRequest {
return &DeviceManagementAndroidForWorkAppConfigurationSchemasCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for AndroidForWorkAppConfigurationSchema item
func (b *DeviceManagementAndroidForWorkAppConfigurationSchemasCollectionRequestBuilder) ID(id string) *AndroidForWorkAppConfigurationSchemaRequestBuilder {
bb := &AndroidForWorkAppConfigurationSchemaRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementAndroidForWorkAppConfigurationSchemasCollectionRequest is request for AndroidForWorkAppConfigurationSchema collection
type DeviceManagementAndroidForWorkAppConfigurationSchemasCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for AndroidForWorkAppConfigurationSchema collection
func (r *DeviceManagementAndroidForWorkAppConfigurationSchemasCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AndroidForWorkAppConfigurationSchema, 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 []AndroidForWorkAppConfigurationSchema
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 []AndroidForWorkAppConfigurationSchema
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for AndroidForWorkAppConfigurationSchema collection, max N pages
func (r *DeviceManagementAndroidForWorkAppConfigurationSchemasCollectionRequest) GetN(ctx context.Context, n int) ([]AndroidForWorkAppConfigurationSchema, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for AndroidForWorkAppConfigurationSchema collection
func (r *DeviceManagementAndroidForWorkAppConfigurationSchemasCollectionRequest) Get(ctx context.Context) ([]AndroidForWorkAppConfigurationSchema, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for AndroidForWorkAppConfigurationSchema collection
func (r *DeviceManagementAndroidForWorkAppConfigurationSchemasCollectionRequest) Add(ctx context.Context, reqObj *AndroidForWorkAppConfigurationSchema) (resObj *AndroidForWorkAppConfigurationSchema, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// AndroidForWorkEnrollmentProfiles returns request builder for AndroidForWorkEnrollmentProfile collection
func (b *DeviceManagementRequestBuilder) AndroidForWorkEnrollmentProfiles() *DeviceManagementAndroidForWorkEnrollmentProfilesCollectionRequestBuilder {
bb := &DeviceManagementAndroidForWorkEnrollmentProfilesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/androidForWorkEnrollmentProfiles"
return bb
}
// DeviceManagementAndroidForWorkEnrollmentProfilesCollectionRequestBuilder is request builder for AndroidForWorkEnrollmentProfile collection
type DeviceManagementAndroidForWorkEnrollmentProfilesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for AndroidForWorkEnrollmentProfile collection
func (b *DeviceManagementAndroidForWorkEnrollmentProfilesCollectionRequestBuilder) Request() *DeviceManagementAndroidForWorkEnrollmentProfilesCollectionRequest {
return &DeviceManagementAndroidForWorkEnrollmentProfilesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for AndroidForWorkEnrollmentProfile item
func (b *DeviceManagementAndroidForWorkEnrollmentProfilesCollectionRequestBuilder) ID(id string) *AndroidForWorkEnrollmentProfileRequestBuilder {
bb := &AndroidForWorkEnrollmentProfileRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementAndroidForWorkEnrollmentProfilesCollectionRequest is request for AndroidForWorkEnrollmentProfile collection
type DeviceManagementAndroidForWorkEnrollmentProfilesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for AndroidForWorkEnrollmentProfile collection
func (r *DeviceManagementAndroidForWorkEnrollmentProfilesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AndroidForWorkEnrollmentProfile, 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 []AndroidForWorkEnrollmentProfile
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 []AndroidForWorkEnrollmentProfile
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for AndroidForWorkEnrollmentProfile collection, max N pages
func (r *DeviceManagementAndroidForWorkEnrollmentProfilesCollectionRequest) GetN(ctx context.Context, n int) ([]AndroidForWorkEnrollmentProfile, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for AndroidForWorkEnrollmentProfile collection
func (r *DeviceManagementAndroidForWorkEnrollmentProfilesCollectionRequest) Get(ctx context.Context) ([]AndroidForWorkEnrollmentProfile, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for AndroidForWorkEnrollmentProfile collection
func (r *DeviceManagementAndroidForWorkEnrollmentProfilesCollectionRequest) Add(ctx context.Context, reqObj *AndroidForWorkEnrollmentProfile) (resObj *AndroidForWorkEnrollmentProfile, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// AndroidForWorkSettings is navigation property
func (b *DeviceManagementRequestBuilder) AndroidForWorkSettings() *AndroidForWorkSettingsRequestBuilder {
bb := &AndroidForWorkSettingsRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/androidForWorkSettings"
return bb
}
// AndroidManagedStoreAccountEnterpriseSettings is navigation property
func (b *DeviceManagementRequestBuilder) AndroidManagedStoreAccountEnterpriseSettings() *AndroidManagedStoreAccountEnterpriseSettingsRequestBuilder {
bb := &AndroidManagedStoreAccountEnterpriseSettingsRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/androidManagedStoreAccountEnterpriseSettings"
return bb
}
// AndroidManagedStoreAppConfigurationSchemas returns request builder for AndroidManagedStoreAppConfigurationSchema collection
func (b *DeviceManagementRequestBuilder) AndroidManagedStoreAppConfigurationSchemas() *DeviceManagementAndroidManagedStoreAppConfigurationSchemasCollectionRequestBuilder {
bb := &DeviceManagementAndroidManagedStoreAppConfigurationSchemasCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/androidManagedStoreAppConfigurationSchemas"
return bb
}
// DeviceManagementAndroidManagedStoreAppConfigurationSchemasCollectionRequestBuilder is request builder for AndroidManagedStoreAppConfigurationSchema collection
type DeviceManagementAndroidManagedStoreAppConfigurationSchemasCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for AndroidManagedStoreAppConfigurationSchema collection
func (b *DeviceManagementAndroidManagedStoreAppConfigurationSchemasCollectionRequestBuilder) Request() *DeviceManagementAndroidManagedStoreAppConfigurationSchemasCollectionRequest {
return &DeviceManagementAndroidManagedStoreAppConfigurationSchemasCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for AndroidManagedStoreAppConfigurationSchema item
func (b *DeviceManagementAndroidManagedStoreAppConfigurationSchemasCollectionRequestBuilder) ID(id string) *AndroidManagedStoreAppConfigurationSchemaRequestBuilder {
bb := &AndroidManagedStoreAppConfigurationSchemaRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementAndroidManagedStoreAppConfigurationSchemasCollectionRequest is request for AndroidManagedStoreAppConfigurationSchema collection
type DeviceManagementAndroidManagedStoreAppConfigurationSchemasCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for AndroidManagedStoreAppConfigurationSchema collection
func (r *DeviceManagementAndroidManagedStoreAppConfigurationSchemasCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AndroidManagedStoreAppConfigurationSchema, 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 []AndroidManagedStoreAppConfigurationSchema
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 []AndroidManagedStoreAppConfigurationSchema
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for AndroidManagedStoreAppConfigurationSchema collection, max N pages
func (r *DeviceManagementAndroidManagedStoreAppConfigurationSchemasCollectionRequest) GetN(ctx context.Context, n int) ([]AndroidManagedStoreAppConfigurationSchema, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for AndroidManagedStoreAppConfigurationSchema collection
func (r *DeviceManagementAndroidManagedStoreAppConfigurationSchemasCollectionRequest) Get(ctx context.Context) ([]AndroidManagedStoreAppConfigurationSchema, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for AndroidManagedStoreAppConfigurationSchema collection
func (r *DeviceManagementAndroidManagedStoreAppConfigurationSchemasCollectionRequest) Add(ctx context.Context, reqObj *AndroidManagedStoreAppConfigurationSchema) (resObj *AndroidManagedStoreAppConfigurationSchema, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ApplePushNotificationCertificate is navigation property
func (b *DeviceManagementRequestBuilder) ApplePushNotificationCertificate() *ApplePushNotificationCertificateRequestBuilder {
bb := &ApplePushNotificationCertificateRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/applePushNotificationCertificate"
return bb
}
// AppleUserInitiatedEnrollmentProfiles returns request builder for AppleUserInitiatedEnrollmentProfile collection
func (b *DeviceManagementRequestBuilder) AppleUserInitiatedEnrollmentProfiles() *DeviceManagementAppleUserInitiatedEnrollmentProfilesCollectionRequestBuilder {
bb := &DeviceManagementAppleUserInitiatedEnrollmentProfilesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/appleUserInitiatedEnrollmentProfiles"
return bb
}
// DeviceManagementAppleUserInitiatedEnrollmentProfilesCollectionRequestBuilder is request builder for AppleUserInitiatedEnrollmentProfile collection
type DeviceManagementAppleUserInitiatedEnrollmentProfilesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for AppleUserInitiatedEnrollmentProfile collection
func (b *DeviceManagementAppleUserInitiatedEnrollmentProfilesCollectionRequestBuilder) Request() *DeviceManagementAppleUserInitiatedEnrollmentProfilesCollectionRequest {
return &DeviceManagementAppleUserInitiatedEnrollmentProfilesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for AppleUserInitiatedEnrollmentProfile item
func (b *DeviceManagementAppleUserInitiatedEnrollmentProfilesCollectionRequestBuilder) ID(id string) *AppleUserInitiatedEnrollmentProfileRequestBuilder {
bb := &AppleUserInitiatedEnrollmentProfileRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementAppleUserInitiatedEnrollmentProfilesCollectionRequest is request for AppleUserInitiatedEnrollmentProfile collection
type DeviceManagementAppleUserInitiatedEnrollmentProfilesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for AppleUserInitiatedEnrollmentProfile collection
func (r *DeviceManagementAppleUserInitiatedEnrollmentProfilesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AppleUserInitiatedEnrollmentProfile, 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 []AppleUserInitiatedEnrollmentProfile
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 []AppleUserInitiatedEnrollmentProfile
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for AppleUserInitiatedEnrollmentProfile collection, max N pages
func (r *DeviceManagementAppleUserInitiatedEnrollmentProfilesCollectionRequest) GetN(ctx context.Context, n int) ([]AppleUserInitiatedEnrollmentProfile, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for AppleUserInitiatedEnrollmentProfile collection
func (r *DeviceManagementAppleUserInitiatedEnrollmentProfilesCollectionRequest) Get(ctx context.Context) ([]AppleUserInitiatedEnrollmentProfile, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for AppleUserInitiatedEnrollmentProfile collection
func (r *DeviceManagementAppleUserInitiatedEnrollmentProfilesCollectionRequest) Add(ctx context.Context, reqObj *AppleUserInitiatedEnrollmentProfile) (resObj *AppleUserInitiatedEnrollmentProfile, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// AuditEvents returns request builder for AuditEvent collection
func (b *DeviceManagementRequestBuilder) AuditEvents() *DeviceManagementAuditEventsCollectionRequestBuilder {
bb := &DeviceManagementAuditEventsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/auditEvents"
return bb
}
// DeviceManagementAuditEventsCollectionRequestBuilder is request builder for AuditEvent collection
type DeviceManagementAuditEventsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for AuditEvent collection
func (b *DeviceManagementAuditEventsCollectionRequestBuilder) Request() *DeviceManagementAuditEventsCollectionRequest {
return &DeviceManagementAuditEventsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for AuditEvent item
func (b *DeviceManagementAuditEventsCollectionRequestBuilder) ID(id string) *AuditEventRequestBuilder {
bb := &AuditEventRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementAuditEventsCollectionRequest is request for AuditEvent collection
type DeviceManagementAuditEventsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for AuditEvent collection
func (r *DeviceManagementAuditEventsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AuditEvent, 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 []AuditEvent
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 []AuditEvent
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for AuditEvent collection, max N pages
func (r *DeviceManagementAuditEventsCollectionRequest) GetN(ctx context.Context, n int) ([]AuditEvent, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for AuditEvent collection
func (r *DeviceManagementAuditEventsCollectionRequest) Get(ctx context.Context) ([]AuditEvent, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for AuditEvent collection
func (r *DeviceManagementAuditEventsCollectionRequest) Add(ctx context.Context, reqObj *AuditEvent) (resObj *AuditEvent, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// AutopilotEvents returns request builder for DeviceManagementAutopilotEvent collection
func (b *DeviceManagementRequestBuilder) AutopilotEvents() *DeviceManagementAutopilotEventsCollectionRequestBuilder {
bb := &DeviceManagementAutopilotEventsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/autopilotEvents"
return bb
}
// DeviceManagementAutopilotEventsCollectionRequestBuilder is request builder for DeviceManagementAutopilotEvent collection
type DeviceManagementAutopilotEventsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementAutopilotEvent collection
func (b *DeviceManagementAutopilotEventsCollectionRequestBuilder) Request() *DeviceManagementAutopilotEventsCollectionRequest {
return &DeviceManagementAutopilotEventsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementAutopilotEvent item
func (b *DeviceManagementAutopilotEventsCollectionRequestBuilder) ID(id string) *DeviceManagementAutopilotEventRequestBuilder {
bb := &DeviceManagementAutopilotEventRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementAutopilotEventsCollectionRequest is request for DeviceManagementAutopilotEvent collection
type DeviceManagementAutopilotEventsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementAutopilotEvent collection
func (r *DeviceManagementAutopilotEventsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementAutopilotEvent, 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 []DeviceManagementAutopilotEvent
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 []DeviceManagementAutopilotEvent
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementAutopilotEvent collection, max N pages
func (r *DeviceManagementAutopilotEventsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementAutopilotEvent, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementAutopilotEvent collection
func (r *DeviceManagementAutopilotEventsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementAutopilotEvent, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementAutopilotEvent collection
func (r *DeviceManagementAutopilotEventsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementAutopilotEvent) (resObj *DeviceManagementAutopilotEvent, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// CartToClassAssociations returns request builder for CartToClassAssociation collection
func (b *DeviceManagementRequestBuilder) CartToClassAssociations() *DeviceManagementCartToClassAssociationsCollectionRequestBuilder {
bb := &DeviceManagementCartToClassAssociationsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/cartToClassAssociations"
return bb
}
// DeviceManagementCartToClassAssociationsCollectionRequestBuilder is request builder for CartToClassAssociation collection
type DeviceManagementCartToClassAssociationsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for CartToClassAssociation collection
func (b *DeviceManagementCartToClassAssociationsCollectionRequestBuilder) Request() *DeviceManagementCartToClassAssociationsCollectionRequest {
return &DeviceManagementCartToClassAssociationsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for CartToClassAssociation item
func (b *DeviceManagementCartToClassAssociationsCollectionRequestBuilder) ID(id string) *CartToClassAssociationRequestBuilder {
bb := &CartToClassAssociationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementCartToClassAssociationsCollectionRequest is request for CartToClassAssociation collection
type DeviceManagementCartToClassAssociationsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for CartToClassAssociation collection
func (r *DeviceManagementCartToClassAssociationsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]CartToClassAssociation, 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 []CartToClassAssociation
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 []CartToClassAssociation
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for CartToClassAssociation collection, max N pages
func (r *DeviceManagementCartToClassAssociationsCollectionRequest) GetN(ctx context.Context, n int) ([]CartToClassAssociation, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for CartToClassAssociation collection
func (r *DeviceManagementCartToClassAssociationsCollectionRequest) Get(ctx context.Context) ([]CartToClassAssociation, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for CartToClassAssociation collection
func (r *DeviceManagementCartToClassAssociationsCollectionRequest) Add(ctx context.Context, reqObj *CartToClassAssociation) (resObj *CartToClassAssociation, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Categories returns request builder for DeviceManagementSettingCategory collection
func (b *DeviceManagementRequestBuilder) Categories() *DeviceManagementCategoriesCollectionRequestBuilder {
bb := &DeviceManagementCategoriesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/categories"
return bb
}
// DeviceManagementCategoriesCollectionRequestBuilder is request builder for DeviceManagementSettingCategory collection
type DeviceManagementCategoriesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementSettingCategory collection
func (b *DeviceManagementCategoriesCollectionRequestBuilder) Request() *DeviceManagementCategoriesCollectionRequest {
return &DeviceManagementCategoriesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementSettingCategory item
func (b *DeviceManagementCategoriesCollectionRequestBuilder) ID(id string) *DeviceManagementSettingCategoryRequestBuilder {
bb := &DeviceManagementSettingCategoryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementCategoriesCollectionRequest is request for DeviceManagementSettingCategory collection
type DeviceManagementCategoriesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementSettingCategory collection
func (r *DeviceManagementCategoriesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementSettingCategory, 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 []DeviceManagementSettingCategory
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 []DeviceManagementSettingCategory
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementSettingCategory collection, max N pages
func (r *DeviceManagementCategoriesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementSettingCategory, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementSettingCategory collection
func (r *DeviceManagementCategoriesCollectionRequest) Get(ctx context.Context) ([]DeviceManagementSettingCategory, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementSettingCategory collection
func (r *DeviceManagementCategoriesCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementSettingCategory) (resObj *DeviceManagementSettingCategory, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ComplianceManagementPartners returns request builder for ComplianceManagementPartner collection
func (b *DeviceManagementRequestBuilder) ComplianceManagementPartners() *DeviceManagementComplianceManagementPartnersCollectionRequestBuilder {
bb := &DeviceManagementComplianceManagementPartnersCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/complianceManagementPartners"
return bb
}
// DeviceManagementComplianceManagementPartnersCollectionRequestBuilder is request builder for ComplianceManagementPartner collection
type DeviceManagementComplianceManagementPartnersCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for ComplianceManagementPartner collection
func (b *DeviceManagementComplianceManagementPartnersCollectionRequestBuilder) Request() *DeviceManagementComplianceManagementPartnersCollectionRequest {
return &DeviceManagementComplianceManagementPartnersCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for ComplianceManagementPartner item
func (b *DeviceManagementComplianceManagementPartnersCollectionRequestBuilder) ID(id string) *ComplianceManagementPartnerRequestBuilder {
bb := &ComplianceManagementPartnerRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementComplianceManagementPartnersCollectionRequest is request for ComplianceManagementPartner collection
type DeviceManagementComplianceManagementPartnersCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for ComplianceManagementPartner collection
func (r *DeviceManagementComplianceManagementPartnersCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]ComplianceManagementPartner, 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 []ComplianceManagementPartner
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 []ComplianceManagementPartner
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for ComplianceManagementPartner collection, max N pages
func (r *DeviceManagementComplianceManagementPartnersCollectionRequest) GetN(ctx context.Context, n int) ([]ComplianceManagementPartner, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for ComplianceManagementPartner collection
func (r *DeviceManagementComplianceManagementPartnersCollectionRequest) Get(ctx context.Context) ([]ComplianceManagementPartner, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for ComplianceManagementPartner collection
func (r *DeviceManagementComplianceManagementPartnersCollectionRequest) Add(ctx context.Context, reqObj *ComplianceManagementPartner) (resObj *ComplianceManagementPartner, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ConditionalAccessSettings is navigation property
func (b *DeviceManagementRequestBuilder) ConditionalAccessSettings() *OnPremisesConditionalAccessSettingsRequestBuilder {
bb := &OnPremisesConditionalAccessSettingsRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/conditionalAccessSettings"
return bb
}
// DataSharingConsents returns request builder for DataSharingConsent collection
func (b *DeviceManagementRequestBuilder) DataSharingConsents() *DeviceManagementDataSharingConsentsCollectionRequestBuilder {
bb := &DeviceManagementDataSharingConsentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/dataSharingConsents"
return bb
}
// DeviceManagementDataSharingConsentsCollectionRequestBuilder is request builder for DataSharingConsent collection
type DeviceManagementDataSharingConsentsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DataSharingConsent collection
func (b *DeviceManagementDataSharingConsentsCollectionRequestBuilder) Request() *DeviceManagementDataSharingConsentsCollectionRequest {
return &DeviceManagementDataSharingConsentsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DataSharingConsent item
func (b *DeviceManagementDataSharingConsentsCollectionRequestBuilder) ID(id string) *DataSharingConsentRequestBuilder {
bb := &DataSharingConsentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementDataSharingConsentsCollectionRequest is request for DataSharingConsent collection
type DeviceManagementDataSharingConsentsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DataSharingConsent collection
func (r *DeviceManagementDataSharingConsentsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DataSharingConsent, 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 []DataSharingConsent
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 []DataSharingConsent
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DataSharingConsent collection, max N pages
func (r *DeviceManagementDataSharingConsentsCollectionRequest) GetN(ctx context.Context, n int) ([]DataSharingConsent, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DataSharingConsent collection
func (r *DeviceManagementDataSharingConsentsCollectionRequest) Get(ctx context.Context) ([]DataSharingConsent, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DataSharingConsent collection
func (r *DeviceManagementDataSharingConsentsCollectionRequest) Add(ctx context.Context, reqObj *DataSharingConsent) (resObj *DataSharingConsent, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DepOnboardingSettings returns request builder for DepOnboardingSetting collection
func (b *DeviceManagementRequestBuilder) DepOnboardingSettings() *DeviceManagementDepOnboardingSettingsCollectionRequestBuilder {
bb := &DeviceManagementDepOnboardingSettingsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/depOnboardingSettings"
return bb
}
// DeviceManagementDepOnboardingSettingsCollectionRequestBuilder is request builder for DepOnboardingSetting collection
type DeviceManagementDepOnboardingSettingsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DepOnboardingSetting collection
func (b *DeviceManagementDepOnboardingSettingsCollectionRequestBuilder) Request() *DeviceManagementDepOnboardingSettingsCollectionRequest {
return &DeviceManagementDepOnboardingSettingsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DepOnboardingSetting item
func (b *DeviceManagementDepOnboardingSettingsCollectionRequestBuilder) ID(id string) *DepOnboardingSettingRequestBuilder {
bb := &DepOnboardingSettingRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementDepOnboardingSettingsCollectionRequest is request for DepOnboardingSetting collection
type DeviceManagementDepOnboardingSettingsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DepOnboardingSetting collection
func (r *DeviceManagementDepOnboardingSettingsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DepOnboardingSetting, 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 []DepOnboardingSetting
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 []DepOnboardingSetting
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DepOnboardingSetting collection, max N pages
func (r *DeviceManagementDepOnboardingSettingsCollectionRequest) GetN(ctx context.Context, n int) ([]DepOnboardingSetting, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DepOnboardingSetting collection
func (r *DeviceManagementDepOnboardingSettingsCollectionRequest) Get(ctx context.Context) ([]DepOnboardingSetting, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DepOnboardingSetting collection
func (r *DeviceManagementDepOnboardingSettingsCollectionRequest) Add(ctx context.Context, reqObj *DepOnboardingSetting) (resObj *DepOnboardingSetting, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DerivedCredentials returns request builder for DeviceManagementDerivedCredentialSettings collection
func (b *DeviceManagementRequestBuilder) DerivedCredentials() *DeviceManagementDerivedCredentialsCollectionRequestBuilder {
bb := &DeviceManagementDerivedCredentialsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/derivedCredentials"
return bb
}
// DeviceManagementDerivedCredentialsCollectionRequestBuilder is request builder for DeviceManagementDerivedCredentialSettings collection
type DeviceManagementDerivedCredentialsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementDerivedCredentialSettings collection
func (b *DeviceManagementDerivedCredentialsCollectionRequestBuilder) Request() *DeviceManagementDerivedCredentialsCollectionRequest {
return &DeviceManagementDerivedCredentialsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementDerivedCredentialSettings item
func (b *DeviceManagementDerivedCredentialsCollectionRequestBuilder) ID(id string) *DeviceManagementDerivedCredentialSettingsRequestBuilder {
bb := &DeviceManagementDerivedCredentialSettingsRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementDerivedCredentialsCollectionRequest is request for DeviceManagementDerivedCredentialSettings collection
type DeviceManagementDerivedCredentialsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementDerivedCredentialSettings collection
func (r *DeviceManagementDerivedCredentialsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementDerivedCredentialSettings, 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 []DeviceManagementDerivedCredentialSettings
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 []DeviceManagementDerivedCredentialSettings
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementDerivedCredentialSettings collection, max N pages
func (r *DeviceManagementDerivedCredentialsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementDerivedCredentialSettings, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementDerivedCredentialSettings collection
func (r *DeviceManagementDerivedCredentialsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementDerivedCredentialSettings, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementDerivedCredentialSettings collection
func (r *DeviceManagementDerivedCredentialsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementDerivedCredentialSettings) (resObj *DeviceManagementDerivedCredentialSettings, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DetectedApps returns request builder for DetectedApp collection
func (b *DeviceManagementRequestBuilder) DetectedApps() *DeviceManagementDetectedAppsCollectionRequestBuilder {
bb := &DeviceManagementDetectedAppsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/detectedApps"
return bb
}
// DeviceManagementDetectedAppsCollectionRequestBuilder is request builder for DetectedApp collection
type DeviceManagementDetectedAppsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DetectedApp collection
func (b *DeviceManagementDetectedAppsCollectionRequestBuilder) Request() *DeviceManagementDetectedAppsCollectionRequest {
return &DeviceManagementDetectedAppsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DetectedApp item
func (b *DeviceManagementDetectedAppsCollectionRequestBuilder) ID(id string) *DetectedAppRequestBuilder {
bb := &DetectedAppRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementDetectedAppsCollectionRequest is request for DetectedApp collection
type DeviceManagementDetectedAppsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DetectedApp collection
func (r *DeviceManagementDetectedAppsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DetectedApp, 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 []DetectedApp
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 []DetectedApp
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DetectedApp collection, max N pages
func (r *DeviceManagementDetectedAppsCollectionRequest) GetN(ctx context.Context, n int) ([]DetectedApp, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DetectedApp collection
func (r *DeviceManagementDetectedAppsCollectionRequest) Get(ctx context.Context) ([]DetectedApp, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DetectedApp collection
func (r *DeviceManagementDetectedAppsCollectionRequest) Add(ctx context.Context, reqObj *DetectedApp) (resObj *DetectedApp, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DeviceCategories returns request builder for DeviceCategory collection
func (b *DeviceManagementRequestBuilder) DeviceCategories() *DeviceManagementDeviceCategoriesCollectionRequestBuilder {
bb := &DeviceManagementDeviceCategoriesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceCategories"
return bb
}
// DeviceManagementDeviceCategoriesCollectionRequestBuilder is request builder for DeviceCategory collection
type DeviceManagementDeviceCategoriesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceCategory collection
func (b *DeviceManagementDeviceCategoriesCollectionRequestBuilder) Request() *DeviceManagementDeviceCategoriesCollectionRequest {
return &DeviceManagementDeviceCategoriesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceCategory item
func (b *DeviceManagementDeviceCategoriesCollectionRequestBuilder) ID(id string) *DeviceCategoryRequestBuilder {
bb := &DeviceCategoryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementDeviceCategoriesCollectionRequest is request for DeviceCategory collection
type DeviceManagementDeviceCategoriesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceCategory collection
func (r *DeviceManagementDeviceCategoriesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceCategory, 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 []DeviceCategory
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 []DeviceCategory
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceCategory collection, max N pages
func (r *DeviceManagementDeviceCategoriesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceCategory, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceCategory collection
func (r *DeviceManagementDeviceCategoriesCollectionRequest) Get(ctx context.Context) ([]DeviceCategory, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceCategory collection
func (r *DeviceManagementDeviceCategoriesCollectionRequest) Add(ctx context.Context, reqObj *DeviceCategory) (resObj *DeviceCategory, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DeviceCompliancePolicies returns request builder for DeviceCompliancePolicy collection
func (b *DeviceManagementRequestBuilder) DeviceCompliancePolicies() *DeviceManagementDeviceCompliancePoliciesCollectionRequestBuilder {
bb := &DeviceManagementDeviceCompliancePoliciesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceCompliancePolicies"
return bb
}
// DeviceManagementDeviceCompliancePoliciesCollectionRequestBuilder is request builder for DeviceCompliancePolicy collection
type DeviceManagementDeviceCompliancePoliciesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceCompliancePolicy collection
func (b *DeviceManagementDeviceCompliancePoliciesCollectionRequestBuilder) Request() *DeviceManagementDeviceCompliancePoliciesCollectionRequest {
return &DeviceManagementDeviceCompliancePoliciesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceCompliancePolicy item
func (b *DeviceManagementDeviceCompliancePoliciesCollectionRequestBuilder) ID(id string) *DeviceCompliancePolicyRequestBuilder {
bb := &DeviceCompliancePolicyRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementDeviceCompliancePoliciesCollectionRequest is request for DeviceCompliancePolicy collection
type DeviceManagementDeviceCompliancePoliciesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceCompliancePolicy collection
func (r *DeviceManagementDeviceCompliancePoliciesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceCompliancePolicy, 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 []DeviceCompliancePolicy
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 []DeviceCompliancePolicy
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceCompliancePolicy collection, max N pages
func (r *DeviceManagementDeviceCompliancePoliciesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceCompliancePolicy, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceCompliancePolicy collection
func (r *DeviceManagementDeviceCompliancePoliciesCollectionRequest) Get(ctx context.Context) ([]DeviceCompliancePolicy, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceCompliancePolicy collection
func (r *DeviceManagementDeviceCompliancePoliciesCollectionRequest) Add(ctx context.Context, reqObj *DeviceCompliancePolicy) (resObj *DeviceCompliancePolicy, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DeviceCompliancePolicyDeviceStateSummary is navigation property
func (b *DeviceManagementRequestBuilder) DeviceCompliancePolicyDeviceStateSummary() *DeviceCompliancePolicyDeviceStateSummaryRequestBuilder {
bb := &DeviceCompliancePolicyDeviceStateSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceCompliancePolicyDeviceStateSummary"
return bb
}
// DeviceCompliancePolicySettingStateSummaries returns request builder for DeviceCompliancePolicySettingStateSummary collection
func (b *DeviceManagementRequestBuilder) DeviceCompliancePolicySettingStateSummaries() *DeviceManagementDeviceCompliancePolicySettingStateSummariesCollectionRequestBuilder {
bb := &DeviceManagementDeviceCompliancePolicySettingStateSummariesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceCompliancePolicySettingStateSummaries"
return bb
}
// DeviceManagementDeviceCompliancePolicySettingStateSummariesCollectionRequestBuilder is request builder for DeviceCompliancePolicySettingStateSummary collection
type DeviceManagementDeviceCompliancePolicySettingStateSummariesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceCompliancePolicySettingStateSummary collection
func (b *DeviceManagementDeviceCompliancePolicySettingStateSummariesCollectionRequestBuilder) Request() *DeviceManagementDeviceCompliancePolicySettingStateSummariesCollectionRequest {
return &DeviceManagementDeviceCompliancePolicySettingStateSummariesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceCompliancePolicySettingStateSummary item
func (b *DeviceManagementDeviceCompliancePolicySettingStateSummariesCollectionRequestBuilder) ID(id string) *DeviceCompliancePolicySettingStateSummaryRequestBuilder {
bb := &DeviceCompliancePolicySettingStateSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementDeviceCompliancePolicySettingStateSummariesCollectionRequest is request for DeviceCompliancePolicySettingStateSummary collection
type DeviceManagementDeviceCompliancePolicySettingStateSummariesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceCompliancePolicySettingStateSummary collection
func (r *DeviceManagementDeviceCompliancePolicySettingStateSummariesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceCompliancePolicySettingStateSummary, 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 []DeviceCompliancePolicySettingStateSummary
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 []DeviceCompliancePolicySettingStateSummary
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceCompliancePolicySettingStateSummary collection, max N pages
func (r *DeviceManagementDeviceCompliancePolicySettingStateSummariesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceCompliancePolicySettingStateSummary, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceCompliancePolicySettingStateSummary collection
func (r *DeviceManagementDeviceCompliancePolicySettingStateSummariesCollectionRequest) Get(ctx context.Context) ([]DeviceCompliancePolicySettingStateSummary, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceCompliancePolicySettingStateSummary collection
func (r *DeviceManagementDeviceCompliancePolicySettingStateSummariesCollectionRequest) Add(ctx context.Context, reqObj *DeviceCompliancePolicySettingStateSummary) (resObj *DeviceCompliancePolicySettingStateSummary, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DeviceConfigurationConflictSummary returns request builder for DeviceConfigurationConflictSummary collection
func (b *DeviceManagementRequestBuilder) DeviceConfigurationConflictSummary() *DeviceManagementDeviceConfigurationConflictSummaryCollectionRequestBuilder {
bb := &DeviceManagementDeviceConfigurationConflictSummaryCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceConfigurationConflictSummary"
return bb
}
// DeviceManagementDeviceConfigurationConflictSummaryCollectionRequestBuilder is request builder for DeviceConfigurationConflictSummary collection
type DeviceManagementDeviceConfigurationConflictSummaryCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceConfigurationConflictSummary collection
func (b *DeviceManagementDeviceConfigurationConflictSummaryCollectionRequestBuilder) Request() *DeviceManagementDeviceConfigurationConflictSummaryCollectionRequest {
return &DeviceManagementDeviceConfigurationConflictSummaryCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceConfigurationConflictSummary item
func (b *DeviceManagementDeviceConfigurationConflictSummaryCollectionRequestBuilder) ID(id string) *DeviceConfigurationConflictSummaryRequestBuilder {
bb := &DeviceConfigurationConflictSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementDeviceConfigurationConflictSummaryCollectionRequest is request for DeviceConfigurationConflictSummary collection
type DeviceManagementDeviceConfigurationConflictSummaryCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceConfigurationConflictSummary collection
func (r *DeviceManagementDeviceConfigurationConflictSummaryCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceConfigurationConflictSummary, 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 []DeviceConfigurationConflictSummary
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 []DeviceConfigurationConflictSummary
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceConfigurationConflictSummary collection, max N pages
func (r *DeviceManagementDeviceConfigurationConflictSummaryCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceConfigurationConflictSummary, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceConfigurationConflictSummary collection
func (r *DeviceManagementDeviceConfigurationConflictSummaryCollectionRequest) Get(ctx context.Context) ([]DeviceConfigurationConflictSummary, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceConfigurationConflictSummary collection
func (r *DeviceManagementDeviceConfigurationConflictSummaryCollectionRequest) Add(ctx context.Context, reqObj *DeviceConfigurationConflictSummary) (resObj *DeviceConfigurationConflictSummary, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DeviceConfigurationDeviceStateSummaries is navigation property
func (b *DeviceManagementRequestBuilder) DeviceConfigurationDeviceStateSummaries() *DeviceConfigurationDeviceStateSummaryRequestBuilder {
bb := &DeviceConfigurationDeviceStateSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceConfigurationDeviceStateSummaries"
return bb
}
// DeviceConfigurationRestrictedAppsViolations returns request builder for RestrictedAppsViolation collection
func (b *DeviceManagementRequestBuilder) DeviceConfigurationRestrictedAppsViolations() *DeviceManagementDeviceConfigurationRestrictedAppsViolationsCollectionRequestBuilder {
bb := &DeviceManagementDeviceConfigurationRestrictedAppsViolationsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceConfigurationRestrictedAppsViolations"
return bb
}
// DeviceManagementDeviceConfigurationRestrictedAppsViolationsCollectionRequestBuilder is request builder for RestrictedAppsViolation collection
type DeviceManagementDeviceConfigurationRestrictedAppsViolationsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for RestrictedAppsViolation collection
func (b *DeviceManagementDeviceConfigurationRestrictedAppsViolationsCollectionRequestBuilder) Request() *DeviceManagementDeviceConfigurationRestrictedAppsViolationsCollectionRequest {
return &DeviceManagementDeviceConfigurationRestrictedAppsViolationsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for RestrictedAppsViolation item
func (b *DeviceManagementDeviceConfigurationRestrictedAppsViolationsCollectionRequestBuilder) ID(id string) *RestrictedAppsViolationRequestBuilder {
bb := &RestrictedAppsViolationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementDeviceConfigurationRestrictedAppsViolationsCollectionRequest is request for RestrictedAppsViolation collection
type DeviceManagementDeviceConfigurationRestrictedAppsViolationsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for RestrictedAppsViolation collection
func (r *DeviceManagementDeviceConfigurationRestrictedAppsViolationsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]RestrictedAppsViolation, 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 []RestrictedAppsViolation
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 []RestrictedAppsViolation
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for RestrictedAppsViolation collection, max N pages
func (r *DeviceManagementDeviceConfigurationRestrictedAppsViolationsCollectionRequest) GetN(ctx context.Context, n int) ([]RestrictedAppsViolation, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for RestrictedAppsViolation collection
func (r *DeviceManagementDeviceConfigurationRestrictedAppsViolationsCollectionRequest) Get(ctx context.Context) ([]RestrictedAppsViolation, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for RestrictedAppsViolation collection
func (r *DeviceManagementDeviceConfigurationRestrictedAppsViolationsCollectionRequest) Add(ctx context.Context, reqObj *RestrictedAppsViolation) (resObj *RestrictedAppsViolation, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DeviceConfigurationUserStateSummaries is navigation property
func (b *DeviceManagementRequestBuilder) DeviceConfigurationUserStateSummaries() *DeviceConfigurationUserStateSummaryRequestBuilder {
bb := &DeviceConfigurationUserStateSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceConfigurationUserStateSummaries"
return bb
}
// DeviceConfigurations returns request builder for DeviceConfiguration collection
func (b *DeviceManagementRequestBuilder) DeviceConfigurations() *DeviceManagementDeviceConfigurationsCollectionRequestBuilder {
bb := &DeviceManagementDeviceConfigurationsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceConfigurations"
return bb
}
// DeviceManagementDeviceConfigurationsCollectionRequestBuilder is request builder for DeviceConfiguration collection
type DeviceManagementDeviceConfigurationsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceConfiguration collection
func (b *DeviceManagementDeviceConfigurationsCollectionRequestBuilder) Request() *DeviceManagementDeviceConfigurationsCollectionRequest {
return &DeviceManagementDeviceConfigurationsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceConfiguration item
func (b *DeviceManagementDeviceConfigurationsCollectionRequestBuilder) ID(id string) *DeviceConfigurationRequestBuilder {
bb := &DeviceConfigurationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementDeviceConfigurationsCollectionRequest is request for DeviceConfiguration collection
type DeviceManagementDeviceConfigurationsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceConfiguration collection
func (r *DeviceManagementDeviceConfigurationsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceConfiguration, 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 []DeviceConfiguration
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 []DeviceConfiguration
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceConfiguration collection, max N pages
func (r *DeviceManagementDeviceConfigurationsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceConfiguration, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceConfiguration collection
func (r *DeviceManagementDeviceConfigurationsCollectionRequest) Get(ctx context.Context) ([]DeviceConfiguration, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceConfiguration collection
func (r *DeviceManagementDeviceConfigurationsCollectionRequest) Add(ctx context.Context, reqObj *DeviceConfiguration) (resObj *DeviceConfiguration, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DeviceConfigurationsAllManagedDeviceCertificateStates returns request builder for ManagedAllDeviceCertificateState collection
func (b *DeviceManagementRequestBuilder) DeviceConfigurationsAllManagedDeviceCertificateStates() *DeviceManagementDeviceConfigurationsAllManagedDeviceCertificateStatesCollectionRequestBuilder {
bb := &DeviceManagementDeviceConfigurationsAllManagedDeviceCertificateStatesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceConfigurationsAllManagedDeviceCertificateStates"
return bb
}
// DeviceManagementDeviceConfigurationsAllManagedDeviceCertificateStatesCollectionRequestBuilder is request builder for ManagedAllDeviceCertificateState collection
type DeviceManagementDeviceConfigurationsAllManagedDeviceCertificateStatesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for ManagedAllDeviceCertificateState collection
func (b *DeviceManagementDeviceConfigurationsAllManagedDeviceCertificateStatesCollectionRequestBuilder) Request() *DeviceManagementDeviceConfigurationsAllManagedDeviceCertificateStatesCollectionRequest {
return &DeviceManagementDeviceConfigurationsAllManagedDeviceCertificateStatesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for ManagedAllDeviceCertificateState item
func (b *DeviceManagementDeviceConfigurationsAllManagedDeviceCertificateStatesCollectionRequestBuilder) ID(id string) *ManagedAllDeviceCertificateStateRequestBuilder {
bb := &ManagedAllDeviceCertificateStateRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementDeviceConfigurationsAllManagedDeviceCertificateStatesCollectionRequest is request for ManagedAllDeviceCertificateState collection
type DeviceManagementDeviceConfigurationsAllManagedDeviceCertificateStatesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for ManagedAllDeviceCertificateState collection
func (r *DeviceManagementDeviceConfigurationsAllManagedDeviceCertificateStatesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]ManagedAllDeviceCertificateState, 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 []ManagedAllDeviceCertificateState
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 []ManagedAllDeviceCertificateState
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for ManagedAllDeviceCertificateState collection, max N pages
func (r *DeviceManagementDeviceConfigurationsAllManagedDeviceCertificateStatesCollectionRequest) GetN(ctx context.Context, n int) ([]ManagedAllDeviceCertificateState, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for ManagedAllDeviceCertificateState collection
func (r *DeviceManagementDeviceConfigurationsAllManagedDeviceCertificateStatesCollectionRequest) Get(ctx context.Context) ([]ManagedAllDeviceCertificateState, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for ManagedAllDeviceCertificateState collection
func (r *DeviceManagementDeviceConfigurationsAllManagedDeviceCertificateStatesCollectionRequest) Add(ctx context.Context, reqObj *ManagedAllDeviceCertificateState) (resObj *ManagedAllDeviceCertificateState, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DeviceEnrollmentConfigurations returns request builder for DeviceEnrollmentConfiguration collection
func (b *DeviceManagementRequestBuilder) DeviceEnrollmentConfigurations() *DeviceManagementDeviceEnrollmentConfigurationsCollectionRequestBuilder {
bb := &DeviceManagementDeviceEnrollmentConfigurationsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceEnrollmentConfigurations"
return bb
}
// DeviceManagementDeviceEnrollmentConfigurationsCollectionRequestBuilder is request builder for DeviceEnrollmentConfiguration collection
type DeviceManagementDeviceEnrollmentConfigurationsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceEnrollmentConfiguration collection
func (b *DeviceManagementDeviceEnrollmentConfigurationsCollectionRequestBuilder) Request() *DeviceManagementDeviceEnrollmentConfigurationsCollectionRequest {
return &DeviceManagementDeviceEnrollmentConfigurationsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceEnrollmentConfiguration item
func (b *DeviceManagementDeviceEnrollmentConfigurationsCollectionRequestBuilder) ID(id string) *DeviceEnrollmentConfigurationRequestBuilder {
bb := &DeviceEnrollmentConfigurationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementDeviceEnrollmentConfigurationsCollectionRequest is request for DeviceEnrollmentConfiguration collection
type DeviceManagementDeviceEnrollmentConfigurationsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceEnrollmentConfiguration collection
func (r *DeviceManagementDeviceEnrollmentConfigurationsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceEnrollmentConfiguration, 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 []DeviceEnrollmentConfiguration
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 []DeviceEnrollmentConfiguration
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceEnrollmentConfiguration collection, max N pages
func (r *DeviceManagementDeviceEnrollmentConfigurationsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceEnrollmentConfiguration, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceEnrollmentConfiguration collection
func (r *DeviceManagementDeviceEnrollmentConfigurationsCollectionRequest) Get(ctx context.Context) ([]DeviceEnrollmentConfiguration, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceEnrollmentConfiguration collection
func (r *DeviceManagementDeviceEnrollmentConfigurationsCollectionRequest) Add(ctx context.Context, reqObj *DeviceEnrollmentConfiguration) (resObj *DeviceEnrollmentConfiguration, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DeviceHealthScripts returns request builder for DeviceHealthScript collection
func (b *DeviceManagementRequestBuilder) DeviceHealthScripts() *DeviceManagementDeviceHealthScriptsCollectionRequestBuilder {
bb := &DeviceManagementDeviceHealthScriptsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceHealthScripts"
return bb
}
// DeviceManagementDeviceHealthScriptsCollectionRequestBuilder is request builder for DeviceHealthScript collection
type DeviceManagementDeviceHealthScriptsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceHealthScript collection
func (b *DeviceManagementDeviceHealthScriptsCollectionRequestBuilder) Request() *DeviceManagementDeviceHealthScriptsCollectionRequest {
return &DeviceManagementDeviceHealthScriptsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceHealthScript item
func (b *DeviceManagementDeviceHealthScriptsCollectionRequestBuilder) ID(id string) *DeviceHealthScriptRequestBuilder {
bb := &DeviceHealthScriptRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementDeviceHealthScriptsCollectionRequest is request for DeviceHealthScript collection
type DeviceManagementDeviceHealthScriptsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceHealthScript collection
func (r *DeviceManagementDeviceHealthScriptsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceHealthScript, 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 []DeviceHealthScript
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 []DeviceHealthScript
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceHealthScript collection, max N pages
func (r *DeviceManagementDeviceHealthScriptsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceHealthScript, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceHealthScript collection
func (r *DeviceManagementDeviceHealthScriptsCollectionRequest) Get(ctx context.Context) ([]DeviceHealthScript, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceHealthScript collection
func (r *DeviceManagementDeviceHealthScriptsCollectionRequest) Add(ctx context.Context, reqObj *DeviceHealthScript) (resObj *DeviceHealthScript, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DeviceManagementPartners returns request builder for DeviceManagementPartner collection
func (b *DeviceManagementRequestBuilder) DeviceManagementPartners() *DeviceManagementDeviceManagementPartnersCollectionRequestBuilder {
bb := &DeviceManagementDeviceManagementPartnersCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceManagementPartners"
return bb
}
// DeviceManagementDeviceManagementPartnersCollectionRequestBuilder is request builder for DeviceManagementPartner collection
type DeviceManagementDeviceManagementPartnersCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementPartner collection
func (b *DeviceManagementDeviceManagementPartnersCollectionRequestBuilder) Request() *DeviceManagementDeviceManagementPartnersCollectionRequest {
return &DeviceManagementDeviceManagementPartnersCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementPartner item
func (b *DeviceManagementDeviceManagementPartnersCollectionRequestBuilder) ID(id string) *DeviceManagementPartnerRequestBuilder {
bb := &DeviceManagementPartnerRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementDeviceManagementPartnersCollectionRequest is request for DeviceManagementPartner collection
type DeviceManagementDeviceManagementPartnersCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementPartner collection
func (r *DeviceManagementDeviceManagementPartnersCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementPartner, 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 []DeviceManagementPartner
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 []DeviceManagementPartner
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementPartner collection, max N pages
func (r *DeviceManagementDeviceManagementPartnersCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementPartner, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementPartner collection
func (r *DeviceManagementDeviceManagementPartnersCollectionRequest) Get(ctx context.Context) ([]DeviceManagementPartner, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementPartner collection
func (r *DeviceManagementDeviceManagementPartnersCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementPartner) (resObj *DeviceManagementPartner, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DeviceManagementScripts returns request builder for DeviceManagementScript collection
func (b *DeviceManagementRequestBuilder) DeviceManagementScripts() *DeviceManagementDeviceManagementScriptsCollectionRequestBuilder {
bb := &DeviceManagementDeviceManagementScriptsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceManagementScripts"
return bb
}
// DeviceManagementDeviceManagementScriptsCollectionRequestBuilder is request builder for DeviceManagementScript collection
type DeviceManagementDeviceManagementScriptsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementScript collection
func (b *DeviceManagementDeviceManagementScriptsCollectionRequestBuilder) Request() *DeviceManagementDeviceManagementScriptsCollectionRequest {
return &DeviceManagementDeviceManagementScriptsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementScript item
func (b *DeviceManagementDeviceManagementScriptsCollectionRequestBuilder) ID(id string) *DeviceManagementScriptRequestBuilder {
bb := &DeviceManagementScriptRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementDeviceManagementScriptsCollectionRequest is request for DeviceManagementScript collection
type DeviceManagementDeviceManagementScriptsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementScript collection
func (r *DeviceManagementDeviceManagementScriptsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementScript, 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 []DeviceManagementScript
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 []DeviceManagementScript
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementScript collection, max N pages
func (r *DeviceManagementDeviceManagementScriptsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementScript, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementScript collection
func (r *DeviceManagementDeviceManagementScriptsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementScript, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementScript collection
func (r *DeviceManagementDeviceManagementScriptsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementScript) (resObj *DeviceManagementScript, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DomainJoinConnectors returns request builder for DeviceManagementDomainJoinConnector collection
func (b *DeviceManagementRequestBuilder) DomainJoinConnectors() *DeviceManagementDomainJoinConnectorsCollectionRequestBuilder {
bb := &DeviceManagementDomainJoinConnectorsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/domainJoinConnectors"
return bb
}
// DeviceManagementDomainJoinConnectorsCollectionRequestBuilder is request builder for DeviceManagementDomainJoinConnector collection
type DeviceManagementDomainJoinConnectorsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementDomainJoinConnector collection
func (b *DeviceManagementDomainJoinConnectorsCollectionRequestBuilder) Request() *DeviceManagementDomainJoinConnectorsCollectionRequest {
return &DeviceManagementDomainJoinConnectorsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementDomainJoinConnector item
func (b *DeviceManagementDomainJoinConnectorsCollectionRequestBuilder) ID(id string) *DeviceManagementDomainJoinConnectorRequestBuilder {
bb := &DeviceManagementDomainJoinConnectorRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementDomainJoinConnectorsCollectionRequest is request for DeviceManagementDomainJoinConnector collection
type DeviceManagementDomainJoinConnectorsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementDomainJoinConnector collection
func (r *DeviceManagementDomainJoinConnectorsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementDomainJoinConnector, 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 []DeviceManagementDomainJoinConnector
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 []DeviceManagementDomainJoinConnector
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementDomainJoinConnector collection, max N pages
func (r *DeviceManagementDomainJoinConnectorsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementDomainJoinConnector, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementDomainJoinConnector collection
func (r *DeviceManagementDomainJoinConnectorsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementDomainJoinConnector, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementDomainJoinConnector collection
func (r *DeviceManagementDomainJoinConnectorsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementDomainJoinConnector) (resObj *DeviceManagementDomainJoinConnector, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// EmbeddedSIMActivationCodePools returns request builder for EmbeddedSIMActivationCodePool collection
func (b *DeviceManagementRequestBuilder) EmbeddedSIMActivationCodePools() *DeviceManagementEmbeddedSIMActivationCodePoolsCollectionRequestBuilder {
bb := &DeviceManagementEmbeddedSIMActivationCodePoolsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/embeddedSIMActivationCodePools"
return bb
}
// DeviceManagementEmbeddedSIMActivationCodePoolsCollectionRequestBuilder is request builder for EmbeddedSIMActivationCodePool collection
type DeviceManagementEmbeddedSIMActivationCodePoolsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for EmbeddedSIMActivationCodePool collection
func (b *DeviceManagementEmbeddedSIMActivationCodePoolsCollectionRequestBuilder) Request() *DeviceManagementEmbeddedSIMActivationCodePoolsCollectionRequest {
return &DeviceManagementEmbeddedSIMActivationCodePoolsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for EmbeddedSIMActivationCodePool item
func (b *DeviceManagementEmbeddedSIMActivationCodePoolsCollectionRequestBuilder) ID(id string) *EmbeddedSIMActivationCodePoolRequestBuilder {
bb := &EmbeddedSIMActivationCodePoolRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementEmbeddedSIMActivationCodePoolsCollectionRequest is request for EmbeddedSIMActivationCodePool collection
type DeviceManagementEmbeddedSIMActivationCodePoolsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for EmbeddedSIMActivationCodePool collection
func (r *DeviceManagementEmbeddedSIMActivationCodePoolsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]EmbeddedSIMActivationCodePool, 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 []EmbeddedSIMActivationCodePool
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 []EmbeddedSIMActivationCodePool
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for EmbeddedSIMActivationCodePool collection, max N pages
func (r *DeviceManagementEmbeddedSIMActivationCodePoolsCollectionRequest) GetN(ctx context.Context, n int) ([]EmbeddedSIMActivationCodePool, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for EmbeddedSIMActivationCodePool collection
func (r *DeviceManagementEmbeddedSIMActivationCodePoolsCollectionRequest) Get(ctx context.Context) ([]EmbeddedSIMActivationCodePool, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for EmbeddedSIMActivationCodePool collection
func (r *DeviceManagementEmbeddedSIMActivationCodePoolsCollectionRequest) Add(ctx context.Context, reqObj *EmbeddedSIMActivationCodePool) (resObj *EmbeddedSIMActivationCodePool, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ExchangeConnectors returns request builder for DeviceManagementExchangeConnector collection
func (b *DeviceManagementRequestBuilder) ExchangeConnectors() *DeviceManagementExchangeConnectorsCollectionRequestBuilder {
bb := &DeviceManagementExchangeConnectorsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/exchangeConnectors"
return bb
}
// DeviceManagementExchangeConnectorsCollectionRequestBuilder is request builder for DeviceManagementExchangeConnector collection
type DeviceManagementExchangeConnectorsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementExchangeConnector collection
func (b *DeviceManagementExchangeConnectorsCollectionRequestBuilder) Request() *DeviceManagementExchangeConnectorsCollectionRequest {
return &DeviceManagementExchangeConnectorsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementExchangeConnector item
func (b *DeviceManagementExchangeConnectorsCollectionRequestBuilder) ID(id string) *DeviceManagementExchangeConnectorRequestBuilder {
bb := &DeviceManagementExchangeConnectorRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementExchangeConnectorsCollectionRequest is request for DeviceManagementExchangeConnector collection
type DeviceManagementExchangeConnectorsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementExchangeConnector collection
func (r *DeviceManagementExchangeConnectorsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementExchangeConnector, 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 []DeviceManagementExchangeConnector
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 []DeviceManagementExchangeConnector
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementExchangeConnector collection, max N pages
func (r *DeviceManagementExchangeConnectorsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementExchangeConnector, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementExchangeConnector collection
func (r *DeviceManagementExchangeConnectorsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementExchangeConnector, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementExchangeConnector collection
func (r *DeviceManagementExchangeConnectorsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementExchangeConnector) (resObj *DeviceManagementExchangeConnector, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ExchangeOnPremisesPolicies returns request builder for DeviceManagementExchangeOnPremisesPolicy collection
func (b *DeviceManagementRequestBuilder) ExchangeOnPremisesPolicies() *DeviceManagementExchangeOnPremisesPoliciesCollectionRequestBuilder {
bb := &DeviceManagementExchangeOnPremisesPoliciesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/exchangeOnPremisesPolicies"
return bb
}
// DeviceManagementExchangeOnPremisesPoliciesCollectionRequestBuilder is request builder for DeviceManagementExchangeOnPremisesPolicy collection
type DeviceManagementExchangeOnPremisesPoliciesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementExchangeOnPremisesPolicy collection
func (b *DeviceManagementExchangeOnPremisesPoliciesCollectionRequestBuilder) Request() *DeviceManagementExchangeOnPremisesPoliciesCollectionRequest {
return &DeviceManagementExchangeOnPremisesPoliciesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementExchangeOnPremisesPolicy item
func (b *DeviceManagementExchangeOnPremisesPoliciesCollectionRequestBuilder) ID(id string) *DeviceManagementExchangeOnPremisesPolicyRequestBuilder {
bb := &DeviceManagementExchangeOnPremisesPolicyRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementExchangeOnPremisesPoliciesCollectionRequest is request for DeviceManagementExchangeOnPremisesPolicy collection
type DeviceManagementExchangeOnPremisesPoliciesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementExchangeOnPremisesPolicy collection
func (r *DeviceManagementExchangeOnPremisesPoliciesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementExchangeOnPremisesPolicy, 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 []DeviceManagementExchangeOnPremisesPolicy
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 []DeviceManagementExchangeOnPremisesPolicy
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementExchangeOnPremisesPolicy collection, max N pages
func (r *DeviceManagementExchangeOnPremisesPoliciesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementExchangeOnPremisesPolicy, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementExchangeOnPremisesPolicy collection
func (r *DeviceManagementExchangeOnPremisesPoliciesCollectionRequest) Get(ctx context.Context) ([]DeviceManagementExchangeOnPremisesPolicy, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementExchangeOnPremisesPolicy collection
func (r *DeviceManagementExchangeOnPremisesPoliciesCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementExchangeOnPremisesPolicy) (resObj *DeviceManagementExchangeOnPremisesPolicy, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ExchangeOnPremisesPolicy is navigation property
func (b *DeviceManagementRequestBuilder) ExchangeOnPremisesPolicy() *DeviceManagementExchangeOnPremisesPolicyRequestBuilder {
bb := &DeviceManagementExchangeOnPremisesPolicyRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/exchangeOnPremisesPolicy"
return bb
}
// GroupPolicyConfigurations returns request builder for GroupPolicyConfiguration collection
func (b *DeviceManagementRequestBuilder) GroupPolicyConfigurations() *DeviceManagementGroupPolicyConfigurationsCollectionRequestBuilder {
bb := &DeviceManagementGroupPolicyConfigurationsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/groupPolicyConfigurations"
return bb
}
// DeviceManagementGroupPolicyConfigurationsCollectionRequestBuilder is request builder for GroupPolicyConfiguration collection
type DeviceManagementGroupPolicyConfigurationsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for GroupPolicyConfiguration collection
func (b *DeviceManagementGroupPolicyConfigurationsCollectionRequestBuilder) Request() *DeviceManagementGroupPolicyConfigurationsCollectionRequest {
return &DeviceManagementGroupPolicyConfigurationsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for GroupPolicyConfiguration item
func (b *DeviceManagementGroupPolicyConfigurationsCollectionRequestBuilder) ID(id string) *GroupPolicyConfigurationRequestBuilder {
bb := &GroupPolicyConfigurationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementGroupPolicyConfigurationsCollectionRequest is request for GroupPolicyConfiguration collection
type DeviceManagementGroupPolicyConfigurationsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for GroupPolicyConfiguration collection
func (r *DeviceManagementGroupPolicyConfigurationsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]GroupPolicyConfiguration, 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 []GroupPolicyConfiguration
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 []GroupPolicyConfiguration
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for GroupPolicyConfiguration collection, max N pages
func (r *DeviceManagementGroupPolicyConfigurationsCollectionRequest) GetN(ctx context.Context, n int) ([]GroupPolicyConfiguration, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for GroupPolicyConfiguration collection
func (r *DeviceManagementGroupPolicyConfigurationsCollectionRequest) Get(ctx context.Context) ([]GroupPolicyConfiguration, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for GroupPolicyConfiguration collection
func (r *DeviceManagementGroupPolicyConfigurationsCollectionRequest) Add(ctx context.Context, reqObj *GroupPolicyConfiguration) (resObj *GroupPolicyConfiguration, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// GroupPolicyDefinitionFiles returns request builder for GroupPolicyDefinitionFile collection
func (b *DeviceManagementRequestBuilder) GroupPolicyDefinitionFiles() *DeviceManagementGroupPolicyDefinitionFilesCollectionRequestBuilder {
bb := &DeviceManagementGroupPolicyDefinitionFilesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/groupPolicyDefinitionFiles"
return bb
}
// DeviceManagementGroupPolicyDefinitionFilesCollectionRequestBuilder is request builder for GroupPolicyDefinitionFile collection
type DeviceManagementGroupPolicyDefinitionFilesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for GroupPolicyDefinitionFile collection
func (b *DeviceManagementGroupPolicyDefinitionFilesCollectionRequestBuilder) Request() *DeviceManagementGroupPolicyDefinitionFilesCollectionRequest {
return &DeviceManagementGroupPolicyDefinitionFilesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for GroupPolicyDefinitionFile item
func (b *DeviceManagementGroupPolicyDefinitionFilesCollectionRequestBuilder) ID(id string) *GroupPolicyDefinitionFileRequestBuilder {
bb := &GroupPolicyDefinitionFileRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementGroupPolicyDefinitionFilesCollectionRequest is request for GroupPolicyDefinitionFile collection
type DeviceManagementGroupPolicyDefinitionFilesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for GroupPolicyDefinitionFile collection
func (r *DeviceManagementGroupPolicyDefinitionFilesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]GroupPolicyDefinitionFile, 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 []GroupPolicyDefinitionFile
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 []GroupPolicyDefinitionFile
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for GroupPolicyDefinitionFile collection, max N pages
func (r *DeviceManagementGroupPolicyDefinitionFilesCollectionRequest) GetN(ctx context.Context, n int) ([]GroupPolicyDefinitionFile, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for GroupPolicyDefinitionFile collection
func (r *DeviceManagementGroupPolicyDefinitionFilesCollectionRequest) Get(ctx context.Context) ([]GroupPolicyDefinitionFile, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for GroupPolicyDefinitionFile collection
func (r *DeviceManagementGroupPolicyDefinitionFilesCollectionRequest) Add(ctx context.Context, reqObj *GroupPolicyDefinitionFile) (resObj *GroupPolicyDefinitionFile, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// GroupPolicyDefinitions returns request builder for GroupPolicyDefinition collection
func (b *DeviceManagementRequestBuilder) GroupPolicyDefinitions() *DeviceManagementGroupPolicyDefinitionsCollectionRequestBuilder {
bb := &DeviceManagementGroupPolicyDefinitionsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/groupPolicyDefinitions"
return bb
}
// DeviceManagementGroupPolicyDefinitionsCollectionRequestBuilder is request builder for GroupPolicyDefinition collection
type DeviceManagementGroupPolicyDefinitionsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for GroupPolicyDefinition collection
func (b *DeviceManagementGroupPolicyDefinitionsCollectionRequestBuilder) Request() *DeviceManagementGroupPolicyDefinitionsCollectionRequest {
return &DeviceManagementGroupPolicyDefinitionsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for GroupPolicyDefinition item
func (b *DeviceManagementGroupPolicyDefinitionsCollectionRequestBuilder) ID(id string) *GroupPolicyDefinitionRequestBuilder {
bb := &GroupPolicyDefinitionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementGroupPolicyDefinitionsCollectionRequest is request for GroupPolicyDefinition collection
type DeviceManagementGroupPolicyDefinitionsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for GroupPolicyDefinition collection
func (r *DeviceManagementGroupPolicyDefinitionsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]GroupPolicyDefinition, 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 []GroupPolicyDefinition
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 []GroupPolicyDefinition
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for GroupPolicyDefinition collection, max N pages
func (r *DeviceManagementGroupPolicyDefinitionsCollectionRequest) GetN(ctx context.Context, n int) ([]GroupPolicyDefinition, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for GroupPolicyDefinition collection
func (r *DeviceManagementGroupPolicyDefinitionsCollectionRequest) Get(ctx context.Context) ([]GroupPolicyDefinition, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for GroupPolicyDefinition collection
func (r *DeviceManagementGroupPolicyDefinitionsCollectionRequest) Add(ctx context.Context, reqObj *GroupPolicyDefinition) (resObj *GroupPolicyDefinition, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// GroupPolicyMigrationReports returns request builder for GroupPolicyMigrationReport collection
func (b *DeviceManagementRequestBuilder) GroupPolicyMigrationReports() *DeviceManagementGroupPolicyMigrationReportsCollectionRequestBuilder {
bb := &DeviceManagementGroupPolicyMigrationReportsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/groupPolicyMigrationReports"
return bb
}
// DeviceManagementGroupPolicyMigrationReportsCollectionRequestBuilder is request builder for GroupPolicyMigrationReport collection
type DeviceManagementGroupPolicyMigrationReportsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for GroupPolicyMigrationReport collection
func (b *DeviceManagementGroupPolicyMigrationReportsCollectionRequestBuilder) Request() *DeviceManagementGroupPolicyMigrationReportsCollectionRequest {
return &DeviceManagementGroupPolicyMigrationReportsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for GroupPolicyMigrationReport item
func (b *DeviceManagementGroupPolicyMigrationReportsCollectionRequestBuilder) ID(id string) *GroupPolicyMigrationReportRequestBuilder {
bb := &GroupPolicyMigrationReportRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementGroupPolicyMigrationReportsCollectionRequest is request for GroupPolicyMigrationReport collection
type DeviceManagementGroupPolicyMigrationReportsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for GroupPolicyMigrationReport collection
func (r *DeviceManagementGroupPolicyMigrationReportsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]GroupPolicyMigrationReport, 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 []GroupPolicyMigrationReport
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 []GroupPolicyMigrationReport
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for GroupPolicyMigrationReport collection, max N pages
func (r *DeviceManagementGroupPolicyMigrationReportsCollectionRequest) GetN(ctx context.Context, n int) ([]GroupPolicyMigrationReport, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for GroupPolicyMigrationReport collection
func (r *DeviceManagementGroupPolicyMigrationReportsCollectionRequest) Get(ctx context.Context) ([]GroupPolicyMigrationReport, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for GroupPolicyMigrationReport collection
func (r *DeviceManagementGroupPolicyMigrationReportsCollectionRequest) Add(ctx context.Context, reqObj *GroupPolicyMigrationReport) (resObj *GroupPolicyMigrationReport, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ImportedDeviceIdentities returns request builder for ImportedDeviceIdentity collection
func (b *DeviceManagementRequestBuilder) ImportedDeviceIdentities() *DeviceManagementImportedDeviceIdentitiesCollectionRequestBuilder {
bb := &DeviceManagementImportedDeviceIdentitiesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/importedDeviceIdentities"
return bb
}
// DeviceManagementImportedDeviceIdentitiesCollectionRequestBuilder is request builder for ImportedDeviceIdentity collection
type DeviceManagementImportedDeviceIdentitiesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for ImportedDeviceIdentity collection
func (b *DeviceManagementImportedDeviceIdentitiesCollectionRequestBuilder) Request() *DeviceManagementImportedDeviceIdentitiesCollectionRequest {
return &DeviceManagementImportedDeviceIdentitiesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for ImportedDeviceIdentity item
func (b *DeviceManagementImportedDeviceIdentitiesCollectionRequestBuilder) ID(id string) *ImportedDeviceIdentityRequestBuilder {
bb := &ImportedDeviceIdentityRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementImportedDeviceIdentitiesCollectionRequest is request for ImportedDeviceIdentity collection
type DeviceManagementImportedDeviceIdentitiesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for ImportedDeviceIdentity collection
func (r *DeviceManagementImportedDeviceIdentitiesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]ImportedDeviceIdentity, 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 []ImportedDeviceIdentity
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 []ImportedDeviceIdentity
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for ImportedDeviceIdentity collection, max N pages
func (r *DeviceManagementImportedDeviceIdentitiesCollectionRequest) GetN(ctx context.Context, n int) ([]ImportedDeviceIdentity, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for ImportedDeviceIdentity collection
func (r *DeviceManagementImportedDeviceIdentitiesCollectionRequest) Get(ctx context.Context) ([]ImportedDeviceIdentity, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for ImportedDeviceIdentity collection
func (r *DeviceManagementImportedDeviceIdentitiesCollectionRequest) Add(ctx context.Context, reqObj *ImportedDeviceIdentity) (resObj *ImportedDeviceIdentity, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ImportedWindowsAutopilotDeviceIdentities returns request builder for ImportedWindowsAutopilotDeviceIdentity collection
func (b *DeviceManagementRequestBuilder) ImportedWindowsAutopilotDeviceIdentities() *DeviceManagementImportedWindowsAutopilotDeviceIdentitiesCollectionRequestBuilder {
bb := &DeviceManagementImportedWindowsAutopilotDeviceIdentitiesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/importedWindowsAutopilotDeviceIdentities"
return bb
}
// DeviceManagementImportedWindowsAutopilotDeviceIdentitiesCollectionRequestBuilder is request builder for ImportedWindowsAutopilotDeviceIdentity collection
type DeviceManagementImportedWindowsAutopilotDeviceIdentitiesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for ImportedWindowsAutopilotDeviceIdentity collection
func (b *DeviceManagementImportedWindowsAutopilotDeviceIdentitiesCollectionRequestBuilder) Request() *DeviceManagementImportedWindowsAutopilotDeviceIdentitiesCollectionRequest {
return &DeviceManagementImportedWindowsAutopilotDeviceIdentitiesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for ImportedWindowsAutopilotDeviceIdentity item
func (b *DeviceManagementImportedWindowsAutopilotDeviceIdentitiesCollectionRequestBuilder) ID(id string) *ImportedWindowsAutopilotDeviceIdentityRequestBuilder {
bb := &ImportedWindowsAutopilotDeviceIdentityRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementImportedWindowsAutopilotDeviceIdentitiesCollectionRequest is request for ImportedWindowsAutopilotDeviceIdentity collection
type DeviceManagementImportedWindowsAutopilotDeviceIdentitiesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for ImportedWindowsAutopilotDeviceIdentity collection
func (r *DeviceManagementImportedWindowsAutopilotDeviceIdentitiesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]ImportedWindowsAutopilotDeviceIdentity, 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 []ImportedWindowsAutopilotDeviceIdentity
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 []ImportedWindowsAutopilotDeviceIdentity
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for ImportedWindowsAutopilotDeviceIdentity collection, max N pages
func (r *DeviceManagementImportedWindowsAutopilotDeviceIdentitiesCollectionRequest) GetN(ctx context.Context, n int) ([]ImportedWindowsAutopilotDeviceIdentity, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for ImportedWindowsAutopilotDeviceIdentity collection
func (r *DeviceManagementImportedWindowsAutopilotDeviceIdentitiesCollectionRequest) Get(ctx context.Context) ([]ImportedWindowsAutopilotDeviceIdentity, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for ImportedWindowsAutopilotDeviceIdentity collection
func (r *DeviceManagementImportedWindowsAutopilotDeviceIdentitiesCollectionRequest) Add(ctx context.Context, reqObj *ImportedWindowsAutopilotDeviceIdentity) (resObj *ImportedWindowsAutopilotDeviceIdentity, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Intents returns request builder for DeviceManagementIntent collection
func (b *DeviceManagementRequestBuilder) Intents() *DeviceManagementIntentsCollectionRequestBuilder {
bb := &DeviceManagementIntentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/intents"
return bb
}
// DeviceManagementIntentsCollectionRequestBuilder is request builder for DeviceManagementIntent collection
type DeviceManagementIntentsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementIntent collection
func (b *DeviceManagementIntentsCollectionRequestBuilder) Request() *DeviceManagementIntentsCollectionRequest {
return &DeviceManagementIntentsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementIntent item
func (b *DeviceManagementIntentsCollectionRequestBuilder) ID(id string) *DeviceManagementIntentRequestBuilder {
bb := &DeviceManagementIntentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementIntentsCollectionRequest is request for DeviceManagementIntent collection
type DeviceManagementIntentsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementIntent collection
func (r *DeviceManagementIntentsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementIntent, 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 []DeviceManagementIntent
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 []DeviceManagementIntent
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementIntent collection, max N pages
func (r *DeviceManagementIntentsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementIntent, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementIntent collection
func (r *DeviceManagementIntentsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementIntent, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementIntent collection
func (r *DeviceManagementIntentsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementIntent) (resObj *DeviceManagementIntent, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// IntuneBrandingProfiles returns request builder for IntuneBrandingProfile collection
func (b *DeviceManagementRequestBuilder) IntuneBrandingProfiles() *DeviceManagementIntuneBrandingProfilesCollectionRequestBuilder {
bb := &DeviceManagementIntuneBrandingProfilesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/intuneBrandingProfiles"
return bb
}
// DeviceManagementIntuneBrandingProfilesCollectionRequestBuilder is request builder for IntuneBrandingProfile collection
type DeviceManagementIntuneBrandingProfilesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for IntuneBrandingProfile collection
func (b *DeviceManagementIntuneBrandingProfilesCollectionRequestBuilder) Request() *DeviceManagementIntuneBrandingProfilesCollectionRequest {
return &DeviceManagementIntuneBrandingProfilesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for IntuneBrandingProfile item
func (b *DeviceManagementIntuneBrandingProfilesCollectionRequestBuilder) ID(id string) *IntuneBrandingProfileRequestBuilder {
bb := &IntuneBrandingProfileRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementIntuneBrandingProfilesCollectionRequest is request for IntuneBrandingProfile collection
type DeviceManagementIntuneBrandingProfilesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for IntuneBrandingProfile collection
func (r *DeviceManagementIntuneBrandingProfilesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]IntuneBrandingProfile, 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 []IntuneBrandingProfile
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 []IntuneBrandingProfile
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for IntuneBrandingProfile collection, max N pages
func (r *DeviceManagementIntuneBrandingProfilesCollectionRequest) GetN(ctx context.Context, n int) ([]IntuneBrandingProfile, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for IntuneBrandingProfile collection
func (r *DeviceManagementIntuneBrandingProfilesCollectionRequest) Get(ctx context.Context) ([]IntuneBrandingProfile, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for IntuneBrandingProfile collection
func (r *DeviceManagementIntuneBrandingProfilesCollectionRequest) Add(ctx context.Context, reqObj *IntuneBrandingProfile) (resObj *IntuneBrandingProfile, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// IOSUpdateStatuses returns request builder for IOSUpdateDeviceStatus collection
func (b *DeviceManagementRequestBuilder) IOSUpdateStatuses() *DeviceManagementIOSUpdateStatusesCollectionRequestBuilder {
bb := &DeviceManagementIOSUpdateStatusesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/iosUpdateStatuses"
return bb
}
// DeviceManagementIOSUpdateStatusesCollectionRequestBuilder is request builder for IOSUpdateDeviceStatus collection
type DeviceManagementIOSUpdateStatusesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for IOSUpdateDeviceStatus collection
func (b *DeviceManagementIOSUpdateStatusesCollectionRequestBuilder) Request() *DeviceManagementIOSUpdateStatusesCollectionRequest {
return &DeviceManagementIOSUpdateStatusesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for IOSUpdateDeviceStatus item
func (b *DeviceManagementIOSUpdateStatusesCollectionRequestBuilder) ID(id string) *IOSUpdateDeviceStatusRequestBuilder {
bb := &IOSUpdateDeviceStatusRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementIOSUpdateStatusesCollectionRequest is request for IOSUpdateDeviceStatus collection
type DeviceManagementIOSUpdateStatusesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for IOSUpdateDeviceStatus collection
func (r *DeviceManagementIOSUpdateStatusesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]IOSUpdateDeviceStatus, 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 []IOSUpdateDeviceStatus
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 []IOSUpdateDeviceStatus
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for IOSUpdateDeviceStatus collection, max N pages
func (r *DeviceManagementIOSUpdateStatusesCollectionRequest) GetN(ctx context.Context, n int) ([]IOSUpdateDeviceStatus, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for IOSUpdateDeviceStatus collection
func (r *DeviceManagementIOSUpdateStatusesCollectionRequest) Get(ctx context.Context) ([]IOSUpdateDeviceStatus, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for IOSUpdateDeviceStatus collection
func (r *DeviceManagementIOSUpdateStatusesCollectionRequest) Add(ctx context.Context, reqObj *IOSUpdateDeviceStatus) (resObj *IOSUpdateDeviceStatus, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ManagedDeviceEncryptionStates returns request builder for ManagedDeviceEncryptionState collection
func (b *DeviceManagementRequestBuilder) ManagedDeviceEncryptionStates() *DeviceManagementManagedDeviceEncryptionStatesCollectionRequestBuilder {
bb := &DeviceManagementManagedDeviceEncryptionStatesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/managedDeviceEncryptionStates"
return bb
}
// DeviceManagementManagedDeviceEncryptionStatesCollectionRequestBuilder is request builder for ManagedDeviceEncryptionState collection
type DeviceManagementManagedDeviceEncryptionStatesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for ManagedDeviceEncryptionState collection
func (b *DeviceManagementManagedDeviceEncryptionStatesCollectionRequestBuilder) Request() *DeviceManagementManagedDeviceEncryptionStatesCollectionRequest {
return &DeviceManagementManagedDeviceEncryptionStatesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for ManagedDeviceEncryptionState item
func (b *DeviceManagementManagedDeviceEncryptionStatesCollectionRequestBuilder) ID(id string) *ManagedDeviceEncryptionStateRequestBuilder {
bb := &ManagedDeviceEncryptionStateRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementManagedDeviceEncryptionStatesCollectionRequest is request for ManagedDeviceEncryptionState collection
type DeviceManagementManagedDeviceEncryptionStatesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for ManagedDeviceEncryptionState collection
func (r *DeviceManagementManagedDeviceEncryptionStatesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]ManagedDeviceEncryptionState, 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 []ManagedDeviceEncryptionState
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 []ManagedDeviceEncryptionState
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for ManagedDeviceEncryptionState collection, max N pages
func (r *DeviceManagementManagedDeviceEncryptionStatesCollectionRequest) GetN(ctx context.Context, n int) ([]ManagedDeviceEncryptionState, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for ManagedDeviceEncryptionState collection
func (r *DeviceManagementManagedDeviceEncryptionStatesCollectionRequest) Get(ctx context.Context) ([]ManagedDeviceEncryptionState, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for ManagedDeviceEncryptionState collection
func (r *DeviceManagementManagedDeviceEncryptionStatesCollectionRequest) Add(ctx context.Context, reqObj *ManagedDeviceEncryptionState) (resObj *ManagedDeviceEncryptionState, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ManagedDeviceOverview is navigation property
func (b *DeviceManagementRequestBuilder) ManagedDeviceOverview() *ManagedDeviceOverviewRequestBuilder {
bb := &ManagedDeviceOverviewRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/managedDeviceOverview"
return bb
}
// ManagedDevices returns request builder for ManagedDevice collection
func (b *DeviceManagementRequestBuilder) ManagedDevices() *DeviceManagementManagedDevicesCollectionRequestBuilder {
bb := &DeviceManagementManagedDevicesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/managedDevices"
return bb
}
// DeviceManagementManagedDevicesCollectionRequestBuilder is request builder for ManagedDevice collection
type DeviceManagementManagedDevicesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for ManagedDevice collection
func (b *DeviceManagementManagedDevicesCollectionRequestBuilder) Request() *DeviceManagementManagedDevicesCollectionRequest {
return &DeviceManagementManagedDevicesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for ManagedDevice item
func (b *DeviceManagementManagedDevicesCollectionRequestBuilder) ID(id string) *ManagedDeviceRequestBuilder {
bb := &ManagedDeviceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementManagedDevicesCollectionRequest is request for ManagedDevice collection
type DeviceManagementManagedDevicesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for ManagedDevice collection
func (r *DeviceManagementManagedDevicesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]ManagedDevice, 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 []ManagedDevice
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 []ManagedDevice
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for ManagedDevice collection, max N pages
func (r *DeviceManagementManagedDevicesCollectionRequest) GetN(ctx context.Context, n int) ([]ManagedDevice, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for ManagedDevice collection
func (r *DeviceManagementManagedDevicesCollectionRequest) Get(ctx context.Context) ([]ManagedDevice, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for ManagedDevice collection
func (r *DeviceManagementManagedDevicesCollectionRequest) Add(ctx context.Context, reqObj *ManagedDevice) (resObj *ManagedDevice, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ManagementConditionStatements returns request builder for ManagementConditionStatement collection
func (b *DeviceManagementRequestBuilder) ManagementConditionStatements() *DeviceManagementManagementConditionStatementsCollectionRequestBuilder {
bb := &DeviceManagementManagementConditionStatementsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/managementConditionStatements"
return bb
}
// DeviceManagementManagementConditionStatementsCollectionRequestBuilder is request builder for ManagementConditionStatement collection
type DeviceManagementManagementConditionStatementsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for ManagementConditionStatement collection
func (b *DeviceManagementManagementConditionStatementsCollectionRequestBuilder) Request() *DeviceManagementManagementConditionStatementsCollectionRequest {
return &DeviceManagementManagementConditionStatementsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for ManagementConditionStatement item
func (b *DeviceManagementManagementConditionStatementsCollectionRequestBuilder) ID(id string) *ManagementConditionStatementRequestBuilder {
bb := &ManagementConditionStatementRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementManagementConditionStatementsCollectionRequest is request for ManagementConditionStatement collection
type DeviceManagementManagementConditionStatementsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for ManagementConditionStatement collection
func (r *DeviceManagementManagementConditionStatementsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]ManagementConditionStatement, 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 []ManagementConditionStatement
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 []ManagementConditionStatement
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for ManagementConditionStatement collection, max N pages
func (r *DeviceManagementManagementConditionStatementsCollectionRequest) GetN(ctx context.Context, n int) ([]ManagementConditionStatement, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for ManagementConditionStatement collection
func (r *DeviceManagementManagementConditionStatementsCollectionRequest) Get(ctx context.Context) ([]ManagementConditionStatement, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for ManagementConditionStatement collection
func (r *DeviceManagementManagementConditionStatementsCollectionRequest) Add(ctx context.Context, reqObj *ManagementConditionStatement) (resObj *ManagementConditionStatement, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ManagementConditions returns request builder for ManagementCondition collection
func (b *DeviceManagementRequestBuilder) ManagementConditions() *DeviceManagementManagementConditionsCollectionRequestBuilder {
bb := &DeviceManagementManagementConditionsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/managementConditions"
return bb
}
// DeviceManagementManagementConditionsCollectionRequestBuilder is request builder for ManagementCondition collection
type DeviceManagementManagementConditionsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for ManagementCondition collection
func (b *DeviceManagementManagementConditionsCollectionRequestBuilder) Request() *DeviceManagementManagementConditionsCollectionRequest {
return &DeviceManagementManagementConditionsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for ManagementCondition item
func (b *DeviceManagementManagementConditionsCollectionRequestBuilder) ID(id string) *ManagementConditionRequestBuilder {
bb := &ManagementConditionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementManagementConditionsCollectionRequest is request for ManagementCondition collection
type DeviceManagementManagementConditionsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for ManagementCondition collection
func (r *DeviceManagementManagementConditionsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]ManagementCondition, 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 []ManagementCondition
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 []ManagementCondition
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for ManagementCondition collection, max N pages
func (r *DeviceManagementManagementConditionsCollectionRequest) GetN(ctx context.Context, n int) ([]ManagementCondition, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for ManagementCondition collection
func (r *DeviceManagementManagementConditionsCollectionRequest) Get(ctx context.Context) ([]ManagementCondition, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for ManagementCondition collection
func (r *DeviceManagementManagementConditionsCollectionRequest) Add(ctx context.Context, reqObj *ManagementCondition) (resObj *ManagementCondition, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// MobileAppTroubleshootingEvents returns request builder for MobileAppTroubleshootingEvent collection
func (b *DeviceManagementRequestBuilder) MobileAppTroubleshootingEvents() *DeviceManagementMobileAppTroubleshootingEventsCollectionRequestBuilder {
bb := &DeviceManagementMobileAppTroubleshootingEventsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/mobileAppTroubleshootingEvents"
return bb
}
// DeviceManagementMobileAppTroubleshootingEventsCollectionRequestBuilder is request builder for MobileAppTroubleshootingEvent collection
type DeviceManagementMobileAppTroubleshootingEventsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for MobileAppTroubleshootingEvent collection
func (b *DeviceManagementMobileAppTroubleshootingEventsCollectionRequestBuilder) Request() *DeviceManagementMobileAppTroubleshootingEventsCollectionRequest {
return &DeviceManagementMobileAppTroubleshootingEventsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for MobileAppTroubleshootingEvent item
func (b *DeviceManagementMobileAppTroubleshootingEventsCollectionRequestBuilder) ID(id string) *MobileAppTroubleshootingEventRequestBuilder {
bb := &MobileAppTroubleshootingEventRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementMobileAppTroubleshootingEventsCollectionRequest is request for MobileAppTroubleshootingEvent collection
type DeviceManagementMobileAppTroubleshootingEventsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for MobileAppTroubleshootingEvent collection
func (r *DeviceManagementMobileAppTroubleshootingEventsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]MobileAppTroubleshootingEvent, 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 []MobileAppTroubleshootingEvent
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 []MobileAppTroubleshootingEvent
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for MobileAppTroubleshootingEvent collection, max N pages
func (r *DeviceManagementMobileAppTroubleshootingEventsCollectionRequest) GetN(ctx context.Context, n int) ([]MobileAppTroubleshootingEvent, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for MobileAppTroubleshootingEvent collection
func (r *DeviceManagementMobileAppTroubleshootingEventsCollectionRequest) Get(ctx context.Context) ([]MobileAppTroubleshootingEvent, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for MobileAppTroubleshootingEvent collection
func (r *DeviceManagementMobileAppTroubleshootingEventsCollectionRequest) Add(ctx context.Context, reqObj *MobileAppTroubleshootingEvent) (resObj *MobileAppTroubleshootingEvent, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// MobileThreatDefenseConnectors returns request builder for MobileThreatDefenseConnector collection
func (b *DeviceManagementRequestBuilder) MobileThreatDefenseConnectors() *DeviceManagementMobileThreatDefenseConnectorsCollectionRequestBuilder {
bb := &DeviceManagementMobileThreatDefenseConnectorsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/mobileThreatDefenseConnectors"
return bb
}
// DeviceManagementMobileThreatDefenseConnectorsCollectionRequestBuilder is request builder for MobileThreatDefenseConnector collection
type DeviceManagementMobileThreatDefenseConnectorsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for MobileThreatDefenseConnector collection
func (b *DeviceManagementMobileThreatDefenseConnectorsCollectionRequestBuilder) Request() *DeviceManagementMobileThreatDefenseConnectorsCollectionRequest {
return &DeviceManagementMobileThreatDefenseConnectorsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for MobileThreatDefenseConnector item
func (b *DeviceManagementMobileThreatDefenseConnectorsCollectionRequestBuilder) ID(id string) *MobileThreatDefenseConnectorRequestBuilder {
bb := &MobileThreatDefenseConnectorRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementMobileThreatDefenseConnectorsCollectionRequest is request for MobileThreatDefenseConnector collection
type DeviceManagementMobileThreatDefenseConnectorsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for MobileThreatDefenseConnector collection
func (r *DeviceManagementMobileThreatDefenseConnectorsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]MobileThreatDefenseConnector, 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 []MobileThreatDefenseConnector
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 []MobileThreatDefenseConnector
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for MobileThreatDefenseConnector collection, max N pages
func (r *DeviceManagementMobileThreatDefenseConnectorsCollectionRequest) GetN(ctx context.Context, n int) ([]MobileThreatDefenseConnector, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for MobileThreatDefenseConnector collection
func (r *DeviceManagementMobileThreatDefenseConnectorsCollectionRequest) Get(ctx context.Context) ([]MobileThreatDefenseConnector, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for MobileThreatDefenseConnector collection
func (r *DeviceManagementMobileThreatDefenseConnectorsCollectionRequest) Add(ctx context.Context, reqObj *MobileThreatDefenseConnector) (resObj *MobileThreatDefenseConnector, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// NDESConnectors returns request builder for NDESConnector collection
func (b *DeviceManagementRequestBuilder) NDESConnectors() *DeviceManagementNDESConnectorsCollectionRequestBuilder {
bb := &DeviceManagementNDESConnectorsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/ndesConnectors"
return bb
}
// DeviceManagementNDESConnectorsCollectionRequestBuilder is request builder for NDESConnector collection
type DeviceManagementNDESConnectorsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for NDESConnector collection
func (b *DeviceManagementNDESConnectorsCollectionRequestBuilder) Request() *DeviceManagementNDESConnectorsCollectionRequest {
return &DeviceManagementNDESConnectorsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for NDESConnector item
func (b *DeviceManagementNDESConnectorsCollectionRequestBuilder) ID(id string) *NDESConnectorRequestBuilder {
bb := &NDESConnectorRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementNDESConnectorsCollectionRequest is request for NDESConnector collection
type DeviceManagementNDESConnectorsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for NDESConnector collection
func (r *DeviceManagementNDESConnectorsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]NDESConnector, 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 []NDESConnector
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 []NDESConnector
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for NDESConnector collection, max N pages
func (r *DeviceManagementNDESConnectorsCollectionRequest) GetN(ctx context.Context, n int) ([]NDESConnector, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for NDESConnector collection
func (r *DeviceManagementNDESConnectorsCollectionRequest) Get(ctx context.Context) ([]NDESConnector, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for NDESConnector collection
func (r *DeviceManagementNDESConnectorsCollectionRequest) Add(ctx context.Context, reqObj *NDESConnector) (resObj *NDESConnector, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// NotificationMessageTemplates returns request builder for NotificationMessageTemplate collection
func (b *DeviceManagementRequestBuilder) NotificationMessageTemplates() *DeviceManagementNotificationMessageTemplatesCollectionRequestBuilder {
bb := &DeviceManagementNotificationMessageTemplatesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/notificationMessageTemplates"
return bb
}
// DeviceManagementNotificationMessageTemplatesCollectionRequestBuilder is request builder for NotificationMessageTemplate collection
type DeviceManagementNotificationMessageTemplatesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for NotificationMessageTemplate collection
func (b *DeviceManagementNotificationMessageTemplatesCollectionRequestBuilder) Request() *DeviceManagementNotificationMessageTemplatesCollectionRequest {
return &DeviceManagementNotificationMessageTemplatesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for NotificationMessageTemplate item
func (b *DeviceManagementNotificationMessageTemplatesCollectionRequestBuilder) ID(id string) *NotificationMessageTemplateRequestBuilder {
bb := &NotificationMessageTemplateRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementNotificationMessageTemplatesCollectionRequest is request for NotificationMessageTemplate collection
type DeviceManagementNotificationMessageTemplatesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for NotificationMessageTemplate collection
func (r *DeviceManagementNotificationMessageTemplatesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]NotificationMessageTemplate, 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 []NotificationMessageTemplate
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 []NotificationMessageTemplate
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for NotificationMessageTemplate collection, max N pages
func (r *DeviceManagementNotificationMessageTemplatesCollectionRequest) GetN(ctx context.Context, n int) ([]NotificationMessageTemplate, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for NotificationMessageTemplate collection
func (r *DeviceManagementNotificationMessageTemplatesCollectionRequest) Get(ctx context.Context) ([]NotificationMessageTemplate, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for NotificationMessageTemplate collection
func (r *DeviceManagementNotificationMessageTemplatesCollectionRequest) Add(ctx context.Context, reqObj *NotificationMessageTemplate) (resObj *NotificationMessageTemplate, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// RemoteActionAudits returns request builder for RemoteActionAudit collection
func (b *DeviceManagementRequestBuilder) RemoteActionAudits() *DeviceManagementRemoteActionAuditsCollectionRequestBuilder {
bb := &DeviceManagementRemoteActionAuditsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/remoteActionAudits"
return bb
}
// DeviceManagementRemoteActionAuditsCollectionRequestBuilder is request builder for RemoteActionAudit collection
type DeviceManagementRemoteActionAuditsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for RemoteActionAudit collection
func (b *DeviceManagementRemoteActionAuditsCollectionRequestBuilder) Request() *DeviceManagementRemoteActionAuditsCollectionRequest {
return &DeviceManagementRemoteActionAuditsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for RemoteActionAudit item
func (b *DeviceManagementRemoteActionAuditsCollectionRequestBuilder) ID(id string) *RemoteActionAuditRequestBuilder {
bb := &RemoteActionAuditRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementRemoteActionAuditsCollectionRequest is request for RemoteActionAudit collection
type DeviceManagementRemoteActionAuditsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for RemoteActionAudit collection
func (r *DeviceManagementRemoteActionAuditsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]RemoteActionAudit, 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 []RemoteActionAudit
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 []RemoteActionAudit
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for RemoteActionAudit collection, max N pages
func (r *DeviceManagementRemoteActionAuditsCollectionRequest) GetN(ctx context.Context, n int) ([]RemoteActionAudit, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for RemoteActionAudit collection
func (r *DeviceManagementRemoteActionAuditsCollectionRequest) Get(ctx context.Context) ([]RemoteActionAudit, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for RemoteActionAudit collection
func (r *DeviceManagementRemoteActionAuditsCollectionRequest) Add(ctx context.Context, reqObj *RemoteActionAudit) (resObj *RemoteActionAudit, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// RemoteAssistancePartners returns request builder for RemoteAssistancePartner collection
func (b *DeviceManagementRequestBuilder) RemoteAssistancePartners() *DeviceManagementRemoteAssistancePartnersCollectionRequestBuilder {
bb := &DeviceManagementRemoteAssistancePartnersCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/remoteAssistancePartners"
return bb
}
// DeviceManagementRemoteAssistancePartnersCollectionRequestBuilder is request builder for RemoteAssistancePartner collection
type DeviceManagementRemoteAssistancePartnersCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for RemoteAssistancePartner collection
func (b *DeviceManagementRemoteAssistancePartnersCollectionRequestBuilder) Request() *DeviceManagementRemoteAssistancePartnersCollectionRequest {
return &DeviceManagementRemoteAssistancePartnersCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for RemoteAssistancePartner item
func (b *DeviceManagementRemoteAssistancePartnersCollectionRequestBuilder) ID(id string) *RemoteAssistancePartnerRequestBuilder {
bb := &RemoteAssistancePartnerRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementRemoteAssistancePartnersCollectionRequest is request for RemoteAssistancePartner collection
type DeviceManagementRemoteAssistancePartnersCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for RemoteAssistancePartner collection
func (r *DeviceManagementRemoteAssistancePartnersCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]RemoteAssistancePartner, 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 []RemoteAssistancePartner
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 []RemoteAssistancePartner
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for RemoteAssistancePartner collection, max N pages
func (r *DeviceManagementRemoteAssistancePartnersCollectionRequest) GetN(ctx context.Context, n int) ([]RemoteAssistancePartner, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for RemoteAssistancePartner collection
func (r *DeviceManagementRemoteAssistancePartnersCollectionRequest) Get(ctx context.Context) ([]RemoteAssistancePartner, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for RemoteAssistancePartner collection
func (r *DeviceManagementRemoteAssistancePartnersCollectionRequest) Add(ctx context.Context, reqObj *RemoteAssistancePartner) (resObj *RemoteAssistancePartner, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Reports is navigation property
func (b *DeviceManagementRequestBuilder) Reports() *DeviceManagementReportsRequestBuilder {
bb := &DeviceManagementReportsRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/reports"
return bb
}
// ResourceOperations returns request builder for ResourceOperation collection
func (b *DeviceManagementRequestBuilder) ResourceOperations() *DeviceManagementResourceOperationsCollectionRequestBuilder {
bb := &DeviceManagementResourceOperationsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/resourceOperations"
return bb
}
// DeviceManagementResourceOperationsCollectionRequestBuilder is request builder for ResourceOperation collection
type DeviceManagementResourceOperationsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for ResourceOperation collection
func (b *DeviceManagementResourceOperationsCollectionRequestBuilder) Request() *DeviceManagementResourceOperationsCollectionRequest {
return &DeviceManagementResourceOperationsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for ResourceOperation item
func (b *DeviceManagementResourceOperationsCollectionRequestBuilder) ID(id string) *ResourceOperationRequestBuilder {
bb := &ResourceOperationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementResourceOperationsCollectionRequest is request for ResourceOperation collection
type DeviceManagementResourceOperationsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for ResourceOperation collection
func (r *DeviceManagementResourceOperationsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]ResourceOperation, 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 []ResourceOperation
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 []ResourceOperation
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for ResourceOperation collection, max N pages
func (r *DeviceManagementResourceOperationsCollectionRequest) GetN(ctx context.Context, n int) ([]ResourceOperation, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for ResourceOperation collection
func (r *DeviceManagementResourceOperationsCollectionRequest) Get(ctx context.Context) ([]ResourceOperation, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for ResourceOperation collection
func (r *DeviceManagementResourceOperationsCollectionRequest) Add(ctx context.Context, reqObj *ResourceOperation) (resObj *ResourceOperation, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// RoleAssignments returns request builder for DeviceAndAppManagementRoleAssignment collection
func (b *DeviceManagementRequestBuilder) RoleAssignments() *DeviceManagementRoleAssignmentsCollectionRequestBuilder {
bb := &DeviceManagementRoleAssignmentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/roleAssignments"
return bb
}
// DeviceManagementRoleAssignmentsCollectionRequestBuilder is request builder for DeviceAndAppManagementRoleAssignment collection
type DeviceManagementRoleAssignmentsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceAndAppManagementRoleAssignment collection
func (b *DeviceManagementRoleAssignmentsCollectionRequestBuilder) Request() *DeviceManagementRoleAssignmentsCollectionRequest {
return &DeviceManagementRoleAssignmentsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceAndAppManagementRoleAssignment item
func (b *DeviceManagementRoleAssignmentsCollectionRequestBuilder) ID(id string) *DeviceAndAppManagementRoleAssignmentRequestBuilder {
bb := &DeviceAndAppManagementRoleAssignmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementRoleAssignmentsCollectionRequest is request for DeviceAndAppManagementRoleAssignment collection
type DeviceManagementRoleAssignmentsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceAndAppManagementRoleAssignment collection
func (r *DeviceManagementRoleAssignmentsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceAndAppManagementRoleAssignment, 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 []DeviceAndAppManagementRoleAssignment
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 []DeviceAndAppManagementRoleAssignment
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceAndAppManagementRoleAssignment collection, max N pages
func (r *DeviceManagementRoleAssignmentsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceAndAppManagementRoleAssignment, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceAndAppManagementRoleAssignment collection
func (r *DeviceManagementRoleAssignmentsCollectionRequest) Get(ctx context.Context) ([]DeviceAndAppManagementRoleAssignment, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceAndAppManagementRoleAssignment collection
func (r *DeviceManagementRoleAssignmentsCollectionRequest) Add(ctx context.Context, reqObj *DeviceAndAppManagementRoleAssignment) (resObj *DeviceAndAppManagementRoleAssignment, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// RoleDefinitions returns request builder for RoleDefinition collection
func (b *DeviceManagementRequestBuilder) RoleDefinitions() *DeviceManagementRoleDefinitionsCollectionRequestBuilder {
bb := &DeviceManagementRoleDefinitionsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/roleDefinitions"
return bb
}
// DeviceManagementRoleDefinitionsCollectionRequestBuilder is request builder for RoleDefinition collection
type DeviceManagementRoleDefinitionsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for RoleDefinition collection
func (b *DeviceManagementRoleDefinitionsCollectionRequestBuilder) Request() *DeviceManagementRoleDefinitionsCollectionRequest {
return &DeviceManagementRoleDefinitionsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for RoleDefinition item
func (b *DeviceManagementRoleDefinitionsCollectionRequestBuilder) ID(id string) *RoleDefinitionRequestBuilder {
bb := &RoleDefinitionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementRoleDefinitionsCollectionRequest is request for RoleDefinition collection
type DeviceManagementRoleDefinitionsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for RoleDefinition collection
func (r *DeviceManagementRoleDefinitionsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]RoleDefinition, 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 []RoleDefinition
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 []RoleDefinition
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for RoleDefinition collection, max N pages
func (r *DeviceManagementRoleDefinitionsCollectionRequest) GetN(ctx context.Context, n int) ([]RoleDefinition, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for RoleDefinition collection
func (r *DeviceManagementRoleDefinitionsCollectionRequest) Get(ctx context.Context) ([]RoleDefinition, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for RoleDefinition collection
func (r *DeviceManagementRoleDefinitionsCollectionRequest) Add(ctx context.Context, reqObj *RoleDefinition) (resObj *RoleDefinition, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// RoleScopeTags returns request builder for RoleScopeTag collection
func (b *DeviceManagementRequestBuilder) RoleScopeTags() *DeviceManagementRoleScopeTagsCollectionRequestBuilder {
bb := &DeviceManagementRoleScopeTagsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/roleScopeTags"
return bb
}
// DeviceManagementRoleScopeTagsCollectionRequestBuilder is request builder for RoleScopeTag collection
type DeviceManagementRoleScopeTagsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for RoleScopeTag collection
func (b *DeviceManagementRoleScopeTagsCollectionRequestBuilder) Request() *DeviceManagementRoleScopeTagsCollectionRequest {
return &DeviceManagementRoleScopeTagsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for RoleScopeTag item
func (b *DeviceManagementRoleScopeTagsCollectionRequestBuilder) ID(id string) *RoleScopeTagRequestBuilder {
bb := &RoleScopeTagRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementRoleScopeTagsCollectionRequest is request for RoleScopeTag collection
type DeviceManagementRoleScopeTagsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for RoleScopeTag collection
func (r *DeviceManagementRoleScopeTagsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]RoleScopeTag, 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 []RoleScopeTag
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 []RoleScopeTag
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for RoleScopeTag collection, max N pages
func (r *DeviceManagementRoleScopeTagsCollectionRequest) GetN(ctx context.Context, n int) ([]RoleScopeTag, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for RoleScopeTag collection
func (r *DeviceManagementRoleScopeTagsCollectionRequest) Get(ctx context.Context) ([]RoleScopeTag, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for RoleScopeTag collection
func (r *DeviceManagementRoleScopeTagsCollectionRequest) Add(ctx context.Context, reqObj *RoleScopeTag) (resObj *RoleScopeTag, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// SettingDefinitions returns request builder for DeviceManagementSettingDefinition collection
func (b *DeviceManagementRequestBuilder) SettingDefinitions() *DeviceManagementSettingDefinitionsCollectionRequestBuilder {
bb := &DeviceManagementSettingDefinitionsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/settingDefinitions"
return bb
}
// DeviceManagementSettingDefinitionsCollectionRequestBuilder is request builder for DeviceManagementSettingDefinition collection
type DeviceManagementSettingDefinitionsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementSettingDefinition collection
func (b *DeviceManagementSettingDefinitionsCollectionRequestBuilder) Request() *DeviceManagementSettingDefinitionsCollectionRequest {
return &DeviceManagementSettingDefinitionsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementSettingDefinition item
func (b *DeviceManagementSettingDefinitionsCollectionRequestBuilder) ID(id string) *DeviceManagementSettingDefinitionRequestBuilder {
bb := &DeviceManagementSettingDefinitionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementSettingDefinitionsCollectionRequest is request for DeviceManagementSettingDefinition collection
type DeviceManagementSettingDefinitionsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementSettingDefinition collection
func (r *DeviceManagementSettingDefinitionsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementSettingDefinition, 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 []DeviceManagementSettingDefinition
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 []DeviceManagementSettingDefinition
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementSettingDefinition collection, max N pages
func (r *DeviceManagementSettingDefinitionsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementSettingDefinition, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementSettingDefinition collection
func (r *DeviceManagementSettingDefinitionsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementSettingDefinition, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementSettingDefinition collection
func (r *DeviceManagementSettingDefinitionsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementSettingDefinition) (resObj *DeviceManagementSettingDefinition, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// SoftwareUpdateStatusSummary is navigation property
func (b *DeviceManagementRequestBuilder) SoftwareUpdateStatusSummary() *SoftwareUpdateStatusSummaryRequestBuilder {
bb := &SoftwareUpdateStatusSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/softwareUpdateStatusSummary"
return bb
}
// TelecomExpenseManagementPartners returns request builder for TelecomExpenseManagementPartner collection
func (b *DeviceManagementRequestBuilder) TelecomExpenseManagementPartners() *DeviceManagementTelecomExpenseManagementPartnersCollectionRequestBuilder {
bb := &DeviceManagementTelecomExpenseManagementPartnersCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/telecomExpenseManagementPartners"
return bb
}
// DeviceManagementTelecomExpenseManagementPartnersCollectionRequestBuilder is request builder for TelecomExpenseManagementPartner collection
type DeviceManagementTelecomExpenseManagementPartnersCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for TelecomExpenseManagementPartner collection
func (b *DeviceManagementTelecomExpenseManagementPartnersCollectionRequestBuilder) Request() *DeviceManagementTelecomExpenseManagementPartnersCollectionRequest {
return &DeviceManagementTelecomExpenseManagementPartnersCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for TelecomExpenseManagementPartner item
func (b *DeviceManagementTelecomExpenseManagementPartnersCollectionRequestBuilder) ID(id string) *TelecomExpenseManagementPartnerRequestBuilder {
bb := &TelecomExpenseManagementPartnerRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementTelecomExpenseManagementPartnersCollectionRequest is request for TelecomExpenseManagementPartner collection
type DeviceManagementTelecomExpenseManagementPartnersCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for TelecomExpenseManagementPartner collection
func (r *DeviceManagementTelecomExpenseManagementPartnersCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]TelecomExpenseManagementPartner, 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 []TelecomExpenseManagementPartner
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 []TelecomExpenseManagementPartner
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for TelecomExpenseManagementPartner collection, max N pages
func (r *DeviceManagementTelecomExpenseManagementPartnersCollectionRequest) GetN(ctx context.Context, n int) ([]TelecomExpenseManagementPartner, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for TelecomExpenseManagementPartner collection
func (r *DeviceManagementTelecomExpenseManagementPartnersCollectionRequest) Get(ctx context.Context) ([]TelecomExpenseManagementPartner, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for TelecomExpenseManagementPartner collection
func (r *DeviceManagementTelecomExpenseManagementPartnersCollectionRequest) Add(ctx context.Context, reqObj *TelecomExpenseManagementPartner) (resObj *TelecomExpenseManagementPartner, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Templates returns request builder for DeviceManagementTemplate collection
func (b *DeviceManagementRequestBuilder) Templates() *DeviceManagementTemplatesCollectionRequestBuilder {
bb := &DeviceManagementTemplatesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/templates"
return bb
}
// DeviceManagementTemplatesCollectionRequestBuilder is request builder for DeviceManagementTemplate collection
type DeviceManagementTemplatesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementTemplate collection
func (b *DeviceManagementTemplatesCollectionRequestBuilder) Request() *DeviceManagementTemplatesCollectionRequest {
return &DeviceManagementTemplatesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementTemplate item
func (b *DeviceManagementTemplatesCollectionRequestBuilder) ID(id string) *DeviceManagementTemplateRequestBuilder {
bb := &DeviceManagementTemplateRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementTemplatesCollectionRequest is request for DeviceManagementTemplate collection
type DeviceManagementTemplatesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementTemplate collection
func (r *DeviceManagementTemplatesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementTemplate, 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 []DeviceManagementTemplate
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 []DeviceManagementTemplate
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementTemplate collection, max N pages
func (r *DeviceManagementTemplatesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementTemplate, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementTemplate collection
func (r *DeviceManagementTemplatesCollectionRequest) Get(ctx context.Context) ([]DeviceManagementTemplate, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementTemplate collection
func (r *DeviceManagementTemplatesCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementTemplate) (resObj *DeviceManagementTemplate, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// TermsAndConditions returns request builder for TermsAndConditions collection
func (b *DeviceManagementRequestBuilder) TermsAndConditions() *DeviceManagementTermsAndConditionsCollectionRequestBuilder {
bb := &DeviceManagementTermsAndConditionsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/termsAndConditions"
return bb
}
// DeviceManagementTermsAndConditionsCollectionRequestBuilder is request builder for TermsAndConditions collection
type DeviceManagementTermsAndConditionsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for TermsAndConditions collection
func (b *DeviceManagementTermsAndConditionsCollectionRequestBuilder) Request() *DeviceManagementTermsAndConditionsCollectionRequest {
return &DeviceManagementTermsAndConditionsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for TermsAndConditions item
func (b *DeviceManagementTermsAndConditionsCollectionRequestBuilder) ID(id string) *TermsAndConditionsRequestBuilder {
bb := &TermsAndConditionsRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementTermsAndConditionsCollectionRequest is request for TermsAndConditions collection
type DeviceManagementTermsAndConditionsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for TermsAndConditions collection
func (r *DeviceManagementTermsAndConditionsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]TermsAndConditions, 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 []TermsAndConditions
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 []TermsAndConditions
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for TermsAndConditions collection, max N pages
func (r *DeviceManagementTermsAndConditionsCollectionRequest) GetN(ctx context.Context, n int) ([]TermsAndConditions, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for TermsAndConditions collection
func (r *DeviceManagementTermsAndConditionsCollectionRequest) Get(ctx context.Context) ([]TermsAndConditions, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for TermsAndConditions collection
func (r *DeviceManagementTermsAndConditionsCollectionRequest) Add(ctx context.Context, reqObj *TermsAndConditions) (resObj *TermsAndConditions, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// TroubleshootingEvents returns request builder for DeviceManagementTroubleshootingEvent collection
func (b *DeviceManagementRequestBuilder) TroubleshootingEvents() *DeviceManagementTroubleshootingEventsCollectionRequestBuilder {
bb := &DeviceManagementTroubleshootingEventsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/troubleshootingEvents"
return bb
}
// DeviceManagementTroubleshootingEventsCollectionRequestBuilder is request builder for DeviceManagementTroubleshootingEvent collection
type DeviceManagementTroubleshootingEventsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementTroubleshootingEvent collection
func (b *DeviceManagementTroubleshootingEventsCollectionRequestBuilder) Request() *DeviceManagementTroubleshootingEventsCollectionRequest {
return &DeviceManagementTroubleshootingEventsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementTroubleshootingEvent item
func (b *DeviceManagementTroubleshootingEventsCollectionRequestBuilder) ID(id string) *DeviceManagementTroubleshootingEventRequestBuilder {
bb := &DeviceManagementTroubleshootingEventRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementTroubleshootingEventsCollectionRequest is request for DeviceManagementTroubleshootingEvent collection
type DeviceManagementTroubleshootingEventsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementTroubleshootingEvent collection
func (r *DeviceManagementTroubleshootingEventsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementTroubleshootingEvent, 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 []DeviceManagementTroubleshootingEvent
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 []DeviceManagementTroubleshootingEvent
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementTroubleshootingEvent collection, max N pages
func (r *DeviceManagementTroubleshootingEventsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementTroubleshootingEvent, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementTroubleshootingEvent collection
func (r *DeviceManagementTroubleshootingEventsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementTroubleshootingEvent, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementTroubleshootingEvent collection
func (r *DeviceManagementTroubleshootingEventsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementTroubleshootingEvent) (resObj *DeviceManagementTroubleshootingEvent, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// UserExperienceAnalyticsBaselines returns request builder for UserExperienceAnalyticsBaseline collection
func (b *DeviceManagementRequestBuilder) UserExperienceAnalyticsBaselines() *DeviceManagementUserExperienceAnalyticsBaselinesCollectionRequestBuilder {
bb := &DeviceManagementUserExperienceAnalyticsBaselinesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/userExperienceAnalyticsBaselines"
return bb
}
// DeviceManagementUserExperienceAnalyticsBaselinesCollectionRequestBuilder is request builder for UserExperienceAnalyticsBaseline collection
type DeviceManagementUserExperienceAnalyticsBaselinesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for UserExperienceAnalyticsBaseline collection
func (b *DeviceManagementUserExperienceAnalyticsBaselinesCollectionRequestBuilder) Request() *DeviceManagementUserExperienceAnalyticsBaselinesCollectionRequest {
return &DeviceManagementUserExperienceAnalyticsBaselinesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for UserExperienceAnalyticsBaseline item
func (b *DeviceManagementUserExperienceAnalyticsBaselinesCollectionRequestBuilder) ID(id string) *UserExperienceAnalyticsBaselineRequestBuilder {
bb := &UserExperienceAnalyticsBaselineRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementUserExperienceAnalyticsBaselinesCollectionRequest is request for UserExperienceAnalyticsBaseline collection
type DeviceManagementUserExperienceAnalyticsBaselinesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for UserExperienceAnalyticsBaseline collection
func (r *DeviceManagementUserExperienceAnalyticsBaselinesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]UserExperienceAnalyticsBaseline, 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 []UserExperienceAnalyticsBaseline
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 []UserExperienceAnalyticsBaseline
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for UserExperienceAnalyticsBaseline collection, max N pages
func (r *DeviceManagementUserExperienceAnalyticsBaselinesCollectionRequest) GetN(ctx context.Context, n int) ([]UserExperienceAnalyticsBaseline, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for UserExperienceAnalyticsBaseline collection
func (r *DeviceManagementUserExperienceAnalyticsBaselinesCollectionRequest) Get(ctx context.Context) ([]UserExperienceAnalyticsBaseline, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for UserExperienceAnalyticsBaseline collection
func (r *DeviceManagementUserExperienceAnalyticsBaselinesCollectionRequest) Add(ctx context.Context, reqObj *UserExperienceAnalyticsBaseline) (resObj *UserExperienceAnalyticsBaseline, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// UserExperienceAnalyticsCategories returns request builder for UserExperienceAnalyticsCategory collection
func (b *DeviceManagementRequestBuilder) UserExperienceAnalyticsCategories() *DeviceManagementUserExperienceAnalyticsCategoriesCollectionRequestBuilder {
bb := &DeviceManagementUserExperienceAnalyticsCategoriesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/userExperienceAnalyticsCategories"
return bb
}
// DeviceManagementUserExperienceAnalyticsCategoriesCollectionRequestBuilder is request builder for UserExperienceAnalyticsCategory collection
type DeviceManagementUserExperienceAnalyticsCategoriesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for UserExperienceAnalyticsCategory collection
func (b *DeviceManagementUserExperienceAnalyticsCategoriesCollectionRequestBuilder) Request() *DeviceManagementUserExperienceAnalyticsCategoriesCollectionRequest {
return &DeviceManagementUserExperienceAnalyticsCategoriesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for UserExperienceAnalyticsCategory item
func (b *DeviceManagementUserExperienceAnalyticsCategoriesCollectionRequestBuilder) ID(id string) *UserExperienceAnalyticsCategoryRequestBuilder {
bb := &UserExperienceAnalyticsCategoryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementUserExperienceAnalyticsCategoriesCollectionRequest is request for UserExperienceAnalyticsCategory collection
type DeviceManagementUserExperienceAnalyticsCategoriesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for UserExperienceAnalyticsCategory collection
func (r *DeviceManagementUserExperienceAnalyticsCategoriesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]UserExperienceAnalyticsCategory, 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 []UserExperienceAnalyticsCategory
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 []UserExperienceAnalyticsCategory
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for UserExperienceAnalyticsCategory collection, max N pages
func (r *DeviceManagementUserExperienceAnalyticsCategoriesCollectionRequest) GetN(ctx context.Context, n int) ([]UserExperienceAnalyticsCategory, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for UserExperienceAnalyticsCategory collection
func (r *DeviceManagementUserExperienceAnalyticsCategoriesCollectionRequest) Get(ctx context.Context) ([]UserExperienceAnalyticsCategory, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for UserExperienceAnalyticsCategory collection
func (r *DeviceManagementUserExperienceAnalyticsCategoriesCollectionRequest) Add(ctx context.Context, reqObj *UserExperienceAnalyticsCategory) (resObj *UserExperienceAnalyticsCategory, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// UserExperienceAnalyticsDevicePerformance returns request builder for UserExperienceAnalyticsDevicePerformance collection
func (b *DeviceManagementRequestBuilder) UserExperienceAnalyticsDevicePerformance() *DeviceManagementUserExperienceAnalyticsDevicePerformanceCollectionRequestBuilder {
bb := &DeviceManagementUserExperienceAnalyticsDevicePerformanceCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/userExperienceAnalyticsDevicePerformance"
return bb
}
// DeviceManagementUserExperienceAnalyticsDevicePerformanceCollectionRequestBuilder is request builder for UserExperienceAnalyticsDevicePerformance collection
type DeviceManagementUserExperienceAnalyticsDevicePerformanceCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for UserExperienceAnalyticsDevicePerformance collection
func (b *DeviceManagementUserExperienceAnalyticsDevicePerformanceCollectionRequestBuilder) Request() *DeviceManagementUserExperienceAnalyticsDevicePerformanceCollectionRequest {
return &DeviceManagementUserExperienceAnalyticsDevicePerformanceCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for UserExperienceAnalyticsDevicePerformance item
func (b *DeviceManagementUserExperienceAnalyticsDevicePerformanceCollectionRequestBuilder) ID(id string) *UserExperienceAnalyticsDevicePerformanceRequestBuilder {
bb := &UserExperienceAnalyticsDevicePerformanceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementUserExperienceAnalyticsDevicePerformanceCollectionRequest is request for UserExperienceAnalyticsDevicePerformance collection
type DeviceManagementUserExperienceAnalyticsDevicePerformanceCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for UserExperienceAnalyticsDevicePerformance collection
func (r *DeviceManagementUserExperienceAnalyticsDevicePerformanceCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]UserExperienceAnalyticsDevicePerformance, 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 []UserExperienceAnalyticsDevicePerformance
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 []UserExperienceAnalyticsDevicePerformance
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for UserExperienceAnalyticsDevicePerformance collection, max N pages
func (r *DeviceManagementUserExperienceAnalyticsDevicePerformanceCollectionRequest) GetN(ctx context.Context, n int) ([]UserExperienceAnalyticsDevicePerformance, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for UserExperienceAnalyticsDevicePerformance collection
func (r *DeviceManagementUserExperienceAnalyticsDevicePerformanceCollectionRequest) Get(ctx context.Context) ([]UserExperienceAnalyticsDevicePerformance, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for UserExperienceAnalyticsDevicePerformance collection
func (r *DeviceManagementUserExperienceAnalyticsDevicePerformanceCollectionRequest) Add(ctx context.Context, reqObj *UserExperienceAnalyticsDevicePerformance) (resObj *UserExperienceAnalyticsDevicePerformance, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// UserExperienceAnalyticsDeviceStartupHistory returns request builder for UserExperienceAnalyticsDeviceStartupHistory collection
func (b *DeviceManagementRequestBuilder) UserExperienceAnalyticsDeviceStartupHistory() *DeviceManagementUserExperienceAnalyticsDeviceStartupHistoryCollectionRequestBuilder {
bb := &DeviceManagementUserExperienceAnalyticsDeviceStartupHistoryCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/userExperienceAnalyticsDeviceStartupHistory"
return bb
}
// DeviceManagementUserExperienceAnalyticsDeviceStartupHistoryCollectionRequestBuilder is request builder for UserExperienceAnalyticsDeviceStartupHistory collection
type DeviceManagementUserExperienceAnalyticsDeviceStartupHistoryCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for UserExperienceAnalyticsDeviceStartupHistory collection
func (b *DeviceManagementUserExperienceAnalyticsDeviceStartupHistoryCollectionRequestBuilder) Request() *DeviceManagementUserExperienceAnalyticsDeviceStartupHistoryCollectionRequest {
return &DeviceManagementUserExperienceAnalyticsDeviceStartupHistoryCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for UserExperienceAnalyticsDeviceStartupHistory item
func (b *DeviceManagementUserExperienceAnalyticsDeviceStartupHistoryCollectionRequestBuilder) ID(id string) *UserExperienceAnalyticsDeviceStartupHistoryRequestBuilder {
bb := &UserExperienceAnalyticsDeviceStartupHistoryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementUserExperienceAnalyticsDeviceStartupHistoryCollectionRequest is request for UserExperienceAnalyticsDeviceStartupHistory collection
type DeviceManagementUserExperienceAnalyticsDeviceStartupHistoryCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for UserExperienceAnalyticsDeviceStartupHistory collection
func (r *DeviceManagementUserExperienceAnalyticsDeviceStartupHistoryCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]UserExperienceAnalyticsDeviceStartupHistory, 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 []UserExperienceAnalyticsDeviceStartupHistory
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 []UserExperienceAnalyticsDeviceStartupHistory
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for UserExperienceAnalyticsDeviceStartupHistory collection, max N pages
func (r *DeviceManagementUserExperienceAnalyticsDeviceStartupHistoryCollectionRequest) GetN(ctx context.Context, n int) ([]UserExperienceAnalyticsDeviceStartupHistory, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for UserExperienceAnalyticsDeviceStartupHistory collection
func (r *DeviceManagementUserExperienceAnalyticsDeviceStartupHistoryCollectionRequest) Get(ctx context.Context) ([]UserExperienceAnalyticsDeviceStartupHistory, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for UserExperienceAnalyticsDeviceStartupHistory collection
func (r *DeviceManagementUserExperienceAnalyticsDeviceStartupHistoryCollectionRequest) Add(ctx context.Context, reqObj *UserExperienceAnalyticsDeviceStartupHistory) (resObj *UserExperienceAnalyticsDeviceStartupHistory, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// UserExperienceAnalyticsOverview is navigation property
func (b *DeviceManagementRequestBuilder) UserExperienceAnalyticsOverview() *UserExperienceAnalyticsOverviewRequestBuilder {
bb := &UserExperienceAnalyticsOverviewRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/userExperienceAnalyticsOverview"
return bb
}
// UserExperienceAnalyticsRegressionSummary is navigation property
func (b *DeviceManagementRequestBuilder) UserExperienceAnalyticsRegressionSummary() *UserExperienceAnalyticsRegressionSummaryRequestBuilder {
bb := &UserExperienceAnalyticsRegressionSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/userExperienceAnalyticsRegressionSummary"
return bb
}
// UserPfxCertificates returns request builder for UserPFXCertificate collection
func (b *DeviceManagementRequestBuilder) UserPfxCertificates() *DeviceManagementUserPfxCertificatesCollectionRequestBuilder {
bb := &DeviceManagementUserPfxCertificatesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/userPfxCertificates"
return bb
}
// DeviceManagementUserPfxCertificatesCollectionRequestBuilder is request builder for UserPFXCertificate collection
type DeviceManagementUserPfxCertificatesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for UserPFXCertificate collection
func (b *DeviceManagementUserPfxCertificatesCollectionRequestBuilder) Request() *DeviceManagementUserPfxCertificatesCollectionRequest {
return &DeviceManagementUserPfxCertificatesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for UserPFXCertificate item
func (b *DeviceManagementUserPfxCertificatesCollectionRequestBuilder) ID(id string) *UserPFXCertificateRequestBuilder {
bb := &UserPFXCertificateRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementUserPfxCertificatesCollectionRequest is request for UserPFXCertificate collection
type DeviceManagementUserPfxCertificatesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for UserPFXCertificate collection
func (r *DeviceManagementUserPfxCertificatesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]UserPFXCertificate, 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 []UserPFXCertificate
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 []UserPFXCertificate
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for UserPFXCertificate collection, max N pages
func (r *DeviceManagementUserPfxCertificatesCollectionRequest) GetN(ctx context.Context, n int) ([]UserPFXCertificate, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for UserPFXCertificate collection
func (r *DeviceManagementUserPfxCertificatesCollectionRequest) Get(ctx context.Context) ([]UserPFXCertificate, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for UserPFXCertificate collection
func (r *DeviceManagementUserPfxCertificatesCollectionRequest) Add(ctx context.Context, reqObj *UserPFXCertificate) (resObj *UserPFXCertificate, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// WindowsAutopilotDeploymentProfiles returns request builder for WindowsAutopilotDeploymentProfile collection
func (b *DeviceManagementRequestBuilder) WindowsAutopilotDeploymentProfiles() *DeviceManagementWindowsAutopilotDeploymentProfilesCollectionRequestBuilder {
bb := &DeviceManagementWindowsAutopilotDeploymentProfilesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/windowsAutopilotDeploymentProfiles"
return bb
}
// DeviceManagementWindowsAutopilotDeploymentProfilesCollectionRequestBuilder is request builder for WindowsAutopilotDeploymentProfile collection
type DeviceManagementWindowsAutopilotDeploymentProfilesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for WindowsAutopilotDeploymentProfile collection
func (b *DeviceManagementWindowsAutopilotDeploymentProfilesCollectionRequestBuilder) Request() *DeviceManagementWindowsAutopilotDeploymentProfilesCollectionRequest {
return &DeviceManagementWindowsAutopilotDeploymentProfilesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for WindowsAutopilotDeploymentProfile item
func (b *DeviceManagementWindowsAutopilotDeploymentProfilesCollectionRequestBuilder) ID(id string) *WindowsAutopilotDeploymentProfileRequestBuilder {
bb := &WindowsAutopilotDeploymentProfileRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementWindowsAutopilotDeploymentProfilesCollectionRequest is request for WindowsAutopilotDeploymentProfile collection
type DeviceManagementWindowsAutopilotDeploymentProfilesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for WindowsAutopilotDeploymentProfile collection
func (r *DeviceManagementWindowsAutopilotDeploymentProfilesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]WindowsAutopilotDeploymentProfile, 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 []WindowsAutopilotDeploymentProfile
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 []WindowsAutopilotDeploymentProfile
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for WindowsAutopilotDeploymentProfile collection, max N pages
func (r *DeviceManagementWindowsAutopilotDeploymentProfilesCollectionRequest) GetN(ctx context.Context, n int) ([]WindowsAutopilotDeploymentProfile, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for WindowsAutopilotDeploymentProfile collection
func (r *DeviceManagementWindowsAutopilotDeploymentProfilesCollectionRequest) Get(ctx context.Context) ([]WindowsAutopilotDeploymentProfile, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for WindowsAutopilotDeploymentProfile collection
func (r *DeviceManagementWindowsAutopilotDeploymentProfilesCollectionRequest) Add(ctx context.Context, reqObj *WindowsAutopilotDeploymentProfile) (resObj *WindowsAutopilotDeploymentProfile, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// WindowsAutopilotDeviceIdentities returns request builder for WindowsAutopilotDeviceIdentity collection
func (b *DeviceManagementRequestBuilder) WindowsAutopilotDeviceIdentities() *DeviceManagementWindowsAutopilotDeviceIdentitiesCollectionRequestBuilder {
bb := &DeviceManagementWindowsAutopilotDeviceIdentitiesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/windowsAutopilotDeviceIdentities"
return bb
}
// DeviceManagementWindowsAutopilotDeviceIdentitiesCollectionRequestBuilder is request builder for WindowsAutopilotDeviceIdentity collection
type DeviceManagementWindowsAutopilotDeviceIdentitiesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for WindowsAutopilotDeviceIdentity collection
func (b *DeviceManagementWindowsAutopilotDeviceIdentitiesCollectionRequestBuilder) Request() *DeviceManagementWindowsAutopilotDeviceIdentitiesCollectionRequest {
return &DeviceManagementWindowsAutopilotDeviceIdentitiesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for WindowsAutopilotDeviceIdentity item
func (b *DeviceManagementWindowsAutopilotDeviceIdentitiesCollectionRequestBuilder) ID(id string) *WindowsAutopilotDeviceIdentityRequestBuilder {
bb := &WindowsAutopilotDeviceIdentityRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementWindowsAutopilotDeviceIdentitiesCollectionRequest is request for WindowsAutopilotDeviceIdentity collection
type DeviceManagementWindowsAutopilotDeviceIdentitiesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for WindowsAutopilotDeviceIdentity collection
func (r *DeviceManagementWindowsAutopilotDeviceIdentitiesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]WindowsAutopilotDeviceIdentity, 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 []WindowsAutopilotDeviceIdentity
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 []WindowsAutopilotDeviceIdentity
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for WindowsAutopilotDeviceIdentity collection, max N pages
func (r *DeviceManagementWindowsAutopilotDeviceIdentitiesCollectionRequest) GetN(ctx context.Context, n int) ([]WindowsAutopilotDeviceIdentity, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for WindowsAutopilotDeviceIdentity collection
func (r *DeviceManagementWindowsAutopilotDeviceIdentitiesCollectionRequest) Get(ctx context.Context) ([]WindowsAutopilotDeviceIdentity, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for WindowsAutopilotDeviceIdentity collection
func (r *DeviceManagementWindowsAutopilotDeviceIdentitiesCollectionRequest) Add(ctx context.Context, reqObj *WindowsAutopilotDeviceIdentity) (resObj *WindowsAutopilotDeviceIdentity, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// WindowsAutopilotSettings is navigation property
func (b *DeviceManagementRequestBuilder) WindowsAutopilotSettings() *WindowsAutopilotSettingsRequestBuilder {
bb := &WindowsAutopilotSettingsRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/windowsAutopilotSettings"
return bb
}
// WindowsFeatureUpdateProfiles returns request builder for WindowsFeatureUpdateProfile collection
func (b *DeviceManagementRequestBuilder) WindowsFeatureUpdateProfiles() *DeviceManagementWindowsFeatureUpdateProfilesCollectionRequestBuilder {
bb := &DeviceManagementWindowsFeatureUpdateProfilesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/windowsFeatureUpdateProfiles"
return bb
}
// DeviceManagementWindowsFeatureUpdateProfilesCollectionRequestBuilder is request builder for WindowsFeatureUpdateProfile collection
type DeviceManagementWindowsFeatureUpdateProfilesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for WindowsFeatureUpdateProfile collection
func (b *DeviceManagementWindowsFeatureUpdateProfilesCollectionRequestBuilder) Request() *DeviceManagementWindowsFeatureUpdateProfilesCollectionRequest {
return &DeviceManagementWindowsFeatureUpdateProfilesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for WindowsFeatureUpdateProfile item
func (b *DeviceManagementWindowsFeatureUpdateProfilesCollectionRequestBuilder) ID(id string) *WindowsFeatureUpdateProfileRequestBuilder {
bb := &WindowsFeatureUpdateProfileRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementWindowsFeatureUpdateProfilesCollectionRequest is request for WindowsFeatureUpdateProfile collection
type DeviceManagementWindowsFeatureUpdateProfilesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for WindowsFeatureUpdateProfile collection
func (r *DeviceManagementWindowsFeatureUpdateProfilesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]WindowsFeatureUpdateProfile, 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 []WindowsFeatureUpdateProfile
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 []WindowsFeatureUpdateProfile
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for WindowsFeatureUpdateProfile collection, max N pages
func (r *DeviceManagementWindowsFeatureUpdateProfilesCollectionRequest) GetN(ctx context.Context, n int) ([]WindowsFeatureUpdateProfile, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for WindowsFeatureUpdateProfile collection
func (r *DeviceManagementWindowsFeatureUpdateProfilesCollectionRequest) Get(ctx context.Context) ([]WindowsFeatureUpdateProfile, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for WindowsFeatureUpdateProfile collection
func (r *DeviceManagementWindowsFeatureUpdateProfilesCollectionRequest) Add(ctx context.Context, reqObj *WindowsFeatureUpdateProfile) (resObj *WindowsFeatureUpdateProfile, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// WindowsInformationProtectionAppLearningSummaries returns request builder for WindowsInformationProtectionAppLearningSummary collection
func (b *DeviceManagementRequestBuilder) WindowsInformationProtectionAppLearningSummaries() *DeviceManagementWindowsInformationProtectionAppLearningSummariesCollectionRequestBuilder {
bb := &DeviceManagementWindowsInformationProtectionAppLearningSummariesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/windowsInformationProtectionAppLearningSummaries"
return bb
}
// DeviceManagementWindowsInformationProtectionAppLearningSummariesCollectionRequestBuilder is request builder for WindowsInformationProtectionAppLearningSummary collection
type DeviceManagementWindowsInformationProtectionAppLearningSummariesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for WindowsInformationProtectionAppLearningSummary collection
func (b *DeviceManagementWindowsInformationProtectionAppLearningSummariesCollectionRequestBuilder) Request() *DeviceManagementWindowsInformationProtectionAppLearningSummariesCollectionRequest {
return &DeviceManagementWindowsInformationProtectionAppLearningSummariesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for WindowsInformationProtectionAppLearningSummary item
func (b *DeviceManagementWindowsInformationProtectionAppLearningSummariesCollectionRequestBuilder) ID(id string) *WindowsInformationProtectionAppLearningSummaryRequestBuilder {
bb := &WindowsInformationProtectionAppLearningSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementWindowsInformationProtectionAppLearningSummariesCollectionRequest is request for WindowsInformationProtectionAppLearningSummary collection
type DeviceManagementWindowsInformationProtectionAppLearningSummariesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for WindowsInformationProtectionAppLearningSummary collection
func (r *DeviceManagementWindowsInformationProtectionAppLearningSummariesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]WindowsInformationProtectionAppLearningSummary, 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 []WindowsInformationProtectionAppLearningSummary
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 []WindowsInformationProtectionAppLearningSummary
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for WindowsInformationProtectionAppLearningSummary collection, max N pages
func (r *DeviceManagementWindowsInformationProtectionAppLearningSummariesCollectionRequest) GetN(ctx context.Context, n int) ([]WindowsInformationProtectionAppLearningSummary, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for WindowsInformationProtectionAppLearningSummary collection
func (r *DeviceManagementWindowsInformationProtectionAppLearningSummariesCollectionRequest) Get(ctx context.Context) ([]WindowsInformationProtectionAppLearningSummary, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for WindowsInformationProtectionAppLearningSummary collection
func (r *DeviceManagementWindowsInformationProtectionAppLearningSummariesCollectionRequest) Add(ctx context.Context, reqObj *WindowsInformationProtectionAppLearningSummary) (resObj *WindowsInformationProtectionAppLearningSummary, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// WindowsInformationProtectionNetworkLearningSummaries returns request builder for WindowsInformationProtectionNetworkLearningSummary collection
func (b *DeviceManagementRequestBuilder) WindowsInformationProtectionNetworkLearningSummaries() *DeviceManagementWindowsInformationProtectionNetworkLearningSummariesCollectionRequestBuilder {
bb := &DeviceManagementWindowsInformationProtectionNetworkLearningSummariesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/windowsInformationProtectionNetworkLearningSummaries"
return bb
}
// DeviceManagementWindowsInformationProtectionNetworkLearningSummariesCollectionRequestBuilder is request builder for WindowsInformationProtectionNetworkLearningSummary collection
type DeviceManagementWindowsInformationProtectionNetworkLearningSummariesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for WindowsInformationProtectionNetworkLearningSummary collection
func (b *DeviceManagementWindowsInformationProtectionNetworkLearningSummariesCollectionRequestBuilder) Request() *DeviceManagementWindowsInformationProtectionNetworkLearningSummariesCollectionRequest {
return &DeviceManagementWindowsInformationProtectionNetworkLearningSummariesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for WindowsInformationProtectionNetworkLearningSummary item
func (b *DeviceManagementWindowsInformationProtectionNetworkLearningSummariesCollectionRequestBuilder) ID(id string) *WindowsInformationProtectionNetworkLearningSummaryRequestBuilder {
bb := &WindowsInformationProtectionNetworkLearningSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementWindowsInformationProtectionNetworkLearningSummariesCollectionRequest is request for WindowsInformationProtectionNetworkLearningSummary collection
type DeviceManagementWindowsInformationProtectionNetworkLearningSummariesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for WindowsInformationProtectionNetworkLearningSummary collection
func (r *DeviceManagementWindowsInformationProtectionNetworkLearningSummariesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]WindowsInformationProtectionNetworkLearningSummary, 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 []WindowsInformationProtectionNetworkLearningSummary
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 []WindowsInformationProtectionNetworkLearningSummary
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for WindowsInformationProtectionNetworkLearningSummary collection, max N pages
func (r *DeviceManagementWindowsInformationProtectionNetworkLearningSummariesCollectionRequest) GetN(ctx context.Context, n int) ([]WindowsInformationProtectionNetworkLearningSummary, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for WindowsInformationProtectionNetworkLearningSummary collection
func (r *DeviceManagementWindowsInformationProtectionNetworkLearningSummariesCollectionRequest) Get(ctx context.Context) ([]WindowsInformationProtectionNetworkLearningSummary, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for WindowsInformationProtectionNetworkLearningSummary collection
func (r *DeviceManagementWindowsInformationProtectionNetworkLearningSummariesCollectionRequest) Add(ctx context.Context, reqObj *WindowsInformationProtectionNetworkLearningSummary) (resObj *WindowsInformationProtectionNetworkLearningSummary, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// WindowsMalwareInformation returns request builder for WindowsMalwareInformation collection
func (b *DeviceManagementRequestBuilder) WindowsMalwareInformation() *DeviceManagementWindowsMalwareInformationCollectionRequestBuilder {
bb := &DeviceManagementWindowsMalwareInformationCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/windowsMalwareInformation"
return bb
}
// DeviceManagementWindowsMalwareInformationCollectionRequestBuilder is request builder for WindowsMalwareInformation collection
type DeviceManagementWindowsMalwareInformationCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for WindowsMalwareInformation collection
func (b *DeviceManagementWindowsMalwareInformationCollectionRequestBuilder) Request() *DeviceManagementWindowsMalwareInformationCollectionRequest {
return &DeviceManagementWindowsMalwareInformationCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for WindowsMalwareInformation item
func (b *DeviceManagementWindowsMalwareInformationCollectionRequestBuilder) ID(id string) *WindowsMalwareInformationRequestBuilder {
bb := &WindowsMalwareInformationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementWindowsMalwareInformationCollectionRequest is request for WindowsMalwareInformation collection
type DeviceManagementWindowsMalwareInformationCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for WindowsMalwareInformation collection
func (r *DeviceManagementWindowsMalwareInformationCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]WindowsMalwareInformation, 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 []WindowsMalwareInformation
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 []WindowsMalwareInformation
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for WindowsMalwareInformation collection, max N pages
func (r *DeviceManagementWindowsMalwareInformationCollectionRequest) GetN(ctx context.Context, n int) ([]WindowsMalwareInformation, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for WindowsMalwareInformation collection
func (r *DeviceManagementWindowsMalwareInformationCollectionRequest) Get(ctx context.Context) ([]WindowsMalwareInformation, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for WindowsMalwareInformation collection
func (r *DeviceManagementWindowsMalwareInformationCollectionRequest) Add(ctx context.Context, reqObj *WindowsMalwareInformation) (resObj *WindowsMalwareInformation, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Value returns request builder for DeviceManagementSettingInstance collection
func (b *DeviceManagementAbstractComplexSettingInstanceRequestBuilder) Value() *DeviceManagementAbstractComplexSettingInstanceValueCollectionRequestBuilder {
bb := &DeviceManagementAbstractComplexSettingInstanceValueCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/value"
return bb
}
// DeviceManagementAbstractComplexSettingInstanceValueCollectionRequestBuilder is request builder for DeviceManagementSettingInstance collection
type DeviceManagementAbstractComplexSettingInstanceValueCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementSettingInstance collection
func (b *DeviceManagementAbstractComplexSettingInstanceValueCollectionRequestBuilder) Request() *DeviceManagementAbstractComplexSettingInstanceValueCollectionRequest {
return &DeviceManagementAbstractComplexSettingInstanceValueCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementSettingInstance item
func (b *DeviceManagementAbstractComplexSettingInstanceValueCollectionRequestBuilder) ID(id string) *DeviceManagementSettingInstanceRequestBuilder {
bb := &DeviceManagementSettingInstanceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementAbstractComplexSettingInstanceValueCollectionRequest is request for DeviceManagementSettingInstance collection
type DeviceManagementAbstractComplexSettingInstanceValueCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementSettingInstance collection
func (r *DeviceManagementAbstractComplexSettingInstanceValueCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementSettingInstance, error) {
req, err := r.NewJSONRequest(method, path, obj)
if err != nil {
return nil, err
}
if ctx != nil {
req = req.WithContext(ctx)
}
res, err := r.client.Do(req)
if err != nil {
return nil, err
}
var values []DeviceManagementSettingInstance
for {
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
errRes := &ErrorResponse{Response: res}
err := jsonx.Unmarshal(b, errRes)
if err != nil {
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
}
return nil, errRes
}
var (
paging Paging
value []DeviceManagementSettingInstance
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementSettingInstance collection, max N pages
func (r *DeviceManagementAbstractComplexSettingInstanceValueCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementSettingInstance, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementSettingInstance collection
func (r *DeviceManagementAbstractComplexSettingInstanceValueCollectionRequest) Get(ctx context.Context) ([]DeviceManagementSettingInstance, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementSettingInstance collection
func (r *DeviceManagementAbstractComplexSettingInstanceValueCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementSettingInstance) (resObj *DeviceManagementSettingInstance, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Value returns request builder for DeviceManagementSettingInstance collection
func (b *DeviceManagementCollectionSettingInstanceRequestBuilder) Value() *DeviceManagementCollectionSettingInstanceValueCollectionRequestBuilder {
bb := &DeviceManagementCollectionSettingInstanceValueCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/value"
return bb
}
// DeviceManagementCollectionSettingInstanceValueCollectionRequestBuilder is request builder for DeviceManagementSettingInstance collection
type DeviceManagementCollectionSettingInstanceValueCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementSettingInstance collection
func (b *DeviceManagementCollectionSettingInstanceValueCollectionRequestBuilder) Request() *DeviceManagementCollectionSettingInstanceValueCollectionRequest {
return &DeviceManagementCollectionSettingInstanceValueCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementSettingInstance item
func (b *DeviceManagementCollectionSettingInstanceValueCollectionRequestBuilder) ID(id string) *DeviceManagementSettingInstanceRequestBuilder {
bb := &DeviceManagementSettingInstanceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementCollectionSettingInstanceValueCollectionRequest is request for DeviceManagementSettingInstance collection
type DeviceManagementCollectionSettingInstanceValueCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementSettingInstance collection
func (r *DeviceManagementCollectionSettingInstanceValueCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementSettingInstance, error) {
req, err := r.NewJSONRequest(method, path, obj)
if err != nil {
return nil, err
}
if ctx != nil {
req = req.WithContext(ctx)
}
res, err := r.client.Do(req)
if err != nil {
return nil, err
}
var values []DeviceManagementSettingInstance
for {
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
errRes := &ErrorResponse{Response: res}
err := jsonx.Unmarshal(b, errRes)
if err != nil {
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
}
return nil, errRes
}
var (
paging Paging
value []DeviceManagementSettingInstance
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementSettingInstance collection, max N pages
func (r *DeviceManagementCollectionSettingInstanceValueCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementSettingInstance, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementSettingInstance collection
func (r *DeviceManagementCollectionSettingInstanceValueCollectionRequest) Get(ctx context.Context) ([]DeviceManagementSettingInstance, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementSettingInstance collection
func (r *DeviceManagementCollectionSettingInstanceValueCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementSettingInstance) (resObj *DeviceManagementSettingInstance, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Value returns request builder for DeviceManagementSettingInstance collection
func (b *DeviceManagementComplexSettingInstanceRequestBuilder) Value() *DeviceManagementComplexSettingInstanceValueCollectionRequestBuilder {
bb := &DeviceManagementComplexSettingInstanceValueCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/value"
return bb
}
// DeviceManagementComplexSettingInstanceValueCollectionRequestBuilder is request builder for DeviceManagementSettingInstance collection
type DeviceManagementComplexSettingInstanceValueCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementSettingInstance collection
func (b *DeviceManagementComplexSettingInstanceValueCollectionRequestBuilder) Request() *DeviceManagementComplexSettingInstanceValueCollectionRequest {
return &DeviceManagementComplexSettingInstanceValueCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementSettingInstance item
func (b *DeviceManagementComplexSettingInstanceValueCollectionRequestBuilder) ID(id string) *DeviceManagementSettingInstanceRequestBuilder {
bb := &DeviceManagementSettingInstanceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementComplexSettingInstanceValueCollectionRequest is request for DeviceManagementSettingInstance collection
type DeviceManagementComplexSettingInstanceValueCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementSettingInstance collection
func (r *DeviceManagementComplexSettingInstanceValueCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementSettingInstance, error) {
req, err := r.NewJSONRequest(method, path, obj)
if err != nil {
return nil, err
}
if ctx != nil {
req = req.WithContext(ctx)
}
res, err := r.client.Do(req)
if err != nil {
return nil, err
}
var values []DeviceManagementSettingInstance
for {
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
errRes := &ErrorResponse{Response: res}
err := jsonx.Unmarshal(b, errRes)
if err != nil {
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
}
return nil, errRes
}
var (
paging Paging
value []DeviceManagementSettingInstance
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementSettingInstance collection, max N pages
func (r *DeviceManagementComplexSettingInstanceValueCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementSettingInstance, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementSettingInstance collection
func (r *DeviceManagementComplexSettingInstanceValueCollectionRequest) Get(ctx context.Context) ([]DeviceManagementSettingInstance, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementSettingInstance collection
func (r *DeviceManagementComplexSettingInstanceValueCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementSettingInstance) (resObj *DeviceManagementSettingInstance, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ConditionalAccessSettings is navigation property
func (b *DeviceManagementExchangeOnPremisesPolicyRequestBuilder) ConditionalAccessSettings() *OnPremisesConditionalAccessSettingsRequestBuilder {
bb := &OnPremisesConditionalAccessSettingsRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/conditionalAccessSettings"
return bb
}
// Assignments returns request builder for DeviceManagementIntentAssignment collection
func (b *DeviceManagementIntentRequestBuilder) Assignments() *DeviceManagementIntentAssignmentsCollectionRequestBuilder {
bb := &DeviceManagementIntentAssignmentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/assignments"
return bb
}
// DeviceManagementIntentAssignmentsCollectionRequestBuilder is request builder for DeviceManagementIntentAssignment collection
type DeviceManagementIntentAssignmentsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementIntentAssignment collection
func (b *DeviceManagementIntentAssignmentsCollectionRequestBuilder) Request() *DeviceManagementIntentAssignmentsCollectionRequest {
return &DeviceManagementIntentAssignmentsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementIntentAssignment item
func (b *DeviceManagementIntentAssignmentsCollectionRequestBuilder) ID(id string) *DeviceManagementIntentAssignmentRequestBuilder {
bb := &DeviceManagementIntentAssignmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementIntentAssignmentsCollectionRequest is request for DeviceManagementIntentAssignment collection
type DeviceManagementIntentAssignmentsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementIntentAssignment collection
func (r *DeviceManagementIntentAssignmentsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementIntentAssignment, error) {
req, err := r.NewJSONRequest(method, path, obj)
if err != nil {
return nil, err
}
if ctx != nil {
req = req.WithContext(ctx)
}
res, err := r.client.Do(req)
if err != nil {
return nil, err
}
var values []DeviceManagementIntentAssignment
for {
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
errRes := &ErrorResponse{Response: res}
err := jsonx.Unmarshal(b, errRes)
if err != nil {
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
}
return nil, errRes
}
var (
paging Paging
value []DeviceManagementIntentAssignment
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementIntentAssignment collection, max N pages
func (r *DeviceManagementIntentAssignmentsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementIntentAssignment, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementIntentAssignment collection
func (r *DeviceManagementIntentAssignmentsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementIntentAssignment, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementIntentAssignment collection
func (r *DeviceManagementIntentAssignmentsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementIntentAssignment) (resObj *DeviceManagementIntentAssignment, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Categories returns request builder for DeviceManagementIntentSettingCategory collection
func (b *DeviceManagementIntentRequestBuilder) Categories() *DeviceManagementIntentCategoriesCollectionRequestBuilder {
bb := &DeviceManagementIntentCategoriesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/categories"
return bb
}
// DeviceManagementIntentCategoriesCollectionRequestBuilder is request builder for DeviceManagementIntentSettingCategory collection
type DeviceManagementIntentCategoriesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementIntentSettingCategory collection
func (b *DeviceManagementIntentCategoriesCollectionRequestBuilder) Request() *DeviceManagementIntentCategoriesCollectionRequest {
return &DeviceManagementIntentCategoriesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementIntentSettingCategory item
func (b *DeviceManagementIntentCategoriesCollectionRequestBuilder) ID(id string) *DeviceManagementIntentSettingCategoryRequestBuilder {
bb := &DeviceManagementIntentSettingCategoryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementIntentCategoriesCollectionRequest is request for DeviceManagementIntentSettingCategory collection
type DeviceManagementIntentCategoriesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementIntentSettingCategory collection
func (r *DeviceManagementIntentCategoriesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementIntentSettingCategory, error) {
req, err := r.NewJSONRequest(method, path, obj)
if err != nil {
return nil, err
}
if ctx != nil {
req = req.WithContext(ctx)
}
res, err := r.client.Do(req)
if err != nil {
return nil, err
}
var values []DeviceManagementIntentSettingCategory
for {
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
errRes := &ErrorResponse{Response: res}
err := jsonx.Unmarshal(b, errRes)
if err != nil {
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
}
return nil, errRes
}
var (
paging Paging
value []DeviceManagementIntentSettingCategory
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementIntentSettingCategory collection, max N pages
func (r *DeviceManagementIntentCategoriesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementIntentSettingCategory, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementIntentSettingCategory collection
func (r *DeviceManagementIntentCategoriesCollectionRequest) Get(ctx context.Context) ([]DeviceManagementIntentSettingCategory, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementIntentSettingCategory collection
func (r *DeviceManagementIntentCategoriesCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementIntentSettingCategory) (resObj *DeviceManagementIntentSettingCategory, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DeviceSettingStateSummaries returns request builder for DeviceManagementIntentDeviceSettingStateSummary collection
func (b *DeviceManagementIntentRequestBuilder) DeviceSettingStateSummaries() *DeviceManagementIntentDeviceSettingStateSummariesCollectionRequestBuilder {
bb := &DeviceManagementIntentDeviceSettingStateSummariesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceSettingStateSummaries"
return bb
}
// DeviceManagementIntentDeviceSettingStateSummariesCollectionRequestBuilder is request builder for DeviceManagementIntentDeviceSettingStateSummary collection
type DeviceManagementIntentDeviceSettingStateSummariesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementIntentDeviceSettingStateSummary collection
func (b *DeviceManagementIntentDeviceSettingStateSummariesCollectionRequestBuilder) Request() *DeviceManagementIntentDeviceSettingStateSummariesCollectionRequest {
return &DeviceManagementIntentDeviceSettingStateSummariesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementIntentDeviceSettingStateSummary item
func (b *DeviceManagementIntentDeviceSettingStateSummariesCollectionRequestBuilder) ID(id string) *DeviceManagementIntentDeviceSettingStateSummaryRequestBuilder {
bb := &DeviceManagementIntentDeviceSettingStateSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementIntentDeviceSettingStateSummariesCollectionRequest is request for DeviceManagementIntentDeviceSettingStateSummary collection
type DeviceManagementIntentDeviceSettingStateSummariesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementIntentDeviceSettingStateSummary collection
func (r *DeviceManagementIntentDeviceSettingStateSummariesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementIntentDeviceSettingStateSummary, error) {
req, err := r.NewJSONRequest(method, path, obj)
if err != nil {
return nil, err
}
if ctx != nil {
req = req.WithContext(ctx)
}
res, err := r.client.Do(req)
if err != nil {
return nil, err
}
var values []DeviceManagementIntentDeviceSettingStateSummary
for {
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
errRes := &ErrorResponse{Response: res}
err := jsonx.Unmarshal(b, errRes)
if err != nil {
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
}
return nil, errRes
}
var (
paging Paging
value []DeviceManagementIntentDeviceSettingStateSummary
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementIntentDeviceSettingStateSummary collection, max N pages
func (r *DeviceManagementIntentDeviceSettingStateSummariesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementIntentDeviceSettingStateSummary, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementIntentDeviceSettingStateSummary collection
func (r *DeviceManagementIntentDeviceSettingStateSummariesCollectionRequest) Get(ctx context.Context) ([]DeviceManagementIntentDeviceSettingStateSummary, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementIntentDeviceSettingStateSummary collection
func (r *DeviceManagementIntentDeviceSettingStateSummariesCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementIntentDeviceSettingStateSummary) (resObj *DeviceManagementIntentDeviceSettingStateSummary, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DeviceStateSummary is navigation property
func (b *DeviceManagementIntentRequestBuilder) DeviceStateSummary() *DeviceManagementIntentDeviceStateSummaryRequestBuilder {
bb := &DeviceManagementIntentDeviceStateSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceStateSummary"
return bb
}
// DeviceStates returns request builder for DeviceManagementIntentDeviceState collection
func (b *DeviceManagementIntentRequestBuilder) DeviceStates() *DeviceManagementIntentDeviceStatesCollectionRequestBuilder {
bb := &DeviceManagementIntentDeviceStatesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceStates"
return bb
}
// DeviceManagementIntentDeviceStatesCollectionRequestBuilder is request builder for DeviceManagementIntentDeviceState collection
type DeviceManagementIntentDeviceStatesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementIntentDeviceState collection
func (b *DeviceManagementIntentDeviceStatesCollectionRequestBuilder) Request() *DeviceManagementIntentDeviceStatesCollectionRequest {
return &DeviceManagementIntentDeviceStatesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementIntentDeviceState item
func (b *DeviceManagementIntentDeviceStatesCollectionRequestBuilder) ID(id string) *DeviceManagementIntentDeviceStateRequestBuilder {
bb := &DeviceManagementIntentDeviceStateRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementIntentDeviceStatesCollectionRequest is request for DeviceManagementIntentDeviceState collection
type DeviceManagementIntentDeviceStatesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementIntentDeviceState collection
func (r *DeviceManagementIntentDeviceStatesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementIntentDeviceState, error) {
req, err := r.NewJSONRequest(method, path, obj)
if err != nil {
return nil, err
}
if ctx != nil {
req = req.WithContext(ctx)
}
res, err := r.client.Do(req)
if err != nil {
return nil, err
}
var values []DeviceManagementIntentDeviceState
for {
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
errRes := &ErrorResponse{Response: res}
err := jsonx.Unmarshal(b, errRes)
if err != nil {
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
}
return nil, errRes
}
var (
paging Paging
value []DeviceManagementIntentDeviceState
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementIntentDeviceState collection, max N pages
func (r *DeviceManagementIntentDeviceStatesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementIntentDeviceState, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementIntentDeviceState collection
func (r *DeviceManagementIntentDeviceStatesCollectionRequest) Get(ctx context.Context) ([]DeviceManagementIntentDeviceState, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementIntentDeviceState collection
func (r *DeviceManagementIntentDeviceStatesCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementIntentDeviceState) (resObj *DeviceManagementIntentDeviceState, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Settings returns request builder for DeviceManagementSettingInstance collection
func (b *DeviceManagementIntentRequestBuilder) Settings() *DeviceManagementIntentSettingsCollectionRequestBuilder {
bb := &DeviceManagementIntentSettingsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/settings"
return bb
}
// DeviceManagementIntentSettingsCollectionRequestBuilder is request builder for DeviceManagementSettingInstance collection
type DeviceManagementIntentSettingsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementSettingInstance collection
func (b *DeviceManagementIntentSettingsCollectionRequestBuilder) Request() *DeviceManagementIntentSettingsCollectionRequest {
return &DeviceManagementIntentSettingsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementSettingInstance item
func (b *DeviceManagementIntentSettingsCollectionRequestBuilder) ID(id string) *DeviceManagementSettingInstanceRequestBuilder {
bb := &DeviceManagementSettingInstanceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementIntentSettingsCollectionRequest is request for DeviceManagementSettingInstance collection
type DeviceManagementIntentSettingsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementSettingInstance collection
func (r *DeviceManagementIntentSettingsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementSettingInstance, error) {
req, err := r.NewJSONRequest(method, path, obj)
if err != nil {
return nil, err
}
if ctx != nil {
req = req.WithContext(ctx)
}
res, err := r.client.Do(req)
if err != nil {
return nil, err
}
var values []DeviceManagementSettingInstance
for {
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
errRes := &ErrorResponse{Response: res}
err := jsonx.Unmarshal(b, errRes)
if err != nil {
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
}
return nil, errRes
}
var (
paging Paging
value []DeviceManagementSettingInstance
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementSettingInstance collection, max N pages
func (r *DeviceManagementIntentSettingsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementSettingInstance, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementSettingInstance collection
func (r *DeviceManagementIntentSettingsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementSettingInstance, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementSettingInstance collection
func (r *DeviceManagementIntentSettingsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementSettingInstance) (resObj *DeviceManagementSettingInstance, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// UserStateSummary is navigation property
func (b *DeviceManagementIntentRequestBuilder) UserStateSummary() *DeviceManagementIntentUserStateSummaryRequestBuilder {
bb := &DeviceManagementIntentUserStateSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/userStateSummary"
return bb
}
// UserStates returns request builder for DeviceManagementIntentUserState collection
func (b *DeviceManagementIntentRequestBuilder) UserStates() *DeviceManagementIntentUserStatesCollectionRequestBuilder {
bb := &DeviceManagementIntentUserStatesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/userStates"
return bb
}
// DeviceManagementIntentUserStatesCollectionRequestBuilder is request builder for DeviceManagementIntentUserState collection
type DeviceManagementIntentUserStatesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementIntentUserState collection
func (b *DeviceManagementIntentUserStatesCollectionRequestBuilder) Request() *DeviceManagementIntentUserStatesCollectionRequest {
return &DeviceManagementIntentUserStatesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementIntentUserState item
func (b *DeviceManagementIntentUserStatesCollectionRequestBuilder) ID(id string) *DeviceManagementIntentUserStateRequestBuilder {
bb := &DeviceManagementIntentUserStateRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementIntentUserStatesCollectionRequest is request for DeviceManagementIntentUserState collection
type DeviceManagementIntentUserStatesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementIntentUserState collection
func (r *DeviceManagementIntentUserStatesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementIntentUserState, error) {
req, err := r.NewJSONRequest(method, path, obj)
if err != nil {
return nil, err
}
if ctx != nil {
req = req.WithContext(ctx)
}
res, err := r.client.Do(req)
if err != nil {
return nil, err
}
var values []DeviceManagementIntentUserState
for {
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
errRes := &ErrorResponse{Response: res}
err := jsonx.Unmarshal(b, errRes)
if err != nil {
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
}
return nil, errRes
}
var (
paging Paging
value []DeviceManagementIntentUserState
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementIntentUserState collection, max N pages
func (r *DeviceManagementIntentUserStatesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementIntentUserState, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementIntentUserState collection
func (r *DeviceManagementIntentUserStatesCollectionRequest) Get(ctx context.Context) ([]DeviceManagementIntentUserState, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementIntentUserState collection
func (r *DeviceManagementIntentUserStatesCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementIntentUserState) (resObj *DeviceManagementIntentUserState, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Settings returns request builder for DeviceManagementSettingInstance collection
func (b *DeviceManagementIntentSettingCategoryRequestBuilder) Settings() *DeviceManagementIntentSettingCategorySettingsCollectionRequestBuilder {
bb := &DeviceManagementIntentSettingCategorySettingsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/settings"
return bb
}
// DeviceManagementIntentSettingCategorySettingsCollectionRequestBuilder is request builder for DeviceManagementSettingInstance collection
type DeviceManagementIntentSettingCategorySettingsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementSettingInstance collection
func (b *DeviceManagementIntentSettingCategorySettingsCollectionRequestBuilder) Request() *DeviceManagementIntentSettingCategorySettingsCollectionRequest {
return &DeviceManagementIntentSettingCategorySettingsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementSettingInstance item
func (b *DeviceManagementIntentSettingCategorySettingsCollectionRequestBuilder) ID(id string) *DeviceManagementSettingInstanceRequestBuilder {
bb := &DeviceManagementSettingInstanceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementIntentSettingCategorySettingsCollectionRequest is request for DeviceManagementSettingInstance collection
type DeviceManagementIntentSettingCategorySettingsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementSettingInstance collection
func (r *DeviceManagementIntentSettingCategorySettingsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementSettingInstance, error) {
req, err := r.NewJSONRequest(method, path, obj)
if err != nil {
return nil, err
}
if ctx != nil {
req = req.WithContext(ctx)
}
res, err := r.client.Do(req)
if err != nil {
return nil, err
}
var values []DeviceManagementSettingInstance
for {
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
errRes := &ErrorResponse{Response: res}
err := jsonx.Unmarshal(b, errRes)
if err != nil {
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
}
return nil, errRes
}
var (
paging Paging
value []DeviceManagementSettingInstance
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementSettingInstance collection, max N pages
func (r *DeviceManagementIntentSettingCategorySettingsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementSettingInstance, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementSettingInstance collection
func (r *DeviceManagementIntentSettingCategorySettingsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementSettingInstance, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementSettingInstance collection
func (r *DeviceManagementIntentSettingCategorySettingsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementSettingInstance) (resObj *DeviceManagementSettingInstance, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// CachedReportConfigurations returns request builder for DeviceManagementCachedReportConfiguration collection
func (b *DeviceManagementReportsRequestBuilder) CachedReportConfigurations() *DeviceManagementReportsCachedReportConfigurationsCollectionRequestBuilder {
bb := &DeviceManagementReportsCachedReportConfigurationsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/cachedReportConfigurations"
return bb
}
// DeviceManagementReportsCachedReportConfigurationsCollectionRequestBuilder is request builder for DeviceManagementCachedReportConfiguration collection
type DeviceManagementReportsCachedReportConfigurationsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementCachedReportConfiguration collection
func (b *DeviceManagementReportsCachedReportConfigurationsCollectionRequestBuilder) Request() *DeviceManagementReportsCachedReportConfigurationsCollectionRequest {
return &DeviceManagementReportsCachedReportConfigurationsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementCachedReportConfiguration item
func (b *DeviceManagementReportsCachedReportConfigurationsCollectionRequestBuilder) ID(id string) *DeviceManagementCachedReportConfigurationRequestBuilder {
bb := &DeviceManagementCachedReportConfigurationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementReportsCachedReportConfigurationsCollectionRequest is request for DeviceManagementCachedReportConfiguration collection
type DeviceManagementReportsCachedReportConfigurationsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementCachedReportConfiguration collection
func (r *DeviceManagementReportsCachedReportConfigurationsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementCachedReportConfiguration, 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 []DeviceManagementCachedReportConfiguration
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 []DeviceManagementCachedReportConfiguration
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementCachedReportConfiguration collection, max N pages
func (r *DeviceManagementReportsCachedReportConfigurationsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementCachedReportConfiguration, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementCachedReportConfiguration collection
func (r *DeviceManagementReportsCachedReportConfigurationsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementCachedReportConfiguration, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementCachedReportConfiguration collection
func (r *DeviceManagementReportsCachedReportConfigurationsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementCachedReportConfiguration) (resObj *DeviceManagementCachedReportConfiguration, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ExportJobs returns request builder for DeviceManagementExportJob collection
func (b *DeviceManagementReportsRequestBuilder) ExportJobs() *DeviceManagementReportsExportJobsCollectionRequestBuilder {
bb := &DeviceManagementReportsExportJobsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/exportJobs"
return bb
}
// DeviceManagementReportsExportJobsCollectionRequestBuilder is request builder for DeviceManagementExportJob collection
type DeviceManagementReportsExportJobsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementExportJob collection
func (b *DeviceManagementReportsExportJobsCollectionRequestBuilder) Request() *DeviceManagementReportsExportJobsCollectionRequest {
return &DeviceManagementReportsExportJobsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementExportJob item
func (b *DeviceManagementReportsExportJobsCollectionRequestBuilder) ID(id string) *DeviceManagementExportJobRequestBuilder {
bb := &DeviceManagementExportJobRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementReportsExportJobsCollectionRequest is request for DeviceManagementExportJob collection
type DeviceManagementReportsExportJobsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementExportJob collection
func (r *DeviceManagementReportsExportJobsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementExportJob, 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 []DeviceManagementExportJob
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 []DeviceManagementExportJob
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementExportJob collection, max N pages
func (r *DeviceManagementReportsExportJobsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementExportJob, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementExportJob collection
func (r *DeviceManagementReportsExportJobsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementExportJob, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementExportJob collection
func (r *DeviceManagementReportsExportJobsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementExportJob) (resObj *DeviceManagementExportJob, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ReportSchedules returns request builder for DeviceManagementReportSchedule collection
func (b *DeviceManagementReportsRequestBuilder) ReportSchedules() *DeviceManagementReportsReportSchedulesCollectionRequestBuilder {
bb := &DeviceManagementReportsReportSchedulesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/reportSchedules"
return bb
}
// DeviceManagementReportsReportSchedulesCollectionRequestBuilder is request builder for DeviceManagementReportSchedule collection
type DeviceManagementReportsReportSchedulesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementReportSchedule collection
func (b *DeviceManagementReportsReportSchedulesCollectionRequestBuilder) Request() *DeviceManagementReportsReportSchedulesCollectionRequest {
return &DeviceManagementReportsReportSchedulesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementReportSchedule item
func (b *DeviceManagementReportsReportSchedulesCollectionRequestBuilder) ID(id string) *DeviceManagementReportScheduleRequestBuilder {
bb := &DeviceManagementReportScheduleRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementReportsReportSchedulesCollectionRequest is request for DeviceManagementReportSchedule collection
type DeviceManagementReportsReportSchedulesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementReportSchedule collection
func (r *DeviceManagementReportsReportSchedulesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementReportSchedule, 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 []DeviceManagementReportSchedule
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 []DeviceManagementReportSchedule
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementReportSchedule collection, max N pages
func (r *DeviceManagementReportsReportSchedulesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementReportSchedule, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementReportSchedule collection
func (r *DeviceManagementReportsReportSchedulesCollectionRequest) Get(ctx context.Context) ([]DeviceManagementReportSchedule, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementReportSchedule collection
func (r *DeviceManagementReportsReportSchedulesCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementReportSchedule) (resObj *DeviceManagementReportSchedule, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Assignments returns request builder for DeviceManagementScriptAssignment collection
func (b *DeviceManagementScriptRequestBuilder) Assignments() *DeviceManagementScriptAssignmentsCollectionRequestBuilder {
bb := &DeviceManagementScriptAssignmentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/assignments"
return bb
}
// DeviceManagementScriptAssignmentsCollectionRequestBuilder is request builder for DeviceManagementScriptAssignment collection
type DeviceManagementScriptAssignmentsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementScriptAssignment collection
func (b *DeviceManagementScriptAssignmentsCollectionRequestBuilder) Request() *DeviceManagementScriptAssignmentsCollectionRequest {
return &DeviceManagementScriptAssignmentsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementScriptAssignment item
func (b *DeviceManagementScriptAssignmentsCollectionRequestBuilder) ID(id string) *DeviceManagementScriptAssignmentRequestBuilder {
bb := &DeviceManagementScriptAssignmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementScriptAssignmentsCollectionRequest is request for DeviceManagementScriptAssignment collection
type DeviceManagementScriptAssignmentsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementScriptAssignment collection
func (r *DeviceManagementScriptAssignmentsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementScriptAssignment, 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 []DeviceManagementScriptAssignment
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 []DeviceManagementScriptAssignment
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementScriptAssignment collection, max N pages
func (r *DeviceManagementScriptAssignmentsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementScriptAssignment, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementScriptAssignment collection
func (r *DeviceManagementScriptAssignmentsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementScriptAssignment, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementScriptAssignment collection
func (r *DeviceManagementScriptAssignmentsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementScriptAssignment) (resObj *DeviceManagementScriptAssignment, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DeviceRunStates returns request builder for DeviceManagementScriptDeviceState collection
func (b *DeviceManagementScriptRequestBuilder) DeviceRunStates() *DeviceManagementScriptDeviceRunStatesCollectionRequestBuilder {
bb := &DeviceManagementScriptDeviceRunStatesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceRunStates"
return bb
}
// DeviceManagementScriptDeviceRunStatesCollectionRequestBuilder is request builder for DeviceManagementScriptDeviceState collection
type DeviceManagementScriptDeviceRunStatesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementScriptDeviceState collection
func (b *DeviceManagementScriptDeviceRunStatesCollectionRequestBuilder) Request() *DeviceManagementScriptDeviceRunStatesCollectionRequest {
return &DeviceManagementScriptDeviceRunStatesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementScriptDeviceState item
func (b *DeviceManagementScriptDeviceRunStatesCollectionRequestBuilder) ID(id string) *DeviceManagementScriptDeviceStateRequestBuilder {
bb := &DeviceManagementScriptDeviceStateRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementScriptDeviceRunStatesCollectionRequest is request for DeviceManagementScriptDeviceState collection
type DeviceManagementScriptDeviceRunStatesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementScriptDeviceState collection
func (r *DeviceManagementScriptDeviceRunStatesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementScriptDeviceState, 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 []DeviceManagementScriptDeviceState
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 []DeviceManagementScriptDeviceState
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementScriptDeviceState collection, max N pages
func (r *DeviceManagementScriptDeviceRunStatesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementScriptDeviceState, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementScriptDeviceState collection
func (r *DeviceManagementScriptDeviceRunStatesCollectionRequest) Get(ctx context.Context) ([]DeviceManagementScriptDeviceState, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementScriptDeviceState collection
func (r *DeviceManagementScriptDeviceRunStatesCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementScriptDeviceState) (resObj *DeviceManagementScriptDeviceState, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// GroupAssignments returns request builder for DeviceManagementScriptGroupAssignment collection
func (b *DeviceManagementScriptRequestBuilder) GroupAssignments() *DeviceManagementScriptGroupAssignmentsCollectionRequestBuilder {
bb := &DeviceManagementScriptGroupAssignmentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/groupAssignments"
return bb
}
// DeviceManagementScriptGroupAssignmentsCollectionRequestBuilder is request builder for DeviceManagementScriptGroupAssignment collection
type DeviceManagementScriptGroupAssignmentsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementScriptGroupAssignment collection
func (b *DeviceManagementScriptGroupAssignmentsCollectionRequestBuilder) Request() *DeviceManagementScriptGroupAssignmentsCollectionRequest {
return &DeviceManagementScriptGroupAssignmentsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementScriptGroupAssignment item
func (b *DeviceManagementScriptGroupAssignmentsCollectionRequestBuilder) ID(id string) *DeviceManagementScriptGroupAssignmentRequestBuilder {
bb := &DeviceManagementScriptGroupAssignmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementScriptGroupAssignmentsCollectionRequest is request for DeviceManagementScriptGroupAssignment collection
type DeviceManagementScriptGroupAssignmentsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementScriptGroupAssignment collection
func (r *DeviceManagementScriptGroupAssignmentsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementScriptGroupAssignment, 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 []DeviceManagementScriptGroupAssignment
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 []DeviceManagementScriptGroupAssignment
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementScriptGroupAssignment collection, max N pages
func (r *DeviceManagementScriptGroupAssignmentsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementScriptGroupAssignment, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementScriptGroupAssignment collection
func (r *DeviceManagementScriptGroupAssignmentsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementScriptGroupAssignment, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementScriptGroupAssignment collection
func (r *DeviceManagementScriptGroupAssignmentsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementScriptGroupAssignment) (resObj *DeviceManagementScriptGroupAssignment, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// RunSummary is navigation property
func (b *DeviceManagementScriptRequestBuilder) RunSummary() *DeviceManagementScriptRunSummaryRequestBuilder {
bb := &DeviceManagementScriptRunSummaryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/runSummary"
return bb
}
// UserRunStates returns request builder for DeviceManagementScriptUserState collection
func (b *DeviceManagementScriptRequestBuilder) UserRunStates() *DeviceManagementScriptUserRunStatesCollectionRequestBuilder {
bb := &DeviceManagementScriptUserRunStatesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/userRunStates"
return bb
}
// DeviceManagementScriptUserRunStatesCollectionRequestBuilder is request builder for DeviceManagementScriptUserState collection
type DeviceManagementScriptUserRunStatesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementScriptUserState collection
func (b *DeviceManagementScriptUserRunStatesCollectionRequestBuilder) Request() *DeviceManagementScriptUserRunStatesCollectionRequest {
return &DeviceManagementScriptUserRunStatesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementScriptUserState item
func (b *DeviceManagementScriptUserRunStatesCollectionRequestBuilder) ID(id string) *DeviceManagementScriptUserStateRequestBuilder {
bb := &DeviceManagementScriptUserStateRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementScriptUserRunStatesCollectionRequest is request for DeviceManagementScriptUserState collection
type DeviceManagementScriptUserRunStatesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementScriptUserState collection
func (r *DeviceManagementScriptUserRunStatesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementScriptUserState, 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 []DeviceManagementScriptUserState
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 []DeviceManagementScriptUserState
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementScriptUserState collection, max N pages
func (r *DeviceManagementScriptUserRunStatesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementScriptUserState, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementScriptUserState collection
func (r *DeviceManagementScriptUserRunStatesCollectionRequest) Get(ctx context.Context) ([]DeviceManagementScriptUserState, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementScriptUserState collection
func (r *DeviceManagementScriptUserRunStatesCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementScriptUserState) (resObj *DeviceManagementScriptUserState, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ManagedDevice is navigation property
func (b *DeviceManagementScriptDeviceStateRequestBuilder) ManagedDevice() *ManagedDeviceRequestBuilder {
bb := &ManagedDeviceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/managedDevice"
return bb
}
// DeviceRunStates returns request builder for DeviceManagementScriptDeviceState collection
func (b *DeviceManagementScriptUserStateRequestBuilder) DeviceRunStates() *DeviceManagementScriptUserStateDeviceRunStatesCollectionRequestBuilder {
bb := &DeviceManagementScriptUserStateDeviceRunStatesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceRunStates"
return bb
}
// DeviceManagementScriptUserStateDeviceRunStatesCollectionRequestBuilder is request builder for DeviceManagementScriptDeviceState collection
type DeviceManagementScriptUserStateDeviceRunStatesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementScriptDeviceState collection
func (b *DeviceManagementScriptUserStateDeviceRunStatesCollectionRequestBuilder) Request() *DeviceManagementScriptUserStateDeviceRunStatesCollectionRequest {
return &DeviceManagementScriptUserStateDeviceRunStatesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementScriptDeviceState item
func (b *DeviceManagementScriptUserStateDeviceRunStatesCollectionRequestBuilder) ID(id string) *DeviceManagementScriptDeviceStateRequestBuilder {
bb := &DeviceManagementScriptDeviceStateRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementScriptUserStateDeviceRunStatesCollectionRequest is request for DeviceManagementScriptDeviceState collection
type DeviceManagementScriptUserStateDeviceRunStatesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementScriptDeviceState collection
func (r *DeviceManagementScriptUserStateDeviceRunStatesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementScriptDeviceState, 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 []DeviceManagementScriptDeviceState
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 []DeviceManagementScriptDeviceState
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementScriptDeviceState collection, max N pages
func (r *DeviceManagementScriptUserStateDeviceRunStatesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementScriptDeviceState, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementScriptDeviceState collection
func (r *DeviceManagementScriptUserStateDeviceRunStatesCollectionRequest) Get(ctx context.Context) ([]DeviceManagementScriptDeviceState, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementScriptDeviceState collection
func (r *DeviceManagementScriptUserStateDeviceRunStatesCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementScriptDeviceState) (resObj *DeviceManagementScriptDeviceState, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// SettingDefinitions returns request builder for DeviceManagementSettingDefinition collection
func (b *DeviceManagementSettingCategoryRequestBuilder) SettingDefinitions() *DeviceManagementSettingCategorySettingDefinitionsCollectionRequestBuilder {
bb := &DeviceManagementSettingCategorySettingDefinitionsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/settingDefinitions"
return bb
}
// DeviceManagementSettingCategorySettingDefinitionsCollectionRequestBuilder is request builder for DeviceManagementSettingDefinition collection
type DeviceManagementSettingCategorySettingDefinitionsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementSettingDefinition collection
func (b *DeviceManagementSettingCategorySettingDefinitionsCollectionRequestBuilder) Request() *DeviceManagementSettingCategorySettingDefinitionsCollectionRequest {
return &DeviceManagementSettingCategorySettingDefinitionsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementSettingDefinition item
func (b *DeviceManagementSettingCategorySettingDefinitionsCollectionRequestBuilder) ID(id string) *DeviceManagementSettingDefinitionRequestBuilder {
bb := &DeviceManagementSettingDefinitionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementSettingCategorySettingDefinitionsCollectionRequest is request for DeviceManagementSettingDefinition collection
type DeviceManagementSettingCategorySettingDefinitionsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementSettingDefinition collection
func (r *DeviceManagementSettingCategorySettingDefinitionsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementSettingDefinition, 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 []DeviceManagementSettingDefinition
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 []DeviceManagementSettingDefinition
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementSettingDefinition collection, max N pages
func (r *DeviceManagementSettingCategorySettingDefinitionsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementSettingDefinition, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementSettingDefinition collection
func (r *DeviceManagementSettingCategorySettingDefinitionsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementSettingDefinition, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementSettingDefinition collection
func (r *DeviceManagementSettingCategorySettingDefinitionsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementSettingDefinition) (resObj *DeviceManagementSettingDefinition, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Categories returns request builder for DeviceManagementTemplateSettingCategory collection
func (b *DeviceManagementTemplateRequestBuilder) Categories() *DeviceManagementTemplateCategoriesCollectionRequestBuilder {
bb := &DeviceManagementTemplateCategoriesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/categories"
return bb
}
// DeviceManagementTemplateCategoriesCollectionRequestBuilder is request builder for DeviceManagementTemplateSettingCategory collection
type DeviceManagementTemplateCategoriesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementTemplateSettingCategory collection
func (b *DeviceManagementTemplateCategoriesCollectionRequestBuilder) Request() *DeviceManagementTemplateCategoriesCollectionRequest {
return &DeviceManagementTemplateCategoriesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementTemplateSettingCategory item
func (b *DeviceManagementTemplateCategoriesCollectionRequestBuilder) ID(id string) *DeviceManagementTemplateSettingCategoryRequestBuilder {
bb := &DeviceManagementTemplateSettingCategoryRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementTemplateCategoriesCollectionRequest is request for DeviceManagementTemplateSettingCategory collection
type DeviceManagementTemplateCategoriesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementTemplateSettingCategory collection
func (r *DeviceManagementTemplateCategoriesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementTemplateSettingCategory, 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 []DeviceManagementTemplateSettingCategory
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 []DeviceManagementTemplateSettingCategory
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementTemplateSettingCategory collection, max N pages
func (r *DeviceManagementTemplateCategoriesCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementTemplateSettingCategory, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementTemplateSettingCategory collection
func (r *DeviceManagementTemplateCategoriesCollectionRequest) Get(ctx context.Context) ([]DeviceManagementTemplateSettingCategory, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementTemplateSettingCategory collection
func (r *DeviceManagementTemplateCategoriesCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementTemplateSettingCategory) (resObj *DeviceManagementTemplateSettingCategory, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// MigratableTo returns request builder for DeviceManagementTemplate collection
func (b *DeviceManagementTemplateRequestBuilder) MigratableTo() *DeviceManagementTemplateMigratableToCollectionRequestBuilder {
bb := &DeviceManagementTemplateMigratableToCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/migratableTo"
return bb
}
// DeviceManagementTemplateMigratableToCollectionRequestBuilder is request builder for DeviceManagementTemplate collection
type DeviceManagementTemplateMigratableToCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementTemplate collection
func (b *DeviceManagementTemplateMigratableToCollectionRequestBuilder) Request() *DeviceManagementTemplateMigratableToCollectionRequest {
return &DeviceManagementTemplateMigratableToCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementTemplate item
func (b *DeviceManagementTemplateMigratableToCollectionRequestBuilder) ID(id string) *DeviceManagementTemplateRequestBuilder {
bb := &DeviceManagementTemplateRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementTemplateMigratableToCollectionRequest is request for DeviceManagementTemplate collection
type DeviceManagementTemplateMigratableToCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementTemplate collection
func (r *DeviceManagementTemplateMigratableToCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementTemplate, 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 []DeviceManagementTemplate
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 []DeviceManagementTemplate
)
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 n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementTemplate collection, max N pages
func (r *DeviceManagementTemplateMigratableToCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementTemplate, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementTemplate collection
func (r *DeviceManagementTemplateMigratableToCollectionRequest) Get(ctx context.Context) ([]DeviceManagementTemplate, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementTemplate collection
func (r *DeviceManagementTemplateMigratableToCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementTemplate) (resObj *DeviceManagementTemplate, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Settings returns request builder for DeviceManagementSettingInstance collection
func (b *DeviceManagementTemplateRequestBuilder) Settings() *DeviceManagementTemplateSettingsCollectionRequestBuilder {
bb := &DeviceManagementTemplateSettingsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/settings"
return bb
}
// DeviceManagementTemplateSettingsCollectionRequestBuilder is request builder for DeviceManagementSettingInstance collection
type DeviceManagementTemplateSettingsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementSettingInstance collection
func (b *DeviceManagementTemplateSettingsCollectionRequestBuilder) Request() *DeviceManagementTemplateSettingsCollectionRequest {
return &DeviceManagementTemplateSettingsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementSettingInstance item
func (b *DeviceManagementTemplateSettingsCollectionRequestBuilder) ID(id string) *DeviceManagementSettingInstanceRequestBuilder {
bb := &DeviceManagementSettingInstanceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementTemplateSettingsCollectionRequest is request for DeviceManagementSettingInstance collection
type DeviceManagementTemplateSettingsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementSettingInstance collection
func (r *DeviceManagementTemplateSettingsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementSettingInstance, error) {
req, err := r.NewJSONRequest(method, path, obj)
if err != nil {
return nil, err
}
if ctx != nil {
req = req.WithContext(ctx)
}
res, err := r.client.Do(req)
if err != nil {
return nil, err
}
var values []DeviceManagementSettingInstance
for {
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
errRes := &ErrorResponse{Response: res}
err := jsonx.Unmarshal(b, errRes)
if err != nil {
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
}
return nil, errRes
}
var (
paging Paging
value []DeviceManagementSettingInstance
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementSettingInstance collection, max N pages
func (r *DeviceManagementTemplateSettingsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementSettingInstance, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementSettingInstance collection
func (r *DeviceManagementTemplateSettingsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementSettingInstance, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementSettingInstance collection
func (r *DeviceManagementTemplateSettingsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementSettingInstance) (resObj *DeviceManagementSettingInstance, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// RecommendedSettings returns request builder for DeviceManagementSettingInstance collection
func (b *DeviceManagementTemplateSettingCategoryRequestBuilder) RecommendedSettings() *DeviceManagementTemplateSettingCategoryRecommendedSettingsCollectionRequestBuilder {
bb := &DeviceManagementTemplateSettingCategoryRecommendedSettingsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/recommendedSettings"
return bb
}
// DeviceManagementTemplateSettingCategoryRecommendedSettingsCollectionRequestBuilder is request builder for DeviceManagementSettingInstance collection
type DeviceManagementTemplateSettingCategoryRecommendedSettingsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementSettingInstance collection
func (b *DeviceManagementTemplateSettingCategoryRecommendedSettingsCollectionRequestBuilder) Request() *DeviceManagementTemplateSettingCategoryRecommendedSettingsCollectionRequest {
return &DeviceManagementTemplateSettingCategoryRecommendedSettingsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementSettingInstance item
func (b *DeviceManagementTemplateSettingCategoryRecommendedSettingsCollectionRequestBuilder) ID(id string) *DeviceManagementSettingInstanceRequestBuilder {
bb := &DeviceManagementSettingInstanceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// DeviceManagementTemplateSettingCategoryRecommendedSettingsCollectionRequest is request for DeviceManagementSettingInstance collection
type DeviceManagementTemplateSettingCategoryRecommendedSettingsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementSettingInstance collection
func (r *DeviceManagementTemplateSettingCategoryRecommendedSettingsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]DeviceManagementSettingInstance, error) {
req, err := r.NewJSONRequest(method, path, obj)
if err != nil {
return nil, err
}
if ctx != nil {
req = req.WithContext(ctx)
}
res, err := r.client.Do(req)
if err != nil {
return nil, err
}
var values []DeviceManagementSettingInstance
for {
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
errRes := &ErrorResponse{Response: res}
err := jsonx.Unmarshal(b, errRes)
if err != nil {
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
}
return nil, errRes
}
var (
paging Paging
value []DeviceManagementSettingInstance
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for DeviceManagementSettingInstance collection, max N pages
func (r *DeviceManagementTemplateSettingCategoryRecommendedSettingsCollectionRequest) GetN(ctx context.Context, n int) ([]DeviceManagementSettingInstance, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for DeviceManagementSettingInstance collection
func (r *DeviceManagementTemplateSettingCategoryRecommendedSettingsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementSettingInstance, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for DeviceManagementSettingInstance collection
func (r *DeviceManagementTemplateSettingCategoryRecommendedSettingsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementSettingInstance) (resObj *DeviceManagementSettingInstance, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}