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