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

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

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