matterbridge/vendor/github.com/matterbridge/msgraph.go/beta/UserRequest.go

3723 lines
115 KiB
Go
Raw Normal View History

// Code generated by msgraph-generate.go DO NOT EDIT.
package msgraph
import (
"context"
"fmt"
"io/ioutil"
"net/http"
"github.com/matterbridge/msgraph.go/jsonx"
)
// UserRequestBuilder is request builder for User
type UserRequestBuilder struct{ BaseRequestBuilder }
// Request returns UserRequest
func (b *UserRequestBuilder) Request() *UserRequest {
return &UserRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// UserRequest is request for User
type UserRequest struct{ BaseRequest }
// Get performs GET request for User
func (r *UserRequest) Get(ctx context.Context) (resObj *User, 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 User
func (r *UserRequest) Update(ctx context.Context, reqObj *User) error {
return r.JSONRequest(ctx, "PATCH", "", reqObj, nil)
}
// Delete performs DELETE request for User
func (r *UserRequest) Delete(ctx context.Context) error {
return r.JSONRequest(ctx, "DELETE", "", nil, nil)
}
// Activities returns request builder for UserActivity collection
func (b *UserRequestBuilder) Activities() *UserActivitiesCollectionRequestBuilder {
bb := &UserActivitiesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/activities"
return bb
}
// UserActivitiesCollectionRequestBuilder is request builder for UserActivity collection
type UserActivitiesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for UserActivity collection
func (b *UserActivitiesCollectionRequestBuilder) Request() *UserActivitiesCollectionRequest {
return &UserActivitiesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for UserActivity item
func (b *UserActivitiesCollectionRequestBuilder) ID(id string) *UserActivityRequestBuilder {
bb := &UserActivityRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserActivitiesCollectionRequest is request for UserActivity collection
type UserActivitiesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for UserActivity collection
func (r *UserActivitiesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]UserActivity, 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 []UserActivity
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 []UserActivity
)
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 UserActivity collection
func (r *UserActivitiesCollectionRequest) Get(ctx context.Context) ([]UserActivity, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for UserActivity collection
func (r *UserActivitiesCollectionRequest) Add(ctx context.Context, reqObj *UserActivity) (resObj *UserActivity, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// AgreementAcceptances returns request builder for AgreementAcceptance collection
func (b *UserRequestBuilder) AgreementAcceptances() *UserAgreementAcceptancesCollectionRequestBuilder {
bb := &UserAgreementAcceptancesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/agreementAcceptances"
return bb
}
// UserAgreementAcceptancesCollectionRequestBuilder is request builder for AgreementAcceptance collection
type UserAgreementAcceptancesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for AgreementAcceptance collection
func (b *UserAgreementAcceptancesCollectionRequestBuilder) Request() *UserAgreementAcceptancesCollectionRequest {
return &UserAgreementAcceptancesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for AgreementAcceptance item
func (b *UserAgreementAcceptancesCollectionRequestBuilder) ID(id string) *AgreementAcceptanceRequestBuilder {
bb := &AgreementAcceptanceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserAgreementAcceptancesCollectionRequest is request for AgreementAcceptance collection
type UserAgreementAcceptancesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for AgreementAcceptance collection
func (r *UserAgreementAcceptancesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]AgreementAcceptance, 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 []AgreementAcceptance
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 []AgreementAcceptance
)
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 AgreementAcceptance collection
func (r *UserAgreementAcceptancesCollectionRequest) Get(ctx context.Context) ([]AgreementAcceptance, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for AgreementAcceptance collection
func (r *UserAgreementAcceptancesCollectionRequest) Add(ctx context.Context, reqObj *AgreementAcceptance) (resObj *AgreementAcceptance, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Analytics is navigation property
func (b *UserRequestBuilder) Analytics() *UserAnalyticsRequestBuilder {
bb := &UserAnalyticsRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/analytics"
return bb
}
// AppRoleAssignments returns request builder for AppRoleAssignment collection
func (b *UserRequestBuilder) AppRoleAssignments() *UserAppRoleAssignmentsCollectionRequestBuilder {
bb := &UserAppRoleAssignmentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/appRoleAssignments"
return bb
}
// UserAppRoleAssignmentsCollectionRequestBuilder is request builder for AppRoleAssignment collection
type UserAppRoleAssignmentsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for AppRoleAssignment collection
func (b *UserAppRoleAssignmentsCollectionRequestBuilder) Request() *UserAppRoleAssignmentsCollectionRequest {
return &UserAppRoleAssignmentsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for AppRoleAssignment item
func (b *UserAppRoleAssignmentsCollectionRequestBuilder) ID(id string) *AppRoleAssignmentRequestBuilder {
bb := &AppRoleAssignmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserAppRoleAssignmentsCollectionRequest is request for AppRoleAssignment collection
type UserAppRoleAssignmentsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for AppRoleAssignment collection
func (r *UserAppRoleAssignmentsCollectionRequest) 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 *UserAppRoleAssignmentsCollectionRequest) 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 *UserAppRoleAssignmentsCollectionRequest) Add(ctx context.Context, reqObj *AppRoleAssignment) (resObj *AppRoleAssignment, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Calendar is navigation property
func (b *UserRequestBuilder) Calendar() *CalendarRequestBuilder {
bb := &CalendarRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/calendar"
return bb
}
// CalendarGroups returns request builder for CalendarGroup collection
func (b *UserRequestBuilder) CalendarGroups() *UserCalendarGroupsCollectionRequestBuilder {
bb := &UserCalendarGroupsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/calendarGroups"
return bb
}
// UserCalendarGroupsCollectionRequestBuilder is request builder for CalendarGroup collection
type UserCalendarGroupsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for CalendarGroup collection
func (b *UserCalendarGroupsCollectionRequestBuilder) Request() *UserCalendarGroupsCollectionRequest {
return &UserCalendarGroupsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for CalendarGroup item
func (b *UserCalendarGroupsCollectionRequestBuilder) ID(id string) *CalendarGroupRequestBuilder {
bb := &CalendarGroupRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserCalendarGroupsCollectionRequest is request for CalendarGroup collection
type UserCalendarGroupsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for CalendarGroup collection
func (r *UserCalendarGroupsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]CalendarGroup, 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 []CalendarGroup
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 []CalendarGroup
)
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 CalendarGroup collection
func (r *UserCalendarGroupsCollectionRequest) Get(ctx context.Context) ([]CalendarGroup, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for CalendarGroup collection
func (r *UserCalendarGroupsCollectionRequest) Add(ctx context.Context, reqObj *CalendarGroup) (resObj *CalendarGroup, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// CalendarView returns request builder for Event collection
func (b *UserRequestBuilder) CalendarView() *UserCalendarViewCollectionRequestBuilder {
bb := &UserCalendarViewCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/calendarView"
return bb
}
// UserCalendarViewCollectionRequestBuilder is request builder for Event collection
type UserCalendarViewCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for Event collection
func (b *UserCalendarViewCollectionRequestBuilder) Request() *UserCalendarViewCollectionRequest {
return &UserCalendarViewCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for Event item
func (b *UserCalendarViewCollectionRequestBuilder) ID(id string) *EventRequestBuilder {
bb := &EventRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserCalendarViewCollectionRequest is request for Event collection
type UserCalendarViewCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for Event collection
func (r *UserCalendarViewCollectionRequest) 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 *UserCalendarViewCollectionRequest) 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 *UserCalendarViewCollectionRequest) Add(ctx context.Context, reqObj *Event) (resObj *Event, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Calendars returns request builder for Calendar collection
func (b *UserRequestBuilder) Calendars() *UserCalendarsCollectionRequestBuilder {
bb := &UserCalendarsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/calendars"
return bb
}
// UserCalendarsCollectionRequestBuilder is request builder for Calendar collection
type UserCalendarsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for Calendar collection
func (b *UserCalendarsCollectionRequestBuilder) Request() *UserCalendarsCollectionRequest {
return &UserCalendarsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for Calendar item
func (b *UserCalendarsCollectionRequestBuilder) ID(id string) *CalendarRequestBuilder {
bb := &CalendarRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserCalendarsCollectionRequest is request for Calendar collection
type UserCalendarsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for Calendar collection
func (r *UserCalendarsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]Calendar, 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 []Calendar
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 []Calendar
)
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 Calendar collection
func (r *UserCalendarsCollectionRequest) Get(ctx context.Context) ([]Calendar, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for Calendar collection
func (r *UserCalendarsCollectionRequest) Add(ctx context.Context, reqObj *Calendar) (resObj *Calendar, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Chats returns request builder for Chat collection
func (b *UserRequestBuilder) Chats() *UserChatsCollectionRequestBuilder {
bb := &UserChatsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/chats"
return bb
}
// UserChatsCollectionRequestBuilder is request builder for Chat collection
type UserChatsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for Chat collection
func (b *UserChatsCollectionRequestBuilder) Request() *UserChatsCollectionRequest {
return &UserChatsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for Chat item
func (b *UserChatsCollectionRequestBuilder) ID(id string) *ChatRequestBuilder {
bb := &ChatRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserChatsCollectionRequest is request for Chat collection
type UserChatsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for Chat collection
func (r *UserChatsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]Chat, 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 []Chat
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 []Chat
)
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 Chat collection
func (r *UserChatsCollectionRequest) Get(ctx context.Context) ([]Chat, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for Chat collection
func (r *UserChatsCollectionRequest) Add(ctx context.Context, reqObj *Chat) (resObj *Chat, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ContactFolders returns request builder for ContactFolder collection
func (b *UserRequestBuilder) ContactFolders() *UserContactFoldersCollectionRequestBuilder {
bb := &UserContactFoldersCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/contactFolders"
return bb
}
// UserContactFoldersCollectionRequestBuilder is request builder for ContactFolder collection
type UserContactFoldersCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for ContactFolder collection
func (b *UserContactFoldersCollectionRequestBuilder) Request() *UserContactFoldersCollectionRequest {
return &UserContactFoldersCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for ContactFolder item
func (b *UserContactFoldersCollectionRequestBuilder) ID(id string) *ContactFolderRequestBuilder {
bb := &ContactFolderRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserContactFoldersCollectionRequest is request for ContactFolder collection
type UserContactFoldersCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for ContactFolder collection
func (r *UserContactFoldersCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]ContactFolder, 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 []ContactFolder
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 []ContactFolder
)
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 ContactFolder collection
func (r *UserContactFoldersCollectionRequest) Get(ctx context.Context) ([]ContactFolder, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for ContactFolder collection
func (r *UserContactFoldersCollectionRequest) Add(ctx context.Context, reqObj *ContactFolder) (resObj *ContactFolder, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Contacts returns request builder for Contact collection
func (b *UserRequestBuilder) Contacts() *UserContactsCollectionRequestBuilder {
bb := &UserContactsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/contacts"
return bb
}
// UserContactsCollectionRequestBuilder is request builder for Contact collection
type UserContactsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for Contact collection
func (b *UserContactsCollectionRequestBuilder) Request() *UserContactsCollectionRequest {
return &UserContactsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for Contact item
func (b *UserContactsCollectionRequestBuilder) ID(id string) *ContactRequestBuilder {
bb := &ContactRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserContactsCollectionRequest is request for Contact collection
type UserContactsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for Contact collection
func (r *UserContactsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]Contact, 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 []Contact
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 []Contact
)
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 Contact collection
func (r *UserContactsCollectionRequest) Get(ctx context.Context) ([]Contact, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for Contact collection
func (r *UserContactsCollectionRequest) Add(ctx context.Context, reqObj *Contact) (resObj *Contact, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// CreatedObjects returns request builder for DirectoryObject collection
func (b *UserRequestBuilder) CreatedObjects() *UserCreatedObjectsCollectionRequestBuilder {
bb := &UserCreatedObjectsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/createdObjects"
return bb
}
// UserCreatedObjectsCollectionRequestBuilder is request builder for DirectoryObject collection
type UserCreatedObjectsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DirectoryObject collection
func (b *UserCreatedObjectsCollectionRequestBuilder) Request() *UserCreatedObjectsCollectionRequest {
return &UserCreatedObjectsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DirectoryObject item
func (b *UserCreatedObjectsCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder {
bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserCreatedObjectsCollectionRequest is request for DirectoryObject collection
type UserCreatedObjectsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DirectoryObject collection
func (r *UserCreatedObjectsCollectionRequest) 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 *UserCreatedObjectsCollectionRequest) 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 *UserCreatedObjectsCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DeviceEnrollmentConfigurations returns request builder for DeviceEnrollmentConfiguration collection
func (b *UserRequestBuilder) DeviceEnrollmentConfigurations() *UserDeviceEnrollmentConfigurationsCollectionRequestBuilder {
bb := &UserDeviceEnrollmentConfigurationsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceEnrollmentConfigurations"
return bb
}
// UserDeviceEnrollmentConfigurationsCollectionRequestBuilder is request builder for DeviceEnrollmentConfiguration collection
type UserDeviceEnrollmentConfigurationsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceEnrollmentConfiguration collection
func (b *UserDeviceEnrollmentConfigurationsCollectionRequestBuilder) Request() *UserDeviceEnrollmentConfigurationsCollectionRequest {
return &UserDeviceEnrollmentConfigurationsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceEnrollmentConfiguration item
func (b *UserDeviceEnrollmentConfigurationsCollectionRequestBuilder) ID(id string) *DeviceEnrollmentConfigurationRequestBuilder {
bb := &DeviceEnrollmentConfigurationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserDeviceEnrollmentConfigurationsCollectionRequest is request for DeviceEnrollmentConfiguration collection
type UserDeviceEnrollmentConfigurationsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceEnrollmentConfiguration collection
func (r *UserDeviceEnrollmentConfigurationsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]DeviceEnrollmentConfiguration, error) {
req, err := r.NewJSONRequest(method, path, obj)
if err != nil {
return nil, err
}
if ctx != nil {
req = req.WithContext(ctx)
}
res, err := r.client.Do(req)
if err != nil {
return nil, err
}
var values []DeviceEnrollmentConfiguration
for {
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
errRes := &ErrorResponse{Response: res}
err := jsonx.Unmarshal(b, errRes)
if err != nil {
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
}
return nil, errRes
}
var (
paging Paging
value []DeviceEnrollmentConfiguration
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if 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 DeviceEnrollmentConfiguration collection
func (r *UserDeviceEnrollmentConfigurationsCollectionRequest) Get(ctx context.Context) ([]DeviceEnrollmentConfiguration, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for DeviceEnrollmentConfiguration collection
func (r *UserDeviceEnrollmentConfigurationsCollectionRequest) Add(ctx context.Context, reqObj *DeviceEnrollmentConfiguration) (resObj *DeviceEnrollmentConfiguration, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DeviceManagementTroubleshootingEvents returns request builder for DeviceManagementTroubleshootingEvent collection
func (b *UserRequestBuilder) DeviceManagementTroubleshootingEvents() *UserDeviceManagementTroubleshootingEventsCollectionRequestBuilder {
bb := &UserDeviceManagementTroubleshootingEventsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/deviceManagementTroubleshootingEvents"
return bb
}
// UserDeviceManagementTroubleshootingEventsCollectionRequestBuilder is request builder for DeviceManagementTroubleshootingEvent collection
type UserDeviceManagementTroubleshootingEventsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DeviceManagementTroubleshootingEvent collection
func (b *UserDeviceManagementTroubleshootingEventsCollectionRequestBuilder) Request() *UserDeviceManagementTroubleshootingEventsCollectionRequest {
return &UserDeviceManagementTroubleshootingEventsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DeviceManagementTroubleshootingEvent item
func (b *UserDeviceManagementTroubleshootingEventsCollectionRequestBuilder) ID(id string) *DeviceManagementTroubleshootingEventRequestBuilder {
bb := &DeviceManagementTroubleshootingEventRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserDeviceManagementTroubleshootingEventsCollectionRequest is request for DeviceManagementTroubleshootingEvent collection
type UserDeviceManagementTroubleshootingEventsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DeviceManagementTroubleshootingEvent collection
func (r *UserDeviceManagementTroubleshootingEventsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]DeviceManagementTroubleshootingEvent, error) {
req, err := r.NewJSONRequest(method, path, obj)
if err != nil {
return nil, err
}
if ctx != nil {
req = req.WithContext(ctx)
}
res, err := r.client.Do(req)
if err != nil {
return nil, err
}
var values []DeviceManagementTroubleshootingEvent
for {
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
errRes := &ErrorResponse{Response: res}
err := jsonx.Unmarshal(b, errRes)
if err != nil {
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
}
return nil, errRes
}
var (
paging Paging
value []DeviceManagementTroubleshootingEvent
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if 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 DeviceManagementTroubleshootingEvent collection
func (r *UserDeviceManagementTroubleshootingEventsCollectionRequest) Get(ctx context.Context) ([]DeviceManagementTroubleshootingEvent, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for DeviceManagementTroubleshootingEvent collection
func (r *UserDeviceManagementTroubleshootingEventsCollectionRequest) Add(ctx context.Context, reqObj *DeviceManagementTroubleshootingEvent) (resObj *DeviceManagementTroubleshootingEvent, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Devices returns request builder for Device collection
func (b *UserRequestBuilder) Devices() *UserDevicesCollectionRequestBuilder {
bb := &UserDevicesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/devices"
return bb
}
// UserDevicesCollectionRequestBuilder is request builder for Device collection
type UserDevicesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for Device collection
func (b *UserDevicesCollectionRequestBuilder) Request() *UserDevicesCollectionRequest {
return &UserDevicesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for Device item
func (b *UserDevicesCollectionRequestBuilder) ID(id string) *DeviceRequestBuilder {
bb := &DeviceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserDevicesCollectionRequest is request for Device collection
type UserDevicesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for Device collection
func (r *UserDevicesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]Device, 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 []Device
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 []Device
)
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 Device collection
func (r *UserDevicesCollectionRequest) Get(ctx context.Context) ([]Device, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for Device collection
func (r *UserDevicesCollectionRequest) Add(ctx context.Context, reqObj *Device) (resObj *Device, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// DirectReports returns request builder for DirectoryObject collection
func (b *UserRequestBuilder) DirectReports() *UserDirectReportsCollectionRequestBuilder {
bb := &UserDirectReportsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/directReports"
return bb
}
// UserDirectReportsCollectionRequestBuilder is request builder for DirectoryObject collection
type UserDirectReportsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DirectoryObject collection
func (b *UserDirectReportsCollectionRequestBuilder) Request() *UserDirectReportsCollectionRequest {
return &UserDirectReportsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DirectoryObject item
func (b *UserDirectReportsCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder {
bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserDirectReportsCollectionRequest is request for DirectoryObject collection
type UserDirectReportsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DirectoryObject collection
func (r *UserDirectReportsCollectionRequest) 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 *UserDirectReportsCollectionRequest) 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 *UserDirectReportsCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Drive is navigation property
func (b *UserRequestBuilder) Drive() *DriveRequestBuilder {
bb := &DriveRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/drive"
return bb
}
// Drives returns request builder for Drive collection
func (b *UserRequestBuilder) Drives() *UserDrivesCollectionRequestBuilder {
bb := &UserDrivesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/drives"
return bb
}
// UserDrivesCollectionRequestBuilder is request builder for Drive collection
type UserDrivesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for Drive collection
func (b *UserDrivesCollectionRequestBuilder) Request() *UserDrivesCollectionRequest {
return &UserDrivesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for Drive item
func (b *UserDrivesCollectionRequestBuilder) ID(id string) *DriveRequestBuilder {
bb := &DriveRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserDrivesCollectionRequest is request for Drive collection
type UserDrivesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for Drive collection
func (r *UserDrivesCollectionRequest) 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 *UserDrivesCollectionRequest) 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 *UserDrivesCollectionRequest) Add(ctx context.Context, reqObj *Drive) (resObj *Drive, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Events returns request builder for Event collection
func (b *UserRequestBuilder) Events() *UserEventsCollectionRequestBuilder {
bb := &UserEventsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/events"
return bb
}
// UserEventsCollectionRequestBuilder is request builder for Event collection
type UserEventsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for Event collection
func (b *UserEventsCollectionRequestBuilder) Request() *UserEventsCollectionRequest {
return &UserEventsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for Event item
func (b *UserEventsCollectionRequestBuilder) ID(id string) *EventRequestBuilder {
bb := &EventRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserEventsCollectionRequest is request for Event collection
type UserEventsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for Event collection
func (r *UserEventsCollectionRequest) 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 *UserEventsCollectionRequest) 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 *UserEventsCollectionRequest) 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 *UserRequestBuilder) Extensions() *UserExtensionsCollectionRequestBuilder {
bb := &UserExtensionsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/extensions"
return bb
}
// UserExtensionsCollectionRequestBuilder is request builder for Extension collection
type UserExtensionsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for Extension collection
func (b *UserExtensionsCollectionRequestBuilder) Request() *UserExtensionsCollectionRequest {
return &UserExtensionsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for Extension item
func (b *UserExtensionsCollectionRequestBuilder) ID(id string) *ExtensionRequestBuilder {
bb := &ExtensionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserExtensionsCollectionRequest is request for Extension collection
type UserExtensionsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for Extension collection
func (r *UserExtensionsCollectionRequest) 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 *UserExtensionsCollectionRequest) 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 *UserExtensionsCollectionRequest) Add(ctx context.Context, reqObj *Extension) (resObj *Extension, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// FollowedSites returns request builder for Site collection
func (b *UserRequestBuilder) FollowedSites() *UserFollowedSitesCollectionRequestBuilder {
bb := &UserFollowedSitesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/followedSites"
return bb
}
// UserFollowedSitesCollectionRequestBuilder is request builder for Site collection
type UserFollowedSitesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for Site collection
func (b *UserFollowedSitesCollectionRequestBuilder) Request() *UserFollowedSitesCollectionRequest {
return &UserFollowedSitesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for Site item
func (b *UserFollowedSitesCollectionRequestBuilder) ID(id string) *SiteRequestBuilder {
bb := &SiteRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserFollowedSitesCollectionRequest is request for Site collection
type UserFollowedSitesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for Site collection
func (r *UserFollowedSitesCollectionRequest) 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 *UserFollowedSitesCollectionRequest) 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 *UserFollowedSitesCollectionRequest) Add(ctx context.Context, reqObj *Site) (resObj *Site, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// InferenceClassification is navigation property
func (b *UserRequestBuilder) InferenceClassification() *InferenceClassificationRequestBuilder {
bb := &InferenceClassificationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/inferenceClassification"
return bb
}
// InformationProtection is navigation property
func (b *UserRequestBuilder) InformationProtection() *InformationProtectionRequestBuilder {
bb := &InformationProtectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/informationProtection"
return bb
}
// Insights is navigation property
func (b *UserRequestBuilder) Insights() *OfficeGraphInsightsRequestBuilder {
bb := &OfficeGraphInsightsRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/insights"
return bb
}
// JoinedGroups returns request builder for Group collection
func (b *UserRequestBuilder) JoinedGroups() *UserJoinedGroupsCollectionRequestBuilder {
bb := &UserJoinedGroupsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/joinedGroups"
return bb
}
// UserJoinedGroupsCollectionRequestBuilder is request builder for Group collection
type UserJoinedGroupsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for Group collection
func (b *UserJoinedGroupsCollectionRequestBuilder) Request() *UserJoinedGroupsCollectionRequest {
return &UserJoinedGroupsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for Group item
func (b *UserJoinedGroupsCollectionRequestBuilder) ID(id string) *GroupRequestBuilder {
bb := &GroupRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserJoinedGroupsCollectionRequest is request for Group collection
type UserJoinedGroupsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for Group collection
func (r *UserJoinedGroupsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]Group, 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 []Group
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 []Group
)
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 Group collection
func (r *UserJoinedGroupsCollectionRequest) Get(ctx context.Context) ([]Group, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for Group collection
func (r *UserJoinedGroupsCollectionRequest) Add(ctx context.Context, reqObj *Group) (resObj *Group, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// JoinedTeams returns request builder for Team collection
func (b *UserRequestBuilder) JoinedTeams() *UserJoinedTeamsCollectionRequestBuilder {
bb := &UserJoinedTeamsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/joinedTeams"
return bb
}
// UserJoinedTeamsCollectionRequestBuilder is request builder for Team collection
type UserJoinedTeamsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for Team collection
func (b *UserJoinedTeamsCollectionRequestBuilder) Request() *UserJoinedTeamsCollectionRequest {
return &UserJoinedTeamsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for Team item
func (b *UserJoinedTeamsCollectionRequestBuilder) ID(id string) *TeamRequestBuilder {
bb := &TeamRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserJoinedTeamsCollectionRequest is request for Team collection
type UserJoinedTeamsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for Team collection
func (r *UserJoinedTeamsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]Team, 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 []Team
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 []Team
)
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 Team collection
func (r *UserJoinedTeamsCollectionRequest) Get(ctx context.Context) ([]Team, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for Team collection
func (r *UserJoinedTeamsCollectionRequest) Add(ctx context.Context, reqObj *Team) (resObj *Team, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// LicenseDetails returns request builder for LicenseDetails collection
func (b *UserRequestBuilder) LicenseDetails() *UserLicenseDetailsCollectionRequestBuilder {
bb := &UserLicenseDetailsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/licenseDetails"
return bb
}
// UserLicenseDetailsCollectionRequestBuilder is request builder for LicenseDetails collection
type UserLicenseDetailsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for LicenseDetails collection
func (b *UserLicenseDetailsCollectionRequestBuilder) Request() *UserLicenseDetailsCollectionRequest {
return &UserLicenseDetailsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for LicenseDetails item
func (b *UserLicenseDetailsCollectionRequestBuilder) ID(id string) *LicenseDetailsRequestBuilder {
bb := &LicenseDetailsRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserLicenseDetailsCollectionRequest is request for LicenseDetails collection
type UserLicenseDetailsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for LicenseDetails collection
func (r *UserLicenseDetailsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]LicenseDetails, 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 []LicenseDetails
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 []LicenseDetails
)
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 LicenseDetails collection
func (r *UserLicenseDetailsCollectionRequest) Get(ctx context.Context) ([]LicenseDetails, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for LicenseDetails collection
func (r *UserLicenseDetailsCollectionRequest) Add(ctx context.Context, reqObj *LicenseDetails) (resObj *LicenseDetails, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// MailFolders returns request builder for MailFolder collection
func (b *UserRequestBuilder) MailFolders() *UserMailFoldersCollectionRequestBuilder {
bb := &UserMailFoldersCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/mailFolders"
return bb
}
// UserMailFoldersCollectionRequestBuilder is request builder for MailFolder collection
type UserMailFoldersCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for MailFolder collection
func (b *UserMailFoldersCollectionRequestBuilder) Request() *UserMailFoldersCollectionRequest {
return &UserMailFoldersCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for MailFolder item
func (b *UserMailFoldersCollectionRequestBuilder) ID(id string) *MailFolderRequestBuilder {
bb := &MailFolderRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserMailFoldersCollectionRequest is request for MailFolder collection
type UserMailFoldersCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for MailFolder collection
func (r *UserMailFoldersCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]MailFolder, 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 []MailFolder
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 []MailFolder
)
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 MailFolder collection
func (r *UserMailFoldersCollectionRequest) Get(ctx context.Context) ([]MailFolder, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for MailFolder collection
func (r *UserMailFoldersCollectionRequest) Add(ctx context.Context, reqObj *MailFolder) (resObj *MailFolder, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ManagedAppRegistrations returns request builder for ManagedAppRegistration collection
func (b *UserRequestBuilder) ManagedAppRegistrations() *UserManagedAppRegistrationsCollectionRequestBuilder {
bb := &UserManagedAppRegistrationsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/managedAppRegistrations"
return bb
}
// UserManagedAppRegistrationsCollectionRequestBuilder is request builder for ManagedAppRegistration collection
type UserManagedAppRegistrationsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for ManagedAppRegistration collection
func (b *UserManagedAppRegistrationsCollectionRequestBuilder) Request() *UserManagedAppRegistrationsCollectionRequest {
return &UserManagedAppRegistrationsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for ManagedAppRegistration item
func (b *UserManagedAppRegistrationsCollectionRequestBuilder) ID(id string) *ManagedAppRegistrationRequestBuilder {
bb := &ManagedAppRegistrationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserManagedAppRegistrationsCollectionRequest is request for ManagedAppRegistration collection
type UserManagedAppRegistrationsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for ManagedAppRegistration collection
func (r *UserManagedAppRegistrationsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]ManagedAppRegistration, error) {
req, err := r.NewJSONRequest(method, path, obj)
if err != nil {
return nil, err
}
if ctx != nil {
req = req.WithContext(ctx)
}
res, err := r.client.Do(req)
if err != nil {
return nil, err
}
var values []ManagedAppRegistration
for {
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
errRes := &ErrorResponse{Response: res}
err := jsonx.Unmarshal(b, errRes)
if err != nil {
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
}
return nil, errRes
}
var (
paging Paging
value []ManagedAppRegistration
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if len(paging.NextLink) == 0 {
return values, nil
}
req, err = http.NewRequest("GET", paging.NextLink, nil)
if ctx != nil {
req = req.WithContext(ctx)
}
res, err = r.client.Do(req)
if err != nil {
return nil, err
}
}
}
// Get performs GET request for ManagedAppRegistration collection
func (r *UserManagedAppRegistrationsCollectionRequest) Get(ctx context.Context) ([]ManagedAppRegistration, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for ManagedAppRegistration collection
func (r *UserManagedAppRegistrationsCollectionRequest) Add(ctx context.Context, reqObj *ManagedAppRegistration) (resObj *ManagedAppRegistration, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ManagedDevices returns request builder for ManagedDevice collection
func (b *UserRequestBuilder) ManagedDevices() *UserManagedDevicesCollectionRequestBuilder {
bb := &UserManagedDevicesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/managedDevices"
return bb
}
// UserManagedDevicesCollectionRequestBuilder is request builder for ManagedDevice collection
type UserManagedDevicesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for ManagedDevice collection
func (b *UserManagedDevicesCollectionRequestBuilder) Request() *UserManagedDevicesCollectionRequest {
return &UserManagedDevicesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for ManagedDevice item
func (b *UserManagedDevicesCollectionRequestBuilder) ID(id string) *ManagedDeviceRequestBuilder {
bb := &ManagedDeviceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserManagedDevicesCollectionRequest is request for ManagedDevice collection
type UserManagedDevicesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for ManagedDevice collection
func (r *UserManagedDevicesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]ManagedDevice, error) {
req, err := r.NewJSONRequest(method, path, obj)
if err != nil {
return nil, err
}
if ctx != nil {
req = req.WithContext(ctx)
}
res, err := r.client.Do(req)
if err != nil {
return nil, err
}
var values []ManagedDevice
for {
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
errRes := &ErrorResponse{Response: res}
err := jsonx.Unmarshal(b, errRes)
if err != nil {
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
}
return nil, errRes
}
var (
paging Paging
value []ManagedDevice
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if 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 ManagedDevice collection
func (r *UserManagedDevicesCollectionRequest) Get(ctx context.Context) ([]ManagedDevice, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for ManagedDevice collection
func (r *UserManagedDevicesCollectionRequest) Add(ctx context.Context, reqObj *ManagedDevice) (resObj *ManagedDevice, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Manager is navigation property
func (b *UserRequestBuilder) Manager() *DirectoryObjectRequestBuilder {
bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/manager"
return bb
}
// MemberOf returns request builder for DirectoryObject collection
func (b *UserRequestBuilder) MemberOf() *UserMemberOfCollectionRequestBuilder {
bb := &UserMemberOfCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/memberOf"
return bb
}
// UserMemberOfCollectionRequestBuilder is request builder for DirectoryObject collection
type UserMemberOfCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DirectoryObject collection
func (b *UserMemberOfCollectionRequestBuilder) Request() *UserMemberOfCollectionRequest {
return &UserMemberOfCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DirectoryObject item
func (b *UserMemberOfCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder {
bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserMemberOfCollectionRequest is request for DirectoryObject collection
type UserMemberOfCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DirectoryObject collection
func (r *UserMemberOfCollectionRequest) 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 *UserMemberOfCollectionRequest) 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 *UserMemberOfCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Messages returns request builder for Message collection
func (b *UserRequestBuilder) Messages() *UserMessagesCollectionRequestBuilder {
bb := &UserMessagesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/messages"
return bb
}
// UserMessagesCollectionRequestBuilder is request builder for Message collection
type UserMessagesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for Message collection
func (b *UserMessagesCollectionRequestBuilder) Request() *UserMessagesCollectionRequest {
return &UserMessagesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for Message item
func (b *UserMessagesCollectionRequestBuilder) ID(id string) *MessageRequestBuilder {
bb := &MessageRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserMessagesCollectionRequest is request for Message collection
type UserMessagesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for Message collection
func (r *UserMessagesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]Message, 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 []Message
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 []Message
)
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 Message collection
func (r *UserMessagesCollectionRequest) Get(ctx context.Context) ([]Message, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for Message collection
func (r *UserMessagesCollectionRequest) Add(ctx context.Context, reqObj *Message) (resObj *Message, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// MobileAppIntentAndStates returns request builder for MobileAppIntentAndState collection
func (b *UserRequestBuilder) MobileAppIntentAndStates() *UserMobileAppIntentAndStatesCollectionRequestBuilder {
bb := &UserMobileAppIntentAndStatesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/mobileAppIntentAndStates"
return bb
}
// UserMobileAppIntentAndStatesCollectionRequestBuilder is request builder for MobileAppIntentAndState collection
type UserMobileAppIntentAndStatesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for MobileAppIntentAndState collection
func (b *UserMobileAppIntentAndStatesCollectionRequestBuilder) Request() *UserMobileAppIntentAndStatesCollectionRequest {
return &UserMobileAppIntentAndStatesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for MobileAppIntentAndState item
func (b *UserMobileAppIntentAndStatesCollectionRequestBuilder) ID(id string) *MobileAppIntentAndStateRequestBuilder {
bb := &MobileAppIntentAndStateRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserMobileAppIntentAndStatesCollectionRequest is request for MobileAppIntentAndState collection
type UserMobileAppIntentAndStatesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for MobileAppIntentAndState collection
func (r *UserMobileAppIntentAndStatesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]MobileAppIntentAndState, 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 []MobileAppIntentAndState
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 []MobileAppIntentAndState
)
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 MobileAppIntentAndState collection
func (r *UserMobileAppIntentAndStatesCollectionRequest) Get(ctx context.Context) ([]MobileAppIntentAndState, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for MobileAppIntentAndState collection
func (r *UserMobileAppIntentAndStatesCollectionRequest) Add(ctx context.Context, reqObj *MobileAppIntentAndState) (resObj *MobileAppIntentAndState, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// MobileAppTroubleshootingEvents returns request builder for MobileAppTroubleshootingEvent collection
func (b *UserRequestBuilder) MobileAppTroubleshootingEvents() *UserMobileAppTroubleshootingEventsCollectionRequestBuilder {
bb := &UserMobileAppTroubleshootingEventsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/mobileAppTroubleshootingEvents"
return bb
}
// UserMobileAppTroubleshootingEventsCollectionRequestBuilder is request builder for MobileAppTroubleshootingEvent collection
type UserMobileAppTroubleshootingEventsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for MobileAppTroubleshootingEvent collection
func (b *UserMobileAppTroubleshootingEventsCollectionRequestBuilder) Request() *UserMobileAppTroubleshootingEventsCollectionRequest {
return &UserMobileAppTroubleshootingEventsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for MobileAppTroubleshootingEvent item
func (b *UserMobileAppTroubleshootingEventsCollectionRequestBuilder) ID(id string) *MobileAppTroubleshootingEventRequestBuilder {
bb := &MobileAppTroubleshootingEventRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserMobileAppTroubleshootingEventsCollectionRequest is request for MobileAppTroubleshootingEvent collection
type UserMobileAppTroubleshootingEventsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for MobileAppTroubleshootingEvent collection
func (r *UserMobileAppTroubleshootingEventsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]MobileAppTroubleshootingEvent, error) {
req, err := r.NewJSONRequest(method, path, obj)
if err != nil {
return nil, err
}
if ctx != nil {
req = req.WithContext(ctx)
}
res, err := r.client.Do(req)
if err != nil {
return nil, err
}
var values []MobileAppTroubleshootingEvent
for {
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
errRes := &ErrorResponse{Response: res}
err := jsonx.Unmarshal(b, errRes)
if err != nil {
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
}
return nil, errRes
}
var (
paging Paging
value []MobileAppTroubleshootingEvent
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if 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 MobileAppTroubleshootingEvent collection
func (r *UserMobileAppTroubleshootingEventsCollectionRequest) Get(ctx context.Context) ([]MobileAppTroubleshootingEvent, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for MobileAppTroubleshootingEvent collection
func (r *UserMobileAppTroubleshootingEventsCollectionRequest) Add(ctx context.Context, reqObj *MobileAppTroubleshootingEvent) (resObj *MobileAppTroubleshootingEvent, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Notifications returns request builder for Notification collection
func (b *UserRequestBuilder) Notifications() *UserNotificationsCollectionRequestBuilder {
bb := &UserNotificationsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/notifications"
return bb
}
// UserNotificationsCollectionRequestBuilder is request builder for Notification collection
type UserNotificationsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for Notification collection
func (b *UserNotificationsCollectionRequestBuilder) Request() *UserNotificationsCollectionRequest {
return &UserNotificationsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for Notification item
func (b *UserNotificationsCollectionRequestBuilder) ID(id string) *NotificationRequestBuilder {
bb := &NotificationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserNotificationsCollectionRequest is request for Notification collection
type UserNotificationsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for Notification collection
func (r *UserNotificationsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]Notification, 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 []Notification
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 []Notification
)
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 Notification collection
func (r *UserNotificationsCollectionRequest) Get(ctx context.Context) ([]Notification, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for Notification collection
func (r *UserNotificationsCollectionRequest) Add(ctx context.Context, reqObj *Notification) (resObj *Notification, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Onenote is navigation property
func (b *UserRequestBuilder) Onenote() *OnenoteRequestBuilder {
bb := &OnenoteRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/onenote"
return bb
}
// OnlineMeetings returns request builder for OnlineMeeting collection
func (b *UserRequestBuilder) OnlineMeetings() *UserOnlineMeetingsCollectionRequestBuilder {
bb := &UserOnlineMeetingsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/onlineMeetings"
return bb
}
// UserOnlineMeetingsCollectionRequestBuilder is request builder for OnlineMeeting collection
type UserOnlineMeetingsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for OnlineMeeting collection
func (b *UserOnlineMeetingsCollectionRequestBuilder) Request() *UserOnlineMeetingsCollectionRequest {
return &UserOnlineMeetingsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for OnlineMeeting item
func (b *UserOnlineMeetingsCollectionRequestBuilder) ID(id string) *OnlineMeetingRequestBuilder {
bb := &OnlineMeetingRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserOnlineMeetingsCollectionRequest is request for OnlineMeeting collection
type UserOnlineMeetingsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for OnlineMeeting collection
func (r *UserOnlineMeetingsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]OnlineMeeting, 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 []OnlineMeeting
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 []OnlineMeeting
)
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 OnlineMeeting collection
func (r *UserOnlineMeetingsCollectionRequest) Get(ctx context.Context) ([]OnlineMeeting, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for OnlineMeeting collection
func (r *UserOnlineMeetingsCollectionRequest) Add(ctx context.Context, reqObj *OnlineMeeting) (resObj *OnlineMeeting, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Outlook is navigation property
func (b *UserRequestBuilder) Outlook() *OutlookUserRequestBuilder {
bb := &OutlookUserRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/outlook"
return bb
}
// OwnedDevices returns request builder for DirectoryObject collection
func (b *UserRequestBuilder) OwnedDevices() *UserOwnedDevicesCollectionRequestBuilder {
bb := &UserOwnedDevicesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/ownedDevices"
return bb
}
// UserOwnedDevicesCollectionRequestBuilder is request builder for DirectoryObject collection
type UserOwnedDevicesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DirectoryObject collection
func (b *UserOwnedDevicesCollectionRequestBuilder) Request() *UserOwnedDevicesCollectionRequest {
return &UserOwnedDevicesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DirectoryObject item
func (b *UserOwnedDevicesCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder {
bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserOwnedDevicesCollectionRequest is request for DirectoryObject collection
type UserOwnedDevicesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DirectoryObject collection
func (r *UserOwnedDevicesCollectionRequest) 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 *UserOwnedDevicesCollectionRequest) 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 *UserOwnedDevicesCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// OwnedObjects returns request builder for DirectoryObject collection
func (b *UserRequestBuilder) OwnedObjects() *UserOwnedObjectsCollectionRequestBuilder {
bb := &UserOwnedObjectsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/ownedObjects"
return bb
}
// UserOwnedObjectsCollectionRequestBuilder is request builder for DirectoryObject collection
type UserOwnedObjectsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DirectoryObject collection
func (b *UserOwnedObjectsCollectionRequestBuilder) Request() *UserOwnedObjectsCollectionRequest {
return &UserOwnedObjectsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DirectoryObject item
func (b *UserOwnedObjectsCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder {
bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserOwnedObjectsCollectionRequest is request for DirectoryObject collection
type UserOwnedObjectsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DirectoryObject collection
func (r *UserOwnedObjectsCollectionRequest) 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 *UserOwnedObjectsCollectionRequest) 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 *UserOwnedObjectsCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// People returns request builder for Person collection
func (b *UserRequestBuilder) People() *UserPeopleCollectionRequestBuilder {
bb := &UserPeopleCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/people"
return bb
}
// UserPeopleCollectionRequestBuilder is request builder for Person collection
type UserPeopleCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for Person collection
func (b *UserPeopleCollectionRequestBuilder) Request() *UserPeopleCollectionRequest {
return &UserPeopleCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for Person item
func (b *UserPeopleCollectionRequestBuilder) ID(id string) *PersonRequestBuilder {
bb := &PersonRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserPeopleCollectionRequest is request for Person collection
type UserPeopleCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for Person collection
func (r *UserPeopleCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]Person, 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 []Person
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 []Person
)
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 Person collection
func (r *UserPeopleCollectionRequest) Get(ctx context.Context) ([]Person, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for Person collection
func (r *UserPeopleCollectionRequest) Add(ctx context.Context, reqObj *Person) (resObj *Person, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Photo is navigation property
func (b *UserRequestBuilder) Photo() *ProfilePhotoRequestBuilder {
bb := &ProfilePhotoRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/photo"
return bb
}
// Photos returns request builder for ProfilePhoto collection
func (b *UserRequestBuilder) Photos() *UserPhotosCollectionRequestBuilder {
bb := &UserPhotosCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/photos"
return bb
}
// UserPhotosCollectionRequestBuilder is request builder for ProfilePhoto collection
type UserPhotosCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for ProfilePhoto collection
func (b *UserPhotosCollectionRequestBuilder) Request() *UserPhotosCollectionRequest {
return &UserPhotosCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for ProfilePhoto item
func (b *UserPhotosCollectionRequestBuilder) ID(id string) *ProfilePhotoRequestBuilder {
bb := &ProfilePhotoRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserPhotosCollectionRequest is request for ProfilePhoto collection
type UserPhotosCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for ProfilePhoto collection
func (r *UserPhotosCollectionRequest) 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 *UserPhotosCollectionRequest) 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 *UserPhotosCollectionRequest) Add(ctx context.Context, reqObj *ProfilePhoto) (resObj *ProfilePhoto, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Planner is navigation property
func (b *UserRequestBuilder) Planner() *PlannerUserRequestBuilder {
bb := &PlannerUserRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/planner"
return bb
}
// Presence is navigation property
func (b *UserRequestBuilder) Presence() *PresenceRequestBuilder {
bb := &PresenceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/presence"
return bb
}
// Profile is navigation property
func (b *UserRequestBuilder) Profile() *ProfileRequestBuilder {
bb := &ProfileRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/profile"
return bb
}
// RegisteredDevices returns request builder for DirectoryObject collection
func (b *UserRequestBuilder) RegisteredDevices() *UserRegisteredDevicesCollectionRequestBuilder {
bb := &UserRegisteredDevicesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/registeredDevices"
return bb
}
// UserRegisteredDevicesCollectionRequestBuilder is request builder for DirectoryObject collection
type UserRegisteredDevicesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DirectoryObject collection
func (b *UserRegisteredDevicesCollectionRequestBuilder) Request() *UserRegisteredDevicesCollectionRequest {
return &UserRegisteredDevicesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DirectoryObject item
func (b *UserRegisteredDevicesCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder {
bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserRegisteredDevicesCollectionRequest is request for DirectoryObject collection
type UserRegisteredDevicesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DirectoryObject collection
func (r *UserRegisteredDevicesCollectionRequest) 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 *UserRegisteredDevicesCollectionRequest) 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 *UserRegisteredDevicesCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// ScopedRoleMemberOf returns request builder for ScopedRoleMembership collection
func (b *UserRequestBuilder) ScopedRoleMemberOf() *UserScopedRoleMemberOfCollectionRequestBuilder {
bb := &UserScopedRoleMemberOfCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/scopedRoleMemberOf"
return bb
}
// UserScopedRoleMemberOfCollectionRequestBuilder is request builder for ScopedRoleMembership collection
type UserScopedRoleMemberOfCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for ScopedRoleMembership collection
func (b *UserScopedRoleMemberOfCollectionRequestBuilder) Request() *UserScopedRoleMemberOfCollectionRequest {
return &UserScopedRoleMemberOfCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for ScopedRoleMembership item
func (b *UserScopedRoleMemberOfCollectionRequestBuilder) ID(id string) *ScopedRoleMembershipRequestBuilder {
bb := &ScopedRoleMembershipRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserScopedRoleMemberOfCollectionRequest is request for ScopedRoleMembership collection
type UserScopedRoleMemberOfCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for ScopedRoleMembership collection
func (r *UserScopedRoleMemberOfCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]ScopedRoleMembership, 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 []ScopedRoleMembership
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 []ScopedRoleMembership
)
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 ScopedRoleMembership collection
func (r *UserScopedRoleMemberOfCollectionRequest) Get(ctx context.Context) ([]ScopedRoleMembership, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for ScopedRoleMembership collection
func (r *UserScopedRoleMemberOfCollectionRequest) Add(ctx context.Context, reqObj *ScopedRoleMembership) (resObj *ScopedRoleMembership, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Settings is navigation property
func (b *UserRequestBuilder) Settings() *UserSettingsRequestBuilder {
bb := &UserSettingsRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/settings"
return bb
}
// Teamwork is navigation property
func (b *UserRequestBuilder) Teamwork() *UserTeamworkRequestBuilder {
bb := &UserTeamworkRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/teamwork"
return bb
}
// TransitiveMemberOf returns request builder for DirectoryObject collection
func (b *UserRequestBuilder) TransitiveMemberOf() *UserTransitiveMemberOfCollectionRequestBuilder {
bb := &UserTransitiveMemberOfCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/transitiveMemberOf"
return bb
}
// UserTransitiveMemberOfCollectionRequestBuilder is request builder for DirectoryObject collection
type UserTransitiveMemberOfCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for DirectoryObject collection
func (b *UserTransitiveMemberOfCollectionRequestBuilder) Request() *UserTransitiveMemberOfCollectionRequest {
return &UserTransitiveMemberOfCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for DirectoryObject item
func (b *UserTransitiveMemberOfCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder {
bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserTransitiveMemberOfCollectionRequest is request for DirectoryObject collection
type UserTransitiveMemberOfCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for DirectoryObject collection
func (r *UserTransitiveMemberOfCollectionRequest) 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 *UserTransitiveMemberOfCollectionRequest) 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 *UserTransitiveMemberOfCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// WindowsInformationProtectionDeviceRegistrations returns request builder for WindowsInformationProtectionDeviceRegistration collection
func (b *UserRequestBuilder) WindowsInformationProtectionDeviceRegistrations() *UserWindowsInformationProtectionDeviceRegistrationsCollectionRequestBuilder {
bb := &UserWindowsInformationProtectionDeviceRegistrationsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/windowsInformationProtectionDeviceRegistrations"
return bb
}
// UserWindowsInformationProtectionDeviceRegistrationsCollectionRequestBuilder is request builder for WindowsInformationProtectionDeviceRegistration collection
type UserWindowsInformationProtectionDeviceRegistrationsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for WindowsInformationProtectionDeviceRegistration collection
func (b *UserWindowsInformationProtectionDeviceRegistrationsCollectionRequestBuilder) Request() *UserWindowsInformationProtectionDeviceRegistrationsCollectionRequest {
return &UserWindowsInformationProtectionDeviceRegistrationsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for WindowsInformationProtectionDeviceRegistration item
func (b *UserWindowsInformationProtectionDeviceRegistrationsCollectionRequestBuilder) ID(id string) *WindowsInformationProtectionDeviceRegistrationRequestBuilder {
bb := &WindowsInformationProtectionDeviceRegistrationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// UserWindowsInformationProtectionDeviceRegistrationsCollectionRequest is request for WindowsInformationProtectionDeviceRegistration collection
type UserWindowsInformationProtectionDeviceRegistrationsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for WindowsInformationProtectionDeviceRegistration collection
func (r *UserWindowsInformationProtectionDeviceRegistrationsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]WindowsInformationProtectionDeviceRegistration, error) {
req, err := r.NewJSONRequest(method, path, obj)
if err != nil {
return nil, err
}
if ctx != nil {
req = req.WithContext(ctx)
}
res, err := r.client.Do(req)
if err != nil {
return nil, err
}
var values []WindowsInformationProtectionDeviceRegistration
for {
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
errRes := &ErrorResponse{Response: res}
err := jsonx.Unmarshal(b, errRes)
if err != nil {
return nil, fmt.Errorf("%s: %s", res.Status, string(b))
}
return nil, errRes
}
var (
paging Paging
value []WindowsInformationProtectionDeviceRegistration
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if len(paging.NextLink) == 0 {
return values, nil
}
req, err = http.NewRequest("GET", paging.NextLink, nil)
if ctx != nil {
req = req.WithContext(ctx)
}
res, err = r.client.Do(req)
if err != nil {
return nil, err
}
}
}
// Get performs GET request for WindowsInformationProtectionDeviceRegistration collection
func (r *UserWindowsInformationProtectionDeviceRegistrationsCollectionRequest) Get(ctx context.Context) ([]WindowsInformationProtectionDeviceRegistration, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for WindowsInformationProtectionDeviceRegistration collection
func (r *UserWindowsInformationProtectionDeviceRegistrationsCollectionRequest) Add(ctx context.Context, reqObj *WindowsInformationProtectionDeviceRegistration) (resObj *WindowsInformationProtectionDeviceRegistration, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}