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