@gofynd/fdk-client-javascript 0.1.35
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/.github/workflows/on_create_release.yml +23 -0
- package/.github/workflows/on_merge_main.yml +38 -0
- package/.github/workflows/on_pull_request.yml +35 -0
- package/.prettierrc +5 -0
- package/LICENSE +21 -0
- package/README.md +118 -0
- package/application.d.ts +3 -0
- package/application.js +6 -0
- package/common.d.ts +4 -0
- package/common.js +9 -0
- package/documentation/application/CART.md +7290 -0
- package/documentation/application/CATALOG.md +9570 -0
- package/documentation/application/COMMON.md +448 -0
- package/documentation/application/COMMUNICATION.md +463 -0
- package/documentation/application/CONFIGURATION.md +2902 -0
- package/documentation/application/CONTENT.md +3350 -0
- package/documentation/application/FILESTORAGE.md +491 -0
- package/documentation/application/LEAD.md +1891 -0
- package/documentation/application/LOGISTIC.md +439 -0
- package/documentation/application/ORDER.md +3428 -0
- package/documentation/application/PAYMENT.md +5035 -0
- package/documentation/application/POSCART.md +7889 -0
- package/documentation/application/README.md +21 -0
- package/documentation/application/REWARDS.md +714 -0
- package/documentation/application/SHARE.md +729 -0
- package/documentation/application/THEME.md +5796 -0
- package/documentation/application/USER.md +4326 -0
- package/documentation/platform/ANALYTICS.md +1150 -0
- package/documentation/platform/AUDITTRAIL.md +572 -0
- package/documentation/platform/BILLING.md +2396 -0
- package/documentation/platform/CART.md +5539 -0
- package/documentation/platform/CATALOG.md +21624 -0
- package/documentation/platform/COMMON.md +448 -0
- package/documentation/platform/COMMUNICATION.md +5714 -0
- package/documentation/platform/COMPANYPROFILE.md +2141 -0
- package/documentation/platform/CONFIGURATION.md +7335 -0
- package/documentation/platform/CONTENT.md +8989 -0
- package/documentation/platform/DISCOUNT.md +773 -0
- package/documentation/platform/FILESTORAGE.md +994 -0
- package/documentation/platform/INVENTORY.md +1775 -0
- package/documentation/platform/LEAD.md +4736 -0
- package/documentation/platform/ORDER.md +3764 -0
- package/documentation/platform/PARTNER.md +216 -0
- package/documentation/platform/PAYMENT.md +3444 -0
- package/documentation/platform/README.md +27 -0
- package/documentation/platform/REWARDS.md +871 -0
- package/documentation/platform/SHARE.md +602 -0
- package/documentation/platform/THEME.md +35725 -0
- package/documentation/platform/USER.md +2305 -0
- package/documentation/platform/WEBHOOK.md +587 -0
- package/documentation/public/CONFIGURATION.md +448 -0
- package/documentation/public/INVENTORY.md +686 -0
- package/documentation/public/WEBHOOK.md +348 -0
- package/index.d.ts +10 -0
- package/index.js +18 -0
- package/jest.config.d.ts +4 -0
- package/jest.config.js +6 -0
- package/package.json +35 -0
- package/platform.d.ts +3 -0
- package/platform.js +6 -0
- package/public.d.ts +3 -0
- package/public.js +6 -0
- package/sdk/application/ApplicationAPIClient.d.ts +11 -0
- package/sdk/application/ApplicationAPIClient.js +44 -0
- package/sdk/application/ApplicationClient.d.ts +40 -0
- package/sdk/application/ApplicationClient.js +84 -0
- package/sdk/application/ApplicationConfig.d.ts +19 -0
- package/sdk/application/ApplicationConfig.js +55 -0
- package/sdk/application/ApplicationModels.d.ts +826 -0
- package/sdk/application/ApplicationModels.js +10474 -0
- package/sdk/application/client/CartApplicationClient.d.ts +432 -0
- package/sdk/application/client/CartApplicationClient.js +1066 -0
- package/sdk/application/client/CatalogApplicationClient.d.ts +694 -0
- package/sdk/application/client/CatalogApplicationClient.js +1629 -0
- package/sdk/application/client/CommonApplicationClient.d.ts +38 -0
- package/sdk/application/client/CommonApplicationClient.js +105 -0
- package/sdk/application/client/CommunicationApplicationClient.d.ts +39 -0
- package/sdk/application/client/CommunicationApplicationClient.js +131 -0
- package/sdk/application/client/ConfigurationApplicationClient.d.ts +210 -0
- package/sdk/application/client/ConfigurationApplicationClient.js +649 -0
- package/sdk/application/client/ContentApplicationClient.d.ts +256 -0
- package/sdk/application/client/ContentApplicationClient.js +785 -0
- package/sdk/application/client/FileStorageApplicationClient.d.ts +88 -0
- package/sdk/application/client/FileStorageApplicationClient.js +214 -0
- package/sdk/application/client/LeadApplicationClient.d.ts +90 -0
- package/sdk/application/client/LeadApplicationClient.js +264 -0
- package/sdk/application/client/LogisticApplicationClient.d.ts +42 -0
- package/sdk/application/client/LogisticApplicationClient.js +128 -0
- package/sdk/application/client/OrderApplicationClient.d.ts +190 -0
- package/sdk/application/client/OrderApplicationClient.js +479 -0
- package/sdk/application/client/PaymentApplicationClient.d.ts +454 -0
- package/sdk/application/client/PaymentApplicationClient.js +1378 -0
- package/sdk/application/client/PosCartApplicationClient.d.ts +449 -0
- package/sdk/application/client/PosCartApplicationClient.js +1123 -0
- package/sdk/application/client/RewardsApplicationClient.d.ts +93 -0
- package/sdk/application/client/RewardsApplicationClient.js +293 -0
- package/sdk/application/client/ShareApplicationClient.d.ts +87 -0
- package/sdk/application/client/ShareApplicationClient.js +268 -0
- package/sdk/application/client/ThemeApplicationClient.d.ts +52 -0
- package/sdk/application/client/ThemeApplicationClient.js +161 -0
- package/sdk/application/client/UserApplicationClient.d.ts +446 -0
- package/sdk/application/client/UserApplicationClient.js +1275 -0
- package/sdk/application/constructUrl.d.ts +5 -0
- package/sdk/application/constructUrl.js +13 -0
- package/sdk/application/index.d.ts +2 -0
- package/sdk/application/index.js +4 -0
- package/sdk/application/models/CartValidator.d.ts +29 -0
- package/sdk/application/models/CartValidator.js +223 -0
- package/sdk/application/models/CatalogValidator.d.ts +33 -0
- package/sdk/application/models/CatalogValidator.js +233 -0
- package/sdk/application/models/CommonValidator.d.ts +5 -0
- package/sdk/application/models/CommonValidator.js +18 -0
- package/sdk/application/models/CommunicationValidator.d.ts +6 -0
- package/sdk/application/models/CommunicationValidator.js +20 -0
- package/sdk/application/models/ConfigurationValidator.d.ts +19 -0
- package/sdk/application/models/ConfigurationValidator.js +88 -0
- package/sdk/application/models/ContentValidator.d.ts +22 -0
- package/sdk/application/models/ContentValidator.js +106 -0
- package/sdk/application/models/FileStorageValidator.d.ts +6 -0
- package/sdk/application/models/FileStorageValidator.js +24 -0
- package/sdk/application/models/LeadValidator.d.ts +10 -0
- package/sdk/application/models/LeadValidator.js +48 -0
- package/sdk/application/models/LogisticValidator.d.ts +6 -0
- package/sdk/application/models/LogisticValidator.js +22 -0
- package/sdk/application/models/OrderValidator.d.ts +15 -0
- package/sdk/application/models/OrderValidator.js +87 -0
- package/sdk/application/models/PaymentValidator.d.ts +40 -0
- package/sdk/application/models/PaymentValidator.js +235 -0
- package/sdk/application/models/PosCartValidator.d.ts +30 -0
- package/sdk/application/models/PosCartValidator.js +232 -0
- package/sdk/application/models/RewardsValidator.d.ts +10 -0
- package/sdk/application/models/RewardsValidator.js +43 -0
- package/sdk/application/models/ShareValidator.d.ts +10 -0
- package/sdk/application/models/ShareValidator.js +44 -0
- package/sdk/application/models/ThemeValidator.d.ts +7 -0
- package/sdk/application/models/ThemeValidator.js +27 -0
- package/sdk/application/models/UserValidator.d.ts +38 -0
- package/sdk/application/models/UserValidator.js +233 -0
- package/sdk/common/AxiosHelper.d.ts +1 -0
- package/sdk/common/AxiosHelper.js +141 -0
- package/sdk/common/Constant.d.ts +294 -0
- package/sdk/common/Constant.js +332 -0
- package/sdk/common/FDKError.d.ts +26 -0
- package/sdk/common/FDKError.js +51 -0
- package/sdk/common/Logger.d.ts +2 -0
- package/sdk/common/Logger.js +85 -0
- package/sdk/common/Paginator.d.ts +16 -0
- package/sdk/common/Paginator.js +26 -0
- package/sdk/common/RequestSigner.d.ts +1 -0
- package/sdk/common/RequestSigner.js +306 -0
- package/sdk/common/Utility.d.ts +9 -0
- package/sdk/common/Utility.js +86 -0
- package/sdk/common/utils.d.ts +14 -0
- package/sdk/common/utils.js +165 -0
- package/sdk/platform/OAuthClient.d.ts +26 -0
- package/sdk/platform/OAuthClient.js +221 -0
- package/sdk/platform/PlatformAPIClient.d.ts +12 -0
- package/sdk/platform/PlatformAPIClient.js +43 -0
- package/sdk/platform/PlatformApplicationClient.d.ts +24398 -0
- package/sdk/platform/PlatformApplicationClient.js +23185 -0
- package/sdk/platform/PlatformApplicationModels.d.ts +333 -0
- package/sdk/platform/PlatformApplicationModels.js +21262 -0
- package/sdk/platform/PlatformClient.d.ts +9535 -0
- package/sdk/platform/PlatformClient.js +12336 -0
- package/sdk/platform/PlatformConfig.d.ts +29 -0
- package/sdk/platform/PlatformConfig.js +36 -0
- package/sdk/platform/PlatformModels.d.ts +1396 -0
- package/sdk/platform/PlatformModels.js +19222 -0
- package/sdk/platform/client/AnalyticsPlatformClient.d.ts +84 -0
- package/sdk/platform/client/AnalyticsPlatformClient.js +215 -0
- package/sdk/platform/client/AuditTrailPlatformClient.d.ts +38 -0
- package/sdk/platform/client/AuditTrailPlatformClient.js +133 -0
- package/sdk/platform/client/BillingPlatformClient.d.ts +109 -0
- package/sdk/platform/client/BillingPlatformClient.js +381 -0
- package/sdk/platform/client/CatalogPlatformClient.d.ts +806 -0
- package/sdk/platform/client/CatalogPlatformClient.js +2462 -0
- package/sdk/platform/client/CommonPlatformClient.d.ts +30 -0
- package/sdk/platform/client/CommonPlatformClient.js +84 -0
- package/sdk/platform/client/CommunicationPlatformClient.d.ts +26 -0
- package/sdk/platform/client/CommunicationPlatformClient.js +72 -0
- package/sdk/platform/client/CompanyProfilePlatformClient.d.ts +182 -0
- package/sdk/platform/client/CompanyProfilePlatformClient.js +540 -0
- package/sdk/platform/client/ConfigurationPlatformClient.d.ts +277 -0
- package/sdk/platform/client/ConfigurationPlatformClient.js +806 -0
- package/sdk/platform/client/DiscountPlatformClient.d.ts +118 -0
- package/sdk/platform/client/DiscountPlatformClient.js +364 -0
- package/sdk/platform/client/FileStoragePlatformClient.d.ts +111 -0
- package/sdk/platform/client/FileStoragePlatformClient.js +268 -0
- package/sdk/platform/client/InventoryPlatformClient.d.ts +125 -0
- package/sdk/platform/client/InventoryPlatformClient.js +409 -0
- package/sdk/platform/client/LeadPlatformClient.d.ts +150 -0
- package/sdk/platform/client/LeadPlatformClient.js +439 -0
- package/sdk/platform/client/OrderPlatformClient.d.ts +190 -0
- package/sdk/platform/client/OrderPlatformClient.js +521 -0
- package/sdk/platform/client/PaymentPlatformClient.d.ts +98 -0
- package/sdk/platform/client/PaymentPlatformClient.js +331 -0
- package/sdk/platform/client/WebhookPlatformClient.d.ts +64 -0
- package/sdk/platform/client/WebhookPlatformClient.js +207 -0
- package/sdk/platform/index.d.ts +2 -0
- package/sdk/platform/index.js +4 -0
- package/sdk/platform/models/AnalyticsValidator.d.ts +7 -0
- package/sdk/platform/models/AnalyticsValidator.js +36 -0
- package/sdk/platform/models/AuditTrailValidator.d.ts +7 -0
- package/sdk/platform/models/AuditTrailValidator.js +26 -0
- package/sdk/platform/models/BillingValidator.d.ts +15 -0
- package/sdk/platform/models/BillingValidator.js +72 -0
- package/sdk/platform/models/CartValidator.d.ts +0 -0
- package/sdk/platform/models/CartValidator.js +0 -0
- package/sdk/platform/models/CatalogValidator.d.ts +74 -0
- package/sdk/platform/models/CatalogValidator.js +484 -0
- package/sdk/platform/models/CommonValidator.d.ts +5 -0
- package/sdk/platform/models/CommonValidator.js +18 -0
- package/sdk/platform/models/CommunicationValidator.d.ts +4 -0
- package/sdk/platform/models/CommunicationValidator.js +11 -0
- package/sdk/platform/models/CompanyProfileValidator.d.ts +17 -0
- package/sdk/platform/models/CompanyProfileValidator.js +93 -0
- package/sdk/platform/models/ConfigurationValidator.d.ts +21 -0
- package/sdk/platform/models/ConfigurationValidator.js +134 -0
- package/sdk/platform/models/ContentValidator.d.ts +0 -0
- package/sdk/platform/models/ContentValidator.js +0 -0
- package/sdk/platform/models/DiscountValidator.d.ts +13 -0
- package/sdk/platform/models/DiscountValidator.js +75 -0
- package/sdk/platform/models/FileStorageValidator.d.ts +9 -0
- package/sdk/platform/models/FileStorageValidator.js +44 -0
- package/sdk/platform/models/InventoryValidator.d.ts +15 -0
- package/sdk/platform/models/InventoryValidator.js +81 -0
- package/sdk/platform/models/LeadValidator.d.ts +14 -0
- package/sdk/platform/models/LeadValidator.js +78 -0
- package/sdk/platform/models/OrderValidator.d.ts +14 -0
- package/sdk/platform/models/OrderValidator.js +110 -0
- package/sdk/platform/models/PartnerValidator.d.ts +0 -0
- package/sdk/platform/models/PartnerValidator.js +0 -0
- package/sdk/platform/models/PaymentValidator.d.ts +13 -0
- package/sdk/platform/models/PaymentValidator.js +65 -0
- package/sdk/platform/models/RewardsValidator.d.ts +0 -0
- package/sdk/platform/models/RewardsValidator.js +0 -0
- package/sdk/platform/models/ShareValidator.d.ts +0 -0
- package/sdk/platform/models/ShareValidator.js +0 -0
- package/sdk/platform/models/ThemeValidator.d.ts +0 -0
- package/sdk/platform/models/ThemeValidator.js +0 -0
- package/sdk/platform/models/UserValidator.d.ts +0 -0
- package/sdk/platform/models/UserValidator.js +0 -0
- package/sdk/platform/models/WebhookValidator.d.ts +9 -0
- package/sdk/platform/models/WebhookValidator.js +42 -0
- package/sdk/public/PublicAPIClient.d.ts +11 -0
- package/sdk/public/PublicAPIClient.js +38 -0
- package/sdk/public/PublicClient.d.ts +12 -0
- package/sdk/public/PublicClient.js +24 -0
- package/sdk/public/PublicConfig.d.ts +10 -0
- package/sdk/public/PublicConfig.js +12 -0
- package/sdk/public/PublicModels.d.ts +50 -0
- package/sdk/public/PublicModels.js +712 -0
- package/sdk/public/client/ConfigurationPublicClient.d.ts +38 -0
- package/sdk/public/client/ConfigurationPublicClient.js +102 -0
- package/sdk/public/client/InventoryPublicClient.d.ts +81 -0
- package/sdk/public/client/InventoryPublicClient.js +239 -0
- package/sdk/public/client/WebhookPublicClient.d.ts +28 -0
- package/sdk/public/client/WebhookPublicClient.js +92 -0
- package/sdk/public/constructUrl.d.ts +5 -0
- package/sdk/public/constructUrl.js +13 -0
- package/sdk/public/index.d.ts +2 -0
- package/sdk/public/index.js +4 -0
- package/sdk/public/models/ConfigurationValidator.d.ts +5 -0
- package/sdk/public/models/ConfigurationValidator.js +18 -0
- package/sdk/public/models/InventoryValidator.d.ts +9 -0
- package/sdk/public/models/InventoryValidator.js +43 -0
- package/sdk/public/models/WebhookValidator.d.ts +5 -0
- package/sdk/public/models/WebhookValidator.js +14 -0
- package/tests/application/catalog.spec.js +47 -0
- package/tests/common/action-url.spec.js +35 -0
- package/tests/common/schema/action-url.json +163 -0
- package/tests/common/schema/url-action.json +667 -0
- package/tests/common/url-action.spec.js +48 -0
- package/tests/helpers/cookie.helper.js +31 -0
- package/tests/helpers/oauth.helper.js +43 -0
- package/tests/platform/catalog.spec.js +49 -0
- package/tests/public/location.spec.js +39 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
##### [Back to Public docs](./README.md)
|
|
6
|
+
|
|
7
|
+
## Webhook Methods
|
|
8
|
+
Webhook dispatcher with retry and one event to many subscriber vice versa
|
|
9
|
+
* [fetchAllWebhookEvents](#fetchallwebhookevents)
|
|
10
|
+
* [queryWebhookEventDetails](#querywebhookeventdetails)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Methods with example and description
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### fetchAllWebhookEvents
|
|
18
|
+
Get All Webhook Events
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
```javascript
|
|
23
|
+
// Promise
|
|
24
|
+
const promise = webhook.fetchAllWebhookEvents();
|
|
25
|
+
|
|
26
|
+
// Async/Await
|
|
27
|
+
const data = await webhook.fetchAllWebhookEvents();
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
Get All Webhook Events
|
|
36
|
+
|
|
37
|
+
*Returned Response:*
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
[EventConfigResponse](#EventConfigResponse)
|
|
43
|
+
|
|
44
|
+
Success
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<details>
|
|
50
|
+
<summary><i> Example:</i></summary>
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
</details>
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### queryWebhookEventDetails
|
|
69
|
+
Send webhook event name, type, version, category in request body to get complete details of event from server
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
```javascript
|
|
74
|
+
// Promise
|
|
75
|
+
const promise = webhook.queryWebhookEventDetails({ body : value });
|
|
76
|
+
|
|
77
|
+
// Async/Await
|
|
78
|
+
const data = await webhook.queryWebhookEventDetails({ body : value });
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
| Argument | Type | Required | Description |
|
|
86
|
+
| --------- | ----- | -------- | ----------- |
|
|
87
|
+
| body | [Array<EventConfigBase>](#Array<EventConfigBase>) | yes | Request body |
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
Get Webhook Event Details for provided events
|
|
91
|
+
|
|
92
|
+
*Returned Response:*
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
[EventConfigResponse](#EventConfigResponse)
|
|
98
|
+
|
|
99
|
+
Success
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
<details>
|
|
105
|
+
<summary><i> Example:</i></summary>
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
</details>
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
### Schemas
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
#### [EventConfig](#EventConfig)
|
|
129
|
+
|
|
130
|
+
| Properties | Type | Nullable | Description |
|
|
131
|
+
| ---------- | ---- | -------- | ----------- |
|
|
132
|
+
| id | number | no | |
|
|
133
|
+
| event_name | string | no | |
|
|
134
|
+
| event_type | string | no | |
|
|
135
|
+
| event_category | string | no | |
|
|
136
|
+
| version | string | no | |
|
|
137
|
+
| display_name | string | no | |
|
|
138
|
+
| description | string | no | |
|
|
139
|
+
| created_on | string | no | |
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
#### [EventConfigList](#EventConfigList)
|
|
147
|
+
|
|
148
|
+
| Properties | Type | Nullable | Description |
|
|
149
|
+
| ---------- | ---- | -------- | ----------- |
|
|
150
|
+
| items | [[EventConfig](#EventConfig)] | no | |
|
|
151
|
+
| page | [Page](#Page) | no | |
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
#### [EventConfigResponse](#EventConfigResponse)
|
|
159
|
+
|
|
160
|
+
| Properties | Type | Nullable | Description |
|
|
161
|
+
| ---------- | ---- | -------- | ----------- |
|
|
162
|
+
| event_configs | [[EventConfig](#EventConfig)] | no | |
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
#### [SubscriberConfigList](#SubscriberConfigList)
|
|
170
|
+
|
|
171
|
+
| Properties | Type | Nullable | Description |
|
|
172
|
+
| ---------- | ---- | -------- | ----------- |
|
|
173
|
+
| items | [[SubscriberResponse](#SubscriberResponse)] | no | |
|
|
174
|
+
| page | [Page](#Page) | no | |
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
#### [Page](#Page)
|
|
182
|
+
|
|
183
|
+
| Properties | Type | Nullable | Description |
|
|
184
|
+
| ---------- | ---- | -------- | ----------- |
|
|
185
|
+
| item_total | number | no | |
|
|
186
|
+
| next_id | string | no | |
|
|
187
|
+
| has_previous | boolean | no | |
|
|
188
|
+
| has_next | boolean | no | |
|
|
189
|
+
| current | number | no | |
|
|
190
|
+
| type | string | yes | |
|
|
191
|
+
| size | number | no | |
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
#### [EventProcessedStatus](#EventProcessedStatus)
|
|
199
|
+
|
|
200
|
+
| Properties | Type | Nullable | Description |
|
|
201
|
+
| ---------- | ---- | -------- | ----------- |
|
|
202
|
+
| id | number | no | |
|
|
203
|
+
| subscriber_id | string | no | |
|
|
204
|
+
| attempt | number | no | |
|
|
205
|
+
| response_code | string | no | |
|
|
206
|
+
| response_message | string | no | |
|
|
207
|
+
| created_on | string | no | |
|
|
208
|
+
| processed_on | string | no | |
|
|
209
|
+
| status | boolean | no | |
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
#### [EventPayload](#EventPayload)
|
|
217
|
+
|
|
218
|
+
| Properties | Type | Nullable | Description |
|
|
219
|
+
| ---------- | ---- | -------- | ----------- |
|
|
220
|
+
| id | number | no | |
|
|
221
|
+
| event_trace_id | string | no | |
|
|
222
|
+
| message_id | string | no | |
|
|
223
|
+
| event_name | string | no | |
|
|
224
|
+
| event_type | string | no | |
|
|
225
|
+
| version | string | no | |
|
|
226
|
+
| status | boolean | no | |
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
#### [SubscriberConfig](#SubscriberConfig)
|
|
234
|
+
|
|
235
|
+
| Properties | Type | Nullable | Description |
|
|
236
|
+
| ---------- | ---- | -------- | ----------- |
|
|
237
|
+
| id | number | no | |
|
|
238
|
+
| name | string | no | |
|
|
239
|
+
| webhook_url | string | no | |
|
|
240
|
+
| association | [Association](#Association) | no | |
|
|
241
|
+
| custom_headers | string | no | |
|
|
242
|
+
| status | [SubscriberStatus](#SubscriberStatus) | no | |
|
|
243
|
+
| email_id | string | no | |
|
|
244
|
+
| auth_meta | [AuthMeta](#AuthMeta) | no | |
|
|
245
|
+
| event_id | [number] | no | |
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
#### [SubscriberResponse](#SubscriberResponse)
|
|
253
|
+
|
|
254
|
+
| Properties | Type | Nullable | Description |
|
|
255
|
+
| ---------- | ---- | -------- | ----------- |
|
|
256
|
+
| id | number | no | |
|
|
257
|
+
| name | string | no | |
|
|
258
|
+
| webhook_url | string | no | |
|
|
259
|
+
| association | [Association](#Association) | no | |
|
|
260
|
+
| custom_headers | string | no | |
|
|
261
|
+
| email_id | string | no | |
|
|
262
|
+
| status | [SubscriberStatus](#SubscriberStatus) | no | |
|
|
263
|
+
| auth_meta | [AuthMeta](#AuthMeta) | no | |
|
|
264
|
+
| created_on | string | no | |
|
|
265
|
+
| updated_on | string | no | |
|
|
266
|
+
| event_configs | [[EventConfig](#EventConfig)] | no | |
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
#### [SubscriberEvent](#SubscriberEvent)
|
|
274
|
+
|
|
275
|
+
| Properties | Type | Nullable | Description |
|
|
276
|
+
| ---------- | ---- | -------- | ----------- |
|
|
277
|
+
| id | number | no | |
|
|
278
|
+
| subscriber_id | number | no | |
|
|
279
|
+
| event_id | number | no | |
|
|
280
|
+
| created_date | string | no | |
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
#### [AuthMeta](#AuthMeta)
|
|
288
|
+
|
|
289
|
+
| Properties | Type | Nullable | Description |
|
|
290
|
+
| ---------- | ---- | -------- | ----------- |
|
|
291
|
+
| type | string | no | |
|
|
292
|
+
| secret | string | no | |
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
#### [Association](#Association)
|
|
300
|
+
|
|
301
|
+
| Properties | Type | Nullable | Description |
|
|
302
|
+
| ---------- | ---- | -------- | ----------- |
|
|
303
|
+
| company_id | number | no | |
|
|
304
|
+
| application_id | [string] | no | |
|
|
305
|
+
| extension_id | string | no | |
|
|
306
|
+
| criteria | string | no | |
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
#### [EventConfigBase](#EventConfigBase)
|
|
314
|
+
|
|
315
|
+
| Properties | Type | Nullable | Description |
|
|
316
|
+
| ---------- | ---- | -------- | ----------- |
|
|
317
|
+
| event_name | string | no | |
|
|
318
|
+
| event_type | string | no | |
|
|
319
|
+
| event_category | string | no | |
|
|
320
|
+
| version | string | no | |
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
### Enums
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
#### [SubscriberStatus](#SubscriberStatus)
|
|
334
|
+
Type : string
|
|
335
|
+
|
|
336
|
+
| Name | Value | Description |
|
|
337
|
+
| ---- | ----- | ----------- |
|
|
338
|
+
| active | active | Status is active |
|
|
339
|
+
| inactive | inactive | Status is inactive |
|
|
340
|
+
| blocked | blocked | Subscriber is blocked by system due to multiple failed delivery attempts. |
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ApplicationConfig } from "./sdk/application";
|
|
2
|
+
import { ApplicationClient } from "./sdk/application";
|
|
3
|
+
import { PlatformConfig } from "./sdk/platform";
|
|
4
|
+
import { PlatformClient } from "./sdk/platform";
|
|
5
|
+
import { PublicConfig } from "./sdk/public";
|
|
6
|
+
import { PublicClient } from "./sdk/public";
|
|
7
|
+
import { fdkAxios } from "./sdk/common/AxiosHelper";
|
|
8
|
+
import Utility = require("./sdk/common/Utility");
|
|
9
|
+
import Constant = require("./sdk/common/Constant");
|
|
10
|
+
export { ApplicationConfig, ApplicationClient, PlatformConfig, PlatformClient, PublicConfig, PublicClient, fdkAxios as FdkAxios, Utility, Constant };
|
package/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const {ApplicationConfig, ApplicationClient} = require('./sdk/application');
|
|
2
|
+
const {PlatformConfig, PlatformClient} = require('./sdk/platform');
|
|
3
|
+
const {PublicConfig, PublicClient} = require('./sdk/public');
|
|
4
|
+
const {fdkAxios} = require('./sdk/common/AxiosHelper');
|
|
5
|
+
const Utility = require('./sdk/common/Utility');
|
|
6
|
+
const Constant = require('./sdk/common/Constant');
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
ApplicationConfig,
|
|
10
|
+
ApplicationClient,
|
|
11
|
+
PlatformConfig,
|
|
12
|
+
PlatformClient,
|
|
13
|
+
PublicConfig,
|
|
14
|
+
PublicClient,
|
|
15
|
+
FdkAxios: fdkAxios,
|
|
16
|
+
Utility,
|
|
17
|
+
Constant,
|
|
18
|
+
};
|
package/jest.config.d.ts
ADDED
package/jest.config.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gofynd/fdk-client-javascript",
|
|
3
|
+
"version": "0.1.35",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "jest --coverage",
|
|
8
|
+
"prettier": "npx prettier -w ./sdk ./tests && npx tsc"
|
|
9
|
+
},
|
|
10
|
+
"jest": {
|
|
11
|
+
"coverageThreshold": {
|
|
12
|
+
"global": {
|
|
13
|
+
"branches": 0,
|
|
14
|
+
"functions": 0,
|
|
15
|
+
"lines": 0
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"author": "Jigar Dafda<jigar.dafda@gmail.com>",
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"axios": "^0.21.1",
|
|
23
|
+
"crypto-js": "^4.0.0",
|
|
24
|
+
"joi": "^17.4.0",
|
|
25
|
+
"query-string": "^6.14.1",
|
|
26
|
+
"loglevel": "^1.8.0",
|
|
27
|
+
"camelcase": "^6.2.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"axios-mock-adapter": "^1.19.0",
|
|
31
|
+
"coveralls": "^3.1.0",
|
|
32
|
+
"dotenv": "^10.0.0",
|
|
33
|
+
"jest": "^26.6.3"
|
|
34
|
+
}
|
|
35
|
+
}
|
package/platform.d.ts
ADDED
package/platform.js
ADDED
package/public.d.ts
ADDED
package/public.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export = APIClient;
|
|
2
|
+
declare class APIClient {
|
|
3
|
+
/**
|
|
4
|
+
* @param {object} conf
|
|
5
|
+
* @param {string} method
|
|
6
|
+
* @param {string} url
|
|
7
|
+
* @param {object} query
|
|
8
|
+
* @param {object} body
|
|
9
|
+
*/
|
|
10
|
+
static execute(conf: object, method: string, url: string, query: object, body: object, xHeaders: any): any;
|
|
11
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const { fdkAxios } = require("../common/AxiosHelper");
|
|
2
|
+
|
|
3
|
+
class APIClient {
|
|
4
|
+
/**
|
|
5
|
+
* @param {object} conf
|
|
6
|
+
* @param {string} method
|
|
7
|
+
* @param {string} url
|
|
8
|
+
* @param {object} query
|
|
9
|
+
* @param {object} body
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
static execute(conf, method, url, query, body, xHeaders) {
|
|
13
|
+
const token = Buffer.from(
|
|
14
|
+
`${conf.applicationID}:${conf.applicationToken}`,
|
|
15
|
+
"utf8"
|
|
16
|
+
).toString("base64");
|
|
17
|
+
|
|
18
|
+
let headers = { Authorization: "Bearer " + token };
|
|
19
|
+
if (conf.cookie) {
|
|
20
|
+
headers = { ...headers, cookie: conf.cookie };
|
|
21
|
+
}
|
|
22
|
+
if (conf.locationDetails) {
|
|
23
|
+
headers = {
|
|
24
|
+
...headers,
|
|
25
|
+
"x-location-detail": JSON.stringify(conf.locationDetails),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const extraHeaders = conf.extraHeaders.reduce((acc, curr) => {
|
|
29
|
+
acc = { ...acc, ...curr };
|
|
30
|
+
return acc;
|
|
31
|
+
}, {});
|
|
32
|
+
|
|
33
|
+
const rawRequest = {
|
|
34
|
+
method: method,
|
|
35
|
+
url: url,
|
|
36
|
+
params: query,
|
|
37
|
+
data: body,
|
|
38
|
+
headers: { ...headers, ...extraHeaders, ...xHeaders },
|
|
39
|
+
};
|
|
40
|
+
return fdkAxios.request(rawRequest);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = APIClient;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export = ApplicationClient;
|
|
2
|
+
declare class ApplicationClient {
|
|
3
|
+
constructor(config: any);
|
|
4
|
+
config: any;
|
|
5
|
+
catalog: Catalog;
|
|
6
|
+
cart: Cart;
|
|
7
|
+
common: Common;
|
|
8
|
+
lead: Lead;
|
|
9
|
+
theme: Theme;
|
|
10
|
+
user: User;
|
|
11
|
+
content: Content;
|
|
12
|
+
communication: Communication;
|
|
13
|
+
share: Share;
|
|
14
|
+
fileStorage: FileStorage;
|
|
15
|
+
configuration: Configuration;
|
|
16
|
+
payment: Payment;
|
|
17
|
+
order: Order;
|
|
18
|
+
rewards: Rewards;
|
|
19
|
+
posCart: PosCart;
|
|
20
|
+
logistic: Logistic;
|
|
21
|
+
setCookie(cookie: any): void;
|
|
22
|
+
setLocationDetails(locationDetails: any): void;
|
|
23
|
+
setExtraHeaders(header: any): void;
|
|
24
|
+
}
|
|
25
|
+
import Catalog = require("./client/CatalogApplicationClient");
|
|
26
|
+
import Cart = require("./client/CartApplicationClient");
|
|
27
|
+
import Common = require("./client/CommonApplicationClient");
|
|
28
|
+
import Lead = require("./client/LeadApplicationClient");
|
|
29
|
+
import Theme = require("./client/ThemeApplicationClient");
|
|
30
|
+
import User = require("./client/UserApplicationClient");
|
|
31
|
+
import Content = require("./client/ContentApplicationClient");
|
|
32
|
+
import Communication = require("./client/CommunicationApplicationClient");
|
|
33
|
+
import Share = require("./client/ShareApplicationClient");
|
|
34
|
+
import FileStorage = require("./client/FileStorageApplicationClient");
|
|
35
|
+
import Configuration = require("./client/ConfigurationApplicationClient");
|
|
36
|
+
import Payment = require("./client/PaymentApplicationClient");
|
|
37
|
+
import Order = require("./client/OrderApplicationClient");
|
|
38
|
+
import Rewards = require("./client/RewardsApplicationClient");
|
|
39
|
+
import PosCart = require("./client/PosCartApplicationClient");
|
|
40
|
+
import Logistic = require("./client/LogisticApplicationClient");
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const { LocationValidator } = require("./ApplicationModels");
|
|
2
|
+
|
|
3
|
+
const Catalog = require("./client/CatalogApplicationClient");
|
|
4
|
+
|
|
5
|
+
const Cart = require("./client/CartApplicationClient");
|
|
6
|
+
|
|
7
|
+
const Common = require("./client/CommonApplicationClient");
|
|
8
|
+
|
|
9
|
+
const Lead = require("./client/LeadApplicationClient");
|
|
10
|
+
|
|
11
|
+
const Theme = require("./client/ThemeApplicationClient");
|
|
12
|
+
|
|
13
|
+
const User = require("./client/UserApplicationClient");
|
|
14
|
+
|
|
15
|
+
const Content = require("./client/ContentApplicationClient");
|
|
16
|
+
|
|
17
|
+
const Communication = require("./client/CommunicationApplicationClient");
|
|
18
|
+
|
|
19
|
+
const Share = require("./client/ShareApplicationClient");
|
|
20
|
+
|
|
21
|
+
const FileStorage = require("./client/FileStorageApplicationClient");
|
|
22
|
+
|
|
23
|
+
const Configuration = require("./client/ConfigurationApplicationClient");
|
|
24
|
+
|
|
25
|
+
const Payment = require("./client/PaymentApplicationClient");
|
|
26
|
+
|
|
27
|
+
const Order = require("./client/OrderApplicationClient");
|
|
28
|
+
|
|
29
|
+
const Rewards = require("./client/RewardsApplicationClient");
|
|
30
|
+
|
|
31
|
+
const PosCart = require("./client/PosCartApplicationClient");
|
|
32
|
+
|
|
33
|
+
const Logistic = require("./client/LogisticApplicationClient");
|
|
34
|
+
|
|
35
|
+
const { FDKClientValidationError } = require("../common/FDKError");
|
|
36
|
+
|
|
37
|
+
class ApplicationClient {
|
|
38
|
+
constructor(config) {
|
|
39
|
+
this.config = config;
|
|
40
|
+
this.catalog = new Catalog(config);
|
|
41
|
+
this.cart = new Cart(config);
|
|
42
|
+
this.common = new Common(config);
|
|
43
|
+
this.lead = new Lead(config);
|
|
44
|
+
this.theme = new Theme(config);
|
|
45
|
+
this.user = new User(config);
|
|
46
|
+
this.content = new Content(config);
|
|
47
|
+
this.communication = new Communication(config);
|
|
48
|
+
this.share = new Share(config);
|
|
49
|
+
this.fileStorage = new FileStorage(config);
|
|
50
|
+
this.configuration = new Configuration(config);
|
|
51
|
+
this.payment = new Payment(config);
|
|
52
|
+
this.order = new Order(config);
|
|
53
|
+
this.rewards = new Rewards(config);
|
|
54
|
+
this.posCart = new PosCart(config);
|
|
55
|
+
this.logistic = new Logistic(config);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
setCookie(cookie) {
|
|
59
|
+
this.config.cookie = cookie;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
setLocationDetails(locationDetails) {
|
|
63
|
+
const {
|
|
64
|
+
error,
|
|
65
|
+
} = LocationValidator.validateLocationObj().validate(locationDetails, {
|
|
66
|
+
abortEarly: false,
|
|
67
|
+
allowUnknown: true,
|
|
68
|
+
});
|
|
69
|
+
if (error) {
|
|
70
|
+
throw new FDKClientValidationError(error);
|
|
71
|
+
}
|
|
72
|
+
this.config.locationDetails = locationDetails;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
setExtraHeaders(header) {
|
|
76
|
+
if (typeof header === "object") {
|
|
77
|
+
this.config.extraHeaders.push(header);
|
|
78
|
+
} else {
|
|
79
|
+
throw new FDKClientValidationError("Context value should be an object");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
module.exports = ApplicationClient;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export = ApplicationConfig;
|
|
2
|
+
declare class ApplicationConfig {
|
|
3
|
+
/**
|
|
4
|
+
* @param {object} _conf
|
|
5
|
+
* @param {object} [_opts]
|
|
6
|
+
*/
|
|
7
|
+
constructor(_conf: object, _opts?: object);
|
|
8
|
+
applicationID: any;
|
|
9
|
+
applicationToken: any;
|
|
10
|
+
opts: any;
|
|
11
|
+
domain: any;
|
|
12
|
+
logLevel: any;
|
|
13
|
+
extraHeaders: any[];
|
|
14
|
+
locationDetails: any;
|
|
15
|
+
setLogLevel(level: any): void;
|
|
16
|
+
setCookie(cookie: any): void;
|
|
17
|
+
cookie: any;
|
|
18
|
+
validate(): void;
|
|
19
|
+
}
|