Пример #1
0
        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));
        }
Пример #2
0
        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));
        }
Пример #3
0
        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));
        }