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