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