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

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

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