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