// Code generated by msgraph-generate.go 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) } // AcceptedSenders returns request builder for DirectoryObject collection func (b *GroupRequestBuilder) AcceptedSenders() *GroupAcceptedSendersCollectionRequestBuilder { bb := &GroupAcceptedSendersCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/acceptedSenders" return bb } // GroupAcceptedSendersCollectionRequestBuilder is request builder for DirectoryObject collection type GroupAcceptedSendersCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for DirectoryObject collection func (b *GroupAcceptedSendersCollectionRequestBuilder) Request() *GroupAcceptedSendersCollectionRequest { return &GroupAcceptedSendersCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for DirectoryObject item func (b *GroupAcceptedSendersCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder { bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupAcceptedSendersCollectionRequest is request for DirectoryObject collection type GroupAcceptedSendersCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for DirectoryObject collection func (r *GroupAcceptedSendersCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]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 len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for DirectoryObject collection func (r *GroupAcceptedSendersCollectionRequest) Get(ctx context.Context) ([]DirectoryObject, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for DirectoryObject collection func (r *GroupAcceptedSendersCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // AppRoleAssignments returns request builder for AppRoleAssignment collection func (b *GroupRequestBuilder) AppRoleAssignments() *GroupAppRoleAssignmentsCollectionRequestBuilder { bb := &GroupAppRoleAssignmentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/appRoleAssignments" return bb } // GroupAppRoleAssignmentsCollectionRequestBuilder is request builder for AppRoleAssignment collection type GroupAppRoleAssignmentsCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for AppRoleAssignment collection func (b *GroupAppRoleAssignmentsCollectionRequestBuilder) Request() *GroupAppRoleAssignmentsCollectionRequest { return &GroupAppRoleAssignmentsCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for AppRoleAssignment item func (b *GroupAppRoleAssignmentsCollectionRequestBuilder) ID(id string) *AppRoleAssignmentRequestBuilder { bb := &AppRoleAssignmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupAppRoleAssignmentsCollectionRequest is request for AppRoleAssignment collection type GroupAppRoleAssignmentsCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for AppRoleAssignment collection func (r *GroupAppRoleAssignmentsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]AppRoleAssignment, 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 []AppRoleAssignment 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 []AppRoleAssignment ) err := jsonx.NewDecoder(res.Body).Decode(&paging) if err != nil { return nil, err } err = jsonx.Unmarshal(paging.Value, &value) if err != nil { return nil, err } values = append(values, value...) if len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for AppRoleAssignment collection func (r *GroupAppRoleAssignmentsCollectionRequest) Get(ctx context.Context) ([]AppRoleAssignment, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for AppRoleAssignment collection func (r *GroupAppRoleAssignmentsCollectionRequest) Add(ctx context.Context, reqObj *AppRoleAssignment) (resObj *AppRoleAssignment, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // Calendar is navigation property func (b *GroupRequestBuilder) Calendar() *CalendarRequestBuilder { bb := &CalendarRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/calendar" return bb } // CalendarView returns request builder for Event collection func (b *GroupRequestBuilder) CalendarView() *GroupCalendarViewCollectionRequestBuilder { bb := &GroupCalendarViewCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/calendarView" return bb } // GroupCalendarViewCollectionRequestBuilder is request builder for Event collection type GroupCalendarViewCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for Event collection func (b *GroupCalendarViewCollectionRequestBuilder) Request() *GroupCalendarViewCollectionRequest { return &GroupCalendarViewCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for Event item func (b *GroupCalendarViewCollectionRequestBuilder) ID(id string) *EventRequestBuilder { bb := &EventRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupCalendarViewCollectionRequest is request for Event collection type GroupCalendarViewCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for Event collection func (r *GroupCalendarViewCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]Event, 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 []Event 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 []Event ) err := jsonx.NewDecoder(res.Body).Decode(&paging) if err != nil { return nil, err } err = jsonx.Unmarshal(paging.Value, &value) if err != nil { return nil, err } values = append(values, value...) if len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for Event collection func (r *GroupCalendarViewCollectionRequest) Get(ctx context.Context) ([]Event, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for Event collection func (r *GroupCalendarViewCollectionRequest) Add(ctx context.Context, reqObj *Event) (resObj *Event, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // Conversations returns request builder for Conversation collection func (b *GroupRequestBuilder) Conversations() *GroupConversationsCollectionRequestBuilder { bb := &GroupConversationsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/conversations" return bb } // GroupConversationsCollectionRequestBuilder is request builder for Conversation collection type GroupConversationsCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for Conversation collection func (b *GroupConversationsCollectionRequestBuilder) Request() *GroupConversationsCollectionRequest { return &GroupConversationsCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for Conversation item func (b *GroupConversationsCollectionRequestBuilder) ID(id string) *ConversationRequestBuilder { bb := &ConversationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupConversationsCollectionRequest is request for Conversation collection type GroupConversationsCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for Conversation collection func (r *GroupConversationsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]Conversation, 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 []Conversation 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 []Conversation ) err := jsonx.NewDecoder(res.Body).Decode(&paging) if err != nil { return nil, err } err = jsonx.Unmarshal(paging.Value, &value) if err != nil { return nil, err } values = append(values, value...) if len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for Conversation collection func (r *GroupConversationsCollectionRequest) Get(ctx context.Context) ([]Conversation, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for Conversation collection func (r *GroupConversationsCollectionRequest) Add(ctx context.Context, reqObj *Conversation) (resObj *Conversation, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // CreatedOnBehalfOf is navigation property func (b *GroupRequestBuilder) CreatedOnBehalfOf() *DirectoryObjectRequestBuilder { bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/createdOnBehalfOf" return bb } // Drive is navigation property func (b *GroupRequestBuilder) Drive() *DriveRequestBuilder { bb := &DriveRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/drive" return bb } // Drives returns request builder for Drive collection func (b *GroupRequestBuilder) Drives() *GroupDrivesCollectionRequestBuilder { bb := &GroupDrivesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/drives" return bb } // GroupDrivesCollectionRequestBuilder is request builder for Drive collection type GroupDrivesCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for Drive collection func (b *GroupDrivesCollectionRequestBuilder) Request() *GroupDrivesCollectionRequest { return &GroupDrivesCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for Drive item func (b *GroupDrivesCollectionRequestBuilder) ID(id string) *DriveRequestBuilder { bb := &DriveRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupDrivesCollectionRequest is request for Drive collection type GroupDrivesCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for Drive collection func (r *GroupDrivesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]Drive, 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 []Drive 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 []Drive ) err := jsonx.NewDecoder(res.Body).Decode(&paging) if err != nil { return nil, err } err = jsonx.Unmarshal(paging.Value, &value) if err != nil { return nil, err } values = append(values, value...) if len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for Drive collection func (r *GroupDrivesCollectionRequest) Get(ctx context.Context) ([]Drive, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for Drive collection func (r *GroupDrivesCollectionRequest) Add(ctx context.Context, reqObj *Drive) (resObj *Drive, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // Endpoints returns request builder for Endpoint collection func (b *GroupRequestBuilder) Endpoints() *GroupEndpointsCollectionRequestBuilder { bb := &GroupEndpointsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/endpoints" return bb } // GroupEndpointsCollectionRequestBuilder is request builder for Endpoint collection type GroupEndpointsCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for Endpoint collection func (b *GroupEndpointsCollectionRequestBuilder) Request() *GroupEndpointsCollectionRequest { return &GroupEndpointsCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for Endpoint item func (b *GroupEndpointsCollectionRequestBuilder) ID(id string) *EndpointRequestBuilder { bb := &EndpointRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupEndpointsCollectionRequest is request for Endpoint collection type GroupEndpointsCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for Endpoint collection func (r *GroupEndpointsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]Endpoint, 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 []Endpoint 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 []Endpoint ) err := jsonx.NewDecoder(res.Body).Decode(&paging) if err != nil { return nil, err } err = jsonx.Unmarshal(paging.Value, &value) if err != nil { return nil, err } values = append(values, value...) if len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for Endpoint collection func (r *GroupEndpointsCollectionRequest) Get(ctx context.Context) ([]Endpoint, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for Endpoint collection func (r *GroupEndpointsCollectionRequest) Add(ctx context.Context, reqObj *Endpoint) (resObj *Endpoint, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // Events returns request builder for Event collection func (b *GroupRequestBuilder) Events() *GroupEventsCollectionRequestBuilder { bb := &GroupEventsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/events" return bb } // GroupEventsCollectionRequestBuilder is request builder for Event collection type GroupEventsCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for Event collection func (b *GroupEventsCollectionRequestBuilder) Request() *GroupEventsCollectionRequest { return &GroupEventsCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for Event item func (b *GroupEventsCollectionRequestBuilder) ID(id string) *EventRequestBuilder { bb := &EventRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupEventsCollectionRequest is request for Event collection type GroupEventsCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for Event collection func (r *GroupEventsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]Event, 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 []Event 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 []Event ) err := jsonx.NewDecoder(res.Body).Decode(&paging) if err != nil { return nil, err } err = jsonx.Unmarshal(paging.Value, &value) if err != nil { return nil, err } values = append(values, value...) if len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for Event collection func (r *GroupEventsCollectionRequest) Get(ctx context.Context) ([]Event, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for Event collection func (r *GroupEventsCollectionRequest) Add(ctx context.Context, reqObj *Event) (resObj *Event, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // Extensions returns request builder for Extension collection func (b *GroupRequestBuilder) Extensions() *GroupExtensionsCollectionRequestBuilder { bb := &GroupExtensionsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/extensions" return bb } // GroupExtensionsCollectionRequestBuilder is request builder for Extension collection type GroupExtensionsCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for Extension collection func (b *GroupExtensionsCollectionRequestBuilder) Request() *GroupExtensionsCollectionRequest { return &GroupExtensionsCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for Extension item func (b *GroupExtensionsCollectionRequestBuilder) ID(id string) *ExtensionRequestBuilder { bb := &ExtensionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupExtensionsCollectionRequest is request for Extension collection type GroupExtensionsCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for Extension collection func (r *GroupExtensionsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]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 len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for Extension collection func (r *GroupExtensionsCollectionRequest) Get(ctx context.Context) ([]Extension, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for Extension collection func (r *GroupExtensionsCollectionRequest) Add(ctx context.Context, reqObj *Extension) (resObj *Extension, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // GroupLifecyclePolicies returns request builder for GroupLifecyclePolicy collection func (b *GroupRequestBuilder) GroupLifecyclePolicies() *GroupGroupLifecyclePoliciesCollectionRequestBuilder { bb := &GroupGroupLifecyclePoliciesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/groupLifecyclePolicies" return bb } // GroupGroupLifecyclePoliciesCollectionRequestBuilder is request builder for GroupLifecyclePolicy collection type GroupGroupLifecyclePoliciesCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for GroupLifecyclePolicy collection func (b *GroupGroupLifecyclePoliciesCollectionRequestBuilder) Request() *GroupGroupLifecyclePoliciesCollectionRequest { return &GroupGroupLifecyclePoliciesCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for GroupLifecyclePolicy item func (b *GroupGroupLifecyclePoliciesCollectionRequestBuilder) ID(id string) *GroupLifecyclePolicyRequestBuilder { bb := &GroupLifecyclePolicyRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupGroupLifecyclePoliciesCollectionRequest is request for GroupLifecyclePolicy collection type GroupGroupLifecyclePoliciesCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for GroupLifecyclePolicy collection func (r *GroupGroupLifecyclePoliciesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]GroupLifecyclePolicy, 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 []GroupLifecyclePolicy 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 []GroupLifecyclePolicy ) err := jsonx.NewDecoder(res.Body).Decode(&paging) if err != nil { return nil, err } err = jsonx.Unmarshal(paging.Value, &value) if err != nil { return nil, err } values = append(values, value...) if len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for GroupLifecyclePolicy collection func (r *GroupGroupLifecyclePoliciesCollectionRequest) Get(ctx context.Context) ([]GroupLifecyclePolicy, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for GroupLifecyclePolicy collection func (r *GroupGroupLifecyclePoliciesCollectionRequest) Add(ctx context.Context, reqObj *GroupLifecyclePolicy) (resObj *GroupLifecyclePolicy, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // MemberOf returns request builder for DirectoryObject collection func (b *GroupRequestBuilder) MemberOf() *GroupMemberOfCollectionRequestBuilder { bb := &GroupMemberOfCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/memberOf" return bb } // GroupMemberOfCollectionRequestBuilder is request builder for DirectoryObject collection type GroupMemberOfCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for DirectoryObject collection func (b *GroupMemberOfCollectionRequestBuilder) Request() *GroupMemberOfCollectionRequest { return &GroupMemberOfCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for DirectoryObject item func (b *GroupMemberOfCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder { bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupMemberOfCollectionRequest is request for DirectoryObject collection type GroupMemberOfCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for DirectoryObject collection func (r *GroupMemberOfCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]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 len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for DirectoryObject collection func (r *GroupMemberOfCollectionRequest) Get(ctx context.Context) ([]DirectoryObject, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for DirectoryObject collection func (r *GroupMemberOfCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // Members returns request builder for DirectoryObject collection func (b *GroupRequestBuilder) Members() *GroupMembersCollectionRequestBuilder { bb := &GroupMembersCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/members" return bb } // GroupMembersCollectionRequestBuilder is request builder for DirectoryObject collection type GroupMembersCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for DirectoryObject collection func (b *GroupMembersCollectionRequestBuilder) Request() *GroupMembersCollectionRequest { return &GroupMembersCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for DirectoryObject item func (b *GroupMembersCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder { bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupMembersCollectionRequest is request for DirectoryObject collection type GroupMembersCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for DirectoryObject collection func (r *GroupMembersCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]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 len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for DirectoryObject collection func (r *GroupMembersCollectionRequest) Get(ctx context.Context) ([]DirectoryObject, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for DirectoryObject collection func (r *GroupMembersCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // MembersWithLicenseErrors returns request builder for DirectoryObject collection func (b *GroupRequestBuilder) MembersWithLicenseErrors() *GroupMembersWithLicenseErrorsCollectionRequestBuilder { bb := &GroupMembersWithLicenseErrorsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/membersWithLicenseErrors" return bb } // GroupMembersWithLicenseErrorsCollectionRequestBuilder is request builder for DirectoryObject collection type GroupMembersWithLicenseErrorsCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for DirectoryObject collection func (b *GroupMembersWithLicenseErrorsCollectionRequestBuilder) Request() *GroupMembersWithLicenseErrorsCollectionRequest { return &GroupMembersWithLicenseErrorsCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for DirectoryObject item func (b *GroupMembersWithLicenseErrorsCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder { bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupMembersWithLicenseErrorsCollectionRequest is request for DirectoryObject collection type GroupMembersWithLicenseErrorsCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for DirectoryObject collection func (r *GroupMembersWithLicenseErrorsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]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 len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for DirectoryObject collection func (r *GroupMembersWithLicenseErrorsCollectionRequest) Get(ctx context.Context) ([]DirectoryObject, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for DirectoryObject collection func (r *GroupMembersWithLicenseErrorsCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // Onenote is navigation property func (b *GroupRequestBuilder) Onenote() *OnenoteRequestBuilder { bb := &OnenoteRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/onenote" return bb } // Owners returns request builder for DirectoryObject collection func (b *GroupRequestBuilder) Owners() *GroupOwnersCollectionRequestBuilder { bb := &GroupOwnersCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/owners" return bb } // GroupOwnersCollectionRequestBuilder is request builder for DirectoryObject collection type GroupOwnersCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for DirectoryObject collection func (b *GroupOwnersCollectionRequestBuilder) Request() *GroupOwnersCollectionRequest { return &GroupOwnersCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for DirectoryObject item func (b *GroupOwnersCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder { bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupOwnersCollectionRequest is request for DirectoryObject collection type GroupOwnersCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for DirectoryObject collection func (r *GroupOwnersCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]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 len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for DirectoryObject collection func (r *GroupOwnersCollectionRequest) Get(ctx context.Context) ([]DirectoryObject, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for DirectoryObject collection func (r *GroupOwnersCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // PermissionGrants returns request builder for ResourceSpecificPermissionGrant collection func (b *GroupRequestBuilder) PermissionGrants() *GroupPermissionGrantsCollectionRequestBuilder { bb := &GroupPermissionGrantsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/permissionGrants" return bb } // GroupPermissionGrantsCollectionRequestBuilder is request builder for ResourceSpecificPermissionGrant collection type GroupPermissionGrantsCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for ResourceSpecificPermissionGrant collection func (b *GroupPermissionGrantsCollectionRequestBuilder) Request() *GroupPermissionGrantsCollectionRequest { return &GroupPermissionGrantsCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for ResourceSpecificPermissionGrant item func (b *GroupPermissionGrantsCollectionRequestBuilder) ID(id string) *ResourceSpecificPermissionGrantRequestBuilder { bb := &ResourceSpecificPermissionGrantRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupPermissionGrantsCollectionRequest is request for ResourceSpecificPermissionGrant collection type GroupPermissionGrantsCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for ResourceSpecificPermissionGrant collection func (r *GroupPermissionGrantsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]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 { 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 []ResourceSpecificPermissionGrant ) err := jsonx.NewDecoder(res.Body).Decode(&paging) if err != nil { return nil, err } err = jsonx.Unmarshal(paging.Value, &value) if err != nil { return nil, err } values = append(values, value...) if len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for ResourceSpecificPermissionGrant collection func (r *GroupPermissionGrantsCollectionRequest) Get(ctx context.Context) ([]ResourceSpecificPermissionGrant, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for ResourceSpecificPermissionGrant collection func (r *GroupPermissionGrantsCollectionRequest) Add(ctx context.Context, reqObj *ResourceSpecificPermissionGrant) (resObj *ResourceSpecificPermissionGrant, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // Photo is navigation property func (b *GroupRequestBuilder) Photo() *ProfilePhotoRequestBuilder { bb := &ProfilePhotoRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/photo" return bb } // Photos returns request builder for ProfilePhoto collection func (b *GroupRequestBuilder) Photos() *GroupPhotosCollectionRequestBuilder { bb := &GroupPhotosCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/photos" return bb } // GroupPhotosCollectionRequestBuilder is request builder for ProfilePhoto collection type GroupPhotosCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for ProfilePhoto collection func (b *GroupPhotosCollectionRequestBuilder) Request() *GroupPhotosCollectionRequest { return &GroupPhotosCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for ProfilePhoto item func (b *GroupPhotosCollectionRequestBuilder) ID(id string) *ProfilePhotoRequestBuilder { bb := &ProfilePhotoRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupPhotosCollectionRequest is request for ProfilePhoto collection type GroupPhotosCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for ProfilePhoto collection func (r *GroupPhotosCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]ProfilePhoto, 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 []ProfilePhoto 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 []ProfilePhoto ) err := jsonx.NewDecoder(res.Body).Decode(&paging) if err != nil { return nil, err } err = jsonx.Unmarshal(paging.Value, &value) if err != nil { return nil, err } values = append(values, value...) if len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for ProfilePhoto collection func (r *GroupPhotosCollectionRequest) Get(ctx context.Context) ([]ProfilePhoto, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for ProfilePhoto collection func (r *GroupPhotosCollectionRequest) Add(ctx context.Context, reqObj *ProfilePhoto) (resObj *ProfilePhoto, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // Planner is navigation property func (b *GroupRequestBuilder) Planner() *PlannerGroupRequestBuilder { bb := &PlannerGroupRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/planner" return bb } // RejectedSenders returns request builder for DirectoryObject collection func (b *GroupRequestBuilder) RejectedSenders() *GroupRejectedSendersCollectionRequestBuilder { bb := &GroupRejectedSendersCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/rejectedSenders" return bb } // GroupRejectedSendersCollectionRequestBuilder is request builder for DirectoryObject collection type GroupRejectedSendersCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for DirectoryObject collection func (b *GroupRejectedSendersCollectionRequestBuilder) Request() *GroupRejectedSendersCollectionRequest { return &GroupRejectedSendersCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for DirectoryObject item func (b *GroupRejectedSendersCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder { bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupRejectedSendersCollectionRequest is request for DirectoryObject collection type GroupRejectedSendersCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for DirectoryObject collection func (r *GroupRejectedSendersCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]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 len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for DirectoryObject collection func (r *GroupRejectedSendersCollectionRequest) Get(ctx context.Context) ([]DirectoryObject, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for DirectoryObject collection func (r *GroupRejectedSendersCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // Settings returns request builder for DirectorySetting collection func (b *GroupRequestBuilder) Settings() *GroupSettingsCollectionRequestBuilder { bb := &GroupSettingsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/settings" return bb } // GroupSettingsCollectionRequestBuilder is request builder for DirectorySetting collection type GroupSettingsCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for DirectorySetting collection func (b *GroupSettingsCollectionRequestBuilder) Request() *GroupSettingsCollectionRequest { return &GroupSettingsCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for DirectorySetting item func (b *GroupSettingsCollectionRequestBuilder) ID(id string) *DirectorySettingRequestBuilder { bb := &DirectorySettingRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupSettingsCollectionRequest is request for DirectorySetting collection type GroupSettingsCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for DirectorySetting collection func (r *GroupSettingsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]DirectorySetting, 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 []DirectorySetting 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 []DirectorySetting ) err := jsonx.NewDecoder(res.Body).Decode(&paging) if err != nil { return nil, err } err = jsonx.Unmarshal(paging.Value, &value) if err != nil { return nil, err } values = append(values, value...) if len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for DirectorySetting collection func (r *GroupSettingsCollectionRequest) Get(ctx context.Context) ([]DirectorySetting, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for DirectorySetting collection func (r *GroupSettingsCollectionRequest) Add(ctx context.Context, reqObj *DirectorySetting) (resObj *DirectorySetting, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // Sites returns request builder for Site collection func (b *GroupRequestBuilder) Sites() *GroupSitesCollectionRequestBuilder { bb := &GroupSitesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/sites" return bb } // GroupSitesCollectionRequestBuilder is request builder for Site collection type GroupSitesCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for Site collection func (b *GroupSitesCollectionRequestBuilder) Request() *GroupSitesCollectionRequest { return &GroupSitesCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for Site item func (b *GroupSitesCollectionRequestBuilder) ID(id string) *SiteRequestBuilder { bb := &SiteRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupSitesCollectionRequest is request for Site collection type GroupSitesCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for Site collection func (r *GroupSitesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]Site, 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 []Site 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 []Site ) err := jsonx.NewDecoder(res.Body).Decode(&paging) if err != nil { return nil, err } err = jsonx.Unmarshal(paging.Value, &value) if err != nil { return nil, err } values = append(values, value...) if len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for Site collection func (r *GroupSitesCollectionRequest) Get(ctx context.Context) ([]Site, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for Site collection func (r *GroupSitesCollectionRequest) Add(ctx context.Context, reqObj *Site) (resObj *Site, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // Team is navigation property func (b *GroupRequestBuilder) Team() *TeamRequestBuilder { bb := &TeamRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/team" return bb } // Threads returns request builder for ConversationThread collection func (b *GroupRequestBuilder) Threads() *GroupThreadsCollectionRequestBuilder { bb := &GroupThreadsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/threads" return bb } // GroupThreadsCollectionRequestBuilder is request builder for ConversationThread collection type GroupThreadsCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for ConversationThread collection func (b *GroupThreadsCollectionRequestBuilder) Request() *GroupThreadsCollectionRequest { return &GroupThreadsCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for ConversationThread item func (b *GroupThreadsCollectionRequestBuilder) ID(id string) *ConversationThreadRequestBuilder { bb := &ConversationThreadRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupThreadsCollectionRequest is request for ConversationThread collection type GroupThreadsCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for ConversationThread collection func (r *GroupThreadsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]ConversationThread, 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 []ConversationThread 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 []ConversationThread ) err := jsonx.NewDecoder(res.Body).Decode(&paging) if err != nil { return nil, err } err = jsonx.Unmarshal(paging.Value, &value) if err != nil { return nil, err } values = append(values, value...) if len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for ConversationThread collection func (r *GroupThreadsCollectionRequest) Get(ctx context.Context) ([]ConversationThread, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for ConversationThread collection func (r *GroupThreadsCollectionRequest) Add(ctx context.Context, reqObj *ConversationThread) (resObj *ConversationThread, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // TransitiveMemberOf returns request builder for DirectoryObject collection func (b *GroupRequestBuilder) TransitiveMemberOf() *GroupTransitiveMemberOfCollectionRequestBuilder { bb := &GroupTransitiveMemberOfCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/transitiveMemberOf" return bb } // GroupTransitiveMemberOfCollectionRequestBuilder is request builder for DirectoryObject collection type GroupTransitiveMemberOfCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for DirectoryObject collection func (b *GroupTransitiveMemberOfCollectionRequestBuilder) Request() *GroupTransitiveMemberOfCollectionRequest { return &GroupTransitiveMemberOfCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for DirectoryObject item func (b *GroupTransitiveMemberOfCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder { bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupTransitiveMemberOfCollectionRequest is request for DirectoryObject collection type GroupTransitiveMemberOfCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for DirectoryObject collection func (r *GroupTransitiveMemberOfCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]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 len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for DirectoryObject collection func (r *GroupTransitiveMemberOfCollectionRequest) Get(ctx context.Context) ([]DirectoryObject, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for DirectoryObject collection func (r *GroupTransitiveMemberOfCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return } // TransitiveMembers returns request builder for DirectoryObject collection func (b *GroupRequestBuilder) TransitiveMembers() *GroupTransitiveMembersCollectionRequestBuilder { bb := &GroupTransitiveMembersCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/transitiveMembers" return bb } // GroupTransitiveMembersCollectionRequestBuilder is request builder for DirectoryObject collection type GroupTransitiveMembersCollectionRequestBuilder struct{ BaseRequestBuilder } // Request returns request for DirectoryObject collection func (b *GroupTransitiveMembersCollectionRequestBuilder) Request() *GroupTransitiveMembersCollectionRequest { return &GroupTransitiveMembersCollectionRequest{ BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, } } // ID returns request builder for DirectoryObject item func (b *GroupTransitiveMembersCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder { bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} bb.baseURL += "/" + id return bb } // GroupTransitiveMembersCollectionRequest is request for DirectoryObject collection type GroupTransitiveMembersCollectionRequest struct{ BaseRequest } // Paging perfoms paging operation for DirectoryObject collection func (r *GroupTransitiveMembersCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]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 len(paging.NextLink) == 0 { return values, nil } req, err = http.NewRequest("GET", paging.NextLink, nil) if ctx != nil { req = req.WithContext(ctx) } res, err = r.client.Do(req) if err != nil { return nil, err } } } // Get performs GET request for DirectoryObject collection func (r *GroupTransitiveMembersCollectionRequest) Get(ctx context.Context) ([]DirectoryObject, error) { var query string if r.query != nil { query = "?" + r.query.Encode() } return r.Paging(ctx, "GET", query, nil) } // Add performs POST request for DirectoryObject collection func (r *GroupTransitiveMembersCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) { err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) return }