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