/// <summary>
 /// Adds the specified WindowsUpdateCatalogItem to the collection via POST.
 /// </summary>
 /// <param name="windowsUpdateCatalogItem">The WindowsUpdateCatalogItem to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created WindowsUpdateCatalogItem.</returns>
 public System.Threading.Tasks.Task <WindowsUpdateCatalogItem> AddAsync(WindowsUpdateCatalogItem windowsUpdateCatalogItem, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     windowsUpdateCatalogItem.ODataType = string.Concat("#", StringHelper.ConvertTypeToLowerCamelCase(windowsUpdateCatalogItem.GetType().FullName));
     return(this.SendAsync <WindowsUpdateCatalogItem>(windowsUpdateCatalogItem, cancellationToken));
 }
示例#2
0
        /// <summary>
        /// Creates the specified WindowsUpdateCatalogItem using POST.
        /// </summary>
        /// <param name="windowsUpdateCatalogItemToCreate">The WindowsUpdateCatalogItem to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created WindowsUpdateCatalogItem.</returns>
        public async System.Threading.Tasks.Task <WindowsUpdateCatalogItem> CreateAsync(WindowsUpdateCatalogItem windowsUpdateCatalogItemToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <WindowsUpdateCatalogItem>(windowsUpdateCatalogItemToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
示例#3
0
 /// <summary>
 /// Creates the specified WindowsUpdateCatalogItem using POST.
 /// </summary>
 /// <param name="windowsUpdateCatalogItemToCreate">The WindowsUpdateCatalogItem to create.</param>
 /// <returns>The created WindowsUpdateCatalogItem.</returns>
 public System.Threading.Tasks.Task <WindowsUpdateCatalogItem> CreateAsync(WindowsUpdateCatalogItem windowsUpdateCatalogItemToCreate)
 {
     return(this.CreateAsync(windowsUpdateCatalogItemToCreate, CancellationToken.None));
 }
示例#4
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="windowsUpdateCatalogItemToInitialize">The <see cref="WindowsUpdateCatalogItem"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(WindowsUpdateCatalogItem windowsUpdateCatalogItemToInitialize)
 {
 }
示例#5
0
        /// <summary>
        /// Updates the specified WindowsUpdateCatalogItem using PATCH.
        /// </summary>
        /// <param name="windowsUpdateCatalogItemToUpdate">The WindowsUpdateCatalogItem 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 WindowsUpdateCatalogItem.</returns>
        public async System.Threading.Tasks.Task <WindowsUpdateCatalogItem> UpdateAsync(WindowsUpdateCatalogItem windowsUpdateCatalogItemToUpdate, CancellationToken cancellationToken)
        {
            if (windowsUpdateCatalogItemToUpdate.AdditionalData != null)
            {
                if (windowsUpdateCatalogItemToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    windowsUpdateCatalogItemToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, windowsUpdateCatalogItemToUpdate.GetType().Name)
                    });
                }
            }
            if (windowsUpdateCatalogItemToUpdate.AdditionalData != null)
            {
                if (windowsUpdateCatalogItemToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    windowsUpdateCatalogItemToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, windowsUpdateCatalogItemToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <WindowsUpdateCatalogItem>(windowsUpdateCatalogItemToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
 /// <summary>
 /// Adds the specified WindowsUpdateCatalogItem to the collection via POST.
 /// </summary>
 /// <param name="windowsUpdateCatalogItem">The WindowsUpdateCatalogItem to add.</param>
 /// <returns>The created WindowsUpdateCatalogItem.</returns>
 public System.Threading.Tasks.Task <WindowsUpdateCatalogItem> AddAsync(WindowsUpdateCatalogItem windowsUpdateCatalogItem)
 {
     return(this.AddAsync(windowsUpdateCatalogItem, CancellationToken.None));
 }