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