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

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

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
示例#4
0
        /// <summary>
        /// Initializes any collection properties after deserialization, like next requests for paging.
        /// </summary>
        /// <param name="workbookChartToInitialize">The <see cref="WorkbookChart"/> with the collection properties to initialize.</param>
        private void InitializeCollectionProperties(WorkbookChart workbookChartToInitialize)
        {
            if (workbookChartToInitialize != null && workbookChartToInitialize.AdditionalData != null)
            {
                if (workbookChartToInitialize.Series != null && workbookChartToInitialize.Series.CurrentPage != null)
                {
                    workbookChartToInitialize.Series.AdditionalData = workbookChartToInitialize.AdditionalData;

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

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        workbookChartToInitialize.Series.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
示例#5
0
 /// <summary>
 /// Creates the specified WorkbookChart using POST.
 /// </summary>
 /// <param name="workbookChartToCreate">The WorkbookChart to create.</param>
 /// <returns>The created WorkbookChart.</returns>
 public System.Threading.Tasks.Task <WorkbookChart> CreateAsync(WorkbookChart workbookChartToCreate)
 {
     return(this.CreateAsync(workbookChartToCreate, CancellationToken.None));
 }
示例#6
0
 /// <summary>
 /// Issues the PUT request.
 /// </summary>
 /// <param name=workbookchart>The WorkbookChart 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 <WorkbookChart> PutAsync(WorkbookChart workbookchart,
                                                             CancellationToken cancellationToken)
 {
     this.Method = "PUT";
     return(this.SendAsync <WorkbookChart>(workbookchart, cancellationToken));
 }
示例#7
0
 /// <summary>
 /// Issues the PUT request.
 /// </summary>
 /// <param name=workbookchart>The WorkbookChart object to update.</param>
 /// <returns>The task to await for async call.</returns>
 public System.Threading.Tasks.Task <WorkbookChart> PutAsync(WorkbookChart workbookchart)
 {
     return(this.PutAsync(workbookchart, CancellationToken.None));
 }
 /// <summary>
 /// Adds the specified WorkbookChart to the collection via POST.
 /// </summary>
 /// <param name="workbookChart">The WorkbookChart to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created WorkbookChart.</returns>
 public System.Threading.Tasks.Task <WorkbookChart> AddAsync(WorkbookChart workbookChart, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <WorkbookChart>(workbookChart, cancellationToken));
 }
示例#9
0
 /// <summary>
 /// Creates the specified WorkbookChart using POST and returns a <see cref="GraphResponse{WorkbookChart}"/> object.
 /// </summary>
 /// <param name="workbookChartToCreate">The WorkbookChart to create.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The <see cref="GraphResponse{WorkbookChart}"/> object of the request.</returns>
 public System.Threading.Tasks.Task <GraphResponse <WorkbookChart> > CreateResponseAsync(WorkbookChart workbookChartToCreate, CancellationToken cancellationToken = default)
 {
     this.ContentType = CoreConstants.MimeTypeNames.Application.Json;
     this.Method      = HttpMethods.POST;
     return(this.SendAsyncWithGraphResponse <WorkbookChart>(workbookChartToCreate, cancellationToken));
 }
示例#10
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="workbookChartToInitialize">The <see cref="WorkbookChart"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(WorkbookChart workbookChartToInitialize)
 {
 }