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

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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Issues the PATCH request.
        /// </summary>
        /// <param name="office365servicesusercounts">The Office365ServicesUserCounts 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 <IReportRootGetOffice365ServicesUserCountsCollectionPage> PatchAsync(Office365ServicesUserCounts office365servicesusercounts,
                                                                                                                      CancellationToken cancellationToken)
        {
            this.Method = "PATCH";
            var response = await this.SendAsync <ReportRootGetOffice365ServicesUserCountsCollectionResponse>(office365servicesusercounts, 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);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Issues the PATCH request.
 /// </summary>
 /// <param name="office365servicesusercounts">The Office365ServicesUserCounts object set with the properties to update.</param>
 /// <returns>The task to await for async call.</returns>
 public System.Threading.Tasks.Task <IReportRootGetOffice365ServicesUserCountsCollectionPage> PatchAsync(Office365ServicesUserCounts office365servicesusercounts)
 {
     return(this.PatchAsync(office365servicesusercounts, CancellationToken.None));
 }