Example #1
0
        public async Task <BatchGetItemResult> BatchGetItemAsync(BatchGetItemRequest request)
        {
            var httpRequest = Setup("BatchGetItem", request.ToJson());

            var json = await SendAndReadJsonElementAsync(httpRequest).ConfigureAwait(false);

            return(BatchGetItemResult.FromJsonElement(json));
        }
Example #2
0
        public static BatchGetItemResult FromJson(JsonObject json)
        {
            var result = new BatchGetItemResult();

            var items = new List <AttributeCollection>();

            if (json.ContainsKey("ConsumedCapacity")) // Array
            {
                foreach (var item in (JsonArray)json["ConsumedCapacity"])
                {
                    var unit = ConsumedCapacity.FromJson((JsonObject)item);

                    // TODO
                }
            }

            if (json.ContainsKey("Responses"))
            {
                foreach (var tableEl in (JsonObject)json["Responses"])
                {
                    var table = new TableItems(tableEl.Key);

                    foreach (var item in (JsonArray)tableEl.Value)
                    {
                        table.Add(AttributeCollection.FromJson((JsonObject)item));
                    }

                    result.Responses.Add(table);
                }
            }

            /*
             *          if (json.ContainsKey("UnprocessedKeys"))
             *          {
             *                  foreach (var tableEl in (JsonObject)json["UnprocessedKeys"])
             *                  {
             *                          var tableName = tableEl.Key;
             *
             *                          foreach (var keyEl in (XArray) tableEl.Value["Keys"])
             *                          {
             *                                  var attributes = new KeyValuePair<string, object>();
             *
             *                                  foreach (var prop in (JsonObject)keyEl)
             *                                  {
             *                                          var name = prop.Key;
             *                                          var value = DbValue.FromJson((JsonObject)prop.Value);
             *                                  }
             *
             *                                  var key = new Key(attributes);
             *                          }
             *                  }
             *          }
             */

            return(result);
        }
Example #3
0
        public async Task <BatchGetItemResult> BatchGetItemAsync(BatchGetItemRequest request)
        {
            var httpRequest = Setup("BatchGetItem", request.ToJson());

            var responseText = await SendAsync(httpRequest).ConfigureAwait(false);

            var responseJson = JsonObject.Parse(responseText);

            return(BatchGetItemResult.FromJson(responseJson));
        }