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

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

            return(newEntity);
        }
        /// <summary>
        /// Adds the specified AgreementAcceptance to the collection via POST.
        /// </summary>
        /// <param name="agreementAcceptance">The AgreementAcceptance to add.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The task to await.</returns>
        public System.Threading.Tasks.Task AddAsync(AgreementAcceptance agreementAcceptance, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";

            if (string.IsNullOrEmpty(agreementAcceptance.Id))
            {
                throw new ServiceException(new Error {
                    Code = "invalidRequest", Message = "ID is required to add a reference."
                });
            }

            var requestBody = new ReferenceRequestBody {
                ODataId = string.Format("{0}/agreementAcceptances/{1}", this.Client.BaseUrl, agreementAcceptance.Id)
            };

            return(this.SendAsync(requestBody, cancellationToken));
        }
示例#4
0
 /// <summary>
 /// Adds the specified AgreementAcceptance to the collection via POST.
 /// </summary>
 /// <param name="agreementAcceptance">The AgreementAcceptance to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created AgreementAcceptance.</returns>
 public System.Threading.Tasks.Task <AgreementAcceptance> AddAsync(AgreementAcceptance agreementAcceptance, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <AgreementAcceptance>(agreementAcceptance, cancellationToken));
 }
示例#5
0
 /// <summary>
 /// Adds the specified AgreementAcceptance to the collection via POST.
 /// </summary>
 /// <param name="agreementAcceptance">The AgreementAcceptance to add.</param>
 /// <returns>The created AgreementAcceptance.</returns>
 public System.Threading.Tasks.Task <AgreementAcceptance> AddAsync(AgreementAcceptance agreementAcceptance)
 {
     return(this.AddAsync(agreementAcceptance, CancellationToken.None));
 }
 /// <summary>
 /// Updates the specified AgreementAcceptance using PATCH.
 /// </summary>
 /// <param name="agreementAcceptanceToUpdate">The AgreementAcceptance to update.</param>
 /// <returns>The updated AgreementAcceptance.</returns>
 public System.Threading.Tasks.Task <AgreementAcceptance> UpdateAsync(AgreementAcceptance agreementAcceptanceToUpdate)
 {
     return(this.UpdateAsync(agreementAcceptanceToUpdate, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="agreementAcceptanceToInitialize">The <see cref="AgreementAcceptance"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(AgreementAcceptance agreementAcceptanceToInitialize)
 {
 }