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

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
Beispiel #3
0
        /// <summary>
        /// Initializes any collection properties after deserialization, like next requests for paging.
        /// </summary>
        /// <param name="agreementFileToInitialize">The <see cref="AgreementFile"/> with the collection properties to initialize.</param>
        private void InitializeCollectionProperties(AgreementFile agreementFileToInitialize)
        {
            if (agreementFileToInitialize != null && agreementFileToInitialize.AdditionalData != null)
            {
                if (agreementFileToInitialize.Localizations != null && agreementFileToInitialize.Localizations.CurrentPage != null)
                {
                    agreementFileToInitialize.Localizations.AdditionalData = agreementFileToInitialize.AdditionalData;

                    object nextPageLink;
                    agreementFileToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink);
                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        agreementFileToInitialize.Localizations.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
 /// <summary>
 /// Adds the specified AgreementFile to the collection via POST.
 /// </summary>
 /// <param name="agreementFile">The AgreementFile to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created AgreementFile.</returns>
 public System.Threading.Tasks.Task <AgreementFile> AddAsync(AgreementFile agreementFile, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <AgreementFile>(agreementFile, cancellationToken));
 }
 /// <summary>
 /// Adds the specified AgreementFile to the collection via POST.
 /// </summary>
 /// <param name="agreementFile">The AgreementFile to add.</param>
 /// <returns>The created AgreementFile.</returns>
 public System.Threading.Tasks.Task <AgreementFile> AddAsync(AgreementFile agreementFile)
 {
     return(this.AddAsync(agreementFile, CancellationToken.None));
 }
 /// <summary>
 /// Creates the specified AgreementFile using POST.
 /// </summary>
 /// <param name="agreementFileToCreate">The AgreementFile to create.</param>
 /// <returns>The created AgreementFile.</returns>
 public System.Threading.Tasks.Task <AgreementFile> CreateAsync(AgreementFile agreementFileToCreate)
 {
     return(this.CreateAsync(agreementFileToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="agreementFileToInitialize">The <see cref="AgreementFile"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(AgreementFile agreementFileToInitialize)
 {
 }