/// <summary> /// Initializes any collection properties after deserialization, like next requests for paging. /// </summary> /// <param name="macOSSoftwareUpdateAccountSummaryToInitialize">The <see cref="MacOSSoftwareUpdateAccountSummary"/> with the collection properties to initialize.</param> private void InitializeCollectionProperties(MacOSSoftwareUpdateAccountSummary macOSSoftwareUpdateAccountSummaryToInitialize) { if (macOSSoftwareUpdateAccountSummaryToInitialize != null && macOSSoftwareUpdateAccountSummaryToInitialize.AdditionalData != null) { if (macOSSoftwareUpdateAccountSummaryToInitialize.CategorySummaries != null && macOSSoftwareUpdateAccountSummaryToInitialize.CategorySummaries.CurrentPage != null) { macOSSoftwareUpdateAccountSummaryToInitialize.CategorySummaries.AdditionalData = macOSSoftwareUpdateAccountSummaryToInitialize.AdditionalData; object nextPageLink; macOSSoftwareUpdateAccountSummaryToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink); var nextPageLinkString = nextPageLink as string; if (!string.IsNullOrEmpty(nextPageLinkString)) { macOSSoftwareUpdateAccountSummaryToInitialize.CategorySummaries.InitializeNextPageRequest( this.Client, nextPageLinkString); } } } }
/// <summary> /// Adds the specified MacOSSoftwareUpdateAccountSummary to the collection via POST. /// </summary> /// <param name="macOSSoftwareUpdateAccountSummary">The MacOSSoftwareUpdateAccountSummary to add.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created MacOSSoftwareUpdateAccountSummary.</returns> public System.Threading.Tasks.Task <MacOSSoftwareUpdateAccountSummary> AddAsync(MacOSSoftwareUpdateAccountSummary macOSSoftwareUpdateAccountSummary, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; return(this.SendAsync <MacOSSoftwareUpdateAccountSummary>(macOSSoftwareUpdateAccountSummary, cancellationToken)); }
/// <summary> /// Adds the specified MacOSSoftwareUpdateAccountSummary to the collection via POST. /// </summary> /// <param name="macOSSoftwareUpdateAccountSummary">The MacOSSoftwareUpdateAccountSummary to add.</param> /// <returns>The created MacOSSoftwareUpdateAccountSummary.</returns> public System.Threading.Tasks.Task <MacOSSoftwareUpdateAccountSummary> AddAsync(MacOSSoftwareUpdateAccountSummary macOSSoftwareUpdateAccountSummary) { return(this.AddAsync(macOSSoftwareUpdateAccountSummary, CancellationToken.None)); }
/// <summary> /// Creates the specified MacOSSoftwareUpdateAccountSummary using POST. /// </summary> /// <param name="macOSSoftwareUpdateAccountSummaryToCreate">The MacOSSoftwareUpdateAccountSummary to create.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created MacOSSoftwareUpdateAccountSummary.</returns> public async System.Threading.Tasks.Task <MacOSSoftwareUpdateAccountSummary> CreateAsync(MacOSSoftwareUpdateAccountSummary macOSSoftwareUpdateAccountSummaryToCreate, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; var newEntity = await this.SendAsync <MacOSSoftwareUpdateAccountSummary>(macOSSoftwareUpdateAccountSummaryToCreate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(newEntity); return(newEntity); }
/// <summary> /// Updates the specified MacOSSoftwareUpdateAccountSummary using PATCH. /// </summary> /// <param name="macOSSoftwareUpdateAccountSummaryToUpdate">The MacOSSoftwareUpdateAccountSummary 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 MacOSSoftwareUpdateAccountSummary.</returns> public async System.Threading.Tasks.Task <MacOSSoftwareUpdateAccountSummary> UpdateAsync(MacOSSoftwareUpdateAccountSummary macOSSoftwareUpdateAccountSummaryToUpdate, CancellationToken cancellationToken) { if (macOSSoftwareUpdateAccountSummaryToUpdate.AdditionalData != null) { if (macOSSoftwareUpdateAccountSummaryToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || macOSSoftwareUpdateAccountSummaryToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, macOSSoftwareUpdateAccountSummaryToUpdate.GetType().Name) }); } } if (macOSSoftwareUpdateAccountSummaryToUpdate.AdditionalData != null) { if (macOSSoftwareUpdateAccountSummaryToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || macOSSoftwareUpdateAccountSummaryToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, macOSSoftwareUpdateAccountSummaryToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <MacOSSoftwareUpdateAccountSummary>(macOSSoftwareUpdateAccountSummaryToUpdate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(updatedEntity); return(updatedEntity); }