コード例 #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);
        }
コード例 #2
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);
        }
コード例 #3
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);
                    }
                }
            }
        }
コード例 #4
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));
 }