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