forked from gate/gateapi-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoupon_api.py
More file actions
321 lines (275 loc) · 114 KB
/
Copy pathcoupon_api.py
File metadata and controls
321 lines (275 loc) · 114 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# coding: utf-8
"""
Gate API
Welcome to Gate API APIv4 provides operations related to spot, margin, and contract trading, including public interfaces for querying market data and authenticated private interfaces for implementing API-based automated trading. # noqa: E501
Contact: support@mail.gate.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility library
import six
from gate_api.api_client import ApiClient
from gate_api.exceptions import ( # noqa: F401
ApiTypeError,
ApiValueError
)
class CouponApi(object):
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def list_user_coupons(self, **kwargs): # noqa: E501
"""Coupon Center list # noqa: E501
## Interface description The general list interface of the card and coupon center returns all the cards and coupons of the currently logged in user (supports paging, filtering type, and valid/invalid switching). --- ## Query Parameters | Parameter name | Type | Required | Default value | Constraints | Description | |--------|------|------|--------|------|------| | `expired` | integer | No | `0` | `0` or `1` | `0` = Query valid cards and coupons; `1` = Check expired/used cards | | `limit` | integer | No | `10` | 1 ~ 20 | The number of cards returned per page | | `last_id` | integer | No | `0` | 1 ~ 1000000000 | Cursor paging: the last record of the previous page `id`, the home page does not transmit | | `expire_time` | integer | no | `0` | 1 ~ 2147483647 | Cursor pagination: with `last_id` Union usage expiration time (Unix timestamp) | | `order_by` | string | no | `latest` | `latest` / `expired` | Sorting method: `latest` = sort by latest receipt; `expired` = sort by expiration time in ascending order | | `type` | string | No | Empty (return all) | See the card type table below | Only return cards of the specified type | | `is_task_coupon` | integer | No | Do not pass (return all) | `0` or `1` | `0` = Only ordinary cards and coupons are returned; `1` = Only mission cards and coupons are returned; both are returned without passing | ### Supported coupon types (`type` parameter enumeration value) The main site (gate.io default site) supports the following types, and different sub-sites (Türkiye, United States, Malta, Australia) have their own whitelist restrictions. | `type` value | Coupon name | Version limit (below this version will not be returned/cannot be transferred) | |-----------|---------|-------------------------------| | `position_voucher` | Position experience coupon | Unlimited | | `tradfi_position_voucher` | TradFi position experience coupon | Android < 7320000 / iOS < 202507320000 does not return | | `contract_bonus` | Contract trial bonus | Unlimited | | `contract_bonus_new` | Contract experience coupon | Unlimited | | `commission_rebate` | Fee rebate coupons | Unlimited | | `hold_bonus` | Financial management trial bonus | Unlimited | | `point` | Point card | Unlimited (main site/Türkiye site only) | | `financial_rate` | Interest rate coupons | Unlimited | | `robot_bonus` | Robot trial bonus | Unlimited | | `loss_protection_copier` | Worry-free money for copying orders | Unlimited | | `vip_card` | VIP experience card | Unlimited | | `interest_voucher` | Leveraged coupons | Unlimited | | `p2p` | P2P transaction coupons | Unlimited | | `cash` | Cash Vouchers | Unlimited | | `crypto_loan_interest` | Mortgage currency interest reduction coupons | Android < 7290000 / iOS < 202507290000 does not return | | `copy_trading` | Trading experience bonus | Android < 7320000 / iOS < 202507320000 No return | | `alpha_voucher` | Alpha Cash Voucher | Android < 7320000 / iOS < 202507320000 Do not return | | `etf_voucher` | ETF trial fund | Android < 7320000 / iOS < 202507320000 No return | --- ##Response ### Outer structure ```json { \"code\": 0, \"message\": \"Success\", \"data\": { \"next_page\": true, \"list\": [ ...array of coupon objects... ] } } ``` | Field | Type | Description | |------|------|------| | `code` | integer | `0` = success | | `message` | string | response message | | `data.next_page` | boolean | Whether there is a next page. `true` = There is more data, the `id` of the last item on this page needs to be `last_id` is passed in for the next request | | `data.list` | array | Array of coupon objects, see below for details | --- ### Public fields of card and coupon objects (included in all types) | Field name | Type | Description | |--------|------|------| | `id` | integer | Card and coupon issuance record ID (`coupon_send_issuing_log.id`), used for paging cursor `last_id` | | `details_id` | integer | The primary key ID of the user card details table (independent tables for each type) | | `coupon_type` | string | Coupon type, see the enumeration table above | | `name` | string | Card display name (i18n translated) | | `amount` | string | Coupon denomination (formatted string, including thousandth sign). Different types have different meanings, see explanation below | | `currency` | string | The denomination unit. Different types have different values, see explanation below | | `rule_new` | string | Use rule text (this field in the list interface always returns the empty string `\"\"`, and only in the detail interface) | | `status` | string | Card status, see status enumeration below | | `jump_url` | object | jump link | | `jump_url.web` | string | Web jump link | | `jump_url.app` | string | App jump link | | `jump_url.mini_app` | string | Mini program jump link (most types are empty strings) | | `help_url` | object | Help center link | | `help_url.web` | string | Web help link | | `help_url.app` | string | App help link | | `expire_time` | integer | Expiration time (Unix timestamp). Note: Some types will be adjusted to the actual expiration time after they have been activated or used | | `expire_time_order_by` | integer | Expiration time for sorting (taken from the original expiration time of the issuance record, not affected by activation) | | `expire_second` | integer | The number of seconds remaining before expiration (expired or point card type returns `0`) | | `has_usage_history` | boolean | Whether there is a usage record (the point card type is fixed to `true`, and the rest are judged based on the type) | | `has_progress` | boolean | Whether to display the progress bar (only `commission_rebate`, `interest_voucher` and task coupons that meet the conditions are `true`) | | `progress_config` | object | Progress bar configuration, when `has_progress` is `false`, each field is an empty string | | `progress_config.total_balance` | string | The total amount to be completed | | `progress_config.current_used` | string | Amount used | | `progress_config.current_achived` | string | Amount achieved | | `progress_config.currency` | string | Progress unit | | `activation_info` | object | Activation information exclusive to each type, see each type description below (types without exclusive information return empty objects `{}`) | | `is_task_coupon` | integer | `0` = ordinary coupon; `1` = task coupon | | `upgrade_toast` | boolean | Whether the user needs to be prompted to upgrade the App (`true` when the version is too old and cannot support the coupon) | | `task_title` | string | Task title (only task coupons have value, ordinary coupons are `\"\"`) | | `task_desc` | string | Task description (only task coupons have value, ordinary coupons are `\"\"`) | | `task_start_at` | integer | Task start timestamp (only `TASK_EXPIRED` status task coupons have value, the rest are `0`) | | `task_expire_at` | integer | Task expiration timestamp (currently fixed to `0`, reserved field) | | `task_completed_at` | integer | Task completion timestamp (currently fixed at `0`, reserved field) | | `extra` | array | Extended field, fixed return empty array `[]` | --- ### `status` status enumeration | Value | Applicable objects | Description | |----|---------|------| | `NOT_ACTIVE` | Ordinary coupons | Pending activation (not yet activated) | | `ACTIVATED` | Ordinary coupons | Activated (activating or after activation) | | `TO_BE_USED` | Ordinary coupons | To be used (valid and not used) | | `EXPIRED` | Ordinary coupons | Expired (expired without being used) | | `RECYCLED` | Ordinary cards and coupons | Recycled (such as contract recharge experience coupons are recycled) | | `INVALID` | Ordinary coupons | Expired | | `USED` | Ordinary coupons | Used/consumed | | `UNKNOWN` | Ordinary coupons | Unknown status | | `LOCKED` | Ordinary cards and coupons (`p2p`) | Locked (P2P transaction in progress, waiting for write-off) | | `TASK_START` | Task coupons | The task has not started (the coupon has been issued and the task is to be started) | | `TASK_WAIT` | Task coupons | Task in progress (to be completed) | | `TASK_DONE` | Task coupons | The task has been completed (receiving is being processed) | | `TASK_EXPIRED` | Task coupon | The task is not completed and has expired | | `TASK_NOT_STARTED_EXPIRED` | Task coupon | The task has expired before it started | | `TASK_RECEIVE_SUCCESS` | Task coupons | Task rewards received successfully | | `TASK_RECEIVE_FAIL` | Task coupons | Failed to receive task rewards | --- ### `amount` / `currency` Description of each type | `coupon_type` | `amount` description | `currency` value | |---------------|--------------|---------------| | `point` | Point card balance (including thousandths) | `\"POINT\"` | | `position_voucher` | `Coupon face amount × leverage multiple` (including thousandths) | Such as `\"USDT\"` | | `tradfi_position_voucher` | `Coupon face amount × leverage multiple` (including thousandths) | `\"USDx\"` | | `financial_rate` | Interest rate increase value + `%`, such as `\"5%\"` | `\"APR\"` | | `vip_card` | VIP level number, such as `\"4\"` | `\"VIP\"` | | `interest_voucher` | Interest rate discount percentage + `%` | Discount logo (Chinese site is `\"discount\"`, other sites are empty) | | `crypto_loan_interest` | Interest rate discount percentage + `%` | `\"\"` | | `alpha_voucher` | Coupon face amount (including thousandths) | Alpha base currency (such as `\"USDT\"` or `\"ETH\"`) | | Other types | Coupon face amount (including thousandths) | Capital currency symbol, such as `\"USDT\"` / `\"GT\"` / `\"BTC\"` | > **Note**: The `point` type additionally returns the `origin_amount` field (the original balance string with the trailing zeros removed), other types do not have this field. --- ### `activation_info` Exclusive fields for each type #### `interest_voucher` (leverage coupon) ```json { \"supported_pairs\": \"BTC/USDT\", \"transaction_type\": \"borrow\" } ``` | Field | Type | Description | |------|------|------| | `supported_pairs` | string | Applicable trading pairs, separated by `/`, such as `\"BTC/USDT\"` | | `transaction_type` | string | Transaction type (such as `borrow`) | #### `contract_bonus_new` (contract experience coupon) ```json { \"received_expired_hour\": 48 } ``` | Field | Type | Description | |------|------|------| | `received_expired_hour` | integer | The number of hours valid after activation (automatic recycling after timeout) | #### `contract_bonus` (Contract experience bonus) ```json { \"check_unified_account_mode\": true, \"received_expired_days\": 7, \"abtest\": false } ``` | Field | Type | Description | |------|------|------| | `check_unified_account_mode` | boolean | Whether to check the unified account mode (fixed `true`) | | `received_expired_days` | integer | Number of days valid after activation | | `abtest` | boolean | AB test flag (currently fixed to `false`) | #### `commission_rebate` (handling fee cashback coupon) ```json { \"market\": \"futures\", \"market_name\": \"Futures\" } ``` | Field | Type | Description | |------|------|------| | `market` | string | Applicable market, enumeration value: `spot` / `margin` / `futures` / `alpha` / `etf` / `tradfi` | | `market_name` | string | Market display name (i18n translated) | #### `robot_bonus` (robot experience bonus) ```json { \"designated_bots\": \"DISABLED\" } ``` | Field | Type | Description | |------|------|------| | `designated_bots` | string | `\"ENABLED\"` = can only be used by specified policies; `\"DISABLED\"` = Unlimited strategy | #### `position_voucher` (position experience coupon) ```json { \"symbols\": \"BTC_USDT\", \"leverage\": \"10\", \"need_user_funds\": 0, \"user_funds_amount\": \"100\", \"position_bonus\": \"500\" } ``` | Field | Type | Description | |------|------|------| | `symbols` | string | Applicable trading pairs (such as `\"BTC_USDT\"`), empty means no limit | | `leverage` | string | Leverage multiple | | `need_user_funds` | integer | `0` = No user-owned funds are required; `1` = Fund allocation is required | | `user_funds_amount` | string | The amount of funds required by the user (meaningful when `need_user_funds=1`) | | `position_bonus` | string | The original amount of the coupon (remove the trailing zero) | #### `tradfi_position_voucher` (TradFi position experience coupon) ```json { \"symbols\": \"AAPL\", \"leverage\": \"5\", \"position_bonus\": \"200\" } ``` | Field | Type | Description | |------|------|------| | `symbols` | string | Applicable to TradFi varieties (such as `\"AAPL\"`), empty means no limit | | `leverage` | string | Leverage multiple | | `position_bonus` | string | The original amount of the coupon (remove the trailing zero) | #### `etf_voucher` (ETF trial bonus) ```json { \"currency_markets\": \"BTC3L_USDT,ETH3L_USDT\", \"amount\": \"50\" } ``` | Field | Type | Description | |------|------|------| | `currency_markets` | string | List of applicable ETF markets (comma separated) | | `amount` | string | The original amount of the coupon (remove the trailing zero) | #### Other types `point` (point card), `hold_bonus` (financial experience fund), `loss_protection_copier` (worry-free money for following orders), `vip_card` (VIP experience card), `p2p` (P2P transaction coupon), `cash` (cash coupon) , `crypto_loan_interest` (interest-reduced coupon for mortgage loan), `copy_trading` (trading experience fee), `alpha_voucher` (Alpha cash coupon), `financial_rate` (interest-increasing coupon) and other types return empty objects: ```json {} ``` --- ## Complete response example ### Ordinary cards and coupons (contract experience money) ```json { \"code\": 0, \"message\": \"Success\", \"data\": { \"next_page\": false, \"list\": [ { \"id\": 1234567, \"details_id\": 890, \"coupon_type\": \"contract_bonus\", \"name\": \"Futures Bonus\", \"amount\": \"100\", \"currency\": \"USDT\", \"rule_new\": \"\", \"status\": \"NOT_ACTIVE\", \"jump_url\": { \"web\": \"/futures/USDT\", \"app\": \"/futures/USDT\", \"mini_app\": \"\" }, \"help_url\": { \"web\": \"\", \"app\": \"\" }, \"expire_time\": 1760000000, \"expire_time_order_by\": 1760000000, \"expire_second\": 86400, \"has_usage_history\": false, \"has_progress\": false, \"progress_config\": { \"total_balance\": \"\", \"current_used\": \"\", \"current_achived\": \"\", \"currency\": \"\" }, \"activation_info\": { \"check_unified_account_mode\": true, \"received_expired_days\": 7, \"abtest\": false }, \"is_task_coupon\": 0, \"upgrade_toast\": false, \"task_title\": \"\", \"task_desc\": \"\", \"task_start_at\": 0, \"task_expire_at\": 0, \"task_completed_at\": 0, \"extra\": [] } ] } } ``` ### Task coupons (handling fee cashback coupons) ```json { \"code\": 0, \"message\": \"Success\", \"data\": { \"next_page\": false, \"list\": [ { \"id\": 9876543, \"details_id\": 0, \"coupon_type\": \"commission_rebate\", \"name\": \"10% Futures Commission Rebate\", \"amount\": \"100\", \"currency\": \"USDT\", \"rule_new\": \"\", \"status\": \"TASK_WAIT\", \"jump_url\": { \"web\": \"https://www.gate.io/futures\", \"app\": \"gateio://futures\", \"mini_app\": \"\" }, \"help_url\": { \"web\": \"\", \"app\": \"\" }, \"expire_time\": 1760000000, \"expire_time_order_by\": 1760000000, \"expire_second\": 172800, \"has_usage_history\": false, \"has_progress\": true, \"progress_config\": { \"total_balance\": \"1000\", \"current_used\": \"350\", \"current_achived\": \"350\", \"currency\": \"USDT\" }, \"activation_info\": { \"market\": \"futures\", \"market_name\": \"Futures\" }, \"is_task_coupon\": 1, \"upgrade_toast\": false, \"task_title\": \"Trade 1000 USDT to earn commission rebate\", \"task_desc\": \"Complete futures trading volume task to get 100 USDT commission rebate\", \"task_start_at\": 0, \"task_expire_at\": 0, \"task_completed_at\": 0, \"extra\": [] } ] } } ``` ### Point card (point) ```json { \"code\": 0, \"message\": \"Success\", \"data\": { \"next_page\": false, \"list\": [ { \"id\": 0, \"details_id\": 0, \"coupon_type\": \"point\", \"name\": \"Points\", \"amount\": \"1,234.56\", \"origin_amount\": \"1234.56\", \"currency\": \"POINT\", \"rule_new\": \"...\", \"status\": \"TO_BE_USED\", \"jump_url\": { \"web\": \"/trade/BTC_USDT\", \"app\": \"/trade/BTC_USDT\", \"mini_app\": \"\" }, \"help_url\": { \"web\": \"\", \"app\": \"\" }, \"expire_time\": 0, \"expire_time_order_by\": 0, \"expire_second\": 0, \"has_usage_history\": true, \"has_progress\": false, \"progress_config\": { \"total_balance\": \"\", \"current_used\": \"\", \"current_achived\": \"\", \"currency\": \"\" }, \"activation_info\": {}, \"is_task_coupon\": 0, \"upgrade_toast\": false, \"task_title\": \"\", \"task_desc\": \"\", \"task_start_at\": 0, \"task_expire_at\": 0, \"task_completed_at\": 0, \"extra\": [] } ] } } ``` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_user_coupons(async_req=True)
>>> result = thread.get()
:param bool async_req: execute request asynchronously
:param int expired: Coupon status filter. `0` = query valid coupons (default); `1` = query expired/used coupons
:param int limit: Number of coupons returned per page, range 1-20, default 10
:param int last_id: Cursor-based pagination: the `id` value of the last record from the previous page, omit (or pass 0) for the first page
:param int expire_time: Cursor-based pagination: used together with `last_id`, pass the `expire_time_order_by` value of the last record from the previous page (Unix timestamp), omit for the first page
:param str order_by: Sort order. `latest` = by latest claim time descending (default); `expired` = by expiration time ascending
:param str type: Coupon type filter. If not specified, all supported types are returned. Available values: `position_voucher` (position voucher), `tradfi_position_voucher` (TradFi position voucher), `contract_bonus` (futures bonus), `contract_bonus_new` (futures trial coupon), `commission_rebate` (commission rebate coupon), `hold_bonus` (earn trial bonus), `point` (point card), `financial_rate` (interest rate boost coupon), `robot_bonus` (trading bot bonus), `loss_protection_copier` (copy trading loss protection), `vip_card` (VIP trial card), `interest_voucher` (margin interest discount coupon), `p2p` (P2P trading deduction coupon), `cash` (cash coupon), `crypto_loan_interest` (crypto loan interest discount coupon), `copy_trading` (copy trading bonus), `alpha_voucher` (Alpha cash coupon), `etf_voucher` (ETF trial bonus)
:param int is_task_coupon: Task Coupon Filter. `0` = Return only regular coupons; `1` = Return only task coupons; Omit to return both
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:rtype: gate_api.ListUserCouponsResponse
:return: If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
return self.list_user_coupons_with_http_info(**kwargs) # noqa: E501
def list_user_coupons_with_http_info(self, **kwargs): # noqa: E501
"""Coupon Center list # noqa: E501
## Interface description The general list interface of the card and coupon center returns all the cards and coupons of the currently logged in user (supports paging, filtering type, and valid/invalid switching). --- ## Query Parameters | Parameter name | Type | Required | Default value | Constraints | Description | |--------|------|------|--------|------|------| | `expired` | integer | No | `0` | `0` or `1` | `0` = Query valid cards and coupons; `1` = Check expired/used cards | | `limit` | integer | No | `10` | 1 ~ 20 | The number of cards returned per page | | `last_id` | integer | No | `0` | 1 ~ 1000000000 | Cursor paging: the last record of the previous page `id`, the home page does not transmit | | `expire_time` | integer | no | `0` | 1 ~ 2147483647 | Cursor pagination: with `last_id` Union usage expiration time (Unix timestamp) | | `order_by` | string | no | `latest` | `latest` / `expired` | Sorting method: `latest` = sort by latest receipt; `expired` = sort by expiration time in ascending order | | `type` | string | No | Empty (return all) | See the card type table below | Only return cards of the specified type | | `is_task_coupon` | integer | No | Do not pass (return all) | `0` or `1` | `0` = Only ordinary cards and coupons are returned; `1` = Only mission cards and coupons are returned; both are returned without passing | ### Supported coupon types (`type` parameter enumeration value) The main site (gate.io default site) supports the following types, and different sub-sites (Türkiye, United States, Malta, Australia) have their own whitelist restrictions. | `type` value | Coupon name | Version limit (below this version will not be returned/cannot be transferred) | |-----------|---------|-------------------------------| | `position_voucher` | Position experience coupon | Unlimited | | `tradfi_position_voucher` | TradFi position experience coupon | Android < 7320000 / iOS < 202507320000 does not return | | `contract_bonus` | Contract trial bonus | Unlimited | | `contract_bonus_new` | Contract experience coupon | Unlimited | | `commission_rebate` | Fee rebate coupons | Unlimited | | `hold_bonus` | Financial management trial bonus | Unlimited | | `point` | Point card | Unlimited (main site/Türkiye site only) | | `financial_rate` | Interest rate coupons | Unlimited | | `robot_bonus` | Robot trial bonus | Unlimited | | `loss_protection_copier` | Worry-free money for copying orders | Unlimited | | `vip_card` | VIP experience card | Unlimited | | `interest_voucher` | Leveraged coupons | Unlimited | | `p2p` | P2P transaction coupons | Unlimited | | `cash` | Cash Vouchers | Unlimited | | `crypto_loan_interest` | Mortgage currency interest reduction coupons | Android < 7290000 / iOS < 202507290000 does not return | | `copy_trading` | Trading experience bonus | Android < 7320000 / iOS < 202507320000 No return | | `alpha_voucher` | Alpha Cash Voucher | Android < 7320000 / iOS < 202507320000 Do not return | | `etf_voucher` | ETF trial fund | Android < 7320000 / iOS < 202507320000 No return | --- ##Response ### Outer structure ```json { \"code\": 0, \"message\": \"Success\", \"data\": { \"next_page\": true, \"list\": [ ...array of coupon objects... ] } } ``` | Field | Type | Description | |------|------|------| | `code` | integer | `0` = success | | `message` | string | response message | | `data.next_page` | boolean | Whether there is a next page. `true` = There is more data, the `id` of the last item on this page needs to be `last_id` is passed in for the next request | | `data.list` | array | Array of coupon objects, see below for details | --- ### Public fields of card and coupon objects (included in all types) | Field name | Type | Description | |--------|------|------| | `id` | integer | Card and coupon issuance record ID (`coupon_send_issuing_log.id`), used for paging cursor `last_id` | | `details_id` | integer | The primary key ID of the user card details table (independent tables for each type) | | `coupon_type` | string | Coupon type, see the enumeration table above | | `name` | string | Card display name (i18n translated) | | `amount` | string | Coupon denomination (formatted string, including thousandth sign). Different types have different meanings, see explanation below | | `currency` | string | The denomination unit. Different types have different values, see explanation below | | `rule_new` | string | Use rule text (this field in the list interface always returns the empty string `\"\"`, and only in the detail interface) | | `status` | string | Card status, see status enumeration below | | `jump_url` | object | jump link | | `jump_url.web` | string | Web jump link | | `jump_url.app` | string | App jump link | | `jump_url.mini_app` | string | Mini program jump link (most types are empty strings) | | `help_url` | object | Help center link | | `help_url.web` | string | Web help link | | `help_url.app` | string | App help link | | `expire_time` | integer | Expiration time (Unix timestamp). Note: Some types will be adjusted to the actual expiration time after they have been activated or used | | `expire_time_order_by` | integer | Expiration time for sorting (taken from the original expiration time of the issuance record, not affected by activation) | | `expire_second` | integer | The number of seconds remaining before expiration (expired or point card type returns `0`) | | `has_usage_history` | boolean | Whether there is a usage record (the point card type is fixed to `true`, and the rest are judged based on the type) | | `has_progress` | boolean | Whether to display the progress bar (only `commission_rebate`, `interest_voucher` and task coupons that meet the conditions are `true`) | | `progress_config` | object | Progress bar configuration, when `has_progress` is `false`, each field is an empty string | | `progress_config.total_balance` | string | The total amount to be completed | | `progress_config.current_used` | string | Amount used | | `progress_config.current_achived` | string | Amount achieved | | `progress_config.currency` | string | Progress unit | | `activation_info` | object | Activation information exclusive to each type, see each type description below (types without exclusive information return empty objects `{}`) | | `is_task_coupon` | integer | `0` = ordinary coupon; `1` = task coupon | | `upgrade_toast` | boolean | Whether the user needs to be prompted to upgrade the App (`true` when the version is too old and cannot support the coupon) | | `task_title` | string | Task title (only task coupons have value, ordinary coupons are `\"\"`) | | `task_desc` | string | Task description (only task coupons have value, ordinary coupons are `\"\"`) | | `task_start_at` | integer | Task start timestamp (only `TASK_EXPIRED` status task coupons have value, the rest are `0`) | | `task_expire_at` | integer | Task expiration timestamp (currently fixed to `0`, reserved field) | | `task_completed_at` | integer | Task completion timestamp (currently fixed at `0`, reserved field) | | `extra` | array | Extended field, fixed return empty array `[]` | --- ### `status` status enumeration | Value | Applicable objects | Description | |----|---------|------| | `NOT_ACTIVE` | Ordinary coupons | Pending activation (not yet activated) | | `ACTIVATED` | Ordinary coupons | Activated (activating or after activation) | | `TO_BE_USED` | Ordinary coupons | To be used (valid and not used) | | `EXPIRED` | Ordinary coupons | Expired (expired without being used) | | `RECYCLED` | Ordinary cards and coupons | Recycled (such as contract recharge experience coupons are recycled) | | `INVALID` | Ordinary coupons | Expired | | `USED` | Ordinary coupons | Used/consumed | | `UNKNOWN` | Ordinary coupons | Unknown status | | `LOCKED` | Ordinary cards and coupons (`p2p`) | Locked (P2P transaction in progress, waiting for write-off) | | `TASK_START` | Task coupons | The task has not started (the coupon has been issued and the task is to be started) | | `TASK_WAIT` | Task coupons | Task in progress (to be completed) | | `TASK_DONE` | Task coupons | The task has been completed (receiving is being processed) | | `TASK_EXPIRED` | Task coupon | The task is not completed and has expired | | `TASK_NOT_STARTED_EXPIRED` | Task coupon | The task has expired before it started | | `TASK_RECEIVE_SUCCESS` | Task coupons | Task rewards received successfully | | `TASK_RECEIVE_FAIL` | Task coupons | Failed to receive task rewards | --- ### `amount` / `currency` Description of each type | `coupon_type` | `amount` description | `currency` value | |---------------|--------------|---------------| | `point` | Point card balance (including thousandths) | `\"POINT\"` | | `position_voucher` | `Coupon face amount × leverage multiple` (including thousandths) | Such as `\"USDT\"` | | `tradfi_position_voucher` | `Coupon face amount × leverage multiple` (including thousandths) | `\"USDx\"` | | `financial_rate` | Interest rate increase value + `%`, such as `\"5%\"` | `\"APR\"` | | `vip_card` | VIP level number, such as `\"4\"` | `\"VIP\"` | | `interest_voucher` | Interest rate discount percentage + `%` | Discount logo (Chinese site is `\"discount\"`, other sites are empty) | | `crypto_loan_interest` | Interest rate discount percentage + `%` | `\"\"` | | `alpha_voucher` | Coupon face amount (including thousandths) | Alpha base currency (such as `\"USDT\"` or `\"ETH\"`) | | Other types | Coupon face amount (including thousandths) | Capital currency symbol, such as `\"USDT\"` / `\"GT\"` / `\"BTC\"` | > **Note**: The `point` type additionally returns the `origin_amount` field (the original balance string with the trailing zeros removed), other types do not have this field. --- ### `activation_info` Exclusive fields for each type #### `interest_voucher` (leverage coupon) ```json { \"supported_pairs\": \"BTC/USDT\", \"transaction_type\": \"borrow\" } ``` | Field | Type | Description | |------|------|------| | `supported_pairs` | string | Applicable trading pairs, separated by `/`, such as `\"BTC/USDT\"` | | `transaction_type` | string | Transaction type (such as `borrow`) | #### `contract_bonus_new` (contract experience coupon) ```json { \"received_expired_hour\": 48 } ``` | Field | Type | Description | |------|------|------| | `received_expired_hour` | integer | The number of hours valid after activation (automatic recycling after timeout) | #### `contract_bonus` (Contract experience bonus) ```json { \"check_unified_account_mode\": true, \"received_expired_days\": 7, \"abtest\": false } ``` | Field | Type | Description | |------|------|------| | `check_unified_account_mode` | boolean | Whether to check the unified account mode (fixed `true`) | | `received_expired_days` | integer | Number of days valid after activation | | `abtest` | boolean | AB test flag (currently fixed to `false`) | #### `commission_rebate` (handling fee cashback coupon) ```json { \"market\": \"futures\", \"market_name\": \"Futures\" } ``` | Field | Type | Description | |------|------|------| | `market` | string | Applicable market, enumeration value: `spot` / `margin` / `futures` / `alpha` / `etf` / `tradfi` | | `market_name` | string | Market display name (i18n translated) | #### `robot_bonus` (robot experience bonus) ```json { \"designated_bots\": \"DISABLED\" } ``` | Field | Type | Description | |------|------|------| | `designated_bots` | string | `\"ENABLED\"` = can only be used by specified policies; `\"DISABLED\"` = Unlimited strategy | #### `position_voucher` (position experience coupon) ```json { \"symbols\": \"BTC_USDT\", \"leverage\": \"10\", \"need_user_funds\": 0, \"user_funds_amount\": \"100\", \"position_bonus\": \"500\" } ``` | Field | Type | Description | |------|------|------| | `symbols` | string | Applicable trading pairs (such as `\"BTC_USDT\"`), empty means no limit | | `leverage` | string | Leverage multiple | | `need_user_funds` | integer | `0` = No user-owned funds are required; `1` = Fund allocation is required | | `user_funds_amount` | string | The amount of funds required by the user (meaningful when `need_user_funds=1`) | | `position_bonus` | string | The original amount of the coupon (remove the trailing zero) | #### `tradfi_position_voucher` (TradFi position experience coupon) ```json { \"symbols\": \"AAPL\", \"leverage\": \"5\", \"position_bonus\": \"200\" } ``` | Field | Type | Description | |------|------|------| | `symbols` | string | Applicable to TradFi varieties (such as `\"AAPL\"`), empty means no limit | | `leverage` | string | Leverage multiple | | `position_bonus` | string | The original amount of the coupon (remove the trailing zero) | #### `etf_voucher` (ETF trial bonus) ```json { \"currency_markets\": \"BTC3L_USDT,ETH3L_USDT\", \"amount\": \"50\" } ``` | Field | Type | Description | |------|------|------| | `currency_markets` | string | List of applicable ETF markets (comma separated) | | `amount` | string | The original amount of the coupon (remove the trailing zero) | #### Other types `point` (point card), `hold_bonus` (financial experience fund), `loss_protection_copier` (worry-free money for following orders), `vip_card` (VIP experience card), `p2p` (P2P transaction coupon), `cash` (cash coupon) , `crypto_loan_interest` (interest-reduced coupon for mortgage loan), `copy_trading` (trading experience fee), `alpha_voucher` (Alpha cash coupon), `financial_rate` (interest-increasing coupon) and other types return empty objects: ```json {} ``` --- ## Complete response example ### Ordinary cards and coupons (contract experience money) ```json { \"code\": 0, \"message\": \"Success\", \"data\": { \"next_page\": false, \"list\": [ { \"id\": 1234567, \"details_id\": 890, \"coupon_type\": \"contract_bonus\", \"name\": \"Futures Bonus\", \"amount\": \"100\", \"currency\": \"USDT\", \"rule_new\": \"\", \"status\": \"NOT_ACTIVE\", \"jump_url\": { \"web\": \"/futures/USDT\", \"app\": \"/futures/USDT\", \"mini_app\": \"\" }, \"help_url\": { \"web\": \"\", \"app\": \"\" }, \"expire_time\": 1760000000, \"expire_time_order_by\": 1760000000, \"expire_second\": 86400, \"has_usage_history\": false, \"has_progress\": false, \"progress_config\": { \"total_balance\": \"\", \"current_used\": \"\", \"current_achived\": \"\", \"currency\": \"\" }, \"activation_info\": { \"check_unified_account_mode\": true, \"received_expired_days\": 7, \"abtest\": false }, \"is_task_coupon\": 0, \"upgrade_toast\": false, \"task_title\": \"\", \"task_desc\": \"\", \"task_start_at\": 0, \"task_expire_at\": 0, \"task_completed_at\": 0, \"extra\": [] } ] } } ``` ### Task coupons (handling fee cashback coupons) ```json { \"code\": 0, \"message\": \"Success\", \"data\": { \"next_page\": false, \"list\": [ { \"id\": 9876543, \"details_id\": 0, \"coupon_type\": \"commission_rebate\", \"name\": \"10% Futures Commission Rebate\", \"amount\": \"100\", \"currency\": \"USDT\", \"rule_new\": \"\", \"status\": \"TASK_WAIT\", \"jump_url\": { \"web\": \"https://www.gate.io/futures\", \"app\": \"gateio://futures\", \"mini_app\": \"\" }, \"help_url\": { \"web\": \"\", \"app\": \"\" }, \"expire_time\": 1760000000, \"expire_time_order_by\": 1760000000, \"expire_second\": 172800, \"has_usage_history\": false, \"has_progress\": true, \"progress_config\": { \"total_balance\": \"1000\", \"current_used\": \"350\", \"current_achived\": \"350\", \"currency\": \"USDT\" }, \"activation_info\": { \"market\": \"futures\", \"market_name\": \"Futures\" }, \"is_task_coupon\": 1, \"upgrade_toast\": false, \"task_title\": \"Trade 1000 USDT to earn commission rebate\", \"task_desc\": \"Complete futures trading volume task to get 100 USDT commission rebate\", \"task_start_at\": 0, \"task_expire_at\": 0, \"task_completed_at\": 0, \"extra\": [] } ] } } ``` ### Point card (point) ```json { \"code\": 0, \"message\": \"Success\", \"data\": { \"next_page\": false, \"list\": [ { \"id\": 0, \"details_id\": 0, \"coupon_type\": \"point\", \"name\": \"Points\", \"amount\": \"1,234.56\", \"origin_amount\": \"1234.56\", \"currency\": \"POINT\", \"rule_new\": \"...\", \"status\": \"TO_BE_USED\", \"jump_url\": { \"web\": \"/trade/BTC_USDT\", \"app\": \"/trade/BTC_USDT\", \"mini_app\": \"\" }, \"help_url\": { \"web\": \"\", \"app\": \"\" }, \"expire_time\": 0, \"expire_time_order_by\": 0, \"expire_second\": 0, \"has_usage_history\": true, \"has_progress\": false, \"progress_config\": { \"total_balance\": \"\", \"current_used\": \"\", \"current_achived\": \"\", \"currency\": \"\" }, \"activation_info\": {}, \"is_task_coupon\": 0, \"upgrade_toast\": false, \"task_title\": \"\", \"task_desc\": \"\", \"task_start_at\": 0, \"task_expire_at\": 0, \"task_completed_at\": 0, \"extra\": [] } ] } } ``` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_user_coupons_with_http_info(async_req=True)
>>> result = thread.get()
:param bool async_req: execute request asynchronously
:param int expired: Coupon status filter. `0` = query valid coupons (default); `1` = query expired/used coupons
:param int limit: Number of coupons returned per page, range 1-20, default 10
:param int last_id: Cursor-based pagination: the `id` value of the last record from the previous page, omit (or pass 0) for the first page
:param int expire_time: Cursor-based pagination: used together with `last_id`, pass the `expire_time_order_by` value of the last record from the previous page (Unix timestamp), omit for the first page
:param str order_by: Sort order. `latest` = by latest claim time descending (default); `expired` = by expiration time ascending
:param str type: Coupon type filter. If not specified, all supported types are returned. Available values: `position_voucher` (position voucher), `tradfi_position_voucher` (TradFi position voucher), `contract_bonus` (futures bonus), `contract_bonus_new` (futures trial coupon), `commission_rebate` (commission rebate coupon), `hold_bonus` (earn trial bonus), `point` (point card), `financial_rate` (interest rate boost coupon), `robot_bonus` (trading bot bonus), `loss_protection_copier` (copy trading loss protection), `vip_card` (VIP trial card), `interest_voucher` (margin interest discount coupon), `p2p` (P2P trading deduction coupon), `cash` (cash coupon), `crypto_loan_interest` (crypto loan interest discount coupon), `copy_trading` (copy trading bonus), `alpha_voucher` (Alpha cash coupon), `etf_voucher` (ETF trial bonus)
:param int is_task_coupon: Task Coupon Filter. `0` = Return only regular coupons; `1` = Return only task coupons; Omit to return both
:param _return_http_data_only: response data without head status code
and headers
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:rtype: tuple(gate_api.ListUserCouponsResponse, status_code(int), headers(HTTPHeaderDict))
:return: If the method is called asynchronously,
returns the request thread.
"""
local_var_params = locals()
all_params = [
'expired',
'limit',
'last_id',
'expire_time',
'order_by',
'type',
'is_task_coupon'
]
all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout'
]
)
for k, v in six.iteritems(local_var_params['kwargs']):
if k not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method list_user_coupons" % k
)
local_var_params[k] = v
del local_var_params['kwargs']
if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 20: # noqa: E501
raise ApiValueError("Invalid value for parameter `limit` when calling `list_user_coupons`, must be a value less than or equal to `20`") # noqa: E501
if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501
raise ApiValueError("Invalid value for parameter `limit` when calling `list_user_coupons`, must be a value greater than or equal to `1`") # noqa: E501
if self.api_client.client_side_validation and 'last_id' in local_var_params and local_var_params['last_id'] > 1000000000: # noqa: E501
raise ApiValueError("Invalid value for parameter `last_id` when calling `list_user_coupons`, must be a value less than or equal to `1000000000`") # noqa: E501
if self.api_client.client_side_validation and 'last_id' in local_var_params and local_var_params['last_id'] < 1: # noqa: E501
raise ApiValueError("Invalid value for parameter `last_id` when calling `list_user_coupons`, must be a value greater than or equal to `1`") # noqa: E501
if self.api_client.client_side_validation and 'expire_time' in local_var_params and local_var_params['expire_time'] > 2147483647: # noqa: E501
raise ApiValueError("Invalid value for parameter `expire_time` when calling `list_user_coupons`, must be a value less than or equal to `2147483647`") # noqa: E501
if self.api_client.client_side_validation and 'expire_time' in local_var_params and local_var_params['expire_time'] < 1: # noqa: E501
raise ApiValueError("Invalid value for parameter `expire_time` when calling `list_user_coupons`, must be a value greater than or equal to `1`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
if 'expired' in local_var_params and local_var_params['expired'] is not None: # noqa: E501
query_params.append(('expired', local_var_params['expired'])) # noqa: E501
if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
query_params.append(('limit', local_var_params['limit'])) # noqa: E501
if 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501
query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501
if 'expire_time' in local_var_params and local_var_params['expire_time'] is not None: # noqa: E501
query_params.append(('expire_time', local_var_params['expire_time'])) # noqa: E501
if 'order_by' in local_var_params and local_var_params['order_by'] is not None: # noqa: E501
query_params.append(('order_by', local_var_params['order_by'])) # noqa: E501
if 'type' in local_var_params and local_var_params['type'] is not None: # noqa: E501
query_params.append(('type', local_var_params['type'])) # noqa: E501
if 'is_task_coupon' in local_var_params and local_var_params['is_task_coupon'] is not None: # noqa: E501
query_params.append(('is_task_coupon', local_var_params['is_task_coupon'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['apiv4'] # noqa: E501
return self.api_client.call_api(
'/coupon/user-coupon-list', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='ListUserCouponsResponse', # noqa: E501
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)
def get_user_coupon_detail(self, coupon_type, detail_id, **kwargs): # noqa: E501
"""Coupon Center details # noqa: E501
## Interface description The general details interface of the card and coupon center returns the complete detailed information of a single card and coupon. Compared with the list interface, it additionally includes: usage rule text, block-based card and coupon detailed attributes (`extra`), and source completion task information (`from_task`). ## Query Parameters | Parameter name | Type | Required | Constraints | Description | | ---------------- | ------- | --- | --------------------- | ------------------------------------------------- | | `coupon_type` | string | Yes | See coupon type enumeration | Coupon type, the value is the same as `coupon-list` has the same interface | | `detail_id` | integer | Yes | min:1, max:2147483647 | Ordinary card and coupon transfer `details_id`; the `id` of the task card and coupon transfer record (i.e. the `id` field in the list) | | `is_task_coupon` | integer | no | `0` or `1`, default `0` | `0` = Ordinary coupons; `1` = mission coupons | > **Note**: The `detail_id` semantics of ordinary coupons and mission coupons are different. > > - Ordinary cards and coupons: `detail_id` = the primary key of each type of user card and coupon table (`details_id` in the list) > - Task coupon: `detail_id` = primary key of issuance record table (`id` in the list) --- ##Response ### Outer structure ```json { \"code\": 0, \"message\": \"\", \"data\": { ...card details object... } } ``` ### Details object fields The details interface returns the same basic fields as the list interface, with differences in the following fields: rule_new | Field name | Type | Difference from list | Description | | ------------------- | ------- | ----------------- | -------------------------------------------- | | `rule_new` | string | **Value** (the list returns an empty string) | Card and coupon usage rule text (i18n translation) | | `extra` | array | **Value** (list returns `[]`) | For the detailed attributes of the cards and coupons in the partitions, please see the description below | | `from_task` | boolean | **New field** | Ordinary coupons redeemed by completing tasks (sub-coupons automatically issued after the task is completed) | | `task_start_at` | integer | **May have value** | Task coupon: task start timestamp; ordinary coupon (`from_task=true`): start time of the source task | | `task_expire_at` | integer | **May have value** | Task coupons: receive the validity expiration timestamp (`0` means no limit); ordinary cards and coupons are fixed `0` | | `task_completed_at` | integer | **May have value** | Task coupon: task completion timestamp; ordinary coupon (`from_task=true`): completion time of the source task | The remaining basic fields (`id`, `details_id`, `coupon_type`, `name`, `amount`, `currency`, `status`, `jump_url`, `help_url`, `expire_time`, `expire_second`, `has_ progress`, `progress_config`, `activation_info`, `is_task_coupon`, `upgrade_toast`, `task_title`, `task_desc`) are exactly the same as the list interface (`listUserCoupons`). --- ## `extra` field description `extra` is a **two-dimensional array**, composed of several \"blocks\", and the front end displays them separately by blocks. ``` extra = [ [block1_item1, block1_item2, ...], // Block 1: Card name/source/status [block2_item1, block2_item2, ...], // Block 2: Core attributes of cards and coupons [block3_item1, block3_item2, ...], // Block 3: time information ] ``` ### The structure of each item in `extra` | Field | Type | Description | | ------- | ---------------- | --------------- | | `type` | string | Display type, enumeration values are shown in the table below | | `key` | string | Label text (i18n translated) | | `value` | string / integer | Value, type changes with `type` | ### `type` enumeration | `type` value | `value` type | description | | ----------- | ---------- | ------------------------ | | `string` | string | Normal text display | | `timestamp` | integer | Unix timestamp, the front end is responsible for formatting into date and time | | `day` | integer | Number of days (integer) | | `hour` | integer | Number of hours (integer) | | `status` | string | Status enum value (same meaning as `status` field) | | `btn` | string | With jump button, `value` is the button copy | --- ## Block 1 (fixed): Coupon name/source/status All types (except `point`) contain this block, the fixed fields are as follows: | Serial number | `type` | `key` (translation key) | `value` | Remarks | | --- | -------- | ----------------------------- | ------- | --------- | | 1 | `string` | `COUPON_VOUCHER_NAME` (coupon name) | Coupon name text | Required | | 2 | `string` | `COUPON_VOUCHER_SOURCE` (coupon source) | Source activity name | Return this item only if there is a source | | 3 | `status` | `COUPON_STATUS` (coupon status) | Status enumeration value | Required | > `extra` of type `point` (point card) is fixed to an empty array `[]`. --- ## Block 2 + Block 3: Exclusive fields for each type ### `contract_bonus` (contract experience bonus) **Block 2: Core Attributes** | `type` | `key` | `value` Description | | -------- | ----------------------------- | -------------- | | `string` | `COUPON_VOUCHER_AMOUNT` (voucher amount) | `amount + space + currency` | **Block 3: Time Information** | `type` | `key` | `value` description | condition | | ----------- | --------------------------------- | ---------- | ----- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_ACTIVATION_PERIOD` (activation validity period) | Activation expiration timestamp | Required | | `day` | `COUPON_USAGE_DURATION` (duration of use) | Number of days valid after activation | Required | | `timestamp` | `COUPON_ACTIVATION_TIME` (activation time) | activation timestamp | only if activated | --- ### `contract_bonus_new` (contract experience coupon) **Block 2: Core Attributes** | `type` | `key` | `value` Description | Conditions | | -------- | ------------------------------------ | ------------------ | ------- | | `string` | `COUPON_VOUCHER_AMOUNT` (voucher amount) | `amount + space + currency` | Required | | `string` | `COUPON_MAXIMUM_LEVERAGE` (maximum leverage) | `NX` or `Unlimited` | Required | | `string` | `COUPON_LIMITED_TRADING_PAIR` (limited trading pair) | Trading pair list | When there are limited trading pairs | **Block 3: Time Information** | `type` | `key` | `value` description | condition | | ----------- | --------------------------------- | ---------- | ---- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_ACTIVATION_PERIOD` (activation validity period) | Activation expiration timestamp | Required | | `hour` | `COUPON_USAGE_DURATION` (duration of use) | Number of hours valid after activation | Required | | `timestamp` | `COUPON_ACTIVATION_TIME` (activation time) | Activation timestamp | When activated | --- ### `commission_rebate` (handling fee cashback coupon) **Block 2: Core Attributes** | `type` | `key` | `value` description | condition | | -------- | -------------------------------- | -------------- | --- | | `string` | `COUPON_VOUCHER_AMOUNT` (voucher amount) | `amount + space + currency` | Required | | `string` | `COUPON_REBATE_PERCENTAGE` (cashback ratio) | `N%` | Required | | `string` | `COUPON_BALANCE` (remaining balance) | `amount + space + currency` | Required | | `string` | `COUPON_USED_AMOUNT` (used amount) | `Amount + space + currency` | Required | | `string` | `COUPON_APPLICABLE_MARKET` (applicable market) | Market name | Required | **Block 3: Time Information** | `type` | `key` | `value` Description | Conditions | | ----------- | --------------------------------- | ---------- | --------------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_ACTIVATION_PERIOD` (activation validity period) | Activation expiration timestamp | Vouchers that require activation are displayed | | `day` | `COUPON_USAGE_DURATION` (duration of use) | Number of days valid after activation | Required | | `timestamp` | `COUPON_ACTIVATION_TIME` (activation time) | Activation timestamp | When the status is activated/used/expired | --- ### `hold_bonus` (Financial Management Experience Bonus) **Block 2: Core Attributes** | `type` | `key` | `value` Description | | -------- | ----------------------------- | -------------- | | `string` | `COUPON_VOUCHER_AMOUNT` (voucher amount) | `amount + space + currency` | **Block 3: Time information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | Use timestamp | When the status is used | --- ### `financial_rate` (interest rate coupon) **Block 2: Core Attributes** | `type` | `key` | `value` Description | Conditions | | -------- | ------------------------------------------ | ----------------------- | --- | | `string` | `COUPON_RATE_UP_CAP` (rate increase cap) | `amount + currency` or `Unlimited` | Required | | `string` | `COUPON_RATE_UP_APR` (rate increase ratio) | `N%APR` | Required | | `string` | `COUPON_RATE_UP_TERM_DAYS` (number of days to increase interest rate) | `N days` or `Unlimited` | Required | | `string` | `COUPON_AVAILABLE_INVESTMENT_TYPE` (available financial management type) | Such as `Lend & Earn` | required | | `string` | `COUPON_AVAILABLE_PRODUCTS` (available products) | List of product names (comma separated) | Required | | `string` | `COUPON_MINIMUM_INVESTMENT_UP` (minimum purchase amount) | `≥ Amount Currency` or interval | required | **Block 3: Time Information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | Use timestamp | When the status is used | --- ### `robot_bonus` (robot experience bonus) **Block 2: Core Attributes** | `type` | `key` | `value` Description | Conditions | | -------- | ------------------------------------ | ------------------------ | ---------- | | `string` | `COUPON_VOUCHER_AMOUNT` (coupon amount) | `amount + space + Currency` | Required | | `string` | `COUPON_APPLICABLE_BOTS` (for robots) | such as `Future Grids` | Unlimited robot time | | `string` | `COUPON_MAXIMUM_LEVERAGE` (maximum leverage multiple) | Multiples | Unlimited and with leverage restrictions | | `string` | `COUPON_LIMITED_TRADING_PAIR` (limited trading pair) | Trading pair or `All` | When not limited to robots | | `string` | `COUPON_STOP_LOSS_AMOUNT` (stop loss amount) | `Amount + Currency` | When there is a stop loss amount | | `btn` | `COUPON_DESIGNATED_BOTS` (limited to bots) | `ViewMyaccountLeft` Button copy | When limited to robots | | `day` | `COUPON_RUNTIME_DURATION` (running duration) | Number of days | required | **Block 3: Time Information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | Use timestamp | When the status is used | --- ### `loss_protection_copier` (worry-free money for following orders) **Block 2: Core Attributes** | `type` | `key` | `value` Description | Conditions | | -------- | ----------------------------------- | ------------------- | ------------ | | `string` | `COUPON_VOUCHER_AMOUNT` (voucher amount) | `amount + space + currency` | Required | | `string` | `COUPON_APPLICABLE_MARKET` (where applicable) | `Contract` or `Spot` | Required | | `string` | `COUPON_MINIMUM_INVESTMENT` (minimum order amount) | `amount + currency` | When there is a minimum amount limit | | `string` | `COUPON_AVAILABLE_TRADERS` (available traders) | Nickname list | When Partially Available (Designated Trader) | **Block 3: Time Information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------ | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | use timestamp | when there is use time | --- ### `position_voucher` (position experience coupon) **Block 2: Core Attributes** | `type` | `key` | `value` Description | Conditions | | -------- | ------------------------------------ | ----------------- | ------- | | `string` | `COUPON_VOUCHER_AMOUNT` (coupon amount) | `Amount × Leverage + Space + Currency` | Required | | `string` | `COUPON_APPLICABLE_MARKET` (applicable market) | `USDT Perpetual Contract` | Required | | `hour` | `COUPON_POSITION_DURATION` (position duration) | Number of hours | Required | | `string` | `COUPON_LEVERAGE` (leverage multiple) | `NX` | Required | | `string` | `COUPON_LIMITED_TRADING_PAIR` (limited trading pair) | Trading pair, empty means no limit | Required | | `string` | `COUPON_USER_INVESTMENT_QUOTA` (capital quota) | `amount + currency` | When user allocation is required | **Block 3: Time Information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | Use timestamp | When the status is used | --- ### `tradfi_position_voucher` (TradFi position experience coupon) **Block 2: Core Attributes** | `type` | `key` | `value` Description | | -------- | ------------------------------------ | ----------------- | | `string` | `COUPON_VOUCHER_AMOUNT` (coupon amount) | `Amount × Leverage + Space + Currency` | | `string` | `COUPON_POSITION_DURATION` (position duration) | `N trading days` | | `string` | `COUPON_LIMITED_TRADING_PAIR` (limited trading pair) | TradFi varieties | | `string` | `COUPON_LEVERAGE` (leverage multiple) | `Nx` | **Block 3: Time Information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | Use timestamp | When the status is used | --- ### `vip_card` (VIP experience card) **Block 2: Core Attributes** | `type` | `key` | `value` Description | | -------- | ------------------------------- | ---------- | | `string` | `COUPON_VIP_TIER` (VIP level) | `VIPN` | | `day` | `COUPON_BENEFIT_DURATION` (benefits duration) | Number of days | **Block 3: Time information** | `type` | `key` | `value` Description | Conditions | | ----------- | --------------------------------- | ---------- | ----------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Create timestamp | Required | | `timestamp` | `COUPON_ACTIVATION_PERIOD` (activation validity period) | Activation expiration timestamp | Required | | `timestamp` | `COUPON_ACTIVATION_TIME` (activation time) | Activation timestamp | When the status is used or expired | | `timestamp` | `COUPON_EXPIRY_TIME` (expiration time) | Expiration timestamp | When the status is used or expired | --- ### `p2p` (P2P transaction discount coupon) **Block 2: Core Attributes** | `type` | `key` | `value` Description | | -------- | ------------------------------- | -------------- | | `string` | `COUPON_DEDUCTION_LIMIT` (deduction limit) | `amount + currency` | | `string` | `COUPON_DEDUCTION_RATIO` (discount ratio) | `N%` | | `string` | `COUPON_USAGE_CONDITIONS` (conditions of use) | `No less than N currencies per transaction` | | `string` | `COUPON_SUPPORTED_FIAT` (for fiat currencies) | Fiat currency list or `all` | **Block 3: Time information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | Use timestamp | When the status is used | --- ### `interest_voucher` (leverage coupon) **Block 2: Core Attributes** | `type` | `key` | `value` Description | Conditions | | -------- | --------------------------------------- | ----------------- | -------- | | `string` | `max_discount_amount` (maximum discount amount) | `amount + currency` | Required | | `string` | `COUPON_APPLICABLE_TRADES` (applicable transactions) | `Isolated Margin` | Required | | `string` | `COUPON_INTEREST_DISCOUNT` (reduction ratio) | `N%` | Required | | `string` | `COUPON_LIMITED_TRADING_PAIR` (limited trading pair) | Trading pair, empty means no limit | Required | | `string` | `COUPON_BALANCE` (remaining balance) | `amount + currency` | Required | | `string` | `COUPON_BORROWING_AMOUNT_LIMIT` (borrowing amount limit) | Borrowing amount range | When there is a limit on the borrowing amount | | `hour` | `COUPON_VALIDITY_PERIOD` (reduction time) | Number of hours | When set | **Block 3: Time Information** | `type` | `key` | `value` Description | Conditions | | ----------- | ------------------------------------- | ---------- | -------------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | When the status is pending or expired | | `timestamp` | `COUPON_EFFECTIVE_TIME` (reduction start time) | Start using timestamp | When the status is invalid/in use/used | | `timestamp` | `COUPON_DISCOUNT_EXPIRY_TIME` (reduction expiry time) | Reduction expiration timestamp | When the status is invalid/in use/used | --- ### `cash` (cash coupon) **Block 2: Core Attributes** | `type` | `key` | `value` Description | | -------- | ----------------------------- | ---------- | | `string` | `COUPON_VOUCHER_AMOUNT` (voucher amount) | `amount + currency` | **Block 3: Time Information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------ | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | Use timestamp | When there is a redemption time | --- ### `crypto_loan_interest` (Mortgage loan interest coupon) **Block 2: Core Attributes** | `type` | `key` | `value` Description | Conditions | | -------- | ---------------------------------------------- | ---------- | -------- | | `string` | `coupon_center_discount_max_amount` (maximum discount amount) | `amount + currency` | Required | | `string` | `COUPON_INTEREST_DISCOUNT` (reduction ratio) | `N%` | Required | | `string` | `coupon_center_loan_min_amount` (minimum loan amount) | `amount + currency` | When there is a minimum amount requirement | | `hour` | `coupon_center_interest_discount_period` (discount duration) | Number of hours | Required | | `string` | `coupon_center_trade_applicable` (applicable transactions) | `demand deposit` | Required | **Block 3: Time information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | Use timestamp | When the status is used | --- ### `copy_trading` (Following experience bonus) **Block 2: Core Attributes** | `type` | `key` | `value` Description | Conditions | | -------- | ---------------------------------- | ------------------- | ---- | | `string` | `COUPON_VOUCHER_AMOUNT` (face value) | `amount + currency` | Required | | `string` | `coupon_applicable_traders` (applicable traders) | `all` or `specified traders` | Required | | `string` | `coupon_trade_category` (applicable transaction type) | `Spot` or `Contract` | Required | | `day` | `coupon_usage_days` (the number of days the experience is valid) | Number of days | Required | | `string` | `COUPON_STOP_LOSS_AMOUNT` (stop loss amount) | `amount + currency` | Required | | `string` | `coupon_ineligible_mkts` (cannot experience the market) | Market list | When there are restrictions | **Block 3: Time Information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | Use timestamp | When the status is used | --- ### `alpha_voucher` (Alpha cash coupon) **Block 2: Core Attributes** | `type` | `key` | `value` Description | | -------- | ----------------------------- | ---------- | | `string` | `COUPON_VOUCHER_AMOUNT` (voucher amount) | `amount + currency` | **Block 3: Time Information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------ | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | Use timestamp | When there is a collection time | --- ### `etf_voucher` (ETF trial bonus) **Block 2: Core Attributes** | `type` | `key` | `value` Description | | -------- | ------------------------------------ | ---------- | | `string` | `COUPON_VOUCHER_AMOUNT` (voucher amount) | `amount + currency` | | `hour` | `coupon_trial_duration` (trial duration) | Number of hours | | `string` | `COUPON_LIMITED_TRADING_PAIR` (limited trading pair) | ETF market list | **Block 3: Time information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------ | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | use timestamp | when there is use time | --- ### `point` (point card) `extra` always returns `[]` without any blocks. --- ## Complete response example ### Ordinary cards and coupons (handling fee cashback coupons) ```json { \"code\": 0, \"message\": \"\", \"data\": { \"id\": 1234567, \"details_id\": 890, \"coupon_type\": \"commission_rebate\", \"name\": \"10% Futures Commission Rebate\", \"amount\": \"100\", \"currency\": \"USDT\", \"rule_new\": \"Rebate up to 100% of futures trading fee within 30 days.\", \"status\": \"TO_BE_USED\", \"jump_url\": { \"web\": \"/futures/USDT\", \"app\": \"/futures/USDT\", \"mini_app\": \"\" }, \"help_url\": { \"web\": \"\", \"app\": \"\" }, \"expire_time\": 1760000000, \"expire_time_order_by\": 1760000000, \"expire_second\": 86400, \"has_usage_history\": false, \"has_progress\": true, \"progress_config\": { \"total_balance\": \"100\", \"current_used\": \"30\", \"current_achived\": \"30\", \"currency\": \"USDT\" }, \"activation_info\": { \"market\": \"futures\", \"market_name\": \"Futures\" }, \"is_task_coupon\": 0, \"upgrade_toast\": false, \"from_task\": false, \"task_title\": \"\", \"task_desc\": \"\", \"task_start_at\": 0, \"task_expire_at\": 0, \"task_completed_at\": 0, \"extra\": [ [ { \"type\": \"string\", \"key\": \"Coupon name\", \"value\": \"10% Futures Commission Rebate\" }, { \"type\": \"string\", \"key\": \"Card and coupon source\", \"value\": \"New user registration activity\" }, { \"type\": \"status\", \"key\": \"Card and coupon status\", \"value\": \"TO_BE_USED\" } ], [ { \"type\": \"string\", \"key\": \"Card coupon amount\", \"value\": \"100 USDT\" }, { \"type\": \"string\", \"key\": \"Cashback ratio\", \"value\": \"10%\" }, { \"type\": \"string\", \"key\": \"Remaining Amount\", \"value\": \"100 USDT\" }, { \"type\": \"string\", \"key\": \"Used quota\", \"value\": \"0 USDT\" }, { \"type\": \"string\", \"key\": \"Applicable markets\", \"value\": \"Futures\" } ], [ { \"type\": \"timestamp\", \"key\": \"Get time\", \"value\": 1757000000 }, { \"type\": \"day\", \"key\": \"duration\", \"value\": 30 } ] ] } } ``` ### Task coupons (position experience coupons) ```json { \"code\": 0, \"message\": \"\", \"data\": { \"id\": 9876543, \"details_id\": 0, \"coupon_type\": \"position_voucher\", \"name\": \"position experience coupon\", \"amount\": \"5,000\", \"currency\": \"USDT\", \"rule_new\": \"Experience the position coupon rules...\", \"status\": \"TASK_WAIT\", \"jump_url\": { \"web\": \"https://www.gate.io/futures\", \"app\": \"gateio://futures\", \"mini_app\": \"\" }, \"help_url\": { \"web\": \"\", \"app\": \"\" }, \"expire_time\": 1760000000, \"expire_time_order_by\": 1760000000, \"expire_second\": 172800, \"has_usage_history\": false, \"has_progress\": true, \"progress_config\": { \"total_balance\": \"10000\", \"current_used\": \"3000\", \"current_achived\": \"3000\", \"currency\": \"USDT\" }, \"activation_info\": { \"symbols\": \"BTC_USDT\", \"leverage\": \"10\", \"need_user_funds\": 0, \"user_funds_amount\": \"\", \"position_bonus\": \"500\" }, \"is_task_coupon\": 1, \"upgrade_toast\": false, \"from_task\": false, \"task_title\": \"Complete 10,000 USDT contract trading volume and obtain position experience coupon\", \"task_desc\": \"Complete the specified trading volume task in the perpetual contract\", \"task_start_at\": 1757000000, \"task_expire_at\": 1760000000, \"task_completed_at\": 0, \"extra\": [ [ { \"type\": \"string\", \"key\": \"Card name\", \"value\": \"position experience coupon\" }, { \"type\": \"status\", \"key\": \"Card and coupon status\", \"value\": \"TASK_WAIT\" } ], [ { \"type\": \"string\", \"key\": \"Coupon amount\", \"value\": \"5,000 USDT\" }, { \"type\": \"string\", \"key\": \"Applicable market\", \"value\": \"USDT perpetual contract\" }, { \"type\": \"hour\", \"key\": \"position duration\", \"value\": 24 }, { \"type\": \"string\", \"key\": \"Leverage multiple\", \"value\": \"10X\" }, { \"type\": \"string\", \"key\": \"Limited trading pairs\", \"value\": \"BTCUSDT\" } ], [ { \"type\": \"timestamp\", \"key\": \"Get time\", \"value\": 1757000000 } ] ] } } ``` ### P2P transaction coupon (p2p) ```json { \"code\": 0, \"message\": \"\", \"data\": { \"id\": 5678901, \"details_id\": 234, \"coupon_type\": \"p2p\", \"name\": \"5.5% P2P transaction discount coupon\", \"amount\": \"100\", \"currency\": \"USDT\", \"rule_new\": \"Each P2P transaction can deduct up to 100 USDT in handling fees, with a discount rate of 5.5%, and each transaction is not less than 200 USDT.\", \"status\": \"TO_BE_USED\", \"jump_url\": { \"web\": \"/p2p\", \"app\": \"gateio://p2p\", \"mini_app\": \"\" }, \"help_url\": { \"web\": \"\", \"app\": \"\" }, \"expire_time\": 1760000000, \"expire_time_order_by\": 1760000000, \"expire_second\": 2592000, \"has_usage_history\": false, \"has_progress\": false, \"progress_config\": { \"total_balance\": \"\", \"current_used\": \"\", \"current_achived\": \"\", \"currency\": \"\" }, \"activation_info\": {}, \"is_task_coupon\": 0, \"upgrade_toast\": false, \"from_task\": false, \"task_title\": \"\", \"task_desc\": \"\", \"task_start_at\": 0, \"task_expire_at\": 0, \"task_completed_at\": 0, \"extra\": [ [ { \"type\": \"string\", \"key\": \"Coupon name\", \"value\": \"5.5% P2P transaction discount coupon\" }, { \"type\": \"string\", \"key\": \"Card and coupon source\", \"value\": \"New user registration activity\" }, { \"type\": \"status\", \"key\": \"Card and coupon status\", \"value\": \"TO_BE_USED\" } ], [ { \"type\": \"string\", \"key\": \"deduction limit\", \"value\": \"100 USDT\" }, { \"type\": \"string\", \"key\": \"Discount ratio\", \"value\": \"5.5%\" }, { \"type\": \"string\", \"key\": \"Usage conditions\", \"value\": \"Each transaction must not be less than 200 USDT\" }, { \"type\": \"string\", \"key\": \"Applicable legal currency\", \"value\": \"CNY, USD\" } ], [ { \"type\": \"timestamp\", \"key\": \"Get time\", \"value\": 1757000000 }, { \"type\": \"timestamp\", \"key\": \"expiration time\", \"value\": 1760000000 } ] ] } } ``` --- ## Error code | `code` | Description | | -------------------------------------------- | ------------------------- | | `0` | Success | | `10001`(`COUPON_SEND_ISSUING_LOG_NOT_FOUND`) | The card and coupon record does not exist or does not belong to the current user | | `10000` (`PARAMS_INVALID`) | The parameter is invalid (such as the task card is missing coupon_info) | | `50105` (`INVALID_PARAMETERS`) | Input parameter verification failed (such as coupon_type illegal) | # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_user_coupon_detail(coupon_type, detail_id, async_req=True)
>>> result = thread.get()
:param bool async_req: execute request asynchronously
:param str coupon_type: Coupon type enum. If not specified, all supported types are returned. Available values: `position_voucher` (position voucher), `tradfi_position_voucher` (TradFi position voucher), `contract_bonus` (futures bonus), `contract_bonus_new` (futures trial coupon), `commission_rebate` (commission rebate coupon), `hold_bonus` (earn trial bonus), `point` (point card), `financial_rate` (interest rate boost coupon), `robot_bonus` (trading bot bonus), `loss_protection_copier` (copy trading loss protection), `vip_card` (VIP trial card), `interest_voucher` (margin interest discount coupon), `p2p` (P2P trading deduction coupon), `cash` (cash coupon), `crypto_loan_interest` (crypto loan interest discount coupon), `copy_trading` (copy trading bonus), `alpha_voucher` (Alpha cash coupon), `etf_voucher` (ETF trial bonus) (required)
:param int detail_id: Coupon ID. **Regular coupon**: pass `details_id` from the list (primary key of each type's user coupon table); **Task coupon**: pass `id` from the list (primary key of the distribution record table) (required)
:param int is_task_coupon: Coupon source type. `0` = regular coupon (default); `1` = task coupon. This parameter determines the query logic for `detail_id`
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:rtype: gate_api.GetUserCouponDetailResponse
:return: If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
return self.get_user_coupon_detail_with_http_info(coupon_type, detail_id, **kwargs) # noqa: E501
def get_user_coupon_detail_with_http_info(self, coupon_type, detail_id, **kwargs): # noqa: E501
"""Coupon Center details # noqa: E501
## Interface description The general details interface of the card and coupon center returns the complete detailed information of a single card and coupon. Compared with the list interface, it additionally includes: usage rule text, block-based card and coupon detailed attributes (`extra`), and source completion task information (`from_task`). ## Query Parameters | Parameter name | Type | Required | Constraints | Description | | ---------------- | ------- | --- | --------------------- | ------------------------------------------------- | | `coupon_type` | string | Yes | See coupon type enumeration | Coupon type, the value is the same as `coupon-list` has the same interface | | `detail_id` | integer | Yes | min:1, max:2147483647 | Ordinary card and coupon transfer `details_id`; the `id` of the task card and coupon transfer record (i.e. the `id` field in the list) | | `is_task_coupon` | integer | no | `0` or `1`, default `0` | `0` = Ordinary coupons; `1` = mission coupons | > **Note**: The `detail_id` semantics of ordinary coupons and mission coupons are different. > > - Ordinary cards and coupons: `detail_id` = the primary key of each type of user card and coupon table (`details_id` in the list) > - Task coupon: `detail_id` = primary key of issuance record table (`id` in the list) --- ##Response ### Outer structure ```json { \"code\": 0, \"message\": \"\", \"data\": { ...card details object... } } ``` ### Details object fields The details interface returns the same basic fields as the list interface, with differences in the following fields: rule_new | Field name | Type | Difference from list | Description | | ------------------- | ------- | ----------------- | -------------------------------------------- | | `rule_new` | string | **Value** (the list returns an empty string) | Card and coupon usage rule text (i18n translation) | | `extra` | array | **Value** (list returns `[]`) | For the detailed attributes of the cards and coupons in the partitions, please see the description below | | `from_task` | boolean | **New field** | Ordinary coupons redeemed by completing tasks (sub-coupons automatically issued after the task is completed) | | `task_start_at` | integer | **May have value** | Task coupon: task start timestamp; ordinary coupon (`from_task=true`): start time of the source task | | `task_expire_at` | integer | **May have value** | Task coupons: receive the validity expiration timestamp (`0` means no limit); ordinary cards and coupons are fixed `0` | | `task_completed_at` | integer | **May have value** | Task coupon: task completion timestamp; ordinary coupon (`from_task=true`): completion time of the source task | The remaining basic fields (`id`, `details_id`, `coupon_type`, `name`, `amount`, `currency`, `status`, `jump_url`, `help_url`, `expire_time`, `expire_second`, `has_ progress`, `progress_config`, `activation_info`, `is_task_coupon`, `upgrade_toast`, `task_title`, `task_desc`) are exactly the same as the list interface (`listUserCoupons`). --- ## `extra` field description `extra` is a **two-dimensional array**, composed of several \"blocks\", and the front end displays them separately by blocks. ``` extra = [ [block1_item1, block1_item2, ...], // Block 1: Card name/source/status [block2_item1, block2_item2, ...], // Block 2: Core attributes of cards and coupons [block3_item1, block3_item2, ...], // Block 3: time information ] ``` ### The structure of each item in `extra` | Field | Type | Description | | ------- | ---------------- | --------------- | | `type` | string | Display type, enumeration values are shown in the table below | | `key` | string | Label text (i18n translated) | | `value` | string / integer | Value, type changes with `type` | ### `type` enumeration | `type` value | `value` type | description | | ----------- | ---------- | ------------------------ | | `string` | string | Normal text display | | `timestamp` | integer | Unix timestamp, the front end is responsible for formatting into date and time | | `day` | integer | Number of days (integer) | | `hour` | integer | Number of hours (integer) | | `status` | string | Status enum value (same meaning as `status` field) | | `btn` | string | With jump button, `value` is the button copy | --- ## Block 1 (fixed): Coupon name/source/status All types (except `point`) contain this block, the fixed fields are as follows: | Serial number | `type` | `key` (translation key) | `value` | Remarks | | --- | -------- | ----------------------------- | ------- | --------- | | 1 | `string` | `COUPON_VOUCHER_NAME` (coupon name) | Coupon name text | Required | | 2 | `string` | `COUPON_VOUCHER_SOURCE` (coupon source) | Source activity name | Return this item only if there is a source | | 3 | `status` | `COUPON_STATUS` (coupon status) | Status enumeration value | Required | > `extra` of type `point` (point card) is fixed to an empty array `[]`. --- ## Block 2 + Block 3: Exclusive fields for each type ### `contract_bonus` (contract experience bonus) **Block 2: Core Attributes** | `type` | `key` | `value` Description | | -------- | ----------------------------- | -------------- | | `string` | `COUPON_VOUCHER_AMOUNT` (voucher amount) | `amount + space + currency` | **Block 3: Time Information** | `type` | `key` | `value` description | condition | | ----------- | --------------------------------- | ---------- | ----- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_ACTIVATION_PERIOD` (activation validity period) | Activation expiration timestamp | Required | | `day` | `COUPON_USAGE_DURATION` (duration of use) | Number of days valid after activation | Required | | `timestamp` | `COUPON_ACTIVATION_TIME` (activation time) | activation timestamp | only if activated | --- ### `contract_bonus_new` (contract experience coupon) **Block 2: Core Attributes** | `type` | `key` | `value` Description | Conditions | | -------- | ------------------------------------ | ------------------ | ------- | | `string` | `COUPON_VOUCHER_AMOUNT` (voucher amount) | `amount + space + currency` | Required | | `string` | `COUPON_MAXIMUM_LEVERAGE` (maximum leverage) | `NX` or `Unlimited` | Required | | `string` | `COUPON_LIMITED_TRADING_PAIR` (limited trading pair) | Trading pair list | When there are limited trading pairs | **Block 3: Time Information** | `type` | `key` | `value` description | condition | | ----------- | --------------------------------- | ---------- | ---- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_ACTIVATION_PERIOD` (activation validity period) | Activation expiration timestamp | Required | | `hour` | `COUPON_USAGE_DURATION` (duration of use) | Number of hours valid after activation | Required | | `timestamp` | `COUPON_ACTIVATION_TIME` (activation time) | Activation timestamp | When activated | --- ### `commission_rebate` (handling fee cashback coupon) **Block 2: Core Attributes** | `type` | `key` | `value` description | condition | | -------- | -------------------------------- | -------------- | --- | | `string` | `COUPON_VOUCHER_AMOUNT` (voucher amount) | `amount + space + currency` | Required | | `string` | `COUPON_REBATE_PERCENTAGE` (cashback ratio) | `N%` | Required | | `string` | `COUPON_BALANCE` (remaining balance) | `amount + space + currency` | Required | | `string` | `COUPON_USED_AMOUNT` (used amount) | `Amount + space + currency` | Required | | `string` | `COUPON_APPLICABLE_MARKET` (applicable market) | Market name | Required | **Block 3: Time Information** | `type` | `key` | `value` Description | Conditions | | ----------- | --------------------------------- | ---------- | --------------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_ACTIVATION_PERIOD` (activation validity period) | Activation expiration timestamp | Vouchers that require activation are displayed | | `day` | `COUPON_USAGE_DURATION` (duration of use) | Number of days valid after activation | Required | | `timestamp` | `COUPON_ACTIVATION_TIME` (activation time) | Activation timestamp | When the status is activated/used/expired | --- ### `hold_bonus` (Financial Management Experience Bonus) **Block 2: Core Attributes** | `type` | `key` | `value` Description | | -------- | ----------------------------- | -------------- | | `string` | `COUPON_VOUCHER_AMOUNT` (voucher amount) | `amount + space + currency` | **Block 3: Time information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | Use timestamp | When the status is used | --- ### `financial_rate` (interest rate coupon) **Block 2: Core Attributes** | `type` | `key` | `value` Description | Conditions | | -------- | ------------------------------------------ | ----------------------- | --- | | `string` | `COUPON_RATE_UP_CAP` (rate increase cap) | `amount + currency` or `Unlimited` | Required | | `string` | `COUPON_RATE_UP_APR` (rate increase ratio) | `N%APR` | Required | | `string` | `COUPON_RATE_UP_TERM_DAYS` (number of days to increase interest rate) | `N days` or `Unlimited` | Required | | `string` | `COUPON_AVAILABLE_INVESTMENT_TYPE` (available financial management type) | Such as `Lend & Earn` | required | | `string` | `COUPON_AVAILABLE_PRODUCTS` (available products) | List of product names (comma separated) | Required | | `string` | `COUPON_MINIMUM_INVESTMENT_UP` (minimum purchase amount) | `≥ Amount Currency` or interval | required | **Block 3: Time Information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | Use timestamp | When the status is used | --- ### `robot_bonus` (robot experience bonus) **Block 2: Core Attributes** | `type` | `key` | `value` Description | Conditions | | -------- | ------------------------------------ | ------------------------ | ---------- | | `string` | `COUPON_VOUCHER_AMOUNT` (coupon amount) | `amount + space + Currency` | Required | | `string` | `COUPON_APPLICABLE_BOTS` (for robots) | such as `Future Grids` | Unlimited robot time | | `string` | `COUPON_MAXIMUM_LEVERAGE` (maximum leverage multiple) | Multiples | Unlimited and with leverage restrictions | | `string` | `COUPON_LIMITED_TRADING_PAIR` (limited trading pair) | Trading pair or `All` | When not limited to robots | | `string` | `COUPON_STOP_LOSS_AMOUNT` (stop loss amount) | `Amount + Currency` | When there is a stop loss amount | | `btn` | `COUPON_DESIGNATED_BOTS` (limited to bots) | `ViewMyaccountLeft` Button copy | When limited to robots | | `day` | `COUPON_RUNTIME_DURATION` (running duration) | Number of days | required | **Block 3: Time Information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | Use timestamp | When the status is used | --- ### `loss_protection_copier` (worry-free money for following orders) **Block 2: Core Attributes** | `type` | `key` | `value` Description | Conditions | | -------- | ----------------------------------- | ------------------- | ------------ | | `string` | `COUPON_VOUCHER_AMOUNT` (voucher amount) | `amount + space + currency` | Required | | `string` | `COUPON_APPLICABLE_MARKET` (where applicable) | `Contract` or `Spot` | Required | | `string` | `COUPON_MINIMUM_INVESTMENT` (minimum order amount) | `amount + currency` | When there is a minimum amount limit | | `string` | `COUPON_AVAILABLE_TRADERS` (available traders) | Nickname list | When Partially Available (Designated Trader) | **Block 3: Time Information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------ | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | use timestamp | when there is use time | --- ### `position_voucher` (position experience coupon) **Block 2: Core Attributes** | `type` | `key` | `value` Description | Conditions | | -------- | ------------------------------------ | ----------------- | ------- | | `string` | `COUPON_VOUCHER_AMOUNT` (coupon amount) | `Amount × Leverage + Space + Currency` | Required | | `string` | `COUPON_APPLICABLE_MARKET` (applicable market) | `USDT Perpetual Contract` | Required | | `hour` | `COUPON_POSITION_DURATION` (position duration) | Number of hours | Required | | `string` | `COUPON_LEVERAGE` (leverage multiple) | `NX` | Required | | `string` | `COUPON_LIMITED_TRADING_PAIR` (limited trading pair) | Trading pair, empty means no limit | Required | | `string` | `COUPON_USER_INVESTMENT_QUOTA` (capital quota) | `amount + currency` | When user allocation is required | **Block 3: Time Information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | Use timestamp | When the status is used | --- ### `tradfi_position_voucher` (TradFi position experience coupon) **Block 2: Core Attributes** | `type` | `key` | `value` Description | | -------- | ------------------------------------ | ----------------- | | `string` | `COUPON_VOUCHER_AMOUNT` (coupon amount) | `Amount × Leverage + Space + Currency` | | `string` | `COUPON_POSITION_DURATION` (position duration) | `N trading days` | | `string` | `COUPON_LIMITED_TRADING_PAIR` (limited trading pair) | TradFi varieties | | `string` | `COUPON_LEVERAGE` (leverage multiple) | `Nx` | **Block 3: Time Information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | Use timestamp | When the status is used | --- ### `vip_card` (VIP experience card) **Block 2: Core Attributes** | `type` | `key` | `value` Description | | -------- | ------------------------------- | ---------- | | `string` | `COUPON_VIP_TIER` (VIP level) | `VIPN` | | `day` | `COUPON_BENEFIT_DURATION` (benefits duration) | Number of days | **Block 3: Time information** | `type` | `key` | `value` Description | Conditions | | ----------- | --------------------------------- | ---------- | ----------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Create timestamp | Required | | `timestamp` | `COUPON_ACTIVATION_PERIOD` (activation validity period) | Activation expiration timestamp | Required | | `timestamp` | `COUPON_ACTIVATION_TIME` (activation time) | Activation timestamp | When the status is used or expired | | `timestamp` | `COUPON_EXPIRY_TIME` (expiration time) | Expiration timestamp | When the status is used or expired | --- ### `p2p` (P2P transaction discount coupon) **Block 2: Core Attributes** | `type` | `key` | `value` Description | | -------- | ------------------------------- | -------------- | | `string` | `COUPON_DEDUCTION_LIMIT` (deduction limit) | `amount + currency` | | `string` | `COUPON_DEDUCTION_RATIO` (discount ratio) | `N%` | | `string` | `COUPON_USAGE_CONDITIONS` (conditions of use) | `No less than N currencies per transaction` | | `string` | `COUPON_SUPPORTED_FIAT` (for fiat currencies) | Fiat currency list or `all` | **Block 3: Time information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | Use timestamp | When the status is used | --- ### `interest_voucher` (leverage coupon) **Block 2: Core Attributes** | `type` | `key` | `value` Description | Conditions | | -------- | --------------------------------------- | ----------------- | -------- | | `string` | `max_discount_amount` (maximum discount amount) | `amount + currency` | Required | | `string` | `COUPON_APPLICABLE_TRADES` (applicable transactions) | `Isolated Margin` | Required | | `string` | `COUPON_INTEREST_DISCOUNT` (reduction ratio) | `N%` | Required | | `string` | `COUPON_LIMITED_TRADING_PAIR` (limited trading pair) | Trading pair, empty means no limit | Required | | `string` | `COUPON_BALANCE` (remaining balance) | `amount + currency` | Required | | `string` | `COUPON_BORROWING_AMOUNT_LIMIT` (borrowing amount limit) | Borrowing amount range | When there is a limit on the borrowing amount | | `hour` | `COUPON_VALIDITY_PERIOD` (reduction time) | Number of hours | When set | **Block 3: Time Information** | `type` | `key` | `value` Description | Conditions | | ----------- | ------------------------------------- | ---------- | -------------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | When the status is pending or expired | | `timestamp` | `COUPON_EFFECTIVE_TIME` (reduction start time) | Start using timestamp | When the status is invalid/in use/used | | `timestamp` | `COUPON_DISCOUNT_EXPIRY_TIME` (reduction expiry time) | Reduction expiration timestamp | When the status is invalid/in use/used | --- ### `cash` (cash coupon) **Block 2: Core Attributes** | `type` | `key` | `value` Description | | -------- | ----------------------------- | ---------- | | `string` | `COUPON_VOUCHER_AMOUNT` (voucher amount) | `amount + currency` | **Block 3: Time Information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------ | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | Use timestamp | When there is a redemption time | --- ### `crypto_loan_interest` (Mortgage loan interest coupon) **Block 2: Core Attributes** | `type` | `key` | `value` Description | Conditions | | -------- | ---------------------------------------------- | ---------- | -------- | | `string` | `coupon_center_discount_max_amount` (maximum discount amount) | `amount + currency` | Required | | `string` | `COUPON_INTEREST_DISCOUNT` (reduction ratio) | `N%` | Required | | `string` | `coupon_center_loan_min_amount` (minimum loan amount) | `amount + currency` | When there is a minimum amount requirement | | `hour` | `coupon_center_interest_discount_period` (discount duration) | Number of hours | Required | | `string` | `coupon_center_trade_applicable` (applicable transactions) | `demand deposit` | Required | **Block 3: Time information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | Use timestamp | When the status is used | --- ### `copy_trading` (Following experience bonus) **Block 2: Core Attributes** | `type` | `key` | `value` Description | Conditions | | -------- | ---------------------------------- | ------------------- | ---- | | `string` | `COUPON_VOUCHER_AMOUNT` (face value) | `amount + currency` | Required | | `string` | `coupon_applicable_traders` (applicable traders) | `all` or `specified traders` | Required | | `string` | `coupon_trade_category` (applicable transaction type) | `Spot` or `Contract` | Required | | `day` | `coupon_usage_days` (the number of days the experience is valid) | Number of days | Required | | `string` | `COUPON_STOP_LOSS_AMOUNT` (stop loss amount) | `amount + currency` | Required | | `string` | `coupon_ineligible_mkts` (cannot experience the market) | Market list | When there are restrictions | **Block 3: Time Information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------- | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | Use timestamp | When the status is used | --- ### `alpha_voucher` (Alpha cash coupon) **Block 2: Core Attributes** | `type` | `key` | `value` Description | | -------- | ----------------------------- | ---------- | | `string` | `COUPON_VOUCHER_AMOUNT` (voucher amount) | `amount + currency` | **Block 3: Time Information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------ | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | Use timestamp | When there is a collection time | --- ### `etf_voucher` (ETF trial bonus) **Block 2: Core Attributes** | `type` | `key` | `value` Description | | -------- | ------------------------------------ | ---------- | | `string` | `COUPON_VOUCHER_AMOUNT` (voucher amount) | `amount + currency` | | `hour` | `coupon_trial_duration` (trial duration) | Number of hours | | `string` | `COUPON_LIMITED_TRADING_PAIR` (limited trading pair) | ETF market list | **Block 3: Time information** | `type` | `key` | `value` description | condition | | ----------- | -------------------------- | ---------- | ------ | | `timestamp` | `COUPON_OBTAINED_AT` (get time) | Get timestamp | Required | | `timestamp` | `COUPON_VALID_UNTIL` (expiration time) | Expiration timestamp | Required | | `timestamp` | `COUPON_USED_AT` (use time) | use timestamp | when there is use time | --- ### `point` (point card) `extra` always returns `[]` without any blocks. --- ## Complete response example ### Ordinary cards and coupons (handling fee cashback coupons) ```json { \"code\": 0, \"message\": \"\", \"data\": { \"id\": 1234567, \"details_id\": 890, \"coupon_type\": \"commission_rebate\", \"name\": \"10% Futures Commission Rebate\", \"amount\": \"100\", \"currency\": \"USDT\", \"rule_new\": \"Rebate up to 100% of futures trading fee within 30 days.\", \"status\": \"TO_BE_USED\", \"jump_url\": { \"web\": \"/futures/USDT\", \"app\": \"/futures/USDT\", \"mini_app\": \"\" }, \"help_url\": { \"web\": \"\", \"app\": \"\" }, \"expire_time\": 1760000000, \"expire_time_order_by\": 1760000000, \"expire_second\": 86400, \"has_usage_history\": false, \"has_progress\": true, \"progress_config\": { \"total_balance\": \"100\", \"current_used\": \"30\", \"current_achived\": \"30\", \"currency\": \"USDT\" }, \"activation_info\": { \"market\": \"futures\", \"market_name\": \"Futures\" }, \"is_task_coupon\": 0, \"upgrade_toast\": false, \"from_task\": false, \"task_title\": \"\", \"task_desc\": \"\", \"task_start_at\": 0, \"task_expire_at\": 0, \"task_completed_at\": 0, \"extra\": [ [ { \"type\": \"string\", \"key\": \"Coupon name\", \"value\": \"10% Futures Commission Rebate\" }, { \"type\": \"string\", \"key\": \"Card and coupon source\", \"value\": \"New user registration activity\" }, { \"type\": \"status\", \"key\": \"Card and coupon status\", \"value\": \"TO_BE_USED\" } ], [ { \"type\": \"string\", \"key\": \"Card coupon amount\", \"value\": \"100 USDT\" }, { \"type\": \"string\", \"key\": \"Cashback ratio\", \"value\": \"10%\" }, { \"type\": \"string\", \"key\": \"Remaining Amount\", \"value\": \"100 USDT\" }, { \"type\": \"string\", \"key\": \"Used quota\", \"value\": \"0 USDT\" }, { \"type\": \"string\", \"key\": \"Applicable markets\", \"value\": \"Futures\" } ], [ { \"type\": \"timestamp\", \"key\": \"Get time\", \"value\": 1757000000 }, { \"type\": \"day\", \"key\": \"duration\", \"value\": 30 } ] ] } } ``` ### Task coupons (position experience coupons) ```json { \"code\": 0, \"message\": \"\", \"data\": { \"id\": 9876543, \"details_id\": 0, \"coupon_type\": \"position_voucher\", \"name\": \"position experience coupon\", \"amount\": \"5,000\", \"currency\": \"USDT\", \"rule_new\": \"Experience the position coupon rules...\", \"status\": \"TASK_WAIT\", \"jump_url\": { \"web\": \"https://www.gate.io/futures\", \"app\": \"gateio://futures\", \"mini_app\": \"\" }, \"help_url\": { \"web\": \"\", \"app\": \"\" }, \"expire_time\": 1760000000, \"expire_time_order_by\": 1760000000, \"expire_second\": 172800, \"has_usage_history\": false, \"has_progress\": true, \"progress_config\": { \"total_balance\": \"10000\", \"current_used\": \"3000\", \"current_achived\": \"3000\", \"currency\": \"USDT\" }, \"activation_info\": { \"symbols\": \"BTC_USDT\", \"leverage\": \"10\", \"need_user_funds\": 0, \"user_funds_amount\": \"\", \"position_bonus\": \"500\" }, \"is_task_coupon\": 1, \"upgrade_toast\": false, \"from_task\": false, \"task_title\": \"Complete 10,000 USDT contract trading volume and obtain position experience coupon\", \"task_desc\": \"Complete the specified trading volume task in the perpetual contract\", \"task_start_at\": 1757000000, \"task_expire_at\": 1760000000, \"task_completed_at\": 0, \"extra\": [ [ { \"type\": \"string\", \"key\": \"Card name\", \"value\": \"position experience coupon\" }, { \"type\": \"status\", \"key\": \"Card and coupon status\", \"value\": \"TASK_WAIT\" } ], [ { \"type\": \"string\", \"key\": \"Coupon amount\", \"value\": \"5,000 USDT\" }, { \"type\": \"string\", \"key\": \"Applicable market\", \"value\": \"USDT perpetual contract\" }, { \"type\": \"hour\", \"key\": \"position duration\", \"value\": 24 }, { \"type\": \"string\", \"key\": \"Leverage multiple\", \"value\": \"10X\" }, { \"type\": \"string\", \"key\": \"Limited trading pairs\", \"value\": \"BTCUSDT\" } ], [ { \"type\": \"timestamp\", \"key\": \"Get time\", \"value\": 1757000000 } ] ] } } ``` ### P2P transaction coupon (p2p) ```json { \"code\": 0, \"message\": \"\", \"data\": { \"id\": 5678901, \"details_id\": 234, \"coupon_type\": \"p2p\", \"name\": \"5.5% P2P transaction discount coupon\", \"amount\": \"100\", \"currency\": \"USDT\", \"rule_new\": \"Each P2P transaction can deduct up to 100 USDT in handling fees, with a discount rate of 5.5%, and each transaction is not less than 200 USDT.\", \"status\": \"TO_BE_USED\", \"jump_url\": { \"web\": \"/p2p\", \"app\": \"gateio://p2p\", \"mini_app\": \"\" }, \"help_url\": { \"web\": \"\", \"app\": \"\" }, \"expire_time\": 1760000000, \"expire_time_order_by\": 1760000000, \"expire_second\": 2592000, \"has_usage_history\": false, \"has_progress\": false, \"progress_config\": { \"total_balance\": \"\", \"current_used\": \"\", \"current_achived\": \"\", \"currency\": \"\" }, \"activation_info\": {}, \"is_task_coupon\": 0, \"upgrade_toast\": false, \"from_task\": false, \"task_title\": \"\", \"task_desc\": \"\", \"task_start_at\": 0, \"task_expire_at\": 0, \"task_completed_at\": 0, \"extra\": [ [ { \"type\": \"string\", \"key\": \"Coupon name\", \"value\": \"5.5% P2P transaction discount coupon\" }, { \"type\": \"string\", \"key\": \"Card and coupon source\", \"value\": \"New user registration activity\" }, { \"type\": \"status\", \"key\": \"Card and coupon status\", \"value\": \"TO_BE_USED\" } ], [ { \"type\": \"string\", \"key\": \"deduction limit\", \"value\": \"100 USDT\" }, { \"type\": \"string\", \"key\": \"Discount ratio\", \"value\": \"5.5%\" }, { \"type\": \"string\", \"key\": \"Usage conditions\", \"value\": \"Each transaction must not be less than 200 USDT\" }, { \"type\": \"string\", \"key\": \"Applicable legal currency\", \"value\": \"CNY, USD\" } ], [ { \"type\": \"timestamp\", \"key\": \"Get time\", \"value\": 1757000000 }, { \"type\": \"timestamp\", \"key\": \"expiration time\", \"value\": 1760000000 } ] ] } } ``` --- ## Error code | `code` | Description | | -------------------------------------------- | ------------------------- | | `0` | Success | | `10001`(`COUPON_SEND_ISSUING_LOG_NOT_FOUND`) | The card and coupon record does not exist or does not belong to the current user | | `10000` (`PARAMS_INVALID`) | The parameter is invalid (such as the task card is missing coupon_info) | | `50105` (`INVALID_PARAMETERS`) | Input parameter verification failed (such as coupon_type illegal) | # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_user_coupon_detail_with_http_info(coupon_type, detail_id, async_req=True)
>>> result = thread.get()
:param bool async_req: execute request asynchronously
:param str coupon_type: Coupon type enum. If not specified, all supported types are returned. Available values: `position_voucher` (position voucher), `tradfi_position_voucher` (TradFi position voucher), `contract_bonus` (futures bonus), `contract_bonus_new` (futures trial coupon), `commission_rebate` (commission rebate coupon), `hold_bonus` (earn trial bonus), `point` (point card), `financial_rate` (interest rate boost coupon), `robot_bonus` (trading bot bonus), `loss_protection_copier` (copy trading loss protection), `vip_card` (VIP trial card), `interest_voucher` (margin interest discount coupon), `p2p` (P2P trading deduction coupon), `cash` (cash coupon), `crypto_loan_interest` (crypto loan interest discount coupon), `copy_trading` (copy trading bonus), `alpha_voucher` (Alpha cash coupon), `etf_voucher` (ETF trial bonus) (required)
:param int detail_id: Coupon ID. **Regular coupon**: pass `details_id` from the list (primary key of each type's user coupon table); **Task coupon**: pass `id` from the list (primary key of the distribution record table) (required)
:param int is_task_coupon: Coupon source type. `0` = regular coupon (default); `1` = task coupon. This parameter determines the query logic for `detail_id`
:param _return_http_data_only: response data without head status code
and headers
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:rtype: tuple(gate_api.GetUserCouponDetailResponse, status_code(int), headers(HTTPHeaderDict))
:return: If the method is called asynchronously,
returns the request thread.
"""
local_var_params = locals()
all_params = [
'coupon_type',
'detail_id',
'is_task_coupon'
]
all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout'
]
)
for k, v in six.iteritems(local_var_params['kwargs']):
if k not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method get_user_coupon_detail" % k
)
local_var_params[k] = v
del local_var_params['kwargs']
# verify the required parameter 'coupon_type' is set
if self.api_client.client_side_validation and ('coupon_type' not in local_var_params or # noqa: E501
local_var_params['coupon_type'] is None): # noqa: E501
raise ApiValueError("Missing the required parameter `coupon_type` when calling `get_user_coupon_detail`") # noqa: E501
# verify the required parameter 'detail_id' is set
if self.api_client.client_side_validation and ('detail_id' not in local_var_params or # noqa: E501
local_var_params['detail_id'] is None): # noqa: E501
raise ApiValueError("Missing the required parameter `detail_id` when calling `get_user_coupon_detail`") # noqa: E501
if self.api_client.client_side_validation and 'detail_id' in local_var_params and local_var_params['detail_id'] > 2147483647: # noqa: E501
raise ApiValueError("Invalid value for parameter `detail_id` when calling `get_user_coupon_detail`, must be a value less than or equal to `2147483647`") # noqa: E501
if self.api_client.client_side_validation and 'detail_id' in local_var_params and local_var_params['detail_id'] < 1: # noqa: E501
raise ApiValueError("Invalid value for parameter `detail_id` when calling `get_user_coupon_detail`, must be a value greater than or equal to `1`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
if 'coupon_type' in local_var_params and local_var_params['coupon_type'] is not None: # noqa: E501
query_params.append(('coupon_type', local_var_params['coupon_type'])) # noqa: E501
if 'detail_id' in local_var_params and local_var_params['detail_id'] is not None: # noqa: E501
query_params.append(('detail_id', local_var_params['detail_id'])) # noqa: E501
if 'is_task_coupon' in local_var_params and local_var_params['is_task_coupon'] is not None: # noqa: E501
query_params.append(('is_task_coupon', local_var_params['is_task_coupon'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['apiv4'] # noqa: E501
return self.api_client.call_api(
'/coupon/user-coupon-detail', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='GetUserCouponDetailResponse', # noqa: E501
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)