@gofynd/fdk-client-javascript 1.0.1 → 1.0.2

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.
Files changed (134) hide show
  1. package/documentation/application/CART.md +251 -251
  2. package/documentation/application/CATALOG.md +414 -414
  3. package/documentation/application/CONTENT.md +15 -1
  4. package/documentation/application/ORDER.md +290 -290
  5. package/documentation/application/PAYMENT.md +255 -255
  6. package/documentation/application/POSCART.md +297 -297
  7. package/documentation/platform/CART.md +499 -499
  8. package/documentation/platform/CATALOG.md +3088 -2702
  9. package/documentation/platform/COMPANYPROFILE.md +201 -201
  10. package/documentation/platform/CONTENT.md +123 -1
  11. package/documentation/platform/ORDER.md +1233 -1158
  12. package/documentation/platform/PARTNER.md +7 -7
  13. package/documentation/platform/PAYMENT.md +83 -83
  14. package/package.json +1 -1
  15. package/sdk/application/ApplicationConfig.js +1 -1
  16. package/sdk/application/Cart/CartApplicationClient.js +619 -108
  17. package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
  18. package/sdk/application/Cart/CartApplicationModel.js +335 -335
  19. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
  20. package/sdk/application/Catalog/CatalogApplicationClient.js +730 -134
  21. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +21 -21
  22. package/sdk/application/Catalog/CatalogApplicationModel.js +547 -547
  23. package/sdk/application/Common/CommonApplicationClient.js +48 -8
  24. package/sdk/application/Communication/CommunicationApplicationClient.js +75 -14
  25. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
  26. package/sdk/application/Configuration/ConfigurationApplicationClient.js +392 -66
  27. package/sdk/application/Content/ContentApplicationClient.js +444 -76
  28. package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
  29. package/sdk/application/Content/ContentApplicationModel.js +11 -1
  30. package/sdk/application/FileStorage/FileStorageApplicationClient.js +74 -12
  31. package/sdk/application/Lead/LeadApplicationClient.js +164 -30
  32. package/sdk/application/Logistic/LogisticApplicationClient.js +98 -16
  33. package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
  34. package/sdk/application/Order/OrderApplicationClient.js +287 -54
  35. package/sdk/application/Order/OrderApplicationModel.d.ts +19 -19
  36. package/sdk/application/Order/OrderApplicationModel.js +357 -357
  37. package/sdk/application/Payment/PaymentApplicationClient.js +961 -186
  38. package/sdk/application/Payment/PaymentApplicationModel.d.ts +3 -3
  39. package/sdk/application/Payment/PaymentApplicationModel.js +352 -352
  40. package/sdk/application/PosCart/PosCartApplicationClient.js +645 -114
  41. package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
  42. package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
  43. package/sdk/application/Rewards/RewardsApplicationClient.js +168 -28
  44. package/sdk/application/Share/ShareApplicationClient.js +157 -32
  45. package/sdk/application/Theme/ThemeApplicationClient.js +94 -16
  46. package/sdk/application/User/UserApplicationClient.js +806 -148
  47. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
  48. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +191 -34
  49. package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
  50. package/sdk/platform/Analytics/AnalyticsPlatformClient.js +103 -16
  51. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
  52. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +103 -16
  53. package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
  54. package/sdk/platform/Billing/BillingPlatformClient.js +299 -54
  55. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
  56. package/sdk/platform/Cart/CartPlatformApplicationClient.js +409 -72
  57. package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
  58. package/sdk/platform/Cart/CartPlatformModel.js +617 -617
  59. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +167 -114
  60. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1562 -453
  61. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +8 -8
  62. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +39 -39
  63. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +314 -196
  64. package/sdk/platform/Catalog/CatalogPlatformClient.js +2459 -718
  65. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +103 -94
  66. package/sdk/platform/Catalog/CatalogPlatformModel.js +2063 -1797
  67. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +17 -15
  68. package/sdk/platform/Catalog/CatalogPlatformValidator.js +95 -76
  69. package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
  70. package/sdk/platform/Common/CommonPlatformClient.js +51 -8
  71. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
  72. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1000 -168
  73. package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
  74. package/sdk/platform/Communication/CommunicationPlatformClient.js +28 -4
  75. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
  76. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +335 -54
  77. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +10 -10
  78. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +278 -278
  79. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
  80. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +702 -118
  81. package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
  82. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +457 -82
  83. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
  84. package/sdk/platform/Content/ContentPlatformApplicationClient.js +1724 -284
  85. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
  86. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
  87. package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
  88. package/sdk/platform/Content/ContentPlatformModel.js +43 -1
  89. package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
  90. package/sdk/platform/Discount/DiscountPlatformClient.js +270 -44
  91. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
  92. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +102 -16
  93. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
  94. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +150 -24
  95. package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
  96. package/sdk/platform/Inventory/InventoryPlatformClient.js +316 -52
  97. package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
  98. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +311 -52
  99. package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
  100. package/sdk/platform/Lead/LeadPlatformClient.js +266 -44
  101. package/sdk/platform/OAuthClient.js +8 -8
  102. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
  103. package/sdk/platform/Order/OrderPlatformApplicationClient.js +78 -14
  104. package/sdk/platform/Order/OrderPlatformClient.d.ts +95 -43
  105. package/sdk/platform/Order/OrderPlatformClient.js +1062 -180
  106. package/sdk/platform/Order/OrderPlatformModel.d.ts +64 -60
  107. package/sdk/platform/Order/OrderPlatformModel.js +1481 -1425
  108. package/sdk/platform/Order/OrderPlatformValidator.js +5 -0
  109. package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
  110. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -8
  111. package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
  112. package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
  113. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
  114. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +287 -56
  115. package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
  116. package/sdk/platform/Payment/PaymentPlatformClient.js +263 -48
  117. package/sdk/platform/Payment/PaymentPlatformModel.js +122 -122
  118. package/sdk/platform/PlatformApplicationClient.d.ts +2959 -2787
  119. package/sdk/platform/PlatformApplicationClient.js +3420 -3212
  120. package/sdk/platform/PlatformClient.d.ts +2959 -2787
  121. package/sdk/platform/PlatformClient.js +3420 -3212
  122. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
  123. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +308 -54
  124. package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
  125. package/sdk/platform/Share/SharePlatformApplicationClient.js +94 -16
  126. package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
  127. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +571 -96
  128. package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
  129. package/sdk/platform/User/UserPlatformApplicationClient.js +296 -48
  130. package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
  131. package/sdk/platform/Webhook/WebhookPlatformClient.js +157 -30
  132. package/sdk/public/Configuration/ConfigurationPublicClient.js +51 -8
  133. package/sdk/public/Inventory/InventoryPublicClient.js +149 -26
  134. package/sdk/public/Webhook/WebhookPublicClient.js +51 -10
@@ -3,6 +3,8 @@ const constructUrl = require("../constructUrl");
3
3
  const Paginator = require("../../common/Paginator");
4
4
  const { FDKClientValidationError } = require("../../common/FDKError");
5
5
  const CommonValidator = require("./CommonApplicationValidator");
6
+ const CommonModel = require("./CommonApplicationModel");
7
+ const { Logger } = require("./../../common/Logger");
6
8
 
7
9
  class Common {
8
10
  constructor(_conf) {
@@ -36,7 +38,7 @@ class Common {
36
38
  * @summary: Search Application
37
39
  * @description: Provide application name or domain url
38
40
  */
39
- searchApplication({ authorization, query } = {}) {
41
+ async searchApplication({ authorization, query } = {}) {
40
42
  const { error } = CommonValidator.searchApplication().validate(
41
43
  { authorization, query },
42
44
  { abortEarly: false, allowUnknown: true }
@@ -51,8 +53,11 @@ class Common {
51
53
  { abortEarly: false, allowUnknown: false }
52
54
  );
53
55
  if (warrning) {
54
- console.log("Parameter Validation warrnings for searchApplication");
55
- console.log(warrning);
56
+ Logger({
57
+ level: "WARN",
58
+ message: "Parameter Validation warrnings for searchApplication",
59
+ });
60
+ Logger({ level: "WARN", message: warrning });
56
61
  }
57
62
 
58
63
  const query_params = {};
@@ -61,7 +66,7 @@ class Common {
61
66
  const xHeaders = {};
62
67
  xHeaders["authorization"] = authorization;
63
68
 
64
- return APIClient.execute(
69
+ const response = await APIClient.execute(
65
70
  this._conf,
66
71
  "get",
67
72
  constructUrl({
@@ -72,6 +77,23 @@ class Common {
72
77
  undefined,
73
78
  xHeaders
74
79
  );
80
+
81
+ const {
82
+ error: res_error,
83
+ } = CommonModel.ApplicationResponse().validate(response, {
84
+ abortEarly: false,
85
+ allowUnknown: false,
86
+ });
87
+
88
+ if (res_error) {
89
+ Logger({
90
+ level: "WARN",
91
+ message: "Response Validation Warnnings for searchApplication",
92
+ });
93
+ Logger({ level: "WARN", message: res_error });
94
+ }
95
+
96
+ return response;
75
97
  }
76
98
 
77
99
  /**
@@ -85,7 +107,7 @@ class Common {
85
107
  * @summary: Get countries, states, cities
86
108
  * @description:
87
109
  */
88
- getLocations({ locationType, id } = {}) {
110
+ async getLocations({ locationType, id } = {}) {
89
111
  const { error } = CommonValidator.getLocations().validate(
90
112
  { locationType, id },
91
113
  { abortEarly: false, allowUnknown: true }
@@ -100,8 +122,11 @@ class Common {
100
122
  { abortEarly: false, allowUnknown: false }
101
123
  );
102
124
  if (warrning) {
103
- console.log("Parameter Validation warrnings for getLocations");
104
- console.log(warrning);
125
+ Logger({
126
+ level: "WARN",
127
+ message: "Parameter Validation warrnings for getLocations",
128
+ });
129
+ Logger({ level: "WARN", message: warrning });
105
130
  }
106
131
 
107
132
  const query_params = {};
@@ -110,7 +135,7 @@ class Common {
110
135
 
111
136
  const xHeaders = {};
112
137
 
113
- return APIClient.execute(
138
+ const response = await APIClient.execute(
114
139
  this._conf,
115
140
  "get",
116
141
  constructUrl({
@@ -121,6 +146,21 @@ class Common {
121
146
  undefined,
122
147
  xHeaders
123
148
  );
149
+
150
+ const { error: res_error } = CommonModel.Locations().validate(response, {
151
+ abortEarly: false,
152
+ allowUnknown: false,
153
+ });
154
+
155
+ if (res_error) {
156
+ Logger({
157
+ level: "WARN",
158
+ message: "Response Validation Warnnings for getLocations",
159
+ });
160
+ Logger({ level: "WARN", message: res_error });
161
+ }
162
+
163
+ return response;
124
164
  }
125
165
  }
126
166
 
@@ -3,6 +3,8 @@ const constructUrl = require("../constructUrl");
3
3
  const Paginator = require("../../common/Paginator");
4
4
  const { FDKClientValidationError } = require("../../common/FDKError");
5
5
  const CommunicationValidator = require("./CommunicationApplicationValidator");
6
+ const CommunicationModel = require("./CommunicationApplicationModel");
7
+ const { Logger } = require("./../../common/Logger");
6
8
 
7
9
  class Communication {
8
10
  constructor(_conf) {
@@ -36,7 +38,7 @@ class Communication {
36
38
  * @summary: Get communication consent
37
39
  * @description: Use this API to retrieve the consent provided by the user for receiving communication messages over Email/SMS/WhatsApp.
38
40
  */
39
- getCommunicationConsent({} = {}) {
41
+ async getCommunicationConsent({} = {}) {
40
42
  const { error } = CommunicationValidator.getCommunicationConsent().validate(
41
43
  {},
42
44
  { abortEarly: false, allowUnknown: true }
@@ -53,15 +55,18 @@ class Communication {
53
55
  { abortEarly: false, allowUnknown: false }
54
56
  );
55
57
  if (warrning) {
56
- console.log("Parameter Validation warrnings for getCommunicationConsent");
57
- console.log(warrning);
58
+ Logger({
59
+ level: "WARN",
60
+ message: "Parameter Validation warrnings for getCommunicationConsent",
61
+ });
62
+ Logger({ level: "WARN", message: warrning });
58
63
  }
59
64
 
60
65
  const query_params = {};
61
66
 
62
67
  const xHeaders = {};
63
68
 
64
- return APIClient.execute(
69
+ const response = await APIClient.execute(
65
70
  this._conf,
66
71
  "get",
67
72
  constructUrl({
@@ -72,6 +77,23 @@ class Communication {
72
77
  undefined,
73
78
  xHeaders
74
79
  );
80
+
81
+ const {
82
+ error: res_error,
83
+ } = CommunicationModel.CommunicationConsent().validate(response, {
84
+ abortEarly: false,
85
+ allowUnknown: false,
86
+ });
87
+
88
+ if (res_error) {
89
+ Logger({
90
+ level: "WARN",
91
+ message: "Response Validation Warnnings for getCommunicationConsent",
92
+ });
93
+ Logger({ level: "WARN", message: res_error });
94
+ }
95
+
96
+ return response;
75
97
  }
76
98
 
77
99
  /**
@@ -81,7 +103,7 @@ class Communication {
81
103
  * @summary: Upsert communication consent
82
104
  * @description: Use this API to update and insert the consent provided by the user for receiving communication messages over Email/SMS/WhatsApp.
83
105
  */
84
- upsertCommunicationConsent({ body } = {}) {
106
+ async upsertCommunicationConsent({ body } = {}) {
85
107
  const {
86
108
  error,
87
109
  } = CommunicationValidator.upsertCommunicationConsent().validate(
@@ -100,17 +122,19 @@ class Communication {
100
122
  { abortEarly: false, allowUnknown: false }
101
123
  );
102
124
  if (warrning) {
103
- console.log(
104
- "Parameter Validation warrnings for upsertCommunicationConsent"
105
- );
106
- console.log(warrning);
125
+ Logger({
126
+ level: "WARN",
127
+ message:
128
+ "Parameter Validation warrnings for upsertCommunicationConsent",
129
+ });
130
+ Logger({ level: "WARN", message: warrning });
107
131
  }
108
132
 
109
133
  const query_params = {};
110
134
 
111
135
  const xHeaders = {};
112
136
 
113
- return APIClient.execute(
137
+ const response = await APIClient.execute(
114
138
  this._conf,
115
139
  "post",
116
140
  constructUrl({
@@ -121,6 +145,23 @@ class Communication {
121
145
  body,
122
146
  xHeaders
123
147
  );
148
+
149
+ const {
150
+ error: res_error,
151
+ } = CommunicationModel.CommunicationConsentRes().validate(response, {
152
+ abortEarly: false,
153
+ allowUnknown: false,
154
+ });
155
+
156
+ if (res_error) {
157
+ Logger({
158
+ level: "WARN",
159
+ message: "Response Validation Warnnings for upsertCommunicationConsent",
160
+ });
161
+ Logger({ level: "WARN", message: res_error });
162
+ }
163
+
164
+ return response;
124
165
  }
125
166
 
126
167
  /**
@@ -130,7 +171,7 @@ class Communication {
130
171
  * @summary: Upsert push token of a user
131
172
  * @description: Use this API to update and insert the push token of the user.
132
173
  */
133
- upsertAppPushtoken({ body } = {}) {
174
+ async upsertAppPushtoken({ body } = {}) {
134
175
  const { error } = CommunicationValidator.upsertAppPushtoken().validate(
135
176
  { body },
136
177
  { abortEarly: false, allowUnknown: true }
@@ -147,15 +188,18 @@ class Communication {
147
188
  { abortEarly: false, allowUnknown: false }
148
189
  );
149
190
  if (warrning) {
150
- console.log("Parameter Validation warrnings for upsertAppPushtoken");
151
- console.log(warrning);
191
+ Logger({
192
+ level: "WARN",
193
+ message: "Parameter Validation warrnings for upsertAppPushtoken",
194
+ });
195
+ Logger({ level: "WARN", message: warrning });
152
196
  }
153
197
 
154
198
  const query_params = {};
155
199
 
156
200
  const xHeaders = {};
157
201
 
158
- return APIClient.execute(
202
+ const response = await APIClient.execute(
159
203
  this._conf,
160
204
  "post",
161
205
  constructUrl({
@@ -166,6 +210,23 @@ class Communication {
166
210
  body,
167
211
  xHeaders
168
212
  );
213
+
214
+ const {
215
+ error: res_error,
216
+ } = CommunicationModel.PushtokenRes().validate(response, {
217
+ abortEarly: false,
218
+ allowUnknown: false,
219
+ });
220
+
221
+ if (res_error) {
222
+ Logger({
223
+ level: "WARN",
224
+ message: "Response Validation Warnnings for upsertAppPushtoken",
225
+ });
226
+ Logger({ level: "WARN", message: res_error });
227
+ }
228
+
229
+ return response;
169
230
  }
170
231
  }
171
232
 
@@ -164,7 +164,7 @@ declare class Configuration {
164
164
  * @summary: Get a list of staff.
165
165
  * @description: Use this API to get a list of staff including the names, employee code, incentive status, assigned ordering stores, and title of each staff added to the application.
166
166
  */
167
- getAppStaffList({ pageNo, pageSize, orderIncent, orderingStore, user }?: {
167
+ getAppStaffList({ pageNo, pageSize, orderIncent, orderingStore, user, }?: {
168
168
  pageNo?: number;
169
169
  pageSize?: number;
170
170
  orderIncent?: boolean;