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

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
Beispiel #3
0
        /// <summary>
        /// Updates the specified SubscribedSku using PATCH.
        /// </summary>
        /// <param name="subscribedSkuToUpdate">The SubscribedSku to update.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The updated SubscribedSku.</returns>
        public async Task <SubscribedSku> UpdateAsync(SubscribedSku subscribedSkuToUpdate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <SubscribedSku>(subscribedSkuToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
 /// <summary>
 /// Adds the specified SubscribedSku to the collection via POST.
 /// </summary>
 /// <param name="subscribedSku">The SubscribedSku to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created SubscribedSku.</returns>
 public System.Threading.Tasks.Task <SubscribedSku> AddAsync(SubscribedSku subscribedSku, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <SubscribedSku>(subscribedSku, cancellationToken));
 }
 /// <summary>
 /// Adds the specified SubscribedSku to the collection via POST.
 /// </summary>
 /// <param name="subscribedSku">The SubscribedSku to add.</param>
 /// <returns>The created SubscribedSku.</returns>
 public System.Threading.Tasks.Task <SubscribedSku> AddAsync(SubscribedSku subscribedSku)
 {
     return(this.AddAsync(subscribedSku, CancellationToken.None));
 }
 /// <summary>
 /// Creates the specified SubscribedSku using PUT.
 /// </summary>
 /// <param name="subscribedSkuToCreate">The SubscribedSku to create.</param>
 /// <returns>The created SubscribedSku.</returns>
 public System.Threading.Tasks.Task <SubscribedSku> CreateAsync(SubscribedSku subscribedSkuToCreate)
 {
     return(this.CreateAsync(subscribedSkuToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="subscribedSkuToInitialize">The <see cref="SubscribedSku"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(SubscribedSku subscribedSkuToInitialize)
 {
 }
 /// <summary>
 /// Adds the specified SubscribedSku to the collection via POST.
 /// </summary>
 /// <param name="subscribedSku">The SubscribedSku to add.</param>
 /// <returns>The created SubscribedSku.</returns>
 public Task <SubscribedSku> AddAsync(SubscribedSku subscribedSku)
 {
     return(this.AddAsync(subscribedSku, CancellationToken.None));
 }
Beispiel #9
0
 /// <summary>
 /// Creates the specified SubscribedSku using PUT.
 /// </summary>
 /// <param name="subscribedSkuToCreate">The SubscribedSku to create.</param>
 /// <returns>The created SubscribedSku.</returns>
 public Task <SubscribedSku> CreateAsync(SubscribedSku subscribedSkuToCreate)
 {
     return(this.CreateAsync(subscribedSkuToCreate, CancellationToken.None));
 }