public async Task <BatchWriteItemResult> BatchWriteItemAsync(params TableRequests[] batches) { #region Preconditions if (batches == null) { throw new ArgumentNullException(nameof(batches)); } #endregion /* * RequestItems { * "TableName1" : [ Request, Request, ... ], * "TableName2" : [ Request, Request, ... ], * ... * } */ var requestJson = new JsonObject { { "RequestItems", new JsonObject(batches.Select(b => b.ToJson())) } }; var httpRequest = Setup("BatchWriteItem", requestJson); var responseText = await SendAsync(httpRequest).ConfigureAwait(false); var responseJson = JsonObject.Parse(responseText); return(BatchWriteItemResult.FromJson(responseJson)); }
public async Task <BatchWriteItemResult> BatchWriteItemAsync(params TableRequests[] batches) { /* * RequestItems { * "TableName1" : [ Request, Request, ... ], * "TableName2" : [ Request, Request, ... ], * ... * } */ var requestJson = new Carbon.Json.JsonObject { { "RequestItems", new Carbon.Json.JsonObject(batches.Select(b => b.ToJson())) } }; var httpRequest = Setup("BatchWriteItem", requestJson); var json = await SendAndReadJsonElementAsync(httpRequest).ConfigureAwait(false); return(BatchWriteItemResult.FromJsonElement(json)); }
public async Task <BatchWriteItemResult> BatchWriteItemAsync(params TableRequests[] batches) { /* * RequestItems { * "TableName1" : [ Request, Request, ... ], * "TableName2" : [ Request, Request, ... ], * ... * } */ var requestJson = new JsonObject { { "RequestItems", new JsonObject(batches.Select(b => b.ToJson())) } }; var httpRequest = Setup("BatchWriteItem", requestJson); var responseText = await SendAsync(httpRequest).ConfigureAwait(false); var responseJson = JsonObject.Parse(responseText); return(BatchWriteItemResult.FromJson(responseJson)); }