tradly 1.1.97 → 1.1.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +879 -132
- package/package.json +1 -1
- package/INTEGRATION_IMPLEMENTATION.md +0 -290
- package/USAGE_SCENARIOS.md +0 -289
package/README.md
CHANGED
|
@@ -4,149 +4,896 @@
|
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
<h3 align="center"> Launch Platforms apps superfast. Headless. API First </h3>
|
|
7
|
-
<p align="center"> The flexible and modular
|
|
7
|
+
<p align="center"> The flexible and modular infrastructure to launch marketplace, community and commerce apps. </p>
|
|
8
8
|
<p align="center"><a href="https://tradly.app/tutorials">See demo videos</a></p>
|
|
9
9
|
<br />
|
|
10
10
|
|
|
11
|
+
Tradly helps developers / non technical founders with low-code/no-code solution
|
|
12
|
+
to launch marketplaces, Ecosystem for SaaS and commerce apps.
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
---
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
Whether you want simple things like catalog creation or configure complex revenue models, we made it simple and easy to configure through our SuperAdmin. Starter kits to develop apps. Not just that, and design system is coming soon.
|
|
16
|
+
## Features
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
- ✅ **100+ API Endpoints** - Comprehensive coverage of all Tradly platform
|
|
19
|
+
features
|
|
20
|
+
- ✅ **Automatic Key Management** - Integrates with `@tradly/auth` for automatic
|
|
21
|
+
key injection
|
|
22
|
+
- ✅ **Multi-Environment Support** - Production, Development, Sandbox
|
|
23
|
+
- ✅ **Domain-Based Configuration** - Support for multiple domains
|
|
24
|
+
- ✅ **Error Handling** - Consistent error-first callback pattern
|
|
25
|
+
- ✅ **TypeScript Ready** - Works with TypeScript projects
|
|
19
26
|
|
|
20
|
-
|
|
27
|
+
---
|
|
21
28
|
|
|
22
|
-
|
|
29
|
+
## Installation
|
|
23
30
|
|
|
24
|
-
|
|
31
|
+
```bash
|
|
32
|
+
npm install tradly
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Optional: Install with Auth Package
|
|
36
|
+
|
|
37
|
+
For automatic key management, also install `@tradly/auth`:
|
|
25
38
|
|
|
26
|
-
|
|
39
|
+
```bash
|
|
40
|
+
npm install tradly @tradly/auth
|
|
41
|
+
```
|
|
27
42
|
|
|
28
|
-
|
|
43
|
+
---
|
|
29
44
|
|
|
30
|
-
|
|
45
|
+
## Quick Start
|
|
31
46
|
|
|
32
|
-
|
|
47
|
+
### Option 1: With @tradly/auth (Recommended)
|
|
33
48
|
|
|
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
|
-
|
|
49
|
+
**Simplest approach - just initialize auth, then use tradly sdk directly:**
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
import { initializeAuth, emailLogin } from "@tradly/auth";
|
|
53
|
+
import TradlySDK from "tradly";
|
|
54
|
+
|
|
55
|
+
// Step 1: Initialize auth (once at app start)
|
|
56
|
+
initializeAuth("beauty.tradly.co", "production");
|
|
57
|
+
|
|
58
|
+
// Step 2: Login via auth (keys automatically stored)
|
|
59
|
+
await emailLogin("user@example.com", "password");
|
|
60
|
+
|
|
61
|
+
// Step 3: Use tradly APIs directly (keys auto-injected!)
|
|
62
|
+
const [error, response] = await TradlySDK.app.getListings({
|
|
63
|
+
bodyParam: {},
|
|
64
|
+
// authKey automatically from auth package!
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Benefits:**
|
|
69
|
+
|
|
70
|
+
- ✅ No need to call `init_v2.config()`
|
|
71
|
+
- ✅ Keys automatically injected
|
|
72
|
+
- ✅ Environment and base URL synced from auth
|
|
73
|
+
- ✅ Simplest usage
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### Option 2: Standalone (Without Auth Package)
|
|
78
|
+
|
|
79
|
+
```javascript
|
|
80
|
+
import TradlySDK from "tradly";
|
|
81
|
+
|
|
82
|
+
// Initialize tradly
|
|
83
|
+
await TradlySDK.init_v2.config({
|
|
84
|
+
domain: "beauty.tradly.co",
|
|
85
|
+
env: "production",
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// Use APIs with manual authKey
|
|
89
|
+
const [error, response] = await TradlySDK.app.getListings({
|
|
90
|
+
authKey: "your-auth-key",
|
|
91
|
+
bodyParam: {},
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
### Option 3: With Both (Explicit Control)
|
|
98
|
+
|
|
99
|
+
```javascript
|
|
100
|
+
import { initializeAuth, emailLogin } from "@tradly/auth";
|
|
101
|
+
import TradlySDK from "tradly";
|
|
102
|
+
|
|
103
|
+
// Initialize auth
|
|
104
|
+
initializeAuth("beauty.tradly.co", "production");
|
|
105
|
+
await emailLogin("user@example.com", "password");
|
|
106
|
+
|
|
107
|
+
// Initialize tradly (uses auth's PK key automatically)
|
|
108
|
+
await TradlySDK.init_v2.config({
|
|
109
|
+
domain: "beauty.tradly.co",
|
|
110
|
+
env: "production",
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// Use APIs (keys auto-injected)
|
|
114
|
+
const [error, response] = await TradlySDK.app.getListings({
|
|
115
|
+
bodyParam: {},
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Initialization
|
|
122
|
+
|
|
123
|
+
### Using InitV2 (Recommended)
|
|
124
|
+
|
|
125
|
+
```javascript
|
|
126
|
+
import TradlySDK from "tradly";
|
|
127
|
+
|
|
128
|
+
await TradlySDK.init_v2.config({
|
|
129
|
+
domain: "beauty.tradly.co", // Required
|
|
130
|
+
env: "production", // Required: "production" | "development" | "sandbox"
|
|
131
|
+
custom_header: {}, // Optional: Custom headers
|
|
132
|
+
is_skip_pk_by_domain: false, // Optional: Skip PK key fetch
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Note:** If `@tradly/auth` is initialized, `init_v2.config()` will
|
|
137
|
+
automatically use auth's cached PK key (no duplicate API call).
|
|
138
|
+
|
|
139
|
+
### Using Legacy Init (Deprecated)
|
|
140
|
+
|
|
141
|
+
```javascript
|
|
142
|
+
import TradlySDK from "tradly";
|
|
143
|
+
|
|
144
|
+
await TradlySDK.init.config({
|
|
145
|
+
token: "your-pk-key", // PK key
|
|
146
|
+
environment: "production", // Environment
|
|
147
|
+
custom_header: {}, // Optional
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Integration with @tradly/auth
|
|
154
|
+
|
|
155
|
+
tradly automatically integrates with `@tradly/auth` when available:
|
|
156
|
+
|
|
157
|
+
### Automatic Features
|
|
158
|
+
|
|
159
|
+
1. **PK Key Auto-Injection:**
|
|
160
|
+
|
|
161
|
+
- If `APPCONSTANT.TOKEN` is empty, gets PK key from auth's cache
|
|
162
|
+
- Caches it for future use
|
|
163
|
+
|
|
164
|
+
2. **Auth Key Auto-Injection:**
|
|
165
|
+
|
|
166
|
+
- If `authKey` not provided in method params, gets from auth package
|
|
167
|
+
- Adds to `x-auth-key` header automatically
|
|
168
|
+
|
|
169
|
+
3. **Environment Sync:**
|
|
170
|
+
|
|
171
|
+
- Syncs environment from auth config if `APPCONSTANT.ENVIRONMENT` is empty
|
|
172
|
+
|
|
173
|
+
4. **Base URL Sync:**
|
|
174
|
+
- Uses auth's `baseUrl` if available (preferred over tradly's Environment
|
|
175
|
+
function)
|
|
176
|
+
|
|
177
|
+
### Backward Compatibility
|
|
178
|
+
|
|
179
|
+
- ✅ Works without `@tradly/auth` package
|
|
180
|
+
- ✅ Manual `authKey` passing still works
|
|
181
|
+
- ✅ No breaking changes
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## API Methods
|
|
186
|
+
|
|
187
|
+
All methods return `[error, response]` format (error-first callback pattern).
|
|
188
|
+
|
|
189
|
+
### Response Format
|
|
190
|
+
|
|
191
|
+
```javascript
|
|
192
|
+
const [error, response] = await TradlySDK.app.getListings({});
|
|
193
|
+
|
|
194
|
+
if (error) {
|
|
195
|
+
// Handle error
|
|
196
|
+
console.error("Error:", error);
|
|
197
|
+
} else {
|
|
198
|
+
// Use response
|
|
199
|
+
console.log("Data:", response.data);
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## API Reference
|
|
206
|
+
|
|
207
|
+
### Configuration & Setup
|
|
208
|
+
|
|
209
|
+
| Method | Description | Parameters |
|
|
210
|
+
| ------------------- | ------------------------ | -------------------------------------------------------- |
|
|
211
|
+
| `init_v2.config()` | Initialize SDK (new way) | `{ domain, env, custom_header?, is_skip_pk_by_domain? }` |
|
|
212
|
+
| `init.config()` | Initialize SDK (legacy) | `{ token, environment, custom_header? }` |
|
|
213
|
+
| `init.refreshAPI()` | Refresh auth token | `{ refreshKey }` |
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
### User Management
|
|
218
|
+
|
|
219
|
+
| Method | Description | Parameters |
|
|
220
|
+
| ------------------------- | ------------------------ | ---------------------------------- |
|
|
221
|
+
| `app.getUserDetail()` | Get user by ID | `{ authKey, id }` |
|
|
222
|
+
| `app.getUserProfile()` | Get current user profile | `{ authKey, id? }` |
|
|
223
|
+
| `app.getUsersList()` | Get users list | `{ authKey, bodyParam? }` |
|
|
224
|
+
| `app.updateUserInfo()` | Update user info | `{ authKey, id, data }` |
|
|
225
|
+
| `app.deleteUser()` | Delete user | `{ authKey, id }` |
|
|
226
|
+
| `app.getUserAttributes()` | Get user attributes | `{ authKey, id, recaptcha_token }` |
|
|
227
|
+
| `app.userFollow()` | Follow a user | `{ authKey, data }` |
|
|
228
|
+
| `app.getUserFollowings()` | Get user followings | `{ authKey, bodyParam? }` |
|
|
229
|
+
| `app.getUserFollowers()` | Get user followers | `{ authKey, bodyParam? }` |
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
### Listings
|
|
234
|
+
|
|
235
|
+
| Method | Description | Parameters |
|
|
236
|
+
| --------------------------------- | ------------------------------- | ----------------------------- |
|
|
237
|
+
| `app.getListings()` | Get listings | `{ authKey?, bodyParam? }` |
|
|
238
|
+
| `app.getListingDetail()` | Get listing detail | `{ authKey?, id, slug? }` |
|
|
239
|
+
| `app.postListing()` | Create/Update listing | `{ authKey?, id?, data }` |
|
|
240
|
+
| `app.deleteListing()` | Delete listing | `{ authKey?, id }` |
|
|
241
|
+
| `app.likeListing()` | Like/Unlike listing | `{ authKey?, id, isLiked }` |
|
|
242
|
+
| `app.unlikeListing()` | Unlike listing | `{ authKey?, id, isUnLiked }` |
|
|
243
|
+
| `app.bulkLikeListings()` | Bulk like listings | `{ authKey?, data }` |
|
|
244
|
+
| `app.getMyListingsLikes()` | Get my liked listings | `{ authKey?, bodyParam? }` |
|
|
245
|
+
| `app.reportListing()` | Report listing | `{ authKey?, id, data }` |
|
|
246
|
+
| `app.getListingsLocations()` | Get listings locations | `{ authKey?, bodyParam? }` |
|
|
247
|
+
| `app.FollowingAccountsListings()` | Get following accounts listings | `{ authKey?, bodyParam? }` |
|
|
248
|
+
|
|
249
|
+
**Note:** `authKey` is optional if `@tradly/auth` is initialized - it will be
|
|
250
|
+
auto-injected.
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
### Listings - Pricing Rules
|
|
255
|
+
|
|
256
|
+
| Method | Description | Parameters |
|
|
257
|
+
| ----------------------------------- | -------------------------- | ----------------------------------------------- |
|
|
258
|
+
| `app.postPricingRules()` | Create/Update pricing rule | `{ authKey?, listing_id, rule_id?, data }` |
|
|
259
|
+
| `app.getListingsPricingRules()` | Get pricing rules | `{ authKey?, listing_id, bodyParam? }` |
|
|
260
|
+
| `app.getListingSinglePricingRule()` | Get single pricing rule | `{ authKey?, listing_id, rule_id, bodyParam? }` |
|
|
261
|
+
| `app.deleteListingPricingRule()` | Delete pricing rule | `{ authKey?, listing_id, rule_id }` |
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
### Listings - Negotiations
|
|
266
|
+
|
|
267
|
+
| Method | Description | Parameters |
|
|
268
|
+
| -------------------------- | --------------------- | ---------------------------------------- |
|
|
269
|
+
| `app.addNegotiation()` | Add negotiation | `{ authKey?, id, data }` |
|
|
270
|
+
| `app.updateNegotiation()` | Update negotiation | `{ authKey?, id, negotiation_id, data }` |
|
|
271
|
+
| `app.getNegotiationList()` | Get negotiations list | `{ authKey?, id, bodyParam? }` |
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
### Listings - Schedules
|
|
276
|
+
|
|
277
|
+
| Method | Description | Parameters |
|
|
278
|
+
| ---------------------- | --------------- | ------------------------------ |
|
|
279
|
+
| `app.createSchedule()` | Create schedule | `{ authKey?, id, data }` |
|
|
280
|
+
| `app.getSchedule()` | Get schedule | `{ authKey?, id, bodyParam? }` |
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
### Variants
|
|
285
|
+
|
|
286
|
+
| Method | Description | Parameters |
|
|
287
|
+
| -------------------------------- | --------------------- | ------------------------------------- |
|
|
288
|
+
| `app.getVariants()` | Get variants | `{ authKey? }` |
|
|
289
|
+
| `app.getListingVariants()` | Get listing variants | `{ authKey?, listingId }` |
|
|
290
|
+
| `app.getListingVariantDetails()` | Get variant details | `{ authKey?, listingId, variant_id }` |
|
|
291
|
+
| `app.addEditVariants()` | Create/Update variant | `{ authKey?, listingId, id?, data }` |
|
|
292
|
+
| `app.deleteVariant()` | Delete variant | `{ authKey?, listingId, id }` |
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
### Variant Types
|
|
297
|
+
|
|
298
|
+
| Method | Description | Parameters |
|
|
299
|
+
| ---------------------------------- | -------------------------------- | ---------------------------------- |
|
|
300
|
+
| `app.getVariantTypes()` | Get variant types | `{ authKey? }` |
|
|
301
|
+
| `app.addEditVariantsTypes()` | Create/Update variant type | `{ authKey?, id?, data }` |
|
|
302
|
+
| `app.deleteVariantType()` | Delete variant type | `{ authKey?, id }` |
|
|
303
|
+
| `app.getVariantTypeValues()` | Get variant type values | `{ authKey?, id }` |
|
|
304
|
+
| `app.getVariantTypeValuesDetail()` | Get variant type value detail | `{ authKey?, id, valueID }` |
|
|
305
|
+
| `app.addEditVariantTypeValues()` | Create/Update variant type value | `{ authKey?, id, valueID?, data }` |
|
|
306
|
+
| `app.deleteVariantTypeValues()` | Delete variant type value | `{ authKey?, id, valueID }` |
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
### Categories
|
|
311
|
+
|
|
312
|
+
| Method | Description | Parameters |
|
|
313
|
+
| ------------------------------- | ---------------------- | -------------------------------------- |
|
|
314
|
+
| `app.getCategory()` | Get categories | `{ authKey?, bodyParam? }` |
|
|
315
|
+
| `app.getSingleCategoryByID()` | Get category by ID | `{ authKey?, categoryID, bodyParam? }` |
|
|
316
|
+
| `app.getSingleCategoryBySlug()` | Get category by slug | `{ authKey?, slug, bodyParam? }` |
|
|
317
|
+
| `app.addEditCategory()` | Create/Update category | `{ authKey?, id?, data }` |
|
|
318
|
+
| `app.deleteCategory()` | Delete category | `{ authKey?, id }` |
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
### Attributes
|
|
323
|
+
|
|
324
|
+
| Method | Description | Parameters |
|
|
325
|
+
| -------------------------------- | ----------------------------- | ---------------------------------- |
|
|
326
|
+
| `app.getAttribute()` | Get attributes | `{ authKey?, bodyParam? }` |
|
|
327
|
+
| `app.getAttributesGrouped()` | Get grouped attributes | `{ authKey?, bodyParam? }` |
|
|
328
|
+
| `app.getUserAttributeValues()` | Get user attribute values | `{ authKey?, id, bodyParam? }` |
|
|
329
|
+
| `app.addEditAttribute()` | Create/Update attribute | `{ authKey?, id?, data }` |
|
|
330
|
+
| `app.deleteAttribute()` | Delete attribute | `{ authKey?, id }` |
|
|
331
|
+
| `app.getAttributeValues()` | Get attribute values | `{ authKey?, id }` |
|
|
332
|
+
| `app.getAttributeValuesDetail()` | Get attribute value detail | `{ authKey?, id, valueID }` |
|
|
333
|
+
| `app.addEditAttributeValues()` | Create/Update attribute value | `{ authKey?, id, valueID?, data }` |
|
|
334
|
+
| `app.deleteAttributeValues()` | Delete attribute value | `{ authKey?, id, valueID }` |
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
### Accounts
|
|
339
|
+
|
|
340
|
+
| Method | Description | Parameters |
|
|
341
|
+
| ------------------------------ | --------------------------- | ------------------------------- |
|
|
342
|
+
| `app.getAccounts()` | Get accounts | `{ authKey?, bodyParam? }` |
|
|
343
|
+
| `app.getAccountDetail()` | Get account detail | `{ authKey?, id, slug? }` |
|
|
344
|
+
| `app.postAccounts()` | Create/Update account | `{ authKey?, id?, data }` |
|
|
345
|
+
| `app.activeInactiveAccounts()` | Activate/Deactivate account | `{ authKey?, id, data }` |
|
|
346
|
+
| `app.followUnfollowAccounts()` | Follow/Unfollow account | `{ authKey?, id, isFollowing }` |
|
|
347
|
+
| `app.blockAccount()` | Block/Unblock account | `{ authKey?, id, isBlocked }` |
|
|
348
|
+
| `app.reportAccount()` | Report account | `{ authKey?, id, data }` |
|
|
349
|
+
| `app.getBlockAccounts()` | Get blocked accounts | `{ authKey?, bodyParam? }` |
|
|
350
|
+
| `app.getFollowingAccounts()` | Get following accounts | `{ authKey?, bodyParam? }` |
|
|
351
|
+
| `app.getAccountsLocations()` | Get accounts locations | `{ authKey?, bodyParam? }` |
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
### Cart & Checkout
|
|
356
|
+
|
|
357
|
+
| Method | Description | Parameters |
|
|
358
|
+
| ----------------------------- | ------------------ | ------------------------------------- |
|
|
359
|
+
| `app.getCarts()` | Get cart | `{ authKey?, bodyParam?, currency? }` |
|
|
360
|
+
| `app.addToCart()` | Add to cart | `{ authKey?, data }` |
|
|
361
|
+
| `app.deleteFromCart()` | Remove from cart | `{ authKey?, data }` |
|
|
362
|
+
| `app.deleteAllCartDetail()` | Clear cart | `{ authKey?, bodyParam? }` |
|
|
363
|
+
| `app.checkout()` | Checkout from cart | `{ authKey?, data, currency? }` |
|
|
364
|
+
| `app.listingDirectCheckout()` | Direct checkout | `{ authKey?, id, data, currency? }` |
|
|
365
|
+
| `app.applyCoupon()` | Apply coupon | `{ authKey?, data }` |
|
|
366
|
+
| `app.removeCoupon()` | Remove coupon | `{ authKey?, data }` |
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
### Orders
|
|
371
|
+
|
|
372
|
+
| Method | Description | Parameters |
|
|
373
|
+
| ---------------------------- | ---------------------- | -------------------------------------------------------- |
|
|
374
|
+
| `app.getOrders()` | Get orders | `{ authKey?, bodyParam? }` |
|
|
375
|
+
| `app.getOrderDetail()` | Get order detail | `{ authKey?, id, bodyParam? }` |
|
|
376
|
+
| `app.updateOrderStatus()` | Update order status | `{ authKey?, id, data, bodyParam? }` |
|
|
377
|
+
| `app.updateOrderDetail()` | Update order details | `{ authKey?, id, data, bodyParam? }` |
|
|
378
|
+
| `app.updateOrderShipment()` | Update order shipment | `{ authKey?, order_id, shipment_id, data, bodyParam? }` |
|
|
379
|
+
| `app.updateShipmentStatus()` | Update shipment status | `{ authKey?, id, shipment_id, data, bodyParam? }` |
|
|
380
|
+
| `app.verifyOrderDetails()` | Verify order details | `{ authKey?, data, bodyParam? }` |
|
|
381
|
+
| `app.confirmOrderByUser()` | Confirm order | `{ authKey?, order_ref, access_key?, data, bodyParam? }` |
|
|
382
|
+
| `app.getOrderInvoice()` | Get order invoice | `{ authKey?, order_id, bodyParam? }` |
|
|
383
|
+
| `app.getDonationsList()` | Get donations list | `{ authKey?, listing_id, bodyParam? }` |
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
### Shipments
|
|
388
|
+
|
|
389
|
+
| Method | Description | Parameters |
|
|
390
|
+
| ------------------------------------ | ------------------------------ | ---------------------------------------------- |
|
|
391
|
+
| `app.getSendCloudShipmentsMethods()` | Get SendCloud shipping methods | `{ authKey?, bodyParam? }` |
|
|
392
|
+
| `app.getSendCloudShipmentLabel()` | Get SendCloud shipping label | `{ authKey?, bodyParam? }` |
|
|
393
|
+
| `app.getExternalShipmentMethods()` | Get external shipping methods | `{ authKey?, shipping_method_id, bodyParam? }` |
|
|
394
|
+
| `app.getExternalShipmentLabel()` | Get external shipping label | `{ authKey?, order_id, shipment_id }` |
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
### Reviews
|
|
399
|
+
|
|
400
|
+
| Method | Description | Parameters |
|
|
401
|
+
| --------------------- | ----------- | -------------------------- |
|
|
402
|
+
| `app.getReviewList()` | Get reviews | `{ authKey?, bodyParam? }` |
|
|
403
|
+
| `app.addReview()` | Add review | `{ authKey?, data }` |
|
|
404
|
+
| `app.likeReview()` | Like review | `{ authKey?, id, data }` |
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
### Payments
|
|
409
|
+
|
|
410
|
+
| Method | Description | Parameters |
|
|
411
|
+
| --------------------------- | ------------------------- | ------------------------ |
|
|
412
|
+
| `app.getPaymentMethods()` | Get payment methods | `{ authKey? }` |
|
|
413
|
+
| `app.getEphemeralKey()` | Get Stripe ephemeral key | `{ authKey?, id, data }` |
|
|
414
|
+
| `app.getPaymentIntentKey()` | Get Stripe payment intent | `{ authKey?, id, data }` |
|
|
415
|
+
|
|
416
|
+
---
|
|
417
|
+
|
|
418
|
+
### MangoPay
|
|
419
|
+
|
|
420
|
+
| Method | Description | Parameters |
|
|
421
|
+
| ------------------------------------- | ------------------------- | -------------------------- |
|
|
422
|
+
| `app.getKycDetails()` | Get KYC details | `{ authKey?, id }` |
|
|
423
|
+
| `app.savePerSonalDetails()` | Save personal details | `{ authKey?, data }` |
|
|
424
|
+
| `app.cardRegistration()` | Register card | `{ authKey?, data }` |
|
|
425
|
+
| `app.confirmCardRegistration()` | Confirm card registration | `{ authKey?, data }` |
|
|
426
|
+
| `app.PayINMangoPayCalc()` | Calculate pay-in | `{ authKey?, data }` |
|
|
427
|
+
| `app.PayINMangoPayByCards()` | Pay-in by cards | `{ authKey?, data }` |
|
|
428
|
+
| `app.PayINMangoPayPayPal()` | Pay-in by PayPal | `{ authKey?, data }` |
|
|
429
|
+
| `app.PayINMangoPayByBank()` | Pay-in by bank | `{ authKey?, data }` |
|
|
430
|
+
| `app.mangoPayWithdrawCalc()` | Calculate withdrawal | `{ authKey?, data }` |
|
|
431
|
+
| `app.mangoPayWithdrawInit()` | Initiate withdrawal | `{ authKey?, data }` |
|
|
432
|
+
| `app.mangoPayWithdrawConfirm()` | Confirm withdrawal | `{ authKey?, data }` |
|
|
433
|
+
| `app.getMangopayWalletTransactions()` | Get wallet transactions | `{ authKey?, bodyParam? }` |
|
|
434
|
+
| `app.getMangoPayWalletBalance()` | Get wallet balance | `{ authKey?, bodyParam? }` |
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
### Stripe Connect
|
|
439
|
+
|
|
440
|
+
| Method | Description | Parameters |
|
|
441
|
+
| ------------------------------- | -------------------------- | -------------------- |
|
|
442
|
+
| `app.getStripeConnectAccount()` | Get Stripe Connect account | `{ authKey?, id }` |
|
|
443
|
+
| `app.createAccountLink()` | Create account link | `{ authKey?, data }` |
|
|
444
|
+
| `app.createExpressLoginLink()` | Create express login link | `{ authKey?, data }` |
|
|
445
|
+
|
|
446
|
+
---
|
|
447
|
+
|
|
448
|
+
### Saved Cards
|
|
449
|
+
|
|
450
|
+
| Method | Description | Parameters |
|
|
451
|
+
| ----------------------- | ----------------- | ----------------------- |
|
|
452
|
+
| `app.getSavedCards()` | Get saved cards | `{ authKey? }` |
|
|
453
|
+
| `app.deleteSavedCard()` | Delete saved card | `{ authKey?, card_id }` |
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
### Addresses
|
|
458
|
+
|
|
459
|
+
| Method | Description | Parameters |
|
|
460
|
+
| ------------------------------- | ------------------------- | -------------------------- |
|
|
461
|
+
| `app.getAddress()` | Get addresses | `{ authKey?, bodyParam? }` |
|
|
462
|
+
| `app.addEditAddress()` | Create/Update address | `{ authKey?, id?, data }` |
|
|
463
|
+
| `app.deleteAddress()` | Delete address | `{ authKey?, id }` |
|
|
464
|
+
| `app.searchAddress()` | Search address | `{ authKey?, searchKey }` |
|
|
465
|
+
| `app.reverseGeoCodingAddress()` | Reverse geocoding | `{ authKey?, lat, long }` |
|
|
466
|
+
| `app.getPlacesAddress()` | Get places address | `{ authKey?, bodyParam? }` |
|
|
467
|
+
| `app.getPlacesAddressDetails()` | Get place address details | `{ authKey?, bodyParam? }` |
|
|
468
|
+
| `app.getStates()` | Get states | `{ authKey?, bodyParam? }` |
|
|
469
|
+
|
|
470
|
+
---
|
|
471
|
+
|
|
472
|
+
### Shipping Methods
|
|
473
|
+
|
|
474
|
+
| Method | Description | Parameters |
|
|
475
|
+
| -------------------------- | -------------------- | ---------------------------------- |
|
|
476
|
+
| `app.getShippingMethods()` | Get shipping methods | `{ authKey?, type?, account_id? }` |
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
### Currency
|
|
481
|
+
|
|
482
|
+
| Method | Description | Parameters |
|
|
483
|
+
| ----------------------- | ---------------------- | ------------------------- |
|
|
484
|
+
| `app.getCurrency()` | Get currencies | `{ authKey? }` |
|
|
485
|
+
| `app.addEditCurrency()` | Create/Update currency | `{ authKey?, id?, data }` |
|
|
486
|
+
| `app.deleteCurrency()` | Delete currency | `{ authKey?, id }` |
|
|
487
|
+
|
|
488
|
+
---
|
|
489
|
+
|
|
490
|
+
### Collections
|
|
491
|
+
|
|
492
|
+
| Method | Description | Parameters |
|
|
493
|
+
| --------------------------- | ------------------------ | -------------------------- |
|
|
494
|
+
| `app.getCollection()` | Get collections | `{ authKey? }` |
|
|
495
|
+
| `app.getCollectionDetail()` | Get collection detail | `{ authKey?, id }` |
|
|
496
|
+
| `app.addEditCollection()` | Create/Update collection | `{ authKey?, id?, data }` |
|
|
497
|
+
| `app.deleteCollections()` | Delete collection | `{ authKey?, id }` |
|
|
498
|
+
| `app.getCollectionData()` | Get collection data | `{ authKey?, bodyParam? }` |
|
|
499
|
+
|
|
500
|
+
---
|
|
501
|
+
|
|
502
|
+
### Promo Banners
|
|
503
|
+
|
|
504
|
+
| Method | Description | Parameters |
|
|
505
|
+
| ------------------------- | -------------------------- | -------------------------- |
|
|
506
|
+
| `app.getPromoBanner()` | Get promo banners | `{ authKey?, bodyParam? }` |
|
|
507
|
+
| `app.addPromoBanner()` | Create/Update promo banner | `{ authKey?, id?, data }` |
|
|
508
|
+
| `app.deletePromoBanner()` | Delete promo banner | `{ authKey?, id }` |
|
|
509
|
+
|
|
510
|
+
---
|
|
511
|
+
|
|
512
|
+
### Transactions & Earnings
|
|
513
|
+
|
|
514
|
+
| Method | Description | Parameters |
|
|
515
|
+
| ----------------------- | ---------------- | -------------------------- |
|
|
516
|
+
| `app.getTransactions()` | Get transactions | `{ authKey?, bodyParam? }` |
|
|
517
|
+
| `app.getEarning()` | Get earnings | `{ authKey?, bodyParam? }` |
|
|
518
|
+
|
|
519
|
+
---
|
|
520
|
+
|
|
521
|
+
### Commissions
|
|
522
|
+
|
|
523
|
+
| Method | Description | Parameters |
|
|
524
|
+
| --------------------------- | --------------------- | -------------------------- |
|
|
525
|
+
| `app.getCommissions()` | Get commissions | `{ authKey?, bodyParam? }` |
|
|
526
|
+
| `app.getCommissionDetail()` | Get commission detail | `{ authKey?, id }` |
|
|
527
|
+
|
|
528
|
+
---
|
|
529
|
+
|
|
530
|
+
### Subscriptions
|
|
531
|
+
|
|
532
|
+
| Method | Description | Parameters |
|
|
533
|
+
| ------------------------------ | ------------------------- | ------------------------------------------- |
|
|
534
|
+
| `app.subscribe()` | Get subscriptions | `{ authKey?, bodyParam? }` |
|
|
535
|
+
| `app.productSubscription()` | Get product subscriptions | `{ authKey?, bodyParam? }` |
|
|
536
|
+
| `app.subscriptionConfirm()` | Confirm subscription | `{ authKey?, data }` |
|
|
537
|
+
| `app.manageSubscriptionLink()` | Manage subscription link | `{ authKey?, data }` |
|
|
538
|
+
| `app.getSubscriptionList()` | Get subscription listings | `{ authKey?, bodyParam? }` |
|
|
539
|
+
| `app.getSubscriptionDetails()` | Get subscription details | `{ authKey?, listing_id }` |
|
|
540
|
+
| `app.subscribeByMangopay()` | Subscribe via MangoPay | `{ authKey?, listing_id, data, currency? }` |
|
|
541
|
+
|
|
542
|
+
---
|
|
543
|
+
|
|
544
|
+
### Layers
|
|
545
|
+
|
|
546
|
+
| Method | Description | Parameters |
|
|
547
|
+
| ---------------------------- | ------------------- | -------------------------- |
|
|
548
|
+
| `app.getLayer()` | Get layers | `{ authKey?, bodyParam? }` |
|
|
549
|
+
| `app.getLayerDetail()` | Get layer detail | `{ authKey?, id }` |
|
|
550
|
+
| `app.getLayerDetailBySlug()` | Get layer by slug | `{ authKey?, id }` |
|
|
551
|
+
| `app.addEditLayer()` | Create/Update layer | `{ authKey?, id?, data }` |
|
|
552
|
+
| `app.deleteLayer()` | Delete layer | `{ authKey?, id }` |
|
|
553
|
+
|
|
554
|
+
---
|
|
555
|
+
|
|
556
|
+
### Taxes
|
|
557
|
+
|
|
558
|
+
| Method | Description | Parameters |
|
|
559
|
+
| ------------------------- | ----------------- | -------------------------- |
|
|
560
|
+
| `app.getListingTaxes()` | Get listing taxes | `{ authKey?, bodyParam? }` |
|
|
561
|
+
| `app.addEditListingTax()` | Create/Update tax | `{ authKey?, id?, data }` |
|
|
562
|
+
| `app.deleteListingTax()` | Delete tax | `{ authKey?, id }` |
|
|
563
|
+
|
|
564
|
+
---
|
|
565
|
+
|
|
566
|
+
### Translations
|
|
567
|
+
|
|
568
|
+
| Method | Description | Parameters |
|
|
569
|
+
| --------------------------------------- | ----------------------------- | -------------------------- |
|
|
570
|
+
| `app.getTranslations()` | Get translations | `{ authKey?, bodyParam? }` |
|
|
571
|
+
| `app.translateData()` | Translate data | `{ authKey?, id, data }` |
|
|
572
|
+
| `app.getClientTranslationsGroups()` | Get client translation groups | `{ authKey?, paramBody? }` |
|
|
573
|
+
| `app.getClientTranslationsValues()` | Get client translation values | `{ authKey?, bodyParam? }` |
|
|
574
|
+
| `app.clientTranslationsValuesByGroup()` | Get translations by group | `{ authKey?, bodyParam? }` |
|
|
575
|
+
|
|
576
|
+
---
|
|
577
|
+
|
|
578
|
+
### Feedback & Comments
|
|
579
|
+
|
|
580
|
+
| Method | Description | Parameters |
|
|
581
|
+
| ----------------------------- | ----------------------- | --------------------------------------- |
|
|
582
|
+
| `app.getFeedbackCategories()` | Get feedback categories | `{ authKey?, bodyParam? }` |
|
|
583
|
+
| `app.createFeedback()` | Create feedback | `{ authKey?, data }` |
|
|
584
|
+
| `app.getComments()` | Get comments | `{ authKey?, bodyParam? }` |
|
|
585
|
+
| `app.addEditComments()` | Create/Update comment | `{ authKey?, id?, data }` |
|
|
586
|
+
| `app.likeUnlikeComments()` | Like/Unlike comment | `{ authKey?, id, isLike, isDowngrade }` |
|
|
587
|
+
|
|
588
|
+
---
|
|
589
|
+
|
|
590
|
+
### Activities
|
|
591
|
+
|
|
592
|
+
| Method | Description | Parameters |
|
|
593
|
+
| --------------------- | -------------- | -------------------------- |
|
|
594
|
+
| `app.getActivities()` | Get activities | `{ authKey?, bodyParam? }` |
|
|
595
|
+
|
|
596
|
+
---
|
|
597
|
+
|
|
598
|
+
### Languages & Countries
|
|
599
|
+
|
|
600
|
+
| Method | Description | Parameters |
|
|
601
|
+
| -------------------------- | -------------------- | -------------- |
|
|
602
|
+
| `app.getLanguages()` | Get languages | `{ authKey? }` |
|
|
603
|
+
| `app.getTenantLanguages()` | Get tenant languages | `{ authKey? }` |
|
|
604
|
+
| `app.getCountries()` | Get countries | `{}` |
|
|
605
|
+
| `app.getTenantCountries()` | Get tenant countries | `{ authKey? }` |
|
|
606
|
+
|
|
607
|
+
---
|
|
608
|
+
|
|
609
|
+
### Configuration
|
|
610
|
+
|
|
611
|
+
| Method | Description | Parameters |
|
|
612
|
+
| ---------------------------------- | ------------------------- | -------------------------------------------------- |
|
|
613
|
+
| `app.getConfigList()` | Get config list | `{ authKey?, paramBody, domain_id? }` |
|
|
614
|
+
| `app.getGroupedConfigList()` | Get grouped config list | `{ authKey?, paramBody, domain_id? }` |
|
|
615
|
+
| `app.getGroupedSecureConfigList()` | Get grouped secure config | `{ authKey?, paramBody, domain_id?, access_key? }` |
|
|
616
|
+
| `app.home()` | Get home data | `{ authKey? }` |
|
|
617
|
+
|
|
618
|
+
---
|
|
619
|
+
|
|
620
|
+
### S3 & Media
|
|
621
|
+
|
|
622
|
+
| Method | Description | Parameters |
|
|
623
|
+
| -------------------------- | ---------------------- | -------------------------------- |
|
|
624
|
+
| `app.generateS3ImageURL()` | Generate S3 signed URL | `{ authKey?, data }` |
|
|
625
|
+
| `app.uploadS3Image()` | Upload image to S3 | `{ signedUrl, mime, blob_body }` |
|
|
626
|
+
| `app.getS3SignedURL()` | Get S3 signed URL | `{ authKey?, data }` |
|
|
627
|
+
|
|
628
|
+
---
|
|
629
|
+
|
|
630
|
+
### Digital Content
|
|
631
|
+
|
|
632
|
+
| Method | Description | Parameters |
|
|
633
|
+
| --------------------------------- | ----------------------------- | --------------------------------------------- |
|
|
634
|
+
| `app.getDigitalContents()` | Get digital contents | `{ authKey?, listing_id, bodyParam? }` |
|
|
635
|
+
| `app.postAndEditDigitalContent()` | Create/Update digital content | `{ authKey?, listing_id, content_id?, data }` |
|
|
636
|
+
| `app.deleteDigitalContent()` | Delete digital content | `{ authKey?, listing_id, content_id }` |
|
|
637
|
+
|
|
638
|
+
---
|
|
639
|
+
|
|
640
|
+
### SSO
|
|
641
|
+
|
|
642
|
+
| Method | Description | Parameters |
|
|
643
|
+
| ---------------------- | ----------------- | ------------------------------- |
|
|
644
|
+
| `app.postSsoReturn()` | SSO return | `{ authKey?, data, currency? }` |
|
|
645
|
+
| `app.postSsoEnabled()` | Check SSO enabled | `{ authKey?, data, currency? }` |
|
|
646
|
+
|
|
647
|
+
---
|
|
648
|
+
|
|
649
|
+
### Wallet
|
|
650
|
+
|
|
651
|
+
| Method | Description | Parameters |
|
|
652
|
+
| ----------------------------- | ----------------------- | -------------------------- |
|
|
653
|
+
| `app.getWalletBalance()` | Get wallet balance | `{ authKey? }` |
|
|
654
|
+
| `app.getWalletTransactions()` | Get wallet transactions | `{ authKey?, bodyParam? }` |
|
|
655
|
+
|
|
656
|
+
---
|
|
657
|
+
|
|
658
|
+
### OPP Merchant
|
|
659
|
+
|
|
660
|
+
| Method | Description | Parameters |
|
|
661
|
+
| -------------------------- | -------------------- | -------------------------- |
|
|
662
|
+
| `app.getMerchantDetails()` | Get merchant details | `{ authKey?, bodyParam? }` |
|
|
663
|
+
| `app.createNewMerchant()` | Create merchant | `{ authKey?, data }` |
|
|
664
|
+
|
|
665
|
+
---
|
|
666
|
+
|
|
667
|
+
### Time Slots
|
|
668
|
+
|
|
669
|
+
| Method | Description | Parameters |
|
|
670
|
+
| -------------------- | -------------- | -------------------------- |
|
|
671
|
+
| `app.getTimeSlots()` | Get time slots | `{ authKey?, bodyParam? }` |
|
|
672
|
+
|
|
673
|
+
---
|
|
674
|
+
|
|
675
|
+
### AI Services
|
|
676
|
+
|
|
677
|
+
| Method | Description | Parameters |
|
|
678
|
+
| --------------------------- | ---------------------- | ------------------------------- |
|
|
679
|
+
| `app.getAiPromptResponse()` | Get AI prompt response | `{ authKey?, data, currency? }` |
|
|
680
|
+
|
|
681
|
+
---
|
|
682
|
+
|
|
683
|
+
### Device Management
|
|
684
|
+
|
|
685
|
+
| Method | Description | Parameters |
|
|
686
|
+
| ------------------------ | ------------------ | -------------------- |
|
|
687
|
+
| `app.updateDeviceInfo()` | Update device info | `{ authKey?, data }` |
|
|
688
|
+
|
|
689
|
+
---
|
|
690
|
+
|
|
691
|
+
## Usage Examples
|
|
692
|
+
|
|
693
|
+
### Example 1: Get Listings
|
|
694
|
+
|
|
695
|
+
```javascript
|
|
696
|
+
import TradlySDK from "tradly";
|
|
697
|
+
|
|
698
|
+
// With auth package (keys auto-injected)
|
|
699
|
+
const [error, response] = await TradlySDK.app.getListings({
|
|
700
|
+
bodyParam: {
|
|
701
|
+
page: 1,
|
|
702
|
+
per_page: 20,
|
|
703
|
+
type: "listings",
|
|
704
|
+
},
|
|
705
|
+
});
|
|
706
|
+
|
|
707
|
+
if (error) {
|
|
708
|
+
console.error("Error:", error);
|
|
709
|
+
} else {
|
|
710
|
+
console.log("Listings:", response.data);
|
|
711
|
+
}
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
### Example 2: Create Listing
|
|
715
|
+
|
|
716
|
+
```javascript
|
|
717
|
+
const [error, response] = await TradlySDK.app.postListing({
|
|
718
|
+
data: {
|
|
719
|
+
title: "My Product",
|
|
720
|
+
description: "Product description",
|
|
721
|
+
price: 99.99,
|
|
722
|
+
// ... other fields
|
|
723
|
+
},
|
|
724
|
+
});
|
|
725
|
+
|
|
726
|
+
if (!error) {
|
|
727
|
+
console.log("Listing created:", response.data);
|
|
728
|
+
}
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
### Example 3: Add to Cart
|
|
732
|
+
|
|
733
|
+
```javascript
|
|
734
|
+
const [error, response] = await TradlySDK.app.addToCart({
|
|
735
|
+
data: {
|
|
736
|
+
listing_id: 123,
|
|
737
|
+
quantity: 2,
|
|
738
|
+
// ... other fields
|
|
739
|
+
},
|
|
740
|
+
});
|
|
741
|
+
```
|
|
742
|
+
|
|
743
|
+
### Example 4: Checkout
|
|
744
|
+
|
|
745
|
+
```javascript
|
|
746
|
+
const [error, response] = await TradlySDK.app.checkout({
|
|
747
|
+
data: {
|
|
748
|
+
// Checkout data
|
|
749
|
+
},
|
|
750
|
+
currency: "USD",
|
|
751
|
+
});
|
|
752
|
+
```
|
|
753
|
+
|
|
754
|
+
### Example 5: Get Orders
|
|
755
|
+
|
|
756
|
+
```javascript
|
|
757
|
+
const [error, response] = await TradlySDK.app.getOrders({
|
|
758
|
+
bodyParam: {
|
|
759
|
+
page: 1,
|
|
760
|
+
per_page: 10,
|
|
761
|
+
status: "pending",
|
|
762
|
+
},
|
|
763
|
+
});
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
---
|
|
767
|
+
|
|
768
|
+
## Parameters
|
|
769
|
+
|
|
770
|
+
### Common Parameters
|
|
771
|
+
|
|
772
|
+
Most methods accept these optional parameters:
|
|
773
|
+
|
|
774
|
+
- `authKey` - User authentication key (auto-injected if `@tradly/auth` is used)
|
|
775
|
+
- `currency` - Currency code (e.g., "USD", "EUR")
|
|
776
|
+
- `language` - Language code (e.g., "en", "fr")
|
|
777
|
+
- `bodyParam` - Query parameters object (converted to URL query string)
|
|
778
|
+
|
|
779
|
+
### bodyParam Example
|
|
780
|
+
|
|
781
|
+
```javascript
|
|
782
|
+
const [error, response] = await TradlySDK.app.getListings({
|
|
783
|
+
bodyParam: {
|
|
784
|
+
page: 1,
|
|
785
|
+
per_page: 20,
|
|
786
|
+
search: "laptop",
|
|
787
|
+
category_id: 5,
|
|
788
|
+
},
|
|
789
|
+
});
|
|
790
|
+
// Converts to: ?page=1&per_page=20&search=laptop&category_id=5
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
---
|
|
794
|
+
|
|
795
|
+
## Error Handling
|
|
796
|
+
|
|
797
|
+
All methods return error-first callback pattern:
|
|
798
|
+
|
|
799
|
+
```javascript
|
|
800
|
+
const [error, response] = await TradlySDK.app.getListings({});
|
|
801
|
+
|
|
802
|
+
if (error) {
|
|
803
|
+
// Handle error
|
|
804
|
+
console.error("Error Code:", error.code);
|
|
805
|
+
console.error("Error Message:", error.message);
|
|
806
|
+
console.error("Full Error:", error);
|
|
807
|
+
} else {
|
|
808
|
+
// Use response
|
|
809
|
+
console.log("Status:", response.status);
|
|
810
|
+
console.log("Data:", response.data);
|
|
811
|
+
}
|
|
812
|
+
```
|
|
813
|
+
|
|
814
|
+
---
|
|
815
|
+
|
|
816
|
+
## Integration with @tradly/auth
|
|
817
|
+
|
|
818
|
+
### Automatic Key Injection
|
|
819
|
+
|
|
820
|
+
When `@tradly/auth` is installed and initialized:
|
|
821
|
+
|
|
822
|
+
1. **PK Key:** Automatically injected from auth's cache
|
|
823
|
+
2. **Auth Key:** Automatically injected from auth's storage
|
|
824
|
+
3. **Environment:** Synced from auth config
|
|
825
|
+
4. **Base URL:** Uses auth's baseUrl
|
|
826
|
+
|
|
827
|
+
### Manual Override
|
|
828
|
+
|
|
829
|
+
You can still manually provide `authKey` to override auto-injection:
|
|
830
|
+
|
|
831
|
+
```javascript
|
|
832
|
+
// Manual authKey overrides auto-injected key
|
|
833
|
+
const [error, response] = await TradlySDK.app.getListings({
|
|
834
|
+
authKey: "custom-key", // Overrides auto-injected
|
|
835
|
+
bodyParam: {},
|
|
836
|
+
});
|
|
837
|
+
```
|
|
838
|
+
|
|
839
|
+
---
|
|
840
|
+
|
|
841
|
+
## Environment Variables
|
|
842
|
+
|
|
843
|
+
Tradly sdk supports these environments:
|
|
844
|
+
|
|
845
|
+
- `production` - Production API (https://api.tradly.app)
|
|
846
|
+
- `development` - Development API (https://api.dev.tradly.app)
|
|
847
|
+
- `sandbox` - Sandbox API (https://api.sandbox.tradly.app)
|
|
848
|
+
|
|
849
|
+
---
|
|
850
|
+
|
|
851
|
+
## Best Practices
|
|
852
|
+
|
|
853
|
+
1. **Initialize Once:** Initialize auth or tradly once at app startup
|
|
854
|
+
2. **Use Auth Package:** For automatic key management, use `@tradly/auth`
|
|
855
|
+
3. **Error Handling:** Always check for errors before using response
|
|
856
|
+
4. **TypeScript:** Use TypeScript for better type safety
|
|
857
|
+
5. **Async/Await:** Use async/await for cleaner code
|
|
858
|
+
|
|
859
|
+
---
|
|
860
|
+
|
|
861
|
+
## TypeScript Support
|
|
862
|
+
|
|
863
|
+
While tradly is written in JavaScript, it works with TypeScript:
|
|
864
|
+
|
|
865
|
+
```typescript
|
|
866
|
+
import TradlySDK from "tradly";
|
|
867
|
+
|
|
868
|
+
const [error, response]: [any, any] = await TradlySDK.app.getListings({
|
|
869
|
+
bodyParam: {},
|
|
870
|
+
});
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
---
|
|
874
|
+
|
|
875
|
+
## Community Support
|
|
876
|
+
|
|
877
|
+
For general help using Tradly:
|
|
878
|
+
|
|
879
|
+
- [Official Tradly Forum](https://community.tradly.app)
|
|
880
|
+
- [YouTube Channel](https://www.youtube.com/channel/UCRpXlfFBX5nayubY70-IFEA)
|
|
881
|
+
- [API Documentation](https://developer.tradly.app)
|
|
882
|
+
|
|
883
|
+
---
|
|
884
|
+
|
|
885
|
+
## License
|
|
886
|
+
|
|
887
|
+
ISC
|
|
888
|
+
|
|
889
|
+
---
|
|
890
|
+
|
|
891
|
+
## Repository
|
|
892
|
+
|
|
893
|
+
https://github.com/TRADLY-PLATFORM
|
|
894
|
+
|
|
895
|
+
---
|
|
896
|
+
|
|
897
|
+
**Note:** This SDK automatically integrates with `@tradly/auth` when available.
|
|
898
|
+
For authentication, we recommend using `@tradly/auth` package which provides
|
|
899
|
+
automatic key management, storage, and better developer experience.
|