github.com/yaegashi/msgraph.go@v0.1.4/beta/ActionCall.go (about) 1 // Code generated by msgraph.go/gen DO NOT EDIT. 2 3 package msgraph 4 5 import ( 6 "context" 7 "fmt" 8 "io/ioutil" 9 "net/http" 10 11 "github.com/yaegashi/msgraph.go/jsonx" 12 ) 13 14 // CallAnswerRequestParameter undocumented 15 type CallAnswerRequestParameter struct { 16 // CallbackURI undocumented 17 CallbackURI *string `json:"callbackUri,omitempty"` 18 // MediaConfig undocumented 19 MediaConfig *MediaConfig `json:"mediaConfig,omitempty"` 20 // AcceptedModalities undocumented 21 AcceptedModalities []Modality `json:"acceptedModalities,omitempty"` 22 } 23 24 // CallCancelMediaProcessingRequestParameter undocumented 25 type CallCancelMediaProcessingRequestParameter struct { 26 // ClientContext undocumented 27 ClientContext *string `json:"clientContext,omitempty"` 28 } 29 30 // CallChangeScreenSharingRoleRequestParameter undocumented 31 type CallChangeScreenSharingRoleRequestParameter struct { 32 // Role undocumented 33 Role *ScreenSharingRole `json:"role,omitempty"` 34 } 35 36 // CallKeepAliveRequestParameter undocumented 37 type CallKeepAliveRequestParameter struct { 38 } 39 40 // CallMuteRequestParameter undocumented 41 type CallMuteRequestParameter struct { 42 // ClientContext undocumented 43 ClientContext *string `json:"clientContext,omitempty"` 44 } 45 46 // CallPlayPromptRequestParameter undocumented 47 type CallPlayPromptRequestParameter struct { 48 // Prompts undocumented 49 Prompts []Prompt `json:"prompts,omitempty"` 50 // Loop undocumented 51 Loop *bool `json:"loop,omitempty"` 52 // ClientContext undocumented 53 ClientContext *string `json:"clientContext,omitempty"` 54 } 55 56 // CallRecordRequestParameter undocumented 57 type CallRecordRequestParameter struct { 58 // Prompts undocumented 59 Prompts []Prompt `json:"prompts,omitempty"` 60 // BargeInAllowed undocumented 61 BargeInAllowed *bool `json:"bargeInAllowed,omitempty"` 62 // InitialSilenceTimeoutInSeconds undocumented 63 InitialSilenceTimeoutInSeconds *int `json:"initialSilenceTimeoutInSeconds,omitempty"` 64 // MaxSilenceTimeoutInSeconds undocumented 65 MaxSilenceTimeoutInSeconds *int `json:"maxSilenceTimeoutInSeconds,omitempty"` 66 // MaxRecordDurationInSeconds undocumented 67 MaxRecordDurationInSeconds *int `json:"maxRecordDurationInSeconds,omitempty"` 68 // PlayBeep undocumented 69 PlayBeep *bool `json:"playBeep,omitempty"` 70 // StreamWhileRecording undocumented 71 StreamWhileRecording *bool `json:"streamWhileRecording,omitempty"` 72 // StopTones undocumented 73 StopTones []string `json:"stopTones,omitempty"` 74 // ClientContext undocumented 75 ClientContext *string `json:"clientContext,omitempty"` 76 } 77 78 // CallRecordResponseRequestParameter undocumented 79 type CallRecordResponseRequestParameter struct { 80 // Prompts undocumented 81 Prompts []Prompt `json:"prompts,omitempty"` 82 // BargeInAllowed undocumented 83 BargeInAllowed *bool `json:"bargeInAllowed,omitempty"` 84 // InitialSilenceTimeoutInSeconds undocumented 85 InitialSilenceTimeoutInSeconds *int `json:"initialSilenceTimeoutInSeconds,omitempty"` 86 // MaxSilenceTimeoutInSeconds undocumented 87 MaxSilenceTimeoutInSeconds *int `json:"maxSilenceTimeoutInSeconds,omitempty"` 88 // MaxRecordDurationInSeconds undocumented 89 MaxRecordDurationInSeconds *int `json:"maxRecordDurationInSeconds,omitempty"` 90 // PlayBeep undocumented 91 PlayBeep *bool `json:"playBeep,omitempty"` 92 // StreamWhileRecording undocumented 93 StreamWhileRecording *bool `json:"streamWhileRecording,omitempty"` 94 // StopTones undocumented 95 StopTones []string `json:"stopTones,omitempty"` 96 // ClientContext undocumented 97 ClientContext *string `json:"clientContext,omitempty"` 98 } 99 100 // CallRedirectRequestParameter undocumented 101 type CallRedirectRequestParameter struct { 102 // Targets undocumented 103 Targets []InvitationParticipantInfo `json:"targets,omitempty"` 104 // TargetDisposition undocumented 105 TargetDisposition *CallDisposition `json:"targetDisposition,omitempty"` 106 // Timeout undocumented 107 Timeout *int `json:"timeout,omitempty"` 108 // MaskCallee undocumented 109 MaskCallee *bool `json:"maskCallee,omitempty"` 110 // MaskCaller undocumented 111 MaskCaller *bool `json:"maskCaller,omitempty"` 112 // CallbackURI undocumented 113 CallbackURI *string `json:"callbackUri,omitempty"` 114 } 115 116 // CallRejectRequestParameter undocumented 117 type CallRejectRequestParameter struct { 118 // Reason undocumented 119 Reason *RejectReason `json:"reason,omitempty"` 120 // CallbackURI undocumented 121 CallbackURI *string `json:"callbackUri,omitempty"` 122 } 123 124 // CallSubscribeToToneRequestParameter undocumented 125 type CallSubscribeToToneRequestParameter struct { 126 // ClientContext undocumented 127 ClientContext *string `json:"clientContext,omitempty"` 128 } 129 130 // CallTransferRequestParameter undocumented 131 type CallTransferRequestParameter struct { 132 // TransferTarget undocumented 133 TransferTarget *InvitationParticipantInfo `json:"transferTarget,omitempty"` 134 } 135 136 // CallUnmuteRequestParameter undocumented 137 type CallUnmuteRequestParameter struct { 138 // ClientContext undocumented 139 ClientContext *string `json:"clientContext,omitempty"` 140 } 141 142 // CallUpdateRecordingStatusRequestParameter undocumented 143 type CallUpdateRecordingStatusRequestParameter struct { 144 // Status undocumented 145 Status *RecordingStatus `json:"status,omitempty"` 146 // ClientContext undocumented 147 ClientContext *string `json:"clientContext,omitempty"` 148 } 149 150 // AudioRoutingGroups returns request builder for AudioRoutingGroup collection 151 func (b *CallRequestBuilder) AudioRoutingGroups() *CallAudioRoutingGroupsCollectionRequestBuilder { 152 bb := &CallAudioRoutingGroupsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} 153 bb.baseURL += "/audioRoutingGroups" 154 return bb 155 } 156 157 // CallAudioRoutingGroupsCollectionRequestBuilder is request builder for AudioRoutingGroup collection 158 type CallAudioRoutingGroupsCollectionRequestBuilder struct{ BaseRequestBuilder } 159 160 // Request returns request for AudioRoutingGroup collection 161 func (b *CallAudioRoutingGroupsCollectionRequestBuilder) Request() *CallAudioRoutingGroupsCollectionRequest { 162 return &CallAudioRoutingGroupsCollectionRequest{ 163 BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, 164 } 165 } 166 167 // ID returns request builder for AudioRoutingGroup item 168 func (b *CallAudioRoutingGroupsCollectionRequestBuilder) ID(id string) *AudioRoutingGroupRequestBuilder { 169 bb := &AudioRoutingGroupRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} 170 bb.baseURL += "/" + id 171 return bb 172 } 173 174 // CallAudioRoutingGroupsCollectionRequest is request for AudioRoutingGroup collection 175 type CallAudioRoutingGroupsCollectionRequest struct{ BaseRequest } 176 177 // Paging perfoms paging operation for AudioRoutingGroup collection 178 func (r *CallAudioRoutingGroupsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]AudioRoutingGroup, error) { 179 req, err := r.NewJSONRequest(method, path, obj) 180 if err != nil { 181 return nil, err 182 } 183 if ctx != nil { 184 req = req.WithContext(ctx) 185 } 186 res, err := r.client.Do(req) 187 if err != nil { 188 return nil, err 189 } 190 var values []AudioRoutingGroup 191 for { 192 if res.StatusCode != http.StatusOK { 193 b, _ := ioutil.ReadAll(res.Body) 194 res.Body.Close() 195 errRes := &ErrorResponse{Response: res} 196 err := jsonx.Unmarshal(b, errRes) 197 if err != nil { 198 return nil, fmt.Errorf("%s: %s", res.Status, string(b)) 199 } 200 return nil, errRes 201 } 202 var ( 203 paging Paging 204 value []AudioRoutingGroup 205 ) 206 err := jsonx.NewDecoder(res.Body).Decode(&paging) 207 res.Body.Close() 208 if err != nil { 209 return nil, err 210 } 211 err = jsonx.Unmarshal(paging.Value, &value) 212 if err != nil { 213 return nil, err 214 } 215 values = append(values, value...) 216 if n >= 0 { 217 n-- 218 } 219 if n == 0 || len(paging.NextLink) == 0 { 220 return values, nil 221 } 222 req, err = http.NewRequest("GET", paging.NextLink, nil) 223 if ctx != nil { 224 req = req.WithContext(ctx) 225 } 226 res, err = r.client.Do(req) 227 if err != nil { 228 return nil, err 229 } 230 } 231 } 232 233 // GetN performs GET request for AudioRoutingGroup collection, max N pages 234 func (r *CallAudioRoutingGroupsCollectionRequest) GetN(ctx context.Context, n int) ([]AudioRoutingGroup, error) { 235 var query string 236 if r.query != nil { 237 query = "?" + r.query.Encode() 238 } 239 return r.Paging(ctx, "GET", query, nil, n) 240 } 241 242 // Get performs GET request for AudioRoutingGroup collection 243 func (r *CallAudioRoutingGroupsCollectionRequest) Get(ctx context.Context) ([]AudioRoutingGroup, error) { 244 return r.GetN(ctx, 0) 245 } 246 247 // Add performs POST request for AudioRoutingGroup collection 248 func (r *CallAudioRoutingGroupsCollectionRequest) Add(ctx context.Context, reqObj *AudioRoutingGroup) (resObj *AudioRoutingGroup, err error) { 249 err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) 250 return 251 } 252 253 // Operations returns request builder for CommsOperation collection 254 func (b *CallRequestBuilder) Operations() *CallOperationsCollectionRequestBuilder { 255 bb := &CallOperationsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} 256 bb.baseURL += "/operations" 257 return bb 258 } 259 260 // CallOperationsCollectionRequestBuilder is request builder for CommsOperation collection 261 type CallOperationsCollectionRequestBuilder struct{ BaseRequestBuilder } 262 263 // Request returns request for CommsOperation collection 264 func (b *CallOperationsCollectionRequestBuilder) Request() *CallOperationsCollectionRequest { 265 return &CallOperationsCollectionRequest{ 266 BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, 267 } 268 } 269 270 // ID returns request builder for CommsOperation item 271 func (b *CallOperationsCollectionRequestBuilder) ID(id string) *CommsOperationRequestBuilder { 272 bb := &CommsOperationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} 273 bb.baseURL += "/" + id 274 return bb 275 } 276 277 // CallOperationsCollectionRequest is request for CommsOperation collection 278 type CallOperationsCollectionRequest struct{ BaseRequest } 279 280 // Paging perfoms paging operation for CommsOperation collection 281 func (r *CallOperationsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]CommsOperation, error) { 282 req, err := r.NewJSONRequest(method, path, obj) 283 if err != nil { 284 return nil, err 285 } 286 if ctx != nil { 287 req = req.WithContext(ctx) 288 } 289 res, err := r.client.Do(req) 290 if err != nil { 291 return nil, err 292 } 293 var values []CommsOperation 294 for { 295 if res.StatusCode != http.StatusOK { 296 b, _ := ioutil.ReadAll(res.Body) 297 res.Body.Close() 298 errRes := &ErrorResponse{Response: res} 299 err := jsonx.Unmarshal(b, errRes) 300 if err != nil { 301 return nil, fmt.Errorf("%s: %s", res.Status, string(b)) 302 } 303 return nil, errRes 304 } 305 var ( 306 paging Paging 307 value []CommsOperation 308 ) 309 err := jsonx.NewDecoder(res.Body).Decode(&paging) 310 res.Body.Close() 311 if err != nil { 312 return nil, err 313 } 314 err = jsonx.Unmarshal(paging.Value, &value) 315 if err != nil { 316 return nil, err 317 } 318 values = append(values, value...) 319 if n >= 0 { 320 n-- 321 } 322 if n == 0 || len(paging.NextLink) == 0 { 323 return values, nil 324 } 325 req, err = http.NewRequest("GET", paging.NextLink, nil) 326 if ctx != nil { 327 req = req.WithContext(ctx) 328 } 329 res, err = r.client.Do(req) 330 if err != nil { 331 return nil, err 332 } 333 } 334 } 335 336 // GetN performs GET request for CommsOperation collection, max N pages 337 func (r *CallOperationsCollectionRequest) GetN(ctx context.Context, n int) ([]CommsOperation, error) { 338 var query string 339 if r.query != nil { 340 query = "?" + r.query.Encode() 341 } 342 return r.Paging(ctx, "GET", query, nil, n) 343 } 344 345 // Get performs GET request for CommsOperation collection 346 func (r *CallOperationsCollectionRequest) Get(ctx context.Context) ([]CommsOperation, error) { 347 return r.GetN(ctx, 0) 348 } 349 350 // Add performs POST request for CommsOperation collection 351 func (r *CallOperationsCollectionRequest) Add(ctx context.Context, reqObj *CommsOperation) (resObj *CommsOperation, err error) { 352 err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) 353 return 354 } 355 356 // Participants returns request builder for Participant collection 357 func (b *CallRequestBuilder) Participants() *CallParticipantsCollectionRequestBuilder { 358 bb := &CallParticipantsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} 359 bb.baseURL += "/participants" 360 return bb 361 } 362 363 // CallParticipantsCollectionRequestBuilder is request builder for Participant collection 364 type CallParticipantsCollectionRequestBuilder struct{ BaseRequestBuilder } 365 366 // Request returns request for Participant collection 367 func (b *CallParticipantsCollectionRequestBuilder) Request() *CallParticipantsCollectionRequest { 368 return &CallParticipantsCollectionRequest{ 369 BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, 370 } 371 } 372 373 // ID returns request builder for Participant item 374 func (b *CallParticipantsCollectionRequestBuilder) ID(id string) *ParticipantRequestBuilder { 375 bb := &ParticipantRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} 376 bb.baseURL += "/" + id 377 return bb 378 } 379 380 // CallParticipantsCollectionRequest is request for Participant collection 381 type CallParticipantsCollectionRequest struct{ BaseRequest } 382 383 // Paging perfoms paging operation for Participant collection 384 func (r *CallParticipantsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]Participant, error) { 385 req, err := r.NewJSONRequest(method, path, obj) 386 if err != nil { 387 return nil, err 388 } 389 if ctx != nil { 390 req = req.WithContext(ctx) 391 } 392 res, err := r.client.Do(req) 393 if err != nil { 394 return nil, err 395 } 396 var values []Participant 397 for { 398 if res.StatusCode != http.StatusOK { 399 b, _ := ioutil.ReadAll(res.Body) 400 res.Body.Close() 401 errRes := &ErrorResponse{Response: res} 402 err := jsonx.Unmarshal(b, errRes) 403 if err != nil { 404 return nil, fmt.Errorf("%s: %s", res.Status, string(b)) 405 } 406 return nil, errRes 407 } 408 var ( 409 paging Paging 410 value []Participant 411 ) 412 err := jsonx.NewDecoder(res.Body).Decode(&paging) 413 res.Body.Close() 414 if err != nil { 415 return nil, err 416 } 417 err = jsonx.Unmarshal(paging.Value, &value) 418 if err != nil { 419 return nil, err 420 } 421 values = append(values, value...) 422 if n >= 0 { 423 n-- 424 } 425 if n == 0 || len(paging.NextLink) == 0 { 426 return values, nil 427 } 428 req, err = http.NewRequest("GET", paging.NextLink, nil) 429 if ctx != nil { 430 req = req.WithContext(ctx) 431 } 432 res, err = r.client.Do(req) 433 if err != nil { 434 return nil, err 435 } 436 } 437 } 438 439 // GetN performs GET request for Participant collection, max N pages 440 func (r *CallParticipantsCollectionRequest) GetN(ctx context.Context, n int) ([]Participant, error) { 441 var query string 442 if r.query != nil { 443 query = "?" + r.query.Encode() 444 } 445 return r.Paging(ctx, "GET", query, nil, n) 446 } 447 448 // Get performs GET request for Participant collection 449 func (r *CallParticipantsCollectionRequest) Get(ctx context.Context) ([]Participant, error) { 450 return r.GetN(ctx, 0) 451 } 452 453 // Add performs POST request for Participant collection 454 func (r *CallParticipantsCollectionRequest) Add(ctx context.Context, reqObj *Participant) (resObj *Participant, err error) { 455 err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) 456 return 457 }