|
1
|
|
|
#!/usr/bin/python |
|
2
|
|
|
# -*- coding: utf-8 -*- |
|
3
|
|
|
from kuon.api_response import APIResponse |
|
4
|
|
|
from kuon.bitskins import BitSkins |
|
5
|
|
|
from kuon.common import CommonSteamGames |
|
6
|
|
|
|
|
7
|
|
|
|
|
8
|
|
|
class ISales(BitSkins): |
|
9
|
|
|
"""Implementation of the API methods related to market sales of 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
|
|
|
market hash name: |
|
15
|
|
|
The full market name of the item. For example: "AK-47 | Aquamarine Revenge (Field-Tested)" |
|
16
|
|
|
""" |
|
17
|
|
|
|
|
18
|
|
|
def __init__(self, *args, **kwargs): |
|
19
|
|
|
"""Initializing function""" |
|
20
|
|
|
super().__init__(*args, **kwargs) |
|
21
|
|
|
|
|
22
|
|
|
def get_sales_info(self, market_hash_name: str, app_id=CommonSteamGames.APP_ID_CSGO, page=None) -> APIResponse: |
|
23
|
|
|
"""GetRecentSaleInfo v1 implementation |
|
24
|
|
|
https://bitskins.com/api#get_sales_info |
|
25
|
|
|
|
|
26
|
|
|
:param market_hash_name: |
|
27
|
|
|
:param page: |
|
28
|
|
|
:param app_id: |
|
29
|
|
|
:return: |
|
30
|
|
|
""" |
|
31
|
|
|
api_url = 'https://bitskins.com/api/v1/get_sales_info/' |
|
32
|
|
|
|
|
33
|
|
|
payload = { |
|
34
|
|
|
'app_id': app_id, |
|
35
|
|
|
'market_hash_name': market_hash_name |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
if page: |
|
39
|
|
|
payload['page'] = int(page) |
|
40
|
|
|
|
|
41
|
|
|
return self.api_request(api_url=api_url, params=payload) |
|
42
|
|
|
|
|
43
|
|
|
def buy_item(self, item_ids: list, prices: list, app_id=CommonSteamGames.APP_ID_CSGO, |
|
44
|
|
|
auto_trade=True) -> APIResponse: |
|
45
|
|
|
"""BuyItem v1 implementation |
|
46
|
|
|
https://bitskins.com/api#buy_item |
|
47
|
|
|
|
|
48
|
|
|
:param item_ids: |
|
49
|
|
|
:param prices: |
|
50
|
|
|
:param app_id: |
|
51
|
|
|
:param auto_trade: |
|
52
|
|
|
:return: |
|
53
|
|
|
""" |
|
54
|
|
|
api_url = 'https://bitskins.com/api/v1/buy_item/' |
|
55
|
|
|
|
|
56
|
|
|
payload = { |
|
57
|
|
|
'app_id': app_id, |
|
58
|
|
|
'item_ids': ",".join(item_ids), |
|
59
|
|
|
'prices': ",".join(prices) |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
if not auto_trade: |
|
63
|
|
|
payload['auto_trade'] = 'false' |
|
64
|
|
|
|
|
65
|
|
|
return self.api_request(api_url=api_url, params=payload) |
|
66
|
|
|
|
|
67
|
|
|
def list_item_for_sale(self, item_ids: list, prices: list, app_id=CommonSteamGames.APP_ID_CSGO) -> APIResponse: |
|
68
|
|
|
"""SellItem v1 implementation |
|
69
|
|
|
https://bitskins.com/api#list_item_for_sale |
|
70
|
|
|
|
|
71
|
|
|
:param item_ids: |
|
72
|
|
|
:param prices: |
|
73
|
|
|
:param app_id: |
|
74
|
|
|
:return: |
|
75
|
|
|
""" |
|
76
|
|
|
api_url = 'https://bitskins.com/api/v1/list_item_for_sale/' |
|
77
|
|
|
|
|
78
|
|
|
payload = { |
|
79
|
|
|
'app_id': app_id, |
|
80
|
|
|
'item_ids': ",".join(item_ids), |
|
81
|
|
|
'prices': ",".join(prices) |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
return self.api_request(api_url=api_url, params=payload) |
|
85
|
|
|
|
|
86
|
|
|
def modify_sale_item(self, item_ids: list, prices: list, app_id=CommonSteamGames.APP_ID_CSGO) -> APIResponse: |
|
87
|
|
|
"""ModifySale v1 implementation |
|
88
|
|
|
https://bitskins.com/api#modify_sale_item |
|
89
|
|
|
|
|
90
|
|
|
:param item_ids: |
|
91
|
|
|
:param prices: |
|
92
|
|
|
:param app_id: |
|
93
|
|
|
:return: |
|
94
|
|
|
""" |
|
95
|
|
|
api_url = 'https://bitskins.com/api/v1/modify_sale_item/' |
|
96
|
|
|
|
|
97
|
|
|
payload = { |
|
98
|
|
|
'app_id': app_id, |
|
99
|
|
|
'item_ids': ",".join(item_ids), |
|
100
|
|
|
'prices': ",".join(prices) |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
return self.api_request(api_url=api_url, params=payload) |
|
104
|
|
|
|
|
105
|
|
|
def withdraw_item(self, item_ids: list, app_id=CommonSteamGames.APP_ID_CSGO) -> APIResponse: |
|
106
|
|
|
"""WithdrawItem v1 implementation |
|
107
|
|
|
https://bitskins.com/api#withdraw_item |
|
108
|
|
|
|
|
109
|
|
|
:param item_ids: |
|
110
|
|
|
:param app_id: |
|
111
|
|
|
:return: |
|
112
|
|
|
""" |
|
113
|
|
|
api_url = 'https://bitskins.com/api/v1/withdraw_item/' |
|
114
|
|
|
|
|
115
|
|
|
payload = { |
|
116
|
|
|
'app_id': app_id, |
|
117
|
|
|
'item_ids': ",".join(item_ids) |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
return self.api_request(api_url=api_url, params=payload) |
|
121
|
|
|
|
|
122
|
|
|
def bump_item(self, item_ids: list, app_id=CommonSteamGames.APP_ID_CSGO) -> APIResponse: |
|
123
|
|
|
"""BumpItem v1 implementation |
|
124
|
|
|
https://bitskins.com/api#bump_item |
|
125
|
|
|
|
|
126
|
|
|
:param item_ids: |
|
127
|
|
|
:param app_id: |
|
128
|
|
|
:return: |
|
129
|
|
|
""" |
|
130
|
|
|
api_url = 'https://bitskins.com/api/v1/bump_item/' |
|
131
|
|
|
|
|
132
|
|
|
payload = { |
|
133
|
|
|
'app_id': app_id, |
|
134
|
|
|
'item_ids': ",".join(item_ids) |
|
135
|
|
|
} |
|
136
|
|
|
|
|
137
|
|
|
return self.api_request(api_url=api_url, params=payload) |
|
138
|
|
|
|
|
139
|
|
|
def get_reset_price_items(self, app_id=CommonSteamGames.APP_ID_CSGO, page=None) -> APIResponse: |
|
140
|
|
|
"""GetResetPriceItems v1 implementation |
|
141
|
|
|
https://bitskins.com/api#get_reset_price_items |
|
142
|
|
|
|
|
143
|
|
|
:param app_id: |
|
144
|
|
|
:param page: |
|
145
|
|
|
:return: |
|
146
|
|
|
""" |
|
147
|
|
|
api_url = 'https://bitskins.com/api/v1/get_reset_price_items/' |
|
148
|
|
|
|
|
149
|
|
|
payload = { |
|
150
|
|
|
'app_id': app_id, |
|
151
|
|
|
} |
|
152
|
|
|
|
|
153
|
|
|
if page: |
|
154
|
|
|
payload['page'] = int(page) |
|
155
|
|
|
|
|
156
|
|
|
return self.api_request(api_url=api_url, params=payload) |
|
157
|
|
|
|
|
158
|
|
|
def get_steam_price_data(self, market_hash_name: str, app_id=CommonSteamGames.APP_ID_CSGO) -> APIResponse: |
|
159
|
|
|
"""GetRawPriceData v1 implementation |
|
160
|
|
|
https://bitskins.com/api#get_steam_price_data |
|
161
|
|
|
|
|
162
|
|
|
Returns the cheapest steam market price |
|
163
|
|
|
|
|
164
|
|
|
:param market_hash_name: |
|
165
|
|
|
:param app_id: |
|
166
|
|
|
:return: |
|
167
|
|
|
""" |
|
168
|
|
|
api_url = 'https://bitskins.com/api/v1/get_steam_price_data/' |
|
169
|
|
|
|
|
170
|
|
|
payload = { |
|
171
|
|
|
'app_id': app_id, |
|
172
|
|
|
'market_hash_name': market_hash_name |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
return self.api_request(api_url=api_url, params=payload) |
|
176
|
|
|
|
|
177
|
|
|
def get_specific_items_on_sale(self, item_ids: list, app_id=CommonSteamGames.APP_ID_CSGO) -> APIResponse: |
|
178
|
|
|
"""GetSpecificItemsOnSale v1 implementation |
|
179
|
|
|
https://bitskins.com/api#get_specific_items_on_sale |
|
180
|
|
|
|
|
181
|
|
|
Returns detailed information of requested items currently on sale on BitSkins |
|
182
|
|
|
|
|
183
|
|
|
:param item_ids: |
|
184
|
|
|
:param app_id: |
|
185
|
|
|
:return: |
|
186
|
|
|
""" |
|
187
|
|
|
api_url = 'https://bitskins.com/api/v1/get_specific_items_on_sale/' |
|
188
|
|
|
|
|
189
|
|
|
payload = { |
|
190
|
|
|
'app_id': app_id, |
|
191
|
|
|
'item_ids': ",".join(item_ids) |
|
192
|
|
|
} |
|
193
|
|
|
|
|
194
|
|
|
return self.api_request(api_url=api_url, params=payload) |
|
195
|
|
|
|