Esempio n. 1
0
 /// <summary>
 /// Adds the specified Fido2AuthenticationMethod to the collection via POST.
 /// </summary>
 /// <param name="fido2AuthenticationMethod">The Fido2AuthenticationMethod to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created Fido2AuthenticationMethod.</returns>
 public System.Threading.Tasks.Task <Fido2AuthenticationMethod> AddAsync(Fido2AuthenticationMethod fido2AuthenticationMethod, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <Fido2AuthenticationMethod>(fido2AuthenticationMethod, cancellationToken));
 }
Esempio n. 2
0
 /// <summary>
 /// Adds the specified Fido2AuthenticationMethod to the collection via POST.
 /// </summary>
 /// <param name="fido2AuthenticationMethod">The Fido2AuthenticationMethod to add.</param>
 /// <returns>The created Fido2AuthenticationMethod.</returns>
 public System.Threading.Tasks.Task <Fido2AuthenticationMethod> AddAsync(Fido2AuthenticationMethod fido2AuthenticationMethod)
 {
     return(this.AddAsync(fido2AuthenticationMethod, CancellationToken.None));
 }
        /// <summary>
        /// Creates the specified Fido2AuthenticationMethod using POST.
        /// </summary>
        /// <param name="fido2AuthenticationMethodToCreate">The Fido2AuthenticationMethod to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created Fido2AuthenticationMethod.</returns>
        public async System.Threading.Tasks.Task <Fido2AuthenticationMethod> CreateAsync(Fido2AuthenticationMethod fido2AuthenticationMethodToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <Fido2AuthenticationMethod>(fido2AuthenticationMethodToCreate, cancellationToken).ConfigureAwait(false);

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

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