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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Creates the specified OneDriveUsageAccountCounts using POST.
 /// </summary>
 /// <param name="oneDriveUsageAccountCountsToCreate">The OneDriveUsageAccountCounts to create.</param>
 /// <returns>The created OneDriveUsageAccountCounts.</returns>
 public System.Threading.Tasks.Task <OneDriveUsageAccountCounts> CreateAsync(OneDriveUsageAccountCounts oneDriveUsageAccountCountsToCreate)
 {
     return(this.CreateAsync(oneDriveUsageAccountCountsToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="oneDriveUsageAccountCountsToInitialize">The <see cref="OneDriveUsageAccountCounts"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(OneDriveUsageAccountCounts oneDriveUsageAccountCountsToInitialize)
 {
 }
        /// <summary>
        /// Updates the specified OneDriveUsageAccountCounts using PATCH.
        /// </summary>
        /// <param name="oneDriveUsageAccountCountsToUpdate">The OneDriveUsageAccountCounts 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 OneDriveUsageAccountCounts.</returns>
        public async System.Threading.Tasks.Task <OneDriveUsageAccountCounts> UpdateAsync(OneDriveUsageAccountCounts oneDriveUsageAccountCountsToUpdate, CancellationToken cancellationToken)
        {
            if (oneDriveUsageAccountCountsToUpdate.AdditionalData != null)
            {
                if (oneDriveUsageAccountCountsToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    oneDriveUsageAccountCountsToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, oneDriveUsageAccountCountsToUpdate.GetType().Name)
                    });
                }
            }
            if (oneDriveUsageAccountCountsToUpdate.AdditionalData != null)
            {
                if (oneDriveUsageAccountCountsToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    oneDriveUsageAccountCountsToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, oneDriveUsageAccountCountsToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <OneDriveUsageAccountCounts>(oneDriveUsageAccountCountsToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
Пример #5
0
        /// <summary>
        /// Issues the PATCH request.
        /// </summary>
        /// <param name="onedriveusageaccountcounts">The OneDriveUsageAccountCounts object set with the properties to update.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The task to await for async call.</returns>
        public async System.Threading.Tasks.Task <IReportRootGetOneDriveUsageAccountCountsCollectionPage> PatchAsync(OneDriveUsageAccountCounts onedriveusageaccountcounts,
                                                                                                                     CancellationToken cancellationToken)
        {
            this.Method = "PATCH";
            var response = await this.SendAsync <ReportRootGetOneDriveUsageAccountCountsCollectionResponse>(onedriveusageaccountcounts, cancellationToken).ConfigureAwait(false);

            if (response != null && response.Value != null && response.Value.CurrentPage != null)
            {
                if (response.AdditionalData != null)
                {
                    response.Value.AdditionalData = response.AdditionalData;

                    object nextPageLink;
                    response.AdditionalData.TryGetValue("@odata.nextLink", out nextPageLink);

                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        response.Value.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }

                return(response.Value);
            }

            return(null);
        }
Пример #6
0
 /// <summary>
 /// Issues the PATCH request.
 /// </summary>
 /// <param name="onedriveusageaccountcounts">The OneDriveUsageAccountCounts object set with the properties to update.</param>
 /// <returns>The task to await for async call.</returns>
 public System.Threading.Tasks.Task <IReportRootGetOneDriveUsageAccountCountsCollectionPage> PatchAsync(OneDriveUsageAccountCounts onedriveusageaccountcounts)
 {
     return(this.PatchAsync(onedriveusageaccountcounts, CancellationToken.None));
 }