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