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