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