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