Exemplo n.º 1
0
        public static Dictionary <string, GetProductDataResponse> MapFromJson(Dictionary <string, object> jsonMap)
        {
            Dictionary <string, GetProductDataResponse> result = new Dictionary <string, GetProductDataResponse>();

            foreach (var entry in jsonMap)
            {
                GetProductDataResponse value = CreateFromDictionary(entry.Value as Dictionary <string, object>);
                result.Add(entry.Key, value);
            }
            return(result);
        }
Exemplo n.º 2
0
        public static GetProductDataResponse CreateFromDictionary(Dictionary <string, object> jsonMap)
        {
            try
            {
                if (jsonMap == null)
                {
                    return(null);
                }

                var request = new GetProductDataResponse();


                if (jsonMap.ContainsKey("requestId"))
                {
                    request.RequestId = (string)jsonMap["requestId"];
                }

                if (jsonMap.ContainsKey("productDataMap"))
                {
                    request.ProductDataMap = ProductData.MapFromJson(jsonMap["productDataMap"] as Dictionary <string, object>);
                }

                if (jsonMap.ContainsKey("unavailableSkus"))
                {
                    request.UnavailableSkus = ((List <object>)jsonMap["unavailableSkus"]).Select(element => (string)element).ToList();
                }

                if (jsonMap.ContainsKey("status"))
                {
                    request.Status = (string)jsonMap["status"];
                }

                return(request);
            }
            catch (System.ApplicationException ex)
            {
                throw new AmazonException("Error encountered while creating Object from dicionary", ex);
            }
        }
Exemplo n.º 3
0
        public static GetProductDataResponse CreateFromDictionary(Dictionary<string, object> jsonMap)
        {
            try
            {
                if (jsonMap == null)
                {
                    return null;
                }

                var request = new GetProductDataResponse();

                if(jsonMap.ContainsKey("requestId"))
                {
                    request.RequestId = (string) jsonMap["requestId"];
                }

                if(jsonMap.ContainsKey("productDataMap"))
                {
                    request.ProductDataMap = ProductData.MapFromJson(jsonMap["productDataMap"] as Dictionary<string, object>);
                }

                if(jsonMap.ContainsKey("unavailableSkus"))
                {
                    request.UnavailableSkus = ((List<object>) jsonMap["unavailableSkus"]).Select(element => (string) element).ToList();
                }

                if(jsonMap.ContainsKey("status"))
                {
                    request.Status = (string) jsonMap["status"];
                }

                return request;
            }
            catch (System.ApplicationException ex)
            {
                throw new AmazonException("Error encountered while creating Object from dicionary", ex);
            }
        }
Exemplo n.º 4
0
 public void ExecuteSuccess(Dictionary <string, object> objectDictionary)
 {
     responseDelegate(GetProductDataResponse.CreateFromDictionary(objectDictionary));
 }