5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-10 14:30:26 +00:00
matterbridge/vendor/github.com/yaegashi/msgraph.go/beta/PlannerUserRequest.go

516 lines
15 KiB
Go

// Code generated by msgraph-generate.go DO NOT EDIT.
package msgraph
import (
"context"
"fmt"
"io/ioutil"
"net/http"
"github.com/yaegashi/msgraph.go/jsonx"
)
// PlannerUserRequestBuilder is request builder for PlannerUser
type PlannerUserRequestBuilder struct{ BaseRequestBuilder }
// Request returns PlannerUserRequest
func (b *PlannerUserRequestBuilder) Request() *PlannerUserRequest {
return &PlannerUserRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// PlannerUserRequest is request for PlannerUser
type PlannerUserRequest struct{ BaseRequest }
// Get performs GET request for PlannerUser
func (r *PlannerUserRequest) Get(ctx context.Context) (resObj *PlannerUser, 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 PlannerUser
func (r *PlannerUserRequest) Update(ctx context.Context, reqObj *PlannerUser) error {
return r.JSONRequest(ctx, "PATCH", "", reqObj, nil)
}
// Delete performs DELETE request for PlannerUser
func (r *PlannerUserRequest) Delete(ctx context.Context) error {
return r.JSONRequest(ctx, "DELETE", "", nil, nil)
}
// All returns request builder for PlannerDelta collection
func (b *PlannerUserRequestBuilder) All() *PlannerUserAllCollectionRequestBuilder {
bb := &PlannerUserAllCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/all"
return bb
}
// PlannerUserAllCollectionRequestBuilder is request builder for PlannerDelta collection
type PlannerUserAllCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for PlannerDelta collection
func (b *PlannerUserAllCollectionRequestBuilder) Request() *PlannerUserAllCollectionRequest {
return &PlannerUserAllCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for PlannerDelta item
func (b *PlannerUserAllCollectionRequestBuilder) ID(id string) *PlannerDeltaRequestBuilder {
bb := &PlannerDeltaRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// PlannerUserAllCollectionRequest is request for PlannerDelta collection
type PlannerUserAllCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for PlannerDelta collection
func (r *PlannerUserAllCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]PlannerDelta, 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 []PlannerDelta
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 []PlannerDelta
)
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 PlannerDelta collection
func (r *PlannerUserAllCollectionRequest) Get(ctx context.Context) ([]PlannerDelta, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for PlannerDelta collection
func (r *PlannerUserAllCollectionRequest) Add(ctx context.Context, reqObj *PlannerDelta) (resObj *PlannerDelta, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// FavoritePlans returns request builder for PlannerPlan collection
func (b *PlannerUserRequestBuilder) FavoritePlans() *PlannerUserFavoritePlansCollectionRequestBuilder {
bb := &PlannerUserFavoritePlansCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/favoritePlans"
return bb
}
// PlannerUserFavoritePlansCollectionRequestBuilder is request builder for PlannerPlan collection
type PlannerUserFavoritePlansCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for PlannerPlan collection
func (b *PlannerUserFavoritePlansCollectionRequestBuilder) Request() *PlannerUserFavoritePlansCollectionRequest {
return &PlannerUserFavoritePlansCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for PlannerPlan item
func (b *PlannerUserFavoritePlansCollectionRequestBuilder) ID(id string) *PlannerPlanRequestBuilder {
bb := &PlannerPlanRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// PlannerUserFavoritePlansCollectionRequest is request for PlannerPlan collection
type PlannerUserFavoritePlansCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for PlannerPlan collection
func (r *PlannerUserFavoritePlansCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]PlannerPlan, 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 []PlannerPlan
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 []PlannerPlan
)
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 PlannerPlan collection
func (r *PlannerUserFavoritePlansCollectionRequest) Get(ctx context.Context) ([]PlannerPlan, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for PlannerPlan collection
func (r *PlannerUserFavoritePlansCollectionRequest) Add(ctx context.Context, reqObj *PlannerPlan) (resObj *PlannerPlan, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Plans returns request builder for PlannerPlan collection
func (b *PlannerUserRequestBuilder) Plans() *PlannerUserPlansCollectionRequestBuilder {
bb := &PlannerUserPlansCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/plans"
return bb
}
// PlannerUserPlansCollectionRequestBuilder is request builder for PlannerPlan collection
type PlannerUserPlansCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for PlannerPlan collection
func (b *PlannerUserPlansCollectionRequestBuilder) Request() *PlannerUserPlansCollectionRequest {
return &PlannerUserPlansCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for PlannerPlan item
func (b *PlannerUserPlansCollectionRequestBuilder) ID(id string) *PlannerPlanRequestBuilder {
bb := &PlannerPlanRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// PlannerUserPlansCollectionRequest is request for PlannerPlan collection
type PlannerUserPlansCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for PlannerPlan collection
func (r *PlannerUserPlansCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]PlannerPlan, 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 []PlannerPlan
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 []PlannerPlan
)
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 PlannerPlan collection
func (r *PlannerUserPlansCollectionRequest) Get(ctx context.Context) ([]PlannerPlan, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for PlannerPlan collection
func (r *PlannerUserPlansCollectionRequest) Add(ctx context.Context, reqObj *PlannerPlan) (resObj *PlannerPlan, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// RecentPlans returns request builder for PlannerPlan collection
func (b *PlannerUserRequestBuilder) RecentPlans() *PlannerUserRecentPlansCollectionRequestBuilder {
bb := &PlannerUserRecentPlansCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/recentPlans"
return bb
}
// PlannerUserRecentPlansCollectionRequestBuilder is request builder for PlannerPlan collection
type PlannerUserRecentPlansCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for PlannerPlan collection
func (b *PlannerUserRecentPlansCollectionRequestBuilder) Request() *PlannerUserRecentPlansCollectionRequest {
return &PlannerUserRecentPlansCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for PlannerPlan item
func (b *PlannerUserRecentPlansCollectionRequestBuilder) ID(id string) *PlannerPlanRequestBuilder {
bb := &PlannerPlanRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// PlannerUserRecentPlansCollectionRequest is request for PlannerPlan collection
type PlannerUserRecentPlansCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for PlannerPlan collection
func (r *PlannerUserRecentPlansCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]PlannerPlan, 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 []PlannerPlan
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 []PlannerPlan
)
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 PlannerPlan collection
func (r *PlannerUserRecentPlansCollectionRequest) Get(ctx context.Context) ([]PlannerPlan, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for PlannerPlan collection
func (r *PlannerUserRecentPlansCollectionRequest) Add(ctx context.Context, reqObj *PlannerPlan) (resObj *PlannerPlan, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Tasks returns request builder for PlannerTask collection
func (b *PlannerUserRequestBuilder) Tasks() *PlannerUserTasksCollectionRequestBuilder {
bb := &PlannerUserTasksCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/tasks"
return bb
}
// PlannerUserTasksCollectionRequestBuilder is request builder for PlannerTask collection
type PlannerUserTasksCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for PlannerTask collection
func (b *PlannerUserTasksCollectionRequestBuilder) Request() *PlannerUserTasksCollectionRequest {
return &PlannerUserTasksCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for PlannerTask item
func (b *PlannerUserTasksCollectionRequestBuilder) ID(id string) *PlannerTaskRequestBuilder {
bb := &PlannerTaskRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// PlannerUserTasksCollectionRequest is request for PlannerTask collection
type PlannerUserTasksCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for PlannerTask collection
func (r *PlannerUserTasksCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]PlannerTask, 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 []PlannerTask
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 []PlannerTask
)
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 PlannerTask collection
func (r *PlannerUserTasksCollectionRequest) Get(ctx context.Context) ([]PlannerTask, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for PlannerTask collection
func (r *PlannerUserTasksCollectionRequest) Add(ctx context.Context, reqObj *PlannerTask) (resObj *PlannerTask, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}