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/OutlookTaskFolderRequest.go

328 lines
11 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"
)
// OutlookTaskFolderRequestBuilder is request builder for OutlookTaskFolder
type OutlookTaskFolderRequestBuilder struct{ BaseRequestBuilder }
// Request returns OutlookTaskFolderRequest
func (b *OutlookTaskFolderRequestBuilder) Request() *OutlookTaskFolderRequest {
return &OutlookTaskFolderRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// OutlookTaskFolderRequest is request for OutlookTaskFolder
type OutlookTaskFolderRequest struct{ BaseRequest }
// Get performs GET request for OutlookTaskFolder
func (r *OutlookTaskFolderRequest) Get(ctx context.Context) (resObj *OutlookTaskFolder, 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 OutlookTaskFolder
func (r *OutlookTaskFolderRequest) Update(ctx context.Context, reqObj *OutlookTaskFolder) error {
return r.JSONRequest(ctx, "PATCH", "", reqObj, nil)
}
// Delete performs DELETE request for OutlookTaskFolder
func (r *OutlookTaskFolderRequest) Delete(ctx context.Context) error {
return r.JSONRequest(ctx, "DELETE", "", nil, nil)
}
// MultiValueExtendedProperties returns request builder for MultiValueLegacyExtendedProperty collection
func (b *OutlookTaskFolderRequestBuilder) MultiValueExtendedProperties() *OutlookTaskFolderMultiValueExtendedPropertiesCollectionRequestBuilder {
bb := &OutlookTaskFolderMultiValueExtendedPropertiesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/multiValueExtendedProperties"
return bb
}
// OutlookTaskFolderMultiValueExtendedPropertiesCollectionRequestBuilder is request builder for MultiValueLegacyExtendedProperty collection
type OutlookTaskFolderMultiValueExtendedPropertiesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for MultiValueLegacyExtendedProperty collection
func (b *OutlookTaskFolderMultiValueExtendedPropertiesCollectionRequestBuilder) Request() *OutlookTaskFolderMultiValueExtendedPropertiesCollectionRequest {
return &OutlookTaskFolderMultiValueExtendedPropertiesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for MultiValueLegacyExtendedProperty item
func (b *OutlookTaskFolderMultiValueExtendedPropertiesCollectionRequestBuilder) ID(id string) *MultiValueLegacyExtendedPropertyRequestBuilder {
bb := &MultiValueLegacyExtendedPropertyRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// OutlookTaskFolderMultiValueExtendedPropertiesCollectionRequest is request for MultiValueLegacyExtendedProperty collection
type OutlookTaskFolderMultiValueExtendedPropertiesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for MultiValueLegacyExtendedProperty collection
func (r *OutlookTaskFolderMultiValueExtendedPropertiesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]MultiValueLegacyExtendedProperty, 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 []MultiValueLegacyExtendedProperty
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 []MultiValueLegacyExtendedProperty
)
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 MultiValueLegacyExtendedProperty collection
func (r *OutlookTaskFolderMultiValueExtendedPropertiesCollectionRequest) Get(ctx context.Context) ([]MultiValueLegacyExtendedProperty, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for MultiValueLegacyExtendedProperty collection
func (r *OutlookTaskFolderMultiValueExtendedPropertiesCollectionRequest) Add(ctx context.Context, reqObj *MultiValueLegacyExtendedProperty) (resObj *MultiValueLegacyExtendedProperty, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// SingleValueExtendedProperties returns request builder for SingleValueLegacyExtendedProperty collection
func (b *OutlookTaskFolderRequestBuilder) SingleValueExtendedProperties() *OutlookTaskFolderSingleValueExtendedPropertiesCollectionRequestBuilder {
bb := &OutlookTaskFolderSingleValueExtendedPropertiesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/singleValueExtendedProperties"
return bb
}
// OutlookTaskFolderSingleValueExtendedPropertiesCollectionRequestBuilder is request builder for SingleValueLegacyExtendedProperty collection
type OutlookTaskFolderSingleValueExtendedPropertiesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for SingleValueLegacyExtendedProperty collection
func (b *OutlookTaskFolderSingleValueExtendedPropertiesCollectionRequestBuilder) Request() *OutlookTaskFolderSingleValueExtendedPropertiesCollectionRequest {
return &OutlookTaskFolderSingleValueExtendedPropertiesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for SingleValueLegacyExtendedProperty item
func (b *OutlookTaskFolderSingleValueExtendedPropertiesCollectionRequestBuilder) ID(id string) *SingleValueLegacyExtendedPropertyRequestBuilder {
bb := &SingleValueLegacyExtendedPropertyRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// OutlookTaskFolderSingleValueExtendedPropertiesCollectionRequest is request for SingleValueLegacyExtendedProperty collection
type OutlookTaskFolderSingleValueExtendedPropertiesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for SingleValueLegacyExtendedProperty collection
func (r *OutlookTaskFolderSingleValueExtendedPropertiesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]SingleValueLegacyExtendedProperty, 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 []SingleValueLegacyExtendedProperty
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 []SingleValueLegacyExtendedProperty
)
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 SingleValueLegacyExtendedProperty collection
func (r *OutlookTaskFolderSingleValueExtendedPropertiesCollectionRequest) Get(ctx context.Context) ([]SingleValueLegacyExtendedProperty, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for SingleValueLegacyExtendedProperty collection
func (r *OutlookTaskFolderSingleValueExtendedPropertiesCollectionRequest) Add(ctx context.Context, reqObj *SingleValueLegacyExtendedProperty) (resObj *SingleValueLegacyExtendedProperty, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Tasks returns request builder for OutlookTask collection
func (b *OutlookTaskFolderRequestBuilder) Tasks() *OutlookTaskFolderTasksCollectionRequestBuilder {
bb := &OutlookTaskFolderTasksCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/tasks"
return bb
}
// OutlookTaskFolderTasksCollectionRequestBuilder is request builder for OutlookTask collection
type OutlookTaskFolderTasksCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for OutlookTask collection
func (b *OutlookTaskFolderTasksCollectionRequestBuilder) Request() *OutlookTaskFolderTasksCollectionRequest {
return &OutlookTaskFolderTasksCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for OutlookTask item
func (b *OutlookTaskFolderTasksCollectionRequestBuilder) ID(id string) *OutlookTaskRequestBuilder {
bb := &OutlookTaskRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// OutlookTaskFolderTasksCollectionRequest is request for OutlookTask collection
type OutlookTaskFolderTasksCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for OutlookTask collection
func (r *OutlookTaskFolderTasksCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]OutlookTask, 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 []OutlookTask
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 []OutlookTask
)
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 OutlookTask collection
func (r *OutlookTaskFolderTasksCollectionRequest) Get(ctx context.Context) ([]OutlookTask, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil)
}
// Add performs POST request for OutlookTask collection
func (r *OutlookTaskFolderTasksCollectionRequest) Add(ctx context.Context, reqObj *OutlookTask) (resObj *OutlookTask, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}