示例#1
0
        /// <summary>
        /// Updates the specified CallRecord using PATCH.
        /// </summary>
        /// <param name="callRecordToUpdate">The CallRecord to update.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <exception cref="Microsoft.Graph.ClientException">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception>
        /// <returns>The updated CallRecord.</returns>
        public async System.Threading.Tasks.Task <CallRecord> UpdateAsync(CallRecord callRecordToUpdate, CancellationToken cancellationToken)
        {
            if (callRecordToUpdate.AdditionalData != null)
            {
                if (callRecordToUpdate.AdditionalData.ContainsKey(Microsoft.Graph.Constants.HttpPropertyNames.ResponseHeaders) ||
                    callRecordToUpdate.AdditionalData.ContainsKey(Microsoft.Graph.Constants.HttpPropertyNames.StatusCode))
                {
                    throw new Microsoft.Graph.ClientException(
                              new Microsoft.Graph.Error
                    {
                        Code    = Microsoft.Graph.GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(Microsoft.Graph.GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, callRecordToUpdate.GetType().Name)
                    });
                }
            }
            if (callRecordToUpdate.AdditionalData != null)
            {
                if (callRecordToUpdate.AdditionalData.ContainsKey(Microsoft.Graph.Constants.HttpPropertyNames.ResponseHeaders) ||
                    callRecordToUpdate.AdditionalData.ContainsKey(Microsoft.Graph.Constants.HttpPropertyNames.StatusCode))
                {
                    throw new Microsoft.Graph.ClientException(
                              new Microsoft.Graph.Error
                    {
                        Code    = Microsoft.Graph.GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(Microsoft.Graph.GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, callRecordToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <CallRecord>(callRecordToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
        /// <summary>
        /// Creates the specified CallRecord using POST.
        /// </summary>
        /// <param name="callRecordToCreate">The CallRecord to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created CallRecord.</returns>
        public async System.Threading.Tasks.Task <CallRecord> CreateAsync(CallRecord callRecordToCreate, CancellationToken cancellationToken = default)
        {
            this.ContentType = CoreConstants.MimeTypeNames.Application.Json;
            this.Method      = HttpMethods.POST;
            var newEntity = await this.SendAsync <CallRecord>(callRecordToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
示例#3
0
        /// <summary>
        /// Creates the specified CallRecord using POST.
        /// </summary>
        /// <param name="callRecordToCreate">The CallRecord to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created CallRecord.</returns>
        public async System.Threading.Tasks.Task <CallRecord> CreateAsync(CallRecord callRecordToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <CallRecord>(callRecordToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="callRecordToInitialize">The <see cref="CallRecord"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(CallRecord callRecordToInitialize)
 {
     if (callRecordToInitialize != null)
     {
         if (callRecordToInitialize.Sessions != null && callRecordToInitialize.Sessions.CurrentPage != null)
         {
             callRecordToInitialize.Sessions.InitializeNextPageRequest(this.Client, callRecordToInitialize.SessionsNextLink);
             // Copy the additional data collection to the page itself so that information is not lost
             callRecordToInitialize.Sessions.AdditionalData = callRecordToInitialize.AdditionalData;
         }
         if (callRecordToInitialize.Recipients != null && callRecordToInitialize.Recipients.CurrentPage != null)
         {
             callRecordToInitialize.Recipients.InitializeNextPageRequest(this.Client, callRecordToInitialize.RecipientsNextLink);
             // Copy the additional data collection to the page itself so that information is not lost
             callRecordToInitialize.Recipients.AdditionalData = callRecordToInitialize.AdditionalData;
         }
     }
 }
示例#5
0
        /// <summary>
        /// Initializes any collection properties after deserialization, like next requests for paging.
        /// </summary>
        /// <param name="callRecordToInitialize">The <see cref="CallRecord"/> with the collection properties to initialize.</param>
        private void InitializeCollectionProperties(CallRecord callRecordToInitialize)
        {
            if (callRecordToInitialize != null && callRecordToInitialize.AdditionalData != null)
            {
                if (callRecordToInitialize.Sessions != null && callRecordToInitialize.Sessions.CurrentPage != null)
                {
                    callRecordToInitialize.Sessions.AdditionalData = callRecordToInitialize.AdditionalData;

                    object nextPageLink;
                    callRecordToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink);
                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        callRecordToInitialize.Sessions.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }

                if (callRecordToInitialize.Recipients != null && callRecordToInitialize.Recipients.CurrentPage != null)
                {
                    callRecordToInitialize.Recipients.AdditionalData = callRecordToInitialize.AdditionalData;

                    object nextPageLink;
                    callRecordToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink);
                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        callRecordToInitialize.Recipients.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
 /// <summary>
 /// Issues the PUT request.
 /// </summary>
 /// <param name="callrecord">The CallRecord object to update.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The task to await for async call.</returns>
 public System.Threading.Tasks.Task <CallRecord> PutAsync(CallRecord callrecord,
                                                          CancellationToken cancellationToken)
 {
     this.Method = "PUT";
     return(this.SendAsync <CallRecord>(callrecord, cancellationToken));
 }
 /// <summary>
 /// Issues the PUT request.
 /// </summary>
 /// <param name="callrecord">The CallRecord object to update.</param>
 /// <returns>The task to await for async call.</returns>
 public System.Threading.Tasks.Task <CallRecord> PutAsync(CallRecord callrecord)
 {
     return(this.PutAsync(callrecord, CancellationToken.None));
 }
示例#8
0
 /// <summary>
 /// Issues the PATCH request and returns a <see cref="GraphResponse"/> object.
 /// </summary>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <param name="callrecord">The CallRecord object set with the properties to update.</param>
 /// <returns>The <see cref="GraphResponse"/> object of the request</returns>
 public System.Threading.Tasks.Task <GraphResponse <CallRecord> > PatchResponseAsync(CallRecord callrecord, CancellationToken cancellationToken = default)
 {
     this.Method = HttpMethods.PATCH;
     return(this.SendAsyncWithGraphResponse <CallRecord>(callrecord, cancellationToken));
 }
 /// <summary>
 /// Creates the specified CallRecord using POST and returns a <see cref="GraphResponse{CallRecord}"/> object.
 /// </summary>
 /// <param name="callRecordToCreate">The CallRecord to create.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The <see cref="GraphResponse{CallRecord}"/> object of the request.</returns>
 public System.Threading.Tasks.Task <GraphResponse <CallRecord> > CreateResponseAsync(CallRecord callRecordToCreate, CancellationToken cancellationToken = default)
 {
     this.ContentType = CoreConstants.MimeTypeNames.Application.Json;
     this.Method      = HttpMethods.POST;
     return(this.SendAsyncWithGraphResponse <CallRecord>(callRecordToCreate, cancellationToken));
 }
示例#10
0
 /// <summary>
 /// Creates the specified CallRecord using POST.
 /// </summary>
 /// <param name="callRecordToCreate">The CallRecord to create.</param>
 /// <returns>The created CallRecord.</returns>
 public System.Threading.Tasks.Task <CallRecord> CreateAsync(CallRecord callRecordToCreate)
 {
     return(this.CreateAsync(callRecordToCreate, CancellationToken.None));
 }