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