Пример #1
0
 /// <summary>
 /// Adds the specified PasswordlessMicrosoftAuthenticatorAuthenticationMethod to the collection via POST.
 /// </summary>
 /// <param name="passwordlessMicrosoftAuthenticatorAuthenticationMethod">The PasswordlessMicrosoftAuthenticatorAuthenticationMethod to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created PasswordlessMicrosoftAuthenticatorAuthenticationMethod.</returns>
 public System.Threading.Tasks.Task <PasswordlessMicrosoftAuthenticatorAuthenticationMethod> AddAsync(PasswordlessMicrosoftAuthenticatorAuthenticationMethod passwordlessMicrosoftAuthenticatorAuthenticationMethod, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <PasswordlessMicrosoftAuthenticatorAuthenticationMethod>(passwordlessMicrosoftAuthenticatorAuthenticationMethod, cancellationToken));
 }
Пример #2
0
 /// <summary>
 /// Adds the specified PasswordlessMicrosoftAuthenticatorAuthenticationMethod to the collection via POST.
 /// </summary>
 /// <param name="passwordlessMicrosoftAuthenticatorAuthenticationMethod">The PasswordlessMicrosoftAuthenticatorAuthenticationMethod to add.</param>
 /// <returns>The created PasswordlessMicrosoftAuthenticatorAuthenticationMethod.</returns>
 public System.Threading.Tasks.Task <PasswordlessMicrosoftAuthenticatorAuthenticationMethod> AddAsync(PasswordlessMicrosoftAuthenticatorAuthenticationMethod passwordlessMicrosoftAuthenticatorAuthenticationMethod)
 {
     return(this.AddAsync(passwordlessMicrosoftAuthenticatorAuthenticationMethod, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="passwordlessMicrosoftAuthenticatorAuthenticationMethodToInitialize">The <see cref="PasswordlessMicrosoftAuthenticatorAuthenticationMethod"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(PasswordlessMicrosoftAuthenticatorAuthenticationMethod passwordlessMicrosoftAuthenticatorAuthenticationMethodToInitialize)
 {
 }
        /// <summary>
        /// Creates the specified PasswordlessMicrosoftAuthenticatorAuthenticationMethod using POST.
        /// </summary>
        /// <param name="passwordlessMicrosoftAuthenticatorAuthenticationMethodToCreate">The PasswordlessMicrosoftAuthenticatorAuthenticationMethod to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created PasswordlessMicrosoftAuthenticatorAuthenticationMethod.</returns>
        public async System.Threading.Tasks.Task <PasswordlessMicrosoftAuthenticatorAuthenticationMethod> CreateAsync(PasswordlessMicrosoftAuthenticatorAuthenticationMethod passwordlessMicrosoftAuthenticatorAuthenticationMethodToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <PasswordlessMicrosoftAuthenticatorAuthenticationMethod>(passwordlessMicrosoftAuthenticatorAuthenticationMethodToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
        /// <summary>
        /// Updates the specified PasswordlessMicrosoftAuthenticatorAuthenticationMethod using PATCH.
        /// </summary>
        /// <param name="passwordlessMicrosoftAuthenticatorAuthenticationMethodToUpdate">The PasswordlessMicrosoftAuthenticatorAuthenticationMethod 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 PasswordlessMicrosoftAuthenticatorAuthenticationMethod.</returns>
        public async System.Threading.Tasks.Task <PasswordlessMicrosoftAuthenticatorAuthenticationMethod> UpdateAsync(PasswordlessMicrosoftAuthenticatorAuthenticationMethod passwordlessMicrosoftAuthenticatorAuthenticationMethodToUpdate, CancellationToken cancellationToken)
        {
            if (passwordlessMicrosoftAuthenticatorAuthenticationMethodToUpdate.AdditionalData != null)
            {
                if (passwordlessMicrosoftAuthenticatorAuthenticationMethodToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    passwordlessMicrosoftAuthenticatorAuthenticationMethodToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, passwordlessMicrosoftAuthenticatorAuthenticationMethodToUpdate.GetType().Name)
                    });
                }
            }
            if (passwordlessMicrosoftAuthenticatorAuthenticationMethodToUpdate.AdditionalData != null)
            {
                if (passwordlessMicrosoftAuthenticatorAuthenticationMethodToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    passwordlessMicrosoftAuthenticatorAuthenticationMethodToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, passwordlessMicrosoftAuthenticatorAuthenticationMethodToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <PasswordlessMicrosoftAuthenticatorAuthenticationMethod>(passwordlessMicrosoftAuthenticatorAuthenticationMethodToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }