Example #1
0
        /// <summary>
        /// Initializes any collection properties after deserialization, like next requests for paging.
        /// </summary>
        /// <param name="macOSSoftwareUpdateCategorySummaryToInitialize">The <see cref="MacOSSoftwareUpdateCategorySummary"/> with the collection properties to initialize.</param>
        private void InitializeCollectionProperties(MacOSSoftwareUpdateCategorySummary macOSSoftwareUpdateCategorySummaryToInitialize)
        {
            if (macOSSoftwareUpdateCategorySummaryToInitialize != null && macOSSoftwareUpdateCategorySummaryToInitialize.AdditionalData != null)
            {
                if (macOSSoftwareUpdateCategorySummaryToInitialize.UpdateStateSummaries != null && macOSSoftwareUpdateCategorySummaryToInitialize.UpdateStateSummaries.CurrentPage != null)
                {
                    macOSSoftwareUpdateCategorySummaryToInitialize.UpdateStateSummaries.AdditionalData = macOSSoftwareUpdateCategorySummaryToInitialize.AdditionalData;

                    object nextPageLink;
                    macOSSoftwareUpdateCategorySummaryToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink);
                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        macOSSoftwareUpdateCategorySummaryToInitialize.UpdateStateSummaries.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// Creates the specified MacOSSoftwareUpdateCategorySummary using POST.
        /// </summary>
        /// <param name="macOSSoftwareUpdateCategorySummaryToCreate">The MacOSSoftwareUpdateCategorySummary to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created MacOSSoftwareUpdateCategorySummary.</returns>
        public async System.Threading.Tasks.Task <MacOSSoftwareUpdateCategorySummary> CreateAsync(MacOSSoftwareUpdateCategorySummary macOSSoftwareUpdateCategorySummaryToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <MacOSSoftwareUpdateCategorySummary>(macOSSoftwareUpdateCategorySummaryToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
Example #3
0
 /// <summary>
 /// Creates the specified MacOSSoftwareUpdateCategorySummary using POST.
 /// </summary>
 /// <param name="macOSSoftwareUpdateCategorySummaryToCreate">The MacOSSoftwareUpdateCategorySummary to create.</param>
 /// <returns>The created MacOSSoftwareUpdateCategorySummary.</returns>
 public System.Threading.Tasks.Task <MacOSSoftwareUpdateCategorySummary> CreateAsync(MacOSSoftwareUpdateCategorySummary macOSSoftwareUpdateCategorySummaryToCreate)
 {
     return(this.CreateAsync(macOSSoftwareUpdateCategorySummaryToCreate, CancellationToken.None));
 }
Example #4
0
        /// <summary>
        /// Updates the specified MacOSSoftwareUpdateCategorySummary using PATCH.
        /// </summary>
        /// <param name="macOSSoftwareUpdateCategorySummaryToUpdate">The MacOSSoftwareUpdateCategorySummary 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 MacOSSoftwareUpdateCategorySummary.</returns>
        public async System.Threading.Tasks.Task <MacOSSoftwareUpdateCategorySummary> UpdateAsync(MacOSSoftwareUpdateCategorySummary macOSSoftwareUpdateCategorySummaryToUpdate, CancellationToken cancellationToken)
        {
            if (macOSSoftwareUpdateCategorySummaryToUpdate.AdditionalData != null)
            {
                if (macOSSoftwareUpdateCategorySummaryToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    macOSSoftwareUpdateCategorySummaryToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, macOSSoftwareUpdateCategorySummaryToUpdate.GetType().Name)
                    });
                }
            }
            if (macOSSoftwareUpdateCategorySummaryToUpdate.AdditionalData != null)
            {
                if (macOSSoftwareUpdateCategorySummaryToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    macOSSoftwareUpdateCategorySummaryToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, macOSSoftwareUpdateCategorySummaryToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <MacOSSoftwareUpdateCategorySummary>(macOSSoftwareUpdateCategorySummaryToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
Example #5
0
 /// <summary>
 /// Adds the specified MacOSSoftwareUpdateCategorySummary to the collection via POST.
 /// </summary>
 /// <param name="macOSSoftwareUpdateCategorySummary">The MacOSSoftwareUpdateCategorySummary to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created MacOSSoftwareUpdateCategorySummary.</returns>
 public System.Threading.Tasks.Task <MacOSSoftwareUpdateCategorySummary> AddAsync(MacOSSoftwareUpdateCategorySummary macOSSoftwareUpdateCategorySummary, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <MacOSSoftwareUpdateCategorySummary>(macOSSoftwareUpdateCategorySummary, cancellationToken));
 }