/// <summary>
        /// Creates the specified PasswordAuthenticationMethod using POST.
        /// </summary>
        /// <param name="passwordAuthenticationMethodToCreate">The PasswordAuthenticationMethod to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created PasswordAuthenticationMethod.</returns>
        public async System.Threading.Tasks.Task <PasswordAuthenticationMethod> CreateAsync(PasswordAuthenticationMethod passwordAuthenticationMethodToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <PasswordAuthenticationMethod>(passwordAuthenticationMethodToCreate, cancellationToken).ConfigureAwait(false);

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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
Пример #5
0
 /// <summary>
 /// Adds the specified PasswordAuthenticationMethod to the collection via POST.
 /// </summary>
 /// <param name="passwordAuthenticationMethod">The PasswordAuthenticationMethod to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created PasswordAuthenticationMethod.</returns>
 public System.Threading.Tasks.Task <PasswordAuthenticationMethod> AddAsync(PasswordAuthenticationMethod passwordAuthenticationMethod, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <PasswordAuthenticationMethod>(passwordAuthenticationMethod, cancellationToken));
 }
Пример #6
0
 /// <summary>
 /// Adds the specified PasswordAuthenticationMethod to the collection via POST.
 /// </summary>
 /// <param name="passwordAuthenticationMethod">The PasswordAuthenticationMethod to add.</param>
 /// <returns>The created PasswordAuthenticationMethod.</returns>
 public System.Threading.Tasks.Task <PasswordAuthenticationMethod> AddAsync(PasswordAuthenticationMethod passwordAuthenticationMethod)
 {
     return(this.AddAsync(passwordAuthenticationMethod, CancellationToken.None));
 }