1
|
|
|
#!/usr/bin/python |
2
|
|
|
# -*- coding: utf-8 -*- |
3
|
1 |
|
from kuon.api_response import APIResponse |
4
|
1 |
|
from kuon.bitskins import BitSkins |
5
|
1 |
|
from kuon.common import * |
6
|
|
|
|
7
|
|
|
|
8
|
1 |
|
class IHistory(BitSkins): |
9
|
|
|
"""Implementation of the API methods related to the history of the user on BitSkins |
10
|
|
|
|
11
|
|
|
common not self explanatory keys: |
12
|
|
|
app id: |
13
|
|
|
The Steam AppID of the game which owns this item (e.g. 730 for CS:GO, 440 for TF2, 570 for Dota 2) |
14
|
|
|
""" |
15
|
|
|
|
16
|
1 |
|
def __init__(self, *args, **kwargs) -> None: |
17
|
|
|
"""Initializing function |
18
|
|
|
|
19
|
|
|
:type args: list |
20
|
|
|
:type kwargs: dict |
21
|
|
|
""" |
22
|
|
|
super().__init__(*args, **kwargs) |
23
|
|
|
|
24
|
1 |
|
def get_money_events(self, page: int = None) -> APIResponse: |
25
|
|
|
"""GetMoneyEvents v1 implementation |
26
|
|
|
https://bitskins.com/api/#get_money_events |
27
|
|
|
|
28
|
|
|
:type page: int |
29
|
|
|
:return: |
30
|
|
|
""" |
31
|
|
|
api_url = "https://bitskins.com/api/v1/get_money_events/" |
32
|
|
|
|
33
|
|
|
payload = {} |
34
|
|
|
|
35
|
|
|
if page: |
36
|
|
|
payload['page'] = page |
37
|
|
|
|
38
|
|
|
return self.api_request(api_url=api_url, params=payload) |
39
|
|
|
|
40
|
1 |
|
def get_buy_history(self, app_id: int = CommonSteamGames.APP_ID_CSGO, page: int = None) -> APIResponse: |
41
|
|
|
"""GetBuyHistory v1 implementation |
42
|
|
|
https://bitskins.com/api/#get_buy_history |
43
|
|
|
|
44
|
|
|
:type app_id: int |
45
|
|
|
:type page: int |
46
|
|
|
:return: |
47
|
|
|
""" |
48
|
|
|
api_url = "https://bitskins.com/api/v1/get_buy_history/" |
49
|
|
|
|
50
|
|
|
payload = { |
51
|
|
|
'app_id': app_id |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
if page: |
55
|
|
|
payload['page'] = int(page) |
56
|
|
|
|
57
|
|
|
return self.api_request(api_url=api_url, params=payload) |
58
|
|
|
|
59
|
1 |
|
def get_sell_history(self, app_id: int = CommonSteamGames.APP_ID_CSGO, page: int = None) -> APIResponse: |
60
|
|
|
"""GetSellHistory v1 implementation |
61
|
|
|
https://bitskins.com/api/#get_sell_history |
62
|
|
|
|
63
|
|
|
:type app_id: |
64
|
|
|
:type page: |
65
|
|
|
:return: |
66
|
|
|
""" |
67
|
|
|
api_url = "https://bitskins.com/api/v1/get_sell_history/" |
68
|
|
|
|
69
|
|
|
payload = { |
70
|
|
|
'app_id': app_id |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
if page: |
74
|
|
|
payload['page'] = int(page) |
75
|
|
|
|
76
|
|
|
return self.api_request(api_url=api_url, params=payload) |
77
|
|
|
|
78
|
1 |
|
def get_item_history(self, app_id: int = CommonSteamGames.APP_ID_CSGO, page: int = None, names: str = "", |
79
|
|
|
delimiter: str = "", per_page: int = None) -> APIResponse: |
80
|
|
|
"""GetItemHistory v1 implementation |
81
|
|
|
https://bitskins.com/api/#get_item_history |
82
|
|
|
|
83
|
|
|
:type app_id: int |
84
|
|
|
:type page: int |
85
|
|
|
:type names: str |
86
|
|
|
:type delimiter: str |
87
|
|
|
:type per_page: int |
88
|
|
|
:return: |
89
|
|
|
""" |
90
|
|
|
api_url = "https://bitskins.com/api/v1/get_item_history/" |
91
|
|
|
|
92
|
|
|
payload = { |
93
|
|
|
'app_id': app_id |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
if page: |
97
|
|
|
payload['page'] = page |
98
|
|
|
if names: |
99
|
|
|
payload['names'] = names |
100
|
|
|
if delimiter: |
101
|
|
|
payload['delimiter'] = delimiter |
102
|
|
|
if per_page: |
103
|
|
|
payload['per_page'] = per_page |
104
|
|
|
|
105
|
|
|
return self.api_request(api_url=api_url, params=payload) |
106
|
|
|
|
107
|
1 |
|
def get_trade_details(self, trade_id: str, trade_token: str) -> APIResponse: |
108
|
|
|
"""GetTradeDetails v1 implementation |
109
|
|
|
https://bitskins.com/api/#get_trade_details |
110
|
|
|
|
111
|
|
|
:type trade_id: str |
112
|
|
|
:type trade_token: str |
113
|
|
|
:return: |
114
|
|
|
""" |
115
|
|
|
api_url = "https://bitskins.com/api/v1/get_trade_details/" |
116
|
|
|
|
117
|
|
|
payload = { |
118
|
|
|
"trade_id": trade_id, |
119
|
|
|
"trade_token": trade_token |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
return self.api_request(api_url=api_url, params=payload) |
123
|
|
|
|
124
|
1 |
|
def get_recent_trade_offers(self, active_only: bool = False) -> APIResponse: |
125
|
|
|
"""GetRecentTradeOffers v1 implementation |
126
|
|
|
https://bitskins.com/api/#get_recent_trade_offers |
127
|
|
|
|
128
|
|
|
:type active_only: bool |
129
|
|
|
:return: |
130
|
|
|
""" |
131
|
|
|
api_url = "https://bitskins.com/api/v1/get_recent_trade_offers/" |
132
|
|
|
|
133
|
|
|
payload = {} |
134
|
|
|
|
135
|
|
|
if active_only: |
136
|
|
|
payload['active_only'] = 'true' |
137
|
|
|
|
138
|
|
|
return self.api_request(api_url=api_url, params=payload) |
139
|
|
|
|