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