2
0
mirror of https://github.com/42wim/matterbridge synced 2024-11-15 06:12:55 +00:00
matterbridge/vendor/github.com/yaegashi/msgraph.go/beta/ActionMessage.go
2020-09-04 23:29:13 +02:00

600 lines
19 KiB
Go

// Code generated by msgraph.go/gen DO NOT EDIT.
package msgraph
import (
"context"
"fmt"
"io/ioutil"
"net/http"
"github.com/yaegashi/msgraph.go/jsonx"
)
// MessageCreateReplyRequestParameter undocumented
type MessageCreateReplyRequestParameter struct {
// Message undocumented
Message *Message `json:"Message,omitempty"`
// Comment undocumented
Comment *string `json:"Comment,omitempty"`
}
// MessageCreateReplyAllRequestParameter undocumented
type MessageCreateReplyAllRequestParameter struct {
// Message undocumented
Message *Message `json:"Message,omitempty"`
// Comment undocumented
Comment *string `json:"Comment,omitempty"`
}
// MessageCreateForwardRequestParameter undocumented
type MessageCreateForwardRequestParameter struct {
// ToRecipients undocumented
ToRecipients []Recipient `json:"ToRecipients,omitempty"`
// Message undocumented
Message *Message `json:"Message,omitempty"`
// Comment undocumented
Comment *string `json:"Comment,omitempty"`
}
// MessageSendRequestParameter undocumented
type MessageSendRequestParameter struct {
}
// MessageCopyRequestParameter undocumented
type MessageCopyRequestParameter struct {
// DestinationID undocumented
DestinationID *string `json:"DestinationId,omitempty"`
}
// MessageMoveRequestParameter undocumented
type MessageMoveRequestParameter struct {
// DestinationID undocumented
DestinationID *string `json:"DestinationId,omitempty"`
}
// MessageReplyRequestParameter undocumented
type MessageReplyRequestParameter struct {
// Message undocumented
Message *Message `json:"Message,omitempty"`
// Comment undocumented
Comment *string `json:"Comment,omitempty"`
}
// MessageReplyAllRequestParameter undocumented
type MessageReplyAllRequestParameter struct {
// Message undocumented
Message *Message `json:"Message,omitempty"`
// Comment undocumented
Comment *string `json:"Comment,omitempty"`
}
// MessageForwardRequestParameter undocumented
type MessageForwardRequestParameter struct {
// ToRecipients undocumented
ToRecipients []Recipient `json:"ToRecipients,omitempty"`
// Message undocumented
Message *Message `json:"Message,omitempty"`
// Comment undocumented
Comment *string `json:"Comment,omitempty"`
}
// MessageUnsubscribeRequestParameter undocumented
type MessageUnsubscribeRequestParameter struct {
}
// Attachments returns request builder for Attachment collection
func (b *MessageRequestBuilder) Attachments() *MessageAttachmentsCollectionRequestBuilder {
bb := &MessageAttachmentsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/attachments"
return bb
}
// MessageAttachmentsCollectionRequestBuilder is request builder for Attachment collection
type MessageAttachmentsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for Attachment collection
func (b *MessageAttachmentsCollectionRequestBuilder) Request() *MessageAttachmentsCollectionRequest {
return &MessageAttachmentsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for Attachment item
func (b *MessageAttachmentsCollectionRequestBuilder) ID(id string) *AttachmentRequestBuilder {
bb := &AttachmentRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// MessageAttachmentsCollectionRequest is request for Attachment collection
type MessageAttachmentsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for Attachment collection
func (r *MessageAttachmentsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]Attachment, 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 []Attachment
for {
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
res.Body.Close()
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 []Attachment
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
res.Body.Close()
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for Attachment collection, max N pages
func (r *MessageAttachmentsCollectionRequest) GetN(ctx context.Context, n int) ([]Attachment, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for Attachment collection
func (r *MessageAttachmentsCollectionRequest) Get(ctx context.Context) ([]Attachment, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for Attachment collection
func (r *MessageAttachmentsCollectionRequest) Add(ctx context.Context, reqObj *Attachment) (resObj *Attachment, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Extensions returns request builder for Extension collection
func (b *MessageRequestBuilder) Extensions() *MessageExtensionsCollectionRequestBuilder {
bb := &MessageExtensionsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/extensions"
return bb
}
// MessageExtensionsCollectionRequestBuilder is request builder for Extension collection
type MessageExtensionsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for Extension collection
func (b *MessageExtensionsCollectionRequestBuilder) Request() *MessageExtensionsCollectionRequest {
return &MessageExtensionsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for Extension item
func (b *MessageExtensionsCollectionRequestBuilder) ID(id string) *ExtensionRequestBuilder {
bb := &ExtensionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// MessageExtensionsCollectionRequest is request for Extension collection
type MessageExtensionsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for Extension collection
func (r *MessageExtensionsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]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 {
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
res.Body.Close()
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)
res.Body.Close()
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for Extension collection, max N pages
func (r *MessageExtensionsCollectionRequest) GetN(ctx context.Context, n int) ([]Extension, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for Extension collection
func (r *MessageExtensionsCollectionRequest) Get(ctx context.Context) ([]Extension, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for Extension collection
func (r *MessageExtensionsCollectionRequest) Add(ctx context.Context, reqObj *Extension) (resObj *Extension, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// Mentions returns request builder for Mention collection
func (b *MessageRequestBuilder) Mentions() *MessageMentionsCollectionRequestBuilder {
bb := &MessageMentionsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/mentions"
return bb
}
// MessageMentionsCollectionRequestBuilder is request builder for Mention collection
type MessageMentionsCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for Mention collection
func (b *MessageMentionsCollectionRequestBuilder) Request() *MessageMentionsCollectionRequest {
return &MessageMentionsCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for Mention item
func (b *MessageMentionsCollectionRequestBuilder) ID(id string) *MentionRequestBuilder {
bb := &MentionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// MessageMentionsCollectionRequest is request for Mention collection
type MessageMentionsCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for Mention collection
func (r *MessageMentionsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]Mention, 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 []Mention
for {
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
res.Body.Close()
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 []Mention
)
err := jsonx.NewDecoder(res.Body).Decode(&paging)
res.Body.Close()
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for Mention collection, max N pages
func (r *MessageMentionsCollectionRequest) GetN(ctx context.Context, n int) ([]Mention, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for Mention collection
func (r *MessageMentionsCollectionRequest) Get(ctx context.Context) ([]Mention, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for Mention collection
func (r *MessageMentionsCollectionRequest) Add(ctx context.Context, reqObj *Mention) (resObj *Mention, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}
// MultiValueExtendedProperties returns request builder for MultiValueLegacyExtendedProperty collection
func (b *MessageRequestBuilder) MultiValueExtendedProperties() *MessageMultiValueExtendedPropertiesCollectionRequestBuilder {
bb := &MessageMultiValueExtendedPropertiesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/multiValueExtendedProperties"
return bb
}
// MessageMultiValueExtendedPropertiesCollectionRequestBuilder is request builder for MultiValueLegacyExtendedProperty collection
type MessageMultiValueExtendedPropertiesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for MultiValueLegacyExtendedProperty collection
func (b *MessageMultiValueExtendedPropertiesCollectionRequestBuilder) Request() *MessageMultiValueExtendedPropertiesCollectionRequest {
return &MessageMultiValueExtendedPropertiesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for MultiValueLegacyExtendedProperty item
func (b *MessageMultiValueExtendedPropertiesCollectionRequestBuilder) ID(id string) *MultiValueLegacyExtendedPropertyRequestBuilder {
bb := &MultiValueLegacyExtendedPropertyRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// MessageMultiValueExtendedPropertiesCollectionRequest is request for MultiValueLegacyExtendedProperty collection
type MessageMultiValueExtendedPropertiesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for MultiValueLegacyExtendedProperty collection
func (r *MessageMultiValueExtendedPropertiesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]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 {
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
res.Body.Close()
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)
res.Body.Close()
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for MultiValueLegacyExtendedProperty collection, max N pages
func (r *MessageMultiValueExtendedPropertiesCollectionRequest) GetN(ctx context.Context, n int) ([]MultiValueLegacyExtendedProperty, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for MultiValueLegacyExtendedProperty collection
func (r *MessageMultiValueExtendedPropertiesCollectionRequest) Get(ctx context.Context) ([]MultiValueLegacyExtendedProperty, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for MultiValueLegacyExtendedProperty collection
func (r *MessageMultiValueExtendedPropertiesCollectionRequest) 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 *MessageRequestBuilder) SingleValueExtendedProperties() *MessageSingleValueExtendedPropertiesCollectionRequestBuilder {
bb := &MessageSingleValueExtendedPropertiesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/singleValueExtendedProperties"
return bb
}
// MessageSingleValueExtendedPropertiesCollectionRequestBuilder is request builder for SingleValueLegacyExtendedProperty collection
type MessageSingleValueExtendedPropertiesCollectionRequestBuilder struct{ BaseRequestBuilder }
// Request returns request for SingleValueLegacyExtendedProperty collection
func (b *MessageSingleValueExtendedPropertiesCollectionRequestBuilder) Request() *MessageSingleValueExtendedPropertiesCollectionRequest {
return &MessageSingleValueExtendedPropertiesCollectionRequest{
BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client},
}
}
// ID returns request builder for SingleValueLegacyExtendedProperty item
func (b *MessageSingleValueExtendedPropertiesCollectionRequestBuilder) ID(id string) *SingleValueLegacyExtendedPropertyRequestBuilder {
bb := &SingleValueLegacyExtendedPropertyRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}
bb.baseURL += "/" + id
return bb
}
// MessageSingleValueExtendedPropertiesCollectionRequest is request for SingleValueLegacyExtendedProperty collection
type MessageSingleValueExtendedPropertiesCollectionRequest struct{ BaseRequest }
// Paging perfoms paging operation for SingleValueLegacyExtendedProperty collection
func (r *MessageSingleValueExtendedPropertiesCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]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 {
if res.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(res.Body)
res.Body.Close()
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)
res.Body.Close()
if err != nil {
return nil, err
}
err = jsonx.Unmarshal(paging.Value, &value)
if err != nil {
return nil, err
}
values = append(values, value...)
if n >= 0 {
n--
}
if n == 0 || 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
}
}
}
// GetN performs GET request for SingleValueLegacyExtendedProperty collection, max N pages
func (r *MessageSingleValueExtendedPropertiesCollectionRequest) GetN(ctx context.Context, n int) ([]SingleValueLegacyExtendedProperty, error) {
var query string
if r.query != nil {
query = "?" + r.query.Encode()
}
return r.Paging(ctx, "GET", query, nil, n)
}
// Get performs GET request for SingleValueLegacyExtendedProperty collection
func (r *MessageSingleValueExtendedPropertiesCollectionRequest) Get(ctx context.Context) ([]SingleValueLegacyExtendedProperty, error) {
return r.GetN(ctx, 0)
}
// Add performs POST request for SingleValueLegacyExtendedProperty collection
func (r *MessageSingleValueExtendedPropertiesCollectionRequest) Add(ctx context.Context, reqObj *SingleValueLegacyExtendedProperty) (resObj *SingleValueLegacyExtendedProperty, err error) {
err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj)
return
}