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