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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates the specified ExactMatchSession using POST.
        /// </summary>
        /// <param name="exactMatchSessionToCreate">The ExactMatchSession to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created ExactMatchSession.</returns>
        public async System.Threading.Tasks.Task <ExactMatchSession> CreateAsync(ExactMatchSession exactMatchSessionToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <ExactMatchSession>(exactMatchSessionToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Adds the specified ExactMatchSession to the collection via POST.
 /// </summary>
 /// <param name="exactMatchSession">The ExactMatchSession to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created ExactMatchSession.</returns>
 public System.Threading.Tasks.Task <ExactMatchSession> AddAsync(ExactMatchSession exactMatchSession, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <ExactMatchSession>(exactMatchSession, cancellationToken));
 }
 /// <summary>
 /// Adds the specified ExactMatchSession to the collection via POST.
 /// </summary>
 /// <param name="exactMatchSession">The ExactMatchSession to add.</param>
 /// <returns>The created ExactMatchSession.</returns>
 public System.Threading.Tasks.Task <ExactMatchSession> AddAsync(ExactMatchSession exactMatchSession)
 {
     return(this.AddAsync(exactMatchSession, CancellationToken.None));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Creates the specified ExactMatchSession using POST.
 /// </summary>
 /// <param name="exactMatchSessionToCreate">The ExactMatchSession to create.</param>
 /// <returns>The created ExactMatchSession.</returns>
 public System.Threading.Tasks.Task <ExactMatchSession> CreateAsync(ExactMatchSession exactMatchSessionToCreate)
 {
     return(this.CreateAsync(exactMatchSessionToCreate, CancellationToken.None));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="exactMatchSessionToInitialize">The <see cref="ExactMatchSession"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(ExactMatchSession exactMatchSessionToInitialize)
 {
 }