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