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