Esempio n. 1
0
 def to_dict(self) -> dict:
     result: dict = {}
     result["Type"] = from_union([from_int, from_none], self.type)
     result["Message"] = from_union([from_str, from_none], self.message)
     result["Promoted"] = from_union([lambda x: from_list(lambda x: x, x), from_none], self.promoted)
     result["Data"] = from_union([lambda x: from_list(lambda x: to_class(NewsRecord, x), x), from_none], self.data)
     result["RateLimit"] = from_union([lambda x: to_class(RateLimit, x), from_none], self.rate_limit)
     result["HasWarning"] = from_union([from_bool, from_none], self.has_warning)
     return result
Esempio n. 2
0
 def from_dict(obj: Any) -> 'NewsData':
     assert isinstance(obj, dict)
     type = from_union([from_int, from_none], obj.get("Type"))
     message = from_union([from_str, from_none], obj.get("Message"))
     promoted = from_union([lambda x: from_list(lambda x: x, x), from_none], obj.get("Promoted"))
     data = from_union([lambda x: from_list(NewsRecord.from_dict, x), from_none], obj.get("Data"))
     rate_limit = from_union([RateLimit.from_dict, from_none], obj.get("RateLimit"))
     has_warning = from_union([from_bool, from_none], obj.get("HasWarning"))
     return NewsData(type, message, promoted, data, rate_limit, has_warning)
Esempio n. 3
0
 def to_dict(self) -> dict:
     result: dict = {}
     result["Points"] = from_union([from_int, from_none], self.points)
     result["Followers"] = from_union([from_int, from_none], self.followers)
     result["Posts"] = from_union([from_int, from_none], self.posts)
     result["SimilarItems"] = from_union([lambda x: from_list(lambda x: to_class(SimilarItem, x), x), from_none], self.similar_items)
     result["Comments"] = from_union([from_int, from_none], self.comments)
     result["PageViewsSplit"] = from_union([lambda x: to_class(PageViewsSplit, x), from_none], self.page_views_split)
     result["PageViews"] = from_union([from_int, from_none], self.page_views)
     result["CryptopianFollowers"] = from_union([lambda x: from_list(lambda x: x, x), from_none], self.cryptopian_followers)
     return result
Esempio n. 4
0
 def from_dict(obj: Any) -> 'CryptoCompare':
     assert isinstance(obj, dict)
     points = from_union([from_int, from_none], obj.get("Points"))
     followers = from_union([from_int, from_none], obj.get("Followers"))
     posts = from_union([from_int, from_none], obj.get("Posts"))
     similar_items = from_union([lambda x: from_list(SimilarItem.from_dict, x), from_none], obj.get("SimilarItems"))
     comments = from_union([from_int, from_none], obj.get("Comments"))
     page_views_split = from_union([PageViewsSplit.from_dict, from_none], obj.get("PageViewsSplit"))
     page_views = from_union([from_int, from_none], obj.get("PageViews"))
     cryptopian_followers = from_union([lambda x: from_list(lambda x: x, x), from_none], obj.get("CryptopianFollowers"))
     return CryptoCompare(points, followers, posts, similar_items, comments, page_views_split, page_views, cryptopian_followers)
Esempio n. 5
0
 def from_dict(obj: Any) -> 'Data':
     assert isinstance(obj, dict)
     aggregated = from_union([from_bool, from_none], obj.get("Aggregated"))
     time_from = from_union([from_int, from_none], obj.get("TimeFrom"))
     time_to = from_union([from_int, from_none], obj.get("TimeTo"))
     data = from_union(
         [lambda x: from_list(HistoryRecord.from_dict, x), from_none],
         obj.get("Data"))
     return Data(aggregated, time_from, time_to, data)
Esempio n. 6
0
 def to_dict(self) -> dict:
     result: dict = {}
     result["Aggregated"] = from_union([from_bool, from_none],
                                       self.aggregated)
     result["TimeFrom"] = from_union([from_int, from_none], self.time_from)
     result["TimeTo"] = from_union([from_int, from_none], self.time_to)
     result["Data"] = from_union([
         lambda x: from_list(lambda x: to_class(BlockchainHistoryRecord, x),
                             x), from_none
     ], self.data)
     return result
Esempio n. 7
0
 def to_dict(self) -> dict:
     result: dict = {}
     result["Id"] = from_union([
         lambda x: from_none((lambda x: is_type(type(None), x))
                             (x)), lambda x: from_str((lambda x: str(
                                 (lambda x: is_type(int, x))(x)))(x))
     ], self.id)
     result["SortOrder"] = from_union([
         lambda x: from_none((lambda x: is_type(type(None), x))
                             (x)), lambda x: from_str((lambda x: str(
                                 (lambda x: is_type(int, x))(x)))(x))
     ], self.sort_order)
     result["Name"] = from_union([from_str, from_none], self.name)
     result["Url"] = from_union([from_str, from_none], self.url)
     result["LogoUrl"] = from_union([from_str, from_none], self.logo_url)
     result["ItemType"] = from_union(
         [lambda x: from_list(from_str, x), from_none], self.item_type)
     result["CentralizationType"] = from_union([from_str, from_none],
                                               self.centralization_type)
     result["InternalName"] = from_union([from_str, from_none],
                                         self.internal_name)
     result["GradePoints"] = from_union([from_str, from_none],
                                        self.grade_points)
     result["Grade"] = from_union([from_str, from_none], self.grade)
     result["GradePointsSplit"] = from_union(
         [lambda x: to_class(GradePointsSplit, x), from_none],
         self.grade_points_split)
     result["AffiliateURL"] = from_union([from_str, from_none],
                                         self.affiliate_url)
     result["Country"] = from_union([from_str, from_none], self.country)
     result["OrderBook"] = from_union([from_bool, from_none],
                                      self.order_book)
     result["Trades"] = from_union([from_bool, from_none], self.trades)
     result["Description"] = from_union([from_str, from_none],
                                        self.description)
     result["FullAddress"] = from_union([from_str, from_none],
                                        self.full_address)
     result["Fees"] = from_union([from_str, from_none], self.fees)
     result["DepositMethods"] = from_union([from_str, from_none],
                                           self.deposit_methods)
     result["WithdrawalMethods"] = from_union([from_str, from_none],
                                              self.withdrawal_methods)
     result["Sponsored"] = from_union([from_bool, from_none],
                                      self.sponsored)
     result["Recommended"] = from_union([from_bool, from_none],
                                        self.recommended)
     result["Rating"] = from_union(
         [lambda x: to_class(Rating, x), from_none], self.rating)
     result["TOTALVOLUME24H"] = from_union([from_plain_dict, from_none],
                                           self.totalvolume24_h)
     result["DISPLAYTOTALVOLUME24H"] = from_union(
         [from_plain_dict, from_none], self.displaytotalvolume24_h)
     return result
Esempio n. 8
0
 def from_dict(obj: Any) -> 'ExchangeInfo':
     assert isinstance(obj, dict)
     id = from_union([from_none, lambda x: int(from_str(x))], obj.get("Id"))
     sort_order = from_union([from_none, lambda x: int(from_str(x))],
                             obj.get("SortOrder"))
     name = from_union([from_str, from_none], obj.get("Name"))
     url = from_union([from_str, from_none], obj.get("Url"))
     logo_url = from_union([from_str, from_none], obj.get("LogoUrl"))
     item_type = from_union([lambda x: from_list(from_str, x), from_none],
                            obj.get("ItemType"))
     centralization_type = from_union([from_str, from_none],
                                      obj.get("CentralizationType"))
     internal_name = from_union([from_str, from_none],
                                obj.get("InternalName"))
     grade_points = from_union([from_float, from_str_number, from_none],
                               obj.get("GradePoints"))
     grade = from_union([from_str, from_none], obj.get("Grade"))
     grade_points_split = from_union(
         [GradePointsSplit.from_dict, from_none],
         obj.get("GradePointsSplit"))
     affiliate_url = from_union([from_str, from_none],
                                obj.get("AffiliateURL"))
     country = from_union([from_str, from_none], obj.get("Country"))
     order_book = from_union([from_bool, from_none], obj.get("OrderBook"))
     trades = from_union([from_bool, from_none], obj.get("Trades"))
     description = from_union([from_str, from_none], obj.get("Description"))
     full_address = from_union([from_str, from_none],
                               obj.get("FullAddress"))
     fees = from_union([from_str, from_none], obj.get("Fees"))
     deposit_methods = from_union([from_str, from_none],
                                  obj.get("DepositMethods"))
     withdrawal_methods = from_union([from_str, from_none],
                                     obj.get("WithdrawalMethods"))
     sponsored = from_union([from_bool, from_none], obj.get("Sponsored"))
     recommended = from_union([from_bool, from_none],
                              obj.get("Recommended"))
     rating = from_union([Rating.from_dict, from_none], obj.get("Rating"))
     totalvolume24_h = from_union([from_plain_dict, from_none],
                                  obj.get("TOTALVOLUME24H"))
     displaytotalvolume24_h = from_union([from_plain_dict, from_none],
                                         obj.get("DISPLAYTOTALVOLUME24H"))
     return ExchangeInfo(id, sort_order, name, url, logo_url, item_type,
                         centralization_type, internal_name, grade_points,
                         grade, grade_points_split, affiliate_url, country,
                         order_book, trades, description, full_address,
                         fees, deposit_methods, withdrawal_methods,
                         sponsored, recommended, rating, totalvolume24_h,
                         displaytotalvolume24_h)
Esempio n. 9
0
 def to_dict(self) -> dict:
     result: dict = {}
     result["Response"] = from_union([from_str, from_none], self.response)
     result["Message"] = from_union([from_str, from_none], self.message)
     result["HasWarning"] = from_union([from_bool, from_none],
                                       self.has_warning)
     result["ParamWithError"] = from_union([from_str, from_none],
                                           self.param_with_error)
     result["Type"] = from_union([from_int, from_none], self.type)
     result["RateLimit"] = from_union(
         [lambda x: to_class(RateLimit, x), from_none], self.rate_limit)
     result["Data"] = from_union([
         lambda x: from_list(lambda x: to_class(SocialRecord, x), x),
         from_none, from_plain_dict
     ], self.data)
     return result
Esempio n. 10
0
 def from_dict(obj: Any) -> 'SocialData':
     assert isinstance(obj, dict)
     response = from_union([from_str, from_none], obj.get("Response"))
     message = from_union([from_str, from_none], obj.get("Message"))
     has_warning = from_union([from_bool, from_none], obj.get("HasWarning"))
     param_with_error = from_union([from_str, from_none],
                                   obj.get("ParamWithError"))
     type = from_union([from_int, from_none], obj.get("Type"))
     rate_limit = from_union([RateLimit.from_dict, from_none],
                             obj.get("RateLimit"))
     data = from_union([
         lambda x: from_list(SocialRecord.from_dict, x), from_none,
         from_plain_dict
     ], obj.get("Data"))
     return SocialData(response, message, has_warning, param_with_error,
                       type, rate_limit, data)
Esempio n. 11
0
 def to_dict(self) -> dict:
     result: dict = {}
     result["List"] = from_union([lambda x: from_list(lambda x: to_class(CodeRepository, x), x), from_none], self.list)
     result["Points"] = from_union([from_int, from_none], self.points)
     return result
Esempio n. 12
0
 def from_dict(obj: Any) -> 'CodeRepositories':
     assert isinstance(obj, dict)
     list = from_union([lambda x: from_list(CodeRepository.from_dict, x), from_none], obj.get("List"))
     points = from_union([from_int, from_none], obj.get("Points"))
     return CodeRepositories(list, points)