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