2019-12-26 23:12:28 +01:00
|
|
|
// Code generated by msgraph-generate.go DO NOT EDIT.
|
|
|
|
|
|
|
|
package msgraph
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
|
|
|
"io/ioutil"
|
|
|
|
"net/http"
|
|
|
|
|
2020-03-15 23:43:46 +01:00
|
|
|
"github.com/yaegashi/msgraph.go/jsonx"
|
2019-12-26 23:12:28 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// AcceptanceStatuses returns request builder for TermsAndConditionsAcceptanceStatus collection
|
|
|
|
func (b *TermsAndConditionsRequestBuilder) AcceptanceStatuses() *TermsAndConditionsAcceptanceStatusesCollectionRequestBuilder {
|
|
|
|
bb := &TermsAndConditionsAcceptanceStatusesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
|
|
bb.baseURL += "/acceptanceStatuses"
|
|
|
|
return bb
|
|
|
|
}
|
|
|
|
|
|
|
|
// TermsAndConditionsAcceptanceStatusesCollectionRequestBuilder is request builder for TermsAndConditionsAcceptanceStatus collection
|
|
|
|
type TermsAndConditionsAcceptanceStatusesCollectionRequestBuilder struct{ BaseRequestBuilder }
|
|
|
|
|
|
|
|
// Request returns request for TermsAndConditionsAcceptanceStatus collection
|
|
|
|
func (b *TermsAndConditionsAcceptanceStatusesCollectionRequestBuilder) Request() *TermsAndConditionsAcceptanceStatusesCollectionRequest {
|
|
|
|
return &TermsAndConditionsAcceptanceStatusesCollectionRequest{
|
|
|
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ID returns request builder for TermsAndConditionsAcceptanceStatus item
|
|
|
|
func (b *TermsAndConditionsAcceptanceStatusesCollectionRequestBuilder) ID(id string) *TermsAndConditionsAcceptanceStatusRequestBuilder {
|
|
|
|
bb := &TermsAndConditionsAcceptanceStatusRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
|
|
bb.baseURL += "/" + id
|
|
|
|
return bb
|
|
|
|
}
|
|
|
|
|
|
|
|
// TermsAndConditionsAcceptanceStatusesCollectionRequest is request for TermsAndConditionsAcceptanceStatus collection
|
|
|
|
type TermsAndConditionsAcceptanceStatusesCollectionRequest struct{ BaseRequest }
|
|
|
|
|
|
|
|
// Paging perfoms paging operation for TermsAndConditionsAcceptanceStatus collection
|
2020-03-15 23:43:46 +01:00
|
|
|
func (r *TermsAndConditionsAcceptanceStatusesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]TermsAndConditionsAcceptanceStatus, error) {
|
2019-12-26 23:12:28 +01:00
|
|
|
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 []TermsAndConditionsAcceptanceStatus
|
|
|
|
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 []TermsAndConditionsAcceptanceStatus
|
|
|
|
)
|
|
|
|
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...)
|
2020-03-15 23:43:46 +01:00
|
|
|
if n >= 0 {
|
|
|
|
n--
|
|
|
|
}
|
|
|
|
if n == 0 || len(paging.NextLink) == 0 {
|
2019-12-26 23:12:28 +01:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-15 23:43:46 +01:00
|
|
|
// GetN performs GET request for TermsAndConditionsAcceptanceStatus collection, max N pages
|
|
|
|
func (r *TermsAndConditionsAcceptanceStatusesCollectionRequest) GetN(ctx context.Context, n int) ([]TermsAndConditionsAcceptanceStatus, error) {
|
2019-12-26 23:12:28 +01:00
|
|
|
var query string
|
|
|
|
if r.query != nil {
|
|
|
|
query = "?" + r.query.Encode()
|
|
|
|
}
|
2020-03-15 23:43:46 +01:00
|
|
|
return r.Paging(ctx, "GET", query, nil, n)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get performs GET request for TermsAndConditionsAcceptanceStatus collection
|
|
|
|
func (r *TermsAndConditionsAcceptanceStatusesCollectionRequest) Get(ctx context.Context) ([]TermsAndConditionsAcceptanceStatus, error) {
|
|
|
|
return r.GetN(ctx, 0)
|
2019-12-26 23:12:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Add performs POST request for TermsAndConditionsAcceptanceStatus collection
|
|
|
|
func (r *TermsAndConditionsAcceptanceStatusesCollectionRequest) Add(ctx context.Context, reqObj *TermsAndConditionsAcceptanceStatus) (resObj *TermsAndConditionsAcceptanceStatus, err error) {
|
|
|
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Assignments returns request builder for TermsAndConditionsAssignment collection
|
|
|
|
func (b *TermsAndConditionsRequestBuilder) Assignments() *TermsAndConditionsAssignmentsCollectionRequestBuilder {
|
|
|
|
bb := &TermsAndConditionsAssignmentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
|
|
bb.baseURL += "/assignments"
|
|
|
|
return bb
|
|
|
|
}
|
|
|
|
|
|
|
|
// TermsAndConditionsAssignmentsCollectionRequestBuilder is request builder for TermsAndConditionsAssignment collection
|
|
|
|
type TermsAndConditionsAssignmentsCollectionRequestBuilder struct{ BaseRequestBuilder }
|
|
|
|
|
|
|
|
// Request returns request for TermsAndConditionsAssignment collection
|
|
|
|
func (b *TermsAndConditionsAssignmentsCollectionRequestBuilder) Request() *TermsAndConditionsAssignmentsCollectionRequest {
|
|
|
|
return &TermsAndConditionsAssignmentsCollectionRequest{
|
|
|
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ID returns request builder for TermsAndConditionsAssignment item
|
|
|
|
func (b *TermsAndConditionsAssignmentsCollectionRequestBuilder) ID(id string) *TermsAndConditionsAssignmentRequestBuilder {
|
|
|
|
bb := &TermsAndConditionsAssignmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
|
|
bb.baseURL += "/" + id
|
|
|
|
return bb
|
|
|
|
}
|
|
|
|
|
|
|
|
// TermsAndConditionsAssignmentsCollectionRequest is request for TermsAndConditionsAssignment collection
|
|
|
|
type TermsAndConditionsAssignmentsCollectionRequest struct{ BaseRequest }
|
|
|
|
|
|
|
|
// Paging perfoms paging operation for TermsAndConditionsAssignment collection
|
2020-03-15 23:43:46 +01:00
|
|
|
func (r *TermsAndConditionsAssignmentsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]TermsAndConditionsAssignment, error) {
|
2019-12-26 23:12:28 +01:00
|
|
|
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 []TermsAndConditionsAssignment
|
|
|
|
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 []TermsAndConditionsAssignment
|
|
|
|
)
|
|
|
|
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...)
|
2020-03-15 23:43:46 +01:00
|
|
|
if n >= 0 {
|
|
|
|
n--
|
|
|
|
}
|
|
|
|
if n == 0 || len(paging.NextLink) == 0 {
|
2019-12-26 23:12:28 +01:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-15 23:43:46 +01:00
|
|
|
// GetN performs GET request for TermsAndConditionsAssignment collection, max N pages
|
|
|
|
func (r *TermsAndConditionsAssignmentsCollectionRequest) GetN(ctx context.Context, n int) ([]TermsAndConditionsAssignment, error) {
|
2019-12-26 23:12:28 +01:00
|
|
|
var query string
|
|
|
|
if r.query != nil {
|
|
|
|
query = "?" + r.query.Encode()
|
|
|
|
}
|
2020-03-15 23:43:46 +01:00
|
|
|
return r.Paging(ctx, "GET", query, nil, n)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get performs GET request for TermsAndConditionsAssignment collection
|
|
|
|
func (r *TermsAndConditionsAssignmentsCollectionRequest) Get(ctx context.Context) ([]TermsAndConditionsAssignment, error) {
|
|
|
|
return r.GetN(ctx, 0)
|
2019-12-26 23:12:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Add performs POST request for TermsAndConditionsAssignment collection
|
|
|
|
func (r *TermsAndConditionsAssignmentsCollectionRequest) Add(ctx context.Context, reqObj *TermsAndConditionsAssignment) (resObj *TermsAndConditionsAssignment, err error) {
|
|
|
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// GroupAssignments returns request builder for TermsAndConditionsGroupAssignment collection
|
|
|
|
func (b *TermsAndConditionsRequestBuilder) GroupAssignments() *TermsAndConditionsGroupAssignmentsCollectionRequestBuilder {
|
|
|
|
bb := &TermsAndConditionsGroupAssignmentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
|
|
bb.baseURL += "/groupAssignments"
|
|
|
|
return bb
|
|
|
|
}
|
|
|
|
|
|
|
|
// TermsAndConditionsGroupAssignmentsCollectionRequestBuilder is request builder for TermsAndConditionsGroupAssignment collection
|
|
|
|
type TermsAndConditionsGroupAssignmentsCollectionRequestBuilder struct{ BaseRequestBuilder }
|
|
|
|
|
|
|
|
// Request returns request for TermsAndConditionsGroupAssignment collection
|
|
|
|
func (b *TermsAndConditionsGroupAssignmentsCollectionRequestBuilder) Request() *TermsAndConditionsGroupAssignmentsCollectionRequest {
|
|
|
|
return &TermsAndConditionsGroupAssignmentsCollectionRequest{
|
|
|
|
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ID returns request builder for TermsAndConditionsGroupAssignment item
|
|
|
|
func (b *TermsAndConditionsGroupAssignmentsCollectionRequestBuilder) ID(id string) *TermsAndConditionsGroupAssignmentRequestBuilder {
|
|
|
|
bb := &TermsAndConditionsGroupAssignmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
|
|
bb.baseURL += "/" + id
|
|
|
|
return bb
|
|
|
|
}
|
|
|
|
|
|
|
|
// TermsAndConditionsGroupAssignmentsCollectionRequest is request for TermsAndConditionsGroupAssignment collection
|
|
|
|
type TermsAndConditionsGroupAssignmentsCollectionRequest struct{ BaseRequest }
|
|
|
|
|
|
|
|
// Paging perfoms paging operation for TermsAndConditionsGroupAssignment collection
|
2020-03-15 23:43:46 +01:00
|
|
|
func (r *TermsAndConditionsGroupAssignmentsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]TermsAndConditionsGroupAssignment, error) {
|
2019-12-26 23:12:28 +01:00
|
|
|
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 []TermsAndConditionsGroupAssignment
|
|
|
|
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 []TermsAndConditionsGroupAssignment
|
|
|
|
)
|
|
|
|
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...)
|
2020-03-15 23:43:46 +01:00
|
|
|
if n >= 0 {
|
|
|
|
n--
|
|
|
|
}
|
|
|
|
if n == 0 || len(paging.NextLink) == 0 {
|
2019-12-26 23:12:28 +01:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-15 23:43:46 +01:00
|
|
|
// GetN performs GET request for TermsAndConditionsGroupAssignment collection, max N pages
|
|
|
|
func (r *TermsAndConditionsGroupAssignmentsCollectionRequest) GetN(ctx context.Context, n int) ([]TermsAndConditionsGroupAssignment, error) {
|
2019-12-26 23:12:28 +01:00
|
|
|
var query string
|
|
|
|
if r.query != nil {
|
|
|
|
query = "?" + r.query.Encode()
|
|
|
|
}
|
2020-03-15 23:43:46 +01:00
|
|
|
return r.Paging(ctx, "GET", query, nil, n)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get performs GET request for TermsAndConditionsGroupAssignment collection
|
|
|
|
func (r *TermsAndConditionsGroupAssignmentsCollectionRequest) Get(ctx context.Context) ([]TermsAndConditionsGroupAssignment, error) {
|
|
|
|
return r.GetN(ctx, 0)
|
2019-12-26 23:12:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Add performs POST request for TermsAndConditionsGroupAssignment collection
|
|
|
|
func (r *TermsAndConditionsGroupAssignmentsCollectionRequest) Add(ctx context.Context, reqObj *TermsAndConditionsGroupAssignment) (resObj *TermsAndConditionsGroupAssignment, err error) {
|
|
|
|
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
|
|
|
|
return
|
|
|
|
}
|
2020-03-15 23:43:46 +01:00
|
|
|
|
|
|
|
// TermsAndConditions is navigation property
|
|
|
|
func (b *TermsAndConditionsAcceptanceStatusRequestBuilder) TermsAndConditions() *TermsAndConditionsRequestBuilder {
|
|
|
|
bb := &TermsAndConditionsRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
|
|
bb.baseURL += "/termsAndConditions"
|
|
|
|
return bb
|
|
|
|
}
|
|
|
|
|
|
|
|
// TermsAndConditions is navigation property
|
|
|
|
func (b *TermsAndConditionsGroupAssignmentRequestBuilder) TermsAndConditions() *TermsAndConditionsRequestBuilder {
|
|
|
|
bb := &TermsAndConditionsRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
|
|
|
|
bb.baseURL += "/termsAndConditions"
|
|
|
|
return bb
|
|
|
|
}
|