// Code generated by msgraph.go/gen DO NOT EDIT.

package msgraph

import (
	"context"
	"fmt"
	"io/ioutil"
	"net/http"

	"github.com/yaegashi/msgraph.go/jsonx"
)

// GroupRequestBuilder is request builder for Group
type GroupRequestBuilder struct{ BaseRequestBuilder }

// Request returns GroupRequest
func (b *GroupRequestBuilder) Request() *GroupRequest {
	return &GroupRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
	}
}

// GroupRequest is request for Group
type GroupRequest struct{ BaseRequest }

// Get performs GET request for Group
func (r *GroupRequest) Get(ctx context.Context) (resObj *Group, err error) {
	var query string
	if r.query != nil {
		query = "?" + r.query.Encode()
	}
	err = r.JSONRequest(ctx, "GET", query, nil, &resObj)
	return
}

// Update performs PATCH request for Group
func (r *GroupRequest) Update(ctx context.Context, reqObj *Group) error {
	return r.JSONRequest(ctx, "PATCH", "", reqObj, nil)
}

// Delete performs DELETE request for Group
func (r *GroupRequest) Delete(ctx context.Context) error {
	return r.JSONRequest(ctx, "DELETE", "", nil, nil)
}

// GroupLifecyclePolicyRequestBuilder is request builder for GroupLifecyclePolicy
type GroupLifecyclePolicyRequestBuilder struct{ BaseRequestBuilder }

// Request returns GroupLifecyclePolicyRequest
func (b *GroupLifecyclePolicyRequestBuilder) Request() *GroupLifecyclePolicyRequest {
	return &GroupLifecyclePolicyRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
	}
}

// GroupLifecyclePolicyRequest is request for GroupLifecyclePolicy
type GroupLifecyclePolicyRequest struct{ BaseRequest }

// Get performs GET request for GroupLifecyclePolicy
func (r *GroupLifecyclePolicyRequest) Get(ctx context.Context) (resObj *GroupLifecyclePolicy, err error) {
	var query string
	if r.query != nil {
		query = "?" + r.query.Encode()
	}
	err = r.JSONRequest(ctx, "GET", query, nil, &resObj)
	return
}

// Update performs PATCH request for GroupLifecyclePolicy
func (r *GroupLifecyclePolicyRequest) Update(ctx context.Context, reqObj *GroupLifecyclePolicy) error {
	return r.JSONRequest(ctx, "PATCH", "", reqObj, nil)
}

// Delete performs DELETE request for GroupLifecyclePolicy
func (r *GroupLifecyclePolicyRequest) Delete(ctx context.Context) error {
	return r.JSONRequest(ctx, "DELETE", "", nil, nil)
}

// GroupPolicyConfigurationRequestBuilder is request builder for GroupPolicyConfiguration
type GroupPolicyConfigurationRequestBuilder struct{ BaseRequestBuilder }

// Request returns GroupPolicyConfigurationRequest
func (b *GroupPolicyConfigurationRequestBuilder) Request() *GroupPolicyConfigurationRequest {
	return &GroupPolicyConfigurationRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
	}
}

// GroupPolicyConfigurationRequest is request for GroupPolicyConfiguration
type GroupPolicyConfigurationRequest struct{ BaseRequest }

// Get performs GET request for GroupPolicyConfiguration
func (r *GroupPolicyConfigurationRequest) Get(ctx context.Context) (resObj *GroupPolicyConfiguration, err error) {
	var query string
	if r.query != nil {
		query = "?" + r.query.Encode()
	}
	err = r.JSONRequest(ctx, "GET", query, nil, &resObj)
	return
}

// Update performs PATCH request for GroupPolicyConfiguration
func (r *GroupPolicyConfigurationRequest) Update(ctx context.Context, reqObj *GroupPolicyConfiguration) error {
	return r.JSONRequest(ctx, "PATCH", "", reqObj, nil)
}

// Delete performs DELETE request for GroupPolicyConfiguration
func (r *GroupPolicyConfigurationRequest) Delete(ctx context.Context) error {
	return r.JSONRequest(ctx, "DELETE", "", nil, nil)
}

// GroupPolicyConfigurationAssignmentRequestBuilder is request builder for GroupPolicyConfigurationAssignment
type GroupPolicyConfigurationAssignmentRequestBuilder struct{ BaseRequestBuilder }

// Request returns GroupPolicyConfigurationAssignmentRequest
func (b *GroupPolicyConfigurationAssignmentRequestBuilder) Request() *GroupPolicyConfigurationAssignmentRequest {
	return &GroupPolicyConfigurationAssignmentRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
	}
}

// GroupPolicyConfigurationAssignmentRequest is request for GroupPolicyConfigurationAssignment
type GroupPolicyConfigurationAssignmentRequest struct{ BaseRequest }

// Get performs GET request for GroupPolicyConfigurationAssignment
func (r *GroupPolicyConfigurationAssignmentRequest) Get(ctx context.Context) (resObj *GroupPolicyConfigurationAssignment, err error) {
	var query string
	if r.query != nil {
		query = "?" + r.query.Encode()
	}
	err = r.JSONRequest(ctx, "GET", query, nil, &resObj)
	return
}

// Update performs PATCH request for GroupPolicyConfigurationAssignment
func (r *GroupPolicyConfigurationAssignmentRequest) Update(ctx context.Context, reqObj *GroupPolicyConfigurationAssignment) error {
	return r.JSONRequest(ctx, "PATCH", "", reqObj, nil)
}

// Delete performs DELETE request for GroupPolicyConfigurationAssignment
func (r *GroupPolicyConfigurationAssignmentRequest) Delete(ctx context.Context) error {
	return r.JSONRequest(ctx, "DELETE", "", nil, nil)
}

// GroupPolicyDefinitionRequestBuilder is request builder for GroupPolicyDefinition
type GroupPolicyDefinitionRequestBuilder struct{ BaseRequestBuilder }

// Request returns GroupPolicyDefinitionRequest
func (b *GroupPolicyDefinitionRequestBuilder) Request() *GroupPolicyDefinitionRequest {
	return &GroupPolicyDefinitionRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
	}
}

// GroupPolicyDefinitionRequest is request for GroupPolicyDefinition
type GroupPolicyDefinitionRequest struct{ BaseRequest }

// Get performs GET request for GroupPolicyDefinition
func (r *GroupPolicyDefinitionRequest) Get(ctx context.Context) (resObj *GroupPolicyDefinition, err error) {
	var query string
	if r.query != nil {
		query = "?" + r.query.Encode()
	}
	err = r.JSONRequest(ctx, "GET", query, nil, &resObj)
	return
}

// Update performs PATCH request for GroupPolicyDefinition
func (r *GroupPolicyDefinitionRequest) Update(ctx context.Context, reqObj *GroupPolicyDefinition) error {
	return r.JSONRequest(ctx, "PATCH", "", reqObj, nil)
}

// Delete performs DELETE request for GroupPolicyDefinition
func (r *GroupPolicyDefinitionRequest) Delete(ctx context.Context) error {
	return r.JSONRequest(ctx, "DELETE", "", nil, nil)
}

// GroupPolicyDefinitionFileRequestBuilder is request builder for GroupPolicyDefinitionFile
type GroupPolicyDefinitionFileRequestBuilder struct{ BaseRequestBuilder }

// Request returns GroupPolicyDefinitionFileRequest
func (b *GroupPolicyDefinitionFileRequestBuilder) Request() *GroupPolicyDefinitionFileRequest {
	return &GroupPolicyDefinitionFileRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
	}
}

// GroupPolicyDefinitionFileRequest is request for GroupPolicyDefinitionFile
type GroupPolicyDefinitionFileRequest struct{ BaseRequest }

// Get performs GET request for GroupPolicyDefinitionFile
func (r *GroupPolicyDefinitionFileRequest) Get(ctx context.Context) (resObj *GroupPolicyDefinitionFile, err error) {
	var query string
	if r.query != nil {
		query = "?" + r.query.Encode()
	}
	err = r.JSONRequest(ctx, "GET", query, nil, &resObj)
	return
}

// Update performs PATCH request for GroupPolicyDefinitionFile
func (r *GroupPolicyDefinitionFileRequest) Update(ctx context.Context, reqObj *GroupPolicyDefinitionFile) error {
	return r.JSONRequest(ctx, "PATCH", "", reqObj, nil)
}

// Delete performs DELETE request for GroupPolicyDefinitionFile
func (r *GroupPolicyDefinitionFileRequest) Delete(ctx context.Context) error {
	return r.JSONRequest(ctx, "DELETE", "", nil, nil)
}

// GroupPolicyDefinitionValueRequestBuilder is request builder for GroupPolicyDefinitionValue
type GroupPolicyDefinitionValueRequestBuilder struct{ BaseRequestBuilder }

// Request returns GroupPolicyDefinitionValueRequest
func (b *GroupPolicyDefinitionValueRequestBuilder) Request() *GroupPolicyDefinitionValueRequest {
	return &GroupPolicyDefinitionValueRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
	}
}

// GroupPolicyDefinitionValueRequest is request for GroupPolicyDefinitionValue
type GroupPolicyDefinitionValueRequest struct{ BaseRequest }

// Get performs GET request for GroupPolicyDefinitionValue
func (r *GroupPolicyDefinitionValueRequest) Get(ctx context.Context) (resObj *GroupPolicyDefinitionValue, err error) {
	var query string
	if r.query != nil {
		query = "?" + r.query.Encode()
	}
	err = r.JSONRequest(ctx, "GET", query, nil, &resObj)
	return
}

// Update performs PATCH request for GroupPolicyDefinitionValue
func (r *GroupPolicyDefinitionValueRequest) Update(ctx context.Context, reqObj *GroupPolicyDefinitionValue) error {
	return r.JSONRequest(ctx, "PATCH", "", reqObj, nil)
}

// Delete performs DELETE request for GroupPolicyDefinitionValue
func (r *GroupPolicyDefinitionValueRequest) Delete(ctx context.Context) error {
	return r.JSONRequest(ctx, "DELETE", "", nil, nil)
}

// GroupPolicyMigrationReportRequestBuilder is request builder for GroupPolicyMigrationReport
type GroupPolicyMigrationReportRequestBuilder struct{ BaseRequestBuilder }

// Request returns GroupPolicyMigrationReportRequest
func (b *GroupPolicyMigrationReportRequestBuilder) Request() *GroupPolicyMigrationReportRequest {
	return &GroupPolicyMigrationReportRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
	}
}

// GroupPolicyMigrationReportRequest is request for GroupPolicyMigrationReport
type GroupPolicyMigrationReportRequest struct{ BaseRequest }

// Get performs GET request for GroupPolicyMigrationReport
func (r *GroupPolicyMigrationReportRequest) Get(ctx context.Context) (resObj *GroupPolicyMigrationReport, err error) {
	var query string
	if r.query != nil {
		query = "?" + r.query.Encode()
	}
	err = r.JSONRequest(ctx, "GET", query, nil, &resObj)
	return
}

// Update performs PATCH request for GroupPolicyMigrationReport
func (r *GroupPolicyMigrationReportRequest) Update(ctx context.Context, reqObj *GroupPolicyMigrationReport) error {
	return r.JSONRequest(ctx, "PATCH", "", reqObj, nil)
}

// Delete performs DELETE request for GroupPolicyMigrationReport
func (r *GroupPolicyMigrationReportRequest) Delete(ctx context.Context) error {
	return r.JSONRequest(ctx, "DELETE", "", nil, nil)
}

// GroupPolicyPresentationRequestBuilder is request builder for GroupPolicyPresentation
type GroupPolicyPresentationRequestBuilder struct{ BaseRequestBuilder }

// Request returns GroupPolicyPresentationRequest
func (b *GroupPolicyPresentationRequestBuilder) Request() *GroupPolicyPresentationRequest {
	return &GroupPolicyPresentationRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
	}
}

// GroupPolicyPresentationRequest is request for GroupPolicyPresentation
type GroupPolicyPresentationRequest struct{ BaseRequest }

// Get performs GET request for GroupPolicyPresentation
func (r *GroupPolicyPresentationRequest) Get(ctx context.Context) (resObj *GroupPolicyPresentation, err error) {
	var query string
	if r.query != nil {
		query = "?" + r.query.Encode()
	}
	err = r.JSONRequest(ctx, "GET", query, nil, &resObj)
	return
}

// Update performs PATCH request for GroupPolicyPresentation
func (r *GroupPolicyPresentationRequest) Update(ctx context.Context, reqObj *GroupPolicyPresentation) error {
	return r.JSONRequest(ctx, "PATCH", "", reqObj, nil)
}

// Delete performs DELETE request for GroupPolicyPresentation
func (r *GroupPolicyPresentationRequest) Delete(ctx context.Context) error {
	return r.JSONRequest(ctx, "DELETE", "", nil, nil)
}

// GroupPolicyPresentationValueRequestBuilder is request builder for GroupPolicyPresentationValue
type GroupPolicyPresentationValueRequestBuilder struct{ BaseRequestBuilder }

// Request returns GroupPolicyPresentationValueRequest
func (b *GroupPolicyPresentationValueRequestBuilder) Request() *GroupPolicyPresentationValueRequest {
	return &GroupPolicyPresentationValueRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
	}
}

// GroupPolicyPresentationValueRequest is request for GroupPolicyPresentationValue
type GroupPolicyPresentationValueRequest struct{ BaseRequest }

// Get performs GET request for GroupPolicyPresentationValue
func (r *GroupPolicyPresentationValueRequest) Get(ctx context.Context) (resObj *GroupPolicyPresentationValue, err error) {
	var query string
	if r.query != nil {
		query = "?" + r.query.Encode()
	}
	err = r.JSONRequest(ctx, "GET", query, nil, &resObj)
	return
}

// Update performs PATCH request for GroupPolicyPresentationValue
func (r *GroupPolicyPresentationValueRequest) Update(ctx context.Context, reqObj *GroupPolicyPresentationValue) error {
	return r.JSONRequest(ctx, "PATCH", "", reqObj, nil)
}

// Delete performs DELETE request for GroupPolicyPresentationValue
func (r *GroupPolicyPresentationValueRequest) Delete(ctx context.Context) error {
	return r.JSONRequest(ctx, "DELETE", "", nil, nil)
}

// GroupPolicySettingMappingRequestBuilder is request builder for GroupPolicySettingMapping
type GroupPolicySettingMappingRequestBuilder struct{ BaseRequestBuilder }

// Request returns GroupPolicySettingMappingRequest
func (b *GroupPolicySettingMappingRequestBuilder) Request() *GroupPolicySettingMappingRequest {
	return &GroupPolicySettingMappingRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
	}
}

// GroupPolicySettingMappingRequest is request for GroupPolicySettingMapping
type GroupPolicySettingMappingRequest struct{ BaseRequest }

// Get performs GET request for GroupPolicySettingMapping
func (r *GroupPolicySettingMappingRequest) Get(ctx context.Context) (resObj *GroupPolicySettingMapping, err error) {
	var query string
	if r.query != nil {
		query = "?" + r.query.Encode()
	}
	err = r.JSONRequest(ctx, "GET", query, nil, &resObj)
	return
}

// Update performs PATCH request for GroupPolicySettingMapping
func (r *GroupPolicySettingMappingRequest) Update(ctx context.Context, reqObj *GroupPolicySettingMapping) error {
	return r.JSONRequest(ctx, "PATCH", "", reqObj, nil)
}

// Delete performs DELETE request for GroupPolicySettingMapping
func (r *GroupPolicySettingMappingRequest) Delete(ctx context.Context) error {
	return r.JSONRequest(ctx, "DELETE", "", nil, nil)
}

//
type GroupCollectionEvaluateDynamicMembershipRequestBuilder struct{ BaseRequestBuilder }

// EvaluateDynamicMembership action undocumented
func (b *UserJoinedGroupsCollectionRequestBuilder) EvaluateDynamicMembership(reqObj *GroupCollectionEvaluateDynamicMembershipRequestParameter) *GroupCollectionEvaluateDynamicMembershipRequestBuilder {
	bb := &GroupCollectionEvaluateDynamicMembershipRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
	bb.BaseRequestBuilder.baseURL += "/evaluateDynamicMembership"
	bb.BaseRequestBuilder.requestObject = reqObj
	return bb
}

//
type GroupCollectionEvaluateDynamicMembershipRequest struct{ BaseRequest }

//
func (b *GroupCollectionEvaluateDynamicMembershipRequestBuilder) Request() *GroupCollectionEvaluateDynamicMembershipRequest {
	return &GroupCollectionEvaluateDynamicMembershipRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject},
	}
}

//
func (r *GroupCollectionEvaluateDynamicMembershipRequest) Post(ctx context.Context) (resObj *EvaluateDynamicMembershipResult, err error) {
	err = r.JSONRequest(ctx, "POST", "", r.requestObject, &resObj)
	return
}

//
type GroupLifecyclePolicyCollectionRenewGroupRequestBuilder struct{ BaseRequestBuilder }

// RenewGroup action undocumented
func (b *GroupGroupLifecyclePoliciesCollectionRequestBuilder) RenewGroup(reqObj *GroupLifecyclePolicyCollectionRenewGroupRequestParameter) *GroupLifecyclePolicyCollectionRenewGroupRequestBuilder {
	bb := &GroupLifecyclePolicyCollectionRenewGroupRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
	bb.BaseRequestBuilder.baseURL += "/renewGroup"
	bb.BaseRequestBuilder.requestObject = reqObj
	return bb
}

//
type GroupLifecyclePolicyCollectionRenewGroupRequest struct{ BaseRequest }

//
func (b *GroupLifecyclePolicyCollectionRenewGroupRequestBuilder) Request() *GroupLifecyclePolicyCollectionRenewGroupRequest {
	return &GroupLifecyclePolicyCollectionRenewGroupRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject},
	}
}

//
func (r *GroupLifecyclePolicyCollectionRenewGroupRequest) Post(ctx context.Context) (resObj *bool, err error) {
	err = r.JSONRequest(ctx, "POST", "", r.requestObject, &resObj)
	return
}

//
type GroupPolicyMigrationReportCollectionCreateMigrationReportRequestBuilder struct{ BaseRequestBuilder }

// CreateMigrationReport action undocumented
func (b *DeviceManagementGroupPolicyMigrationReportsCollectionRequestBuilder) CreateMigrationReport(reqObj *GroupPolicyMigrationReportCollectionCreateMigrationReportRequestParameter) *GroupPolicyMigrationReportCollectionCreateMigrationReportRequestBuilder {
	bb := &GroupPolicyMigrationReportCollectionCreateMigrationReportRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
	bb.BaseRequestBuilder.baseURL += "/createMigrationReport"
	bb.BaseRequestBuilder.requestObject = reqObj
	return bb
}

//
type GroupPolicyMigrationReportCollectionCreateMigrationReportRequest struct{ BaseRequest }

//
func (b *GroupPolicyMigrationReportCollectionCreateMigrationReportRequestBuilder) Request() *GroupPolicyMigrationReportCollectionCreateMigrationReportRequest {
	return &GroupPolicyMigrationReportCollectionCreateMigrationReportRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject},
	}
}

//
func (r *GroupPolicyMigrationReportCollectionCreateMigrationReportRequest) Post(ctx context.Context) (resObj *string, err error) {
	err = r.JSONRequest(ctx, "POST", "", r.requestObject, &resObj)
	return
}

//
type GroupValidatePropertiesRequestBuilder struct{ BaseRequestBuilder }

// ValidateProperties action undocumented
func (b *GroupRequestBuilder) ValidateProperties(reqObj *GroupValidatePropertiesRequestParameter) *GroupValidatePropertiesRequestBuilder {
	bb := &GroupValidatePropertiesRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
	bb.BaseRequestBuilder.baseURL += "/validateProperties"
	bb.BaseRequestBuilder.requestObject = reqObj
	return bb
}

//
type GroupValidatePropertiesRequest struct{ BaseRequest }

//
func (b *GroupValidatePropertiesRequestBuilder) Request() *GroupValidatePropertiesRequest {
	return &GroupValidatePropertiesRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject},
	}
}

//
func (r *GroupValidatePropertiesRequest) Post(ctx context.Context) error {
	return r.JSONRequest(ctx, "POST", "", r.requestObject, nil)
}

//
type GroupCheckGrantedPermissionsForAppRequestBuilder struct{ BaseRequestBuilder }

// CheckGrantedPermissionsForApp action undocumented
func (b *GroupRequestBuilder) CheckGrantedPermissionsForApp(reqObj *GroupCheckGrantedPermissionsForAppRequestParameter) *GroupCheckGrantedPermissionsForAppRequestBuilder {
	bb := &GroupCheckGrantedPermissionsForAppRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
	bb.BaseRequestBuilder.baseURL += "/checkGrantedPermissionsForApp"
	bb.BaseRequestBuilder.requestObject = reqObj
	return bb
}

//
type GroupCheckGrantedPermissionsForAppRequest struct{ BaseRequest }

//
func (b *GroupCheckGrantedPermissionsForAppRequestBuilder) Request() *GroupCheckGrantedPermissionsForAppRequest {
	return &GroupCheckGrantedPermissionsForAppRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject},
	}
}

//
func (r *GroupCheckGrantedPermissionsForAppRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]ResourceSpecificPermissionGrant, 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 []ResourceSpecificPermissionGrant
	for {
		if res.StatusCode != http.StatusOK {
			b, _ := ioutil.ReadAll(res.Body)
			res.Body.Close()
			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  []ResourceSpecificPermissionGrant
		)
		err := jsonx.NewDecoder(res.Body).Decode(&paging)
		res.Body.Close()
		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
		}
	}
}

//
func (r *GroupCheckGrantedPermissionsForAppRequest) PostN(ctx context.Context, n int) ([]ResourceSpecificPermissionGrant, error) {
	return r.Paging(ctx, "POST", "", r.requestObject, n)
}

//
func (r *GroupCheckGrantedPermissionsForAppRequest) Post(ctx context.Context) ([]ResourceSpecificPermissionGrant, error) {
	return r.Paging(ctx, "POST", "", r.requestObject, 0)
}

//
type GroupAssignLicenseRequestBuilder struct{ BaseRequestBuilder }

// AssignLicense action undocumented
func (b *GroupRequestBuilder) AssignLicense(reqObj *GroupAssignLicenseRequestParameter) *GroupAssignLicenseRequestBuilder {
	bb := &GroupAssignLicenseRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
	bb.BaseRequestBuilder.baseURL += "/assignLicense"
	bb.BaseRequestBuilder.requestObject = reqObj
	return bb
}

//
type GroupAssignLicenseRequest struct{ BaseRequest }

//
func (b *GroupAssignLicenseRequestBuilder) Request() *GroupAssignLicenseRequest {
	return &GroupAssignLicenseRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject},
	}
}

//
func (r *GroupAssignLicenseRequest) Post(ctx context.Context) (resObj *Group, err error) {
	err = r.JSONRequest(ctx, "POST", "", r.requestObject, &resObj)
	return
}

//
type GroupSubscribeByMailRequestBuilder struct{ BaseRequestBuilder }

// SubscribeByMail action undocumented
func (b *GroupRequestBuilder) SubscribeByMail(reqObj *GroupSubscribeByMailRequestParameter) *GroupSubscribeByMailRequestBuilder {
	bb := &GroupSubscribeByMailRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
	bb.BaseRequestBuilder.baseURL += "/subscribeByMail"
	bb.BaseRequestBuilder.requestObject = reqObj
	return bb
}

//
type GroupSubscribeByMailRequest struct{ BaseRequest }

//
func (b *GroupSubscribeByMailRequestBuilder) Request() *GroupSubscribeByMailRequest {
	return &GroupSubscribeByMailRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject},
	}
}

//
func (r *GroupSubscribeByMailRequest) Post(ctx context.Context) error {
	return r.JSONRequest(ctx, "POST", "", r.requestObject, nil)
}

//
type GroupUnsubscribeByMailRequestBuilder struct{ BaseRequestBuilder }

// UnsubscribeByMail action undocumented
func (b *GroupRequestBuilder) UnsubscribeByMail(reqObj *GroupUnsubscribeByMailRequestParameter) *GroupUnsubscribeByMailRequestBuilder {
	bb := &GroupUnsubscribeByMailRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
	bb.BaseRequestBuilder.baseURL += "/unsubscribeByMail"
	bb.BaseRequestBuilder.requestObject = reqObj
	return bb
}

//
type GroupUnsubscribeByMailRequest struct{ BaseRequest }

//
func (b *GroupUnsubscribeByMailRequestBuilder) Request() *GroupUnsubscribeByMailRequest {
	return &GroupUnsubscribeByMailRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject},
	}
}

//
func (r *GroupUnsubscribeByMailRequest) Post(ctx context.Context) error {
	return r.JSONRequest(ctx, "POST", "", r.requestObject, nil)
}

//
type GroupAddFavoriteRequestBuilder struct{ BaseRequestBuilder }

// AddFavorite action undocumented
func (b *GroupRequestBuilder) AddFavorite(reqObj *GroupAddFavoriteRequestParameter) *GroupAddFavoriteRequestBuilder {
	bb := &GroupAddFavoriteRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
	bb.BaseRequestBuilder.baseURL += "/addFavorite"
	bb.BaseRequestBuilder.requestObject = reqObj
	return bb
}

//
type GroupAddFavoriteRequest struct{ BaseRequest }

//
func (b *GroupAddFavoriteRequestBuilder) Request() *GroupAddFavoriteRequest {
	return &GroupAddFavoriteRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject},
	}
}

//
func (r *GroupAddFavoriteRequest) Post(ctx context.Context) error {
	return r.JSONRequest(ctx, "POST", "", r.requestObject, nil)
}

//
type GroupRemoveFavoriteRequestBuilder struct{ BaseRequestBuilder }

// RemoveFavorite action undocumented
func (b *GroupRequestBuilder) RemoveFavorite(reqObj *GroupRemoveFavoriteRequestParameter) *GroupRemoveFavoriteRequestBuilder {
	bb := &GroupRemoveFavoriteRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
	bb.BaseRequestBuilder.baseURL += "/removeFavorite"
	bb.BaseRequestBuilder.requestObject = reqObj
	return bb
}

//
type GroupRemoveFavoriteRequest struct{ BaseRequest }

//
func (b *GroupRemoveFavoriteRequestBuilder) Request() *GroupRemoveFavoriteRequest {
	return &GroupRemoveFavoriteRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject},
	}
}

//
func (r *GroupRemoveFavoriteRequest) Post(ctx context.Context) error {
	return r.JSONRequest(ctx, "POST", "", r.requestObject, nil)
}

//
type GroupResetUnseenCountRequestBuilder struct{ BaseRequestBuilder }

// ResetUnseenCount action undocumented
func (b *GroupRequestBuilder) ResetUnseenCount(reqObj *GroupResetUnseenCountRequestParameter) *GroupResetUnseenCountRequestBuilder {
	bb := &GroupResetUnseenCountRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
	bb.BaseRequestBuilder.baseURL += "/resetUnseenCount"
	bb.BaseRequestBuilder.requestObject = reqObj
	return bb
}

//
type GroupResetUnseenCountRequest struct{ BaseRequest }

//
func (b *GroupResetUnseenCountRequestBuilder) Request() *GroupResetUnseenCountRequest {
	return &GroupResetUnseenCountRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject},
	}
}

//
func (r *GroupResetUnseenCountRequest) Post(ctx context.Context) error {
	return r.JSONRequest(ctx, "POST", "", r.requestObject, nil)
}

//
type GroupRenewRequestBuilder struct{ BaseRequestBuilder }

// Renew action undocumented
func (b *GroupRequestBuilder) Renew(reqObj *GroupRenewRequestParameter) *GroupRenewRequestBuilder {
	bb := &GroupRenewRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
	bb.BaseRequestBuilder.baseURL += "/renew"
	bb.BaseRequestBuilder.requestObject = reqObj
	return bb
}

//
type GroupRenewRequest struct{ BaseRequest }

//
func (b *GroupRenewRequestBuilder) Request() *GroupRenewRequest {
	return &GroupRenewRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject},
	}
}

//
func (r *GroupRenewRequest) Post(ctx context.Context) error {
	return r.JSONRequest(ctx, "POST", "", r.requestObject, nil)
}

//
type GroupEvaluateDynamicMembershipRequestBuilder struct{ BaseRequestBuilder }

// EvaluateDynamicMembership action undocumented
func (b *GroupRequestBuilder) EvaluateDynamicMembership(reqObj *GroupEvaluateDynamicMembershipRequestParameter) *GroupEvaluateDynamicMembershipRequestBuilder {
	bb := &GroupEvaluateDynamicMembershipRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
	bb.BaseRequestBuilder.baseURL += "/evaluateDynamicMembership"
	bb.BaseRequestBuilder.requestObject = reqObj
	return bb
}

//
type GroupEvaluateDynamicMembershipRequest struct{ BaseRequest }

//
func (b *GroupEvaluateDynamicMembershipRequestBuilder) Request() *GroupEvaluateDynamicMembershipRequest {
	return &GroupEvaluateDynamicMembershipRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject},
	}
}

//
func (r *GroupEvaluateDynamicMembershipRequest) Post(ctx context.Context) (resObj *EvaluateDynamicMembershipResult, err error) {
	err = r.JSONRequest(ctx, "POST", "", r.requestObject, &resObj)
	return
}

//
type GroupLifecyclePolicyAddGroupRequestBuilder struct{ BaseRequestBuilder }

// AddGroup action undocumented
func (b *GroupLifecyclePolicyRequestBuilder) AddGroup(reqObj *GroupLifecyclePolicyAddGroupRequestParameter) *GroupLifecyclePolicyAddGroupRequestBuilder {
	bb := &GroupLifecyclePolicyAddGroupRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
	bb.BaseRequestBuilder.baseURL += "/addGroup"
	bb.BaseRequestBuilder.requestObject = reqObj
	return bb
}

//
type GroupLifecyclePolicyAddGroupRequest struct{ BaseRequest }

//
func (b *GroupLifecyclePolicyAddGroupRequestBuilder) Request() *GroupLifecyclePolicyAddGroupRequest {
	return &GroupLifecyclePolicyAddGroupRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject},
	}
}

//
func (r *GroupLifecyclePolicyAddGroupRequest) Post(ctx context.Context) (resObj *bool, err error) {
	err = r.JSONRequest(ctx, "POST", "", r.requestObject, &resObj)
	return
}

//
type GroupLifecyclePolicyRemoveGroupRequestBuilder struct{ BaseRequestBuilder }

// RemoveGroup action undocumented
func (b *GroupLifecyclePolicyRequestBuilder) RemoveGroup(reqObj *GroupLifecyclePolicyRemoveGroupRequestParameter) *GroupLifecyclePolicyRemoveGroupRequestBuilder {
	bb := &GroupLifecyclePolicyRemoveGroupRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
	bb.BaseRequestBuilder.baseURL += "/removeGroup"
	bb.BaseRequestBuilder.requestObject = reqObj
	return bb
}

//
type GroupLifecyclePolicyRemoveGroupRequest struct{ BaseRequest }

//
func (b *GroupLifecyclePolicyRemoveGroupRequestBuilder) Request() *GroupLifecyclePolicyRemoveGroupRequest {
	return &GroupLifecyclePolicyRemoveGroupRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject},
	}
}

//
func (r *GroupLifecyclePolicyRemoveGroupRequest) Post(ctx context.Context) (resObj *bool, err error) {
	err = r.JSONRequest(ctx, "POST", "", r.requestObject, &resObj)
	return
}

//
type GroupPolicyConfigurationAssignRequestBuilder struct{ BaseRequestBuilder }

// Assign action undocumented
func (b *GroupPolicyConfigurationRequestBuilder) Assign(reqObj *GroupPolicyConfigurationAssignRequestParameter) *GroupPolicyConfigurationAssignRequestBuilder {
	bb := &GroupPolicyConfigurationAssignRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
	bb.BaseRequestBuilder.baseURL += "/assign"
	bb.BaseRequestBuilder.requestObject = reqObj
	return bb
}

//
type GroupPolicyConfigurationAssignRequest struct{ BaseRequest }

//
func (b *GroupPolicyConfigurationAssignRequestBuilder) Request() *GroupPolicyConfigurationAssignRequest {
	return &GroupPolicyConfigurationAssignRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject},
	}
}

//
func (r *GroupPolicyConfigurationAssignRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]GroupPolicyConfigurationAssignment, 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 []GroupPolicyConfigurationAssignment
	for {
		if res.StatusCode != http.StatusOK {
			b, _ := ioutil.ReadAll(res.Body)
			res.Body.Close()
			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  []GroupPolicyConfigurationAssignment
		)
		err := jsonx.NewDecoder(res.Body).Decode(&paging)
		res.Body.Close()
		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
		}
	}
}

//
func (r *GroupPolicyConfigurationAssignRequest) PostN(ctx context.Context, n int) ([]GroupPolicyConfigurationAssignment, error) {
	return r.Paging(ctx, "POST", "", r.requestObject, n)
}

//
func (r *GroupPolicyConfigurationAssignRequest) Post(ctx context.Context) ([]GroupPolicyConfigurationAssignment, error) {
	return r.Paging(ctx, "POST", "", r.requestObject, 0)
}

//
type GroupPolicyConfigurationUpdateDefinitionValuesRequestBuilder struct{ BaseRequestBuilder }

// UpdateDefinitionValues action undocumented
func (b *GroupPolicyConfigurationRequestBuilder) UpdateDefinitionValues(reqObj *GroupPolicyConfigurationUpdateDefinitionValuesRequestParameter) *GroupPolicyConfigurationUpdateDefinitionValuesRequestBuilder {
	bb := &GroupPolicyConfigurationUpdateDefinitionValuesRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
	bb.BaseRequestBuilder.baseURL += "/updateDefinitionValues"
	bb.BaseRequestBuilder.requestObject = reqObj
	return bb
}

//
type GroupPolicyConfigurationUpdateDefinitionValuesRequest struct{ BaseRequest }

//
func (b *GroupPolicyConfigurationUpdateDefinitionValuesRequestBuilder) Request() *GroupPolicyConfigurationUpdateDefinitionValuesRequest {
	return &GroupPolicyConfigurationUpdateDefinitionValuesRequest{
		BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject},
	}
}

//
func (r *GroupPolicyConfigurationUpdateDefinitionValuesRequest) Post(ctx context.Context) error {
	return r.JSONRequest(ctx, "POST", "", r.requestObject, nil)
}