示例#1
0
        public static GetUserDataResponse CreateFromDictionary(Dictionary <string, object> jsonMap)
        {
            try
            {
                if (jsonMap == null)
                {
                    return(null);
                }

                var request = new GetUserDataResponse();


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

                if (jsonMap.ContainsKey("amazonUserData"))
                {
                    request.AmazonUserData = AmazonUserData.CreateFromDictionary(jsonMap["amazonUserData"] as Dictionary <string, object>);
                }

                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);
            }
        }
示例#2
0
        public static AmazonUserData CreateFromDictionary(Dictionary <string, object> jsonMap)
        {
            try
            {
                if (jsonMap == null)
                {
                    return(null);
                }

                var request = new AmazonUserData();


                if (jsonMap.ContainsKey("userId"))
                {
                    request.UserId = (string)jsonMap["userId"];
                }

                if (jsonMap.ContainsKey("marketplace"))
                {
                    request.Marketplace = (string)jsonMap["marketplace"];
                }

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

                var request = new AmazonUserData();

                if(jsonMap.ContainsKey("userId"))
                {
                    request.UserId = (string) jsonMap["userId"];
                }

                if(jsonMap.ContainsKey("marketplace"))
                {
                    request.Marketplace = (string) jsonMap["marketplace"];
                }

                return request;
            }
            catch (System.ApplicationException ex)
            {
                throw new AmazonException("Error encountered while creating Object from dicionary", ex);
            }
        }
示例#4
0
        public static Dictionary <string, AmazonUserData> MapFromJson(Dictionary <string, object> jsonMap)
        {
            Dictionary <string, AmazonUserData> result = new Dictionary <string, AmazonUserData>();

            foreach (var entry in jsonMap)
            {
                AmazonUserData value = CreateFromDictionary(entry.Value as Dictionary <string, object>);
                result.Add(entry.Key, value);
            }
            return(result);
        }
示例#5
0
        public override Dictionary <string, object> GetObjectDictionary()
        {
            try
            {
                Dictionary <string, object> objectDictionary = new Dictionary <string, object>();

                objectDictionary.Add("requestId", RequestId);
                objectDictionary.Add("amazonUserData", (AmazonUserData != null) ? AmazonUserData.GetObjectDictionary() : null);
                objectDictionary.Add("status", Status);
                return(objectDictionary);
            }
            catch (System.ApplicationException ex)
            {
                throw new AmazonException("Error encountered while getting object dictionary", ex);
            }
        }