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