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