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

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

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