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

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

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