@gofynd/fdk-client-javascript 1.3.11-beta.6 → 1.3.11-beta.8

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 (229) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/sdk/application/Cart/CartApplicationClient.d.ts +1 -1
  4. package/sdk/application/Cart/CartApplicationClient.js +5 -3
  5. package/sdk/application/Cart/CartApplicationModel.d.ts +107 -1
  6. package/sdk/application/Cart/CartApplicationModel.js +74 -0
  7. package/sdk/application/Cart/CartApplicationValidator.d.ts +4 -0
  8. package/sdk/application/Cart/CartApplicationValidator.js +4 -0
  9. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +3 -6
  10. package/sdk/application/Catalog/CatalogApplicationClient.js +7 -20
  11. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +2 -2
  12. package/sdk/application/Catalog/CatalogApplicationModel.js +2 -2
  13. package/sdk/application/Catalog/CatalogApplicationValidator.d.ts +0 -14
  14. package/sdk/application/Catalog/CatalogApplicationValidator.js +0 -6
  15. package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +183 -49
  16. package/sdk/application/Configuration/ConfigurationApplicationModel.js +173 -31
  17. package/sdk/application/Content/ContentApplicationClient.d.ts +36 -0
  18. package/sdk/application/Content/ContentApplicationClient.js +246 -0
  19. package/sdk/application/Content/ContentApplicationModel.d.ts +208 -1
  20. package/sdk/application/Content/ContentApplicationModel.js +252 -0
  21. package/sdk/application/Content/ContentApplicationValidator.d.ts +40 -1
  22. package/sdk/application/Content/ContentApplicationValidator.js +41 -0
  23. package/sdk/application/Logistic/LogisticApplicationClient.d.ts +67 -0
  24. package/sdk/application/Logistic/LogisticApplicationClient.js +547 -0
  25. package/sdk/application/Logistic/LogisticApplicationModel.d.ts +456 -1
  26. package/sdk/application/Logistic/LogisticApplicationModel.js +488 -0
  27. package/sdk/application/Logistic/LogisticApplicationValidator.d.ts +211 -1
  28. package/sdk/application/Logistic/LogisticApplicationValidator.js +131 -0
  29. package/sdk/application/Order/OrderApplicationClient.d.ts +3 -3
  30. package/sdk/application/Order/OrderApplicationClient.js +32 -8
  31. package/sdk/application/Order/OrderApplicationModel.d.ts +6 -0
  32. package/sdk/application/Order/OrderApplicationModel.js +6 -0
  33. package/sdk/application/Order/OrderApplicationValidator.d.ts +20 -0
  34. package/sdk/application/Order/OrderApplicationValidator.js +8 -0
  35. package/sdk/application/Payment/PaymentApplicationClient.d.ts +46 -2
  36. package/sdk/application/Payment/PaymentApplicationClient.js +341 -10
  37. package/sdk/application/Payment/PaymentApplicationModel.d.ts +493 -186
  38. package/sdk/application/Payment/PaymentApplicationModel.js +341 -70
  39. package/sdk/application/Payment/PaymentApplicationValidator.d.ts +59 -14
  40. package/sdk/application/Payment/PaymentApplicationValidator.js +64 -10
  41. package/sdk/application/PosCart/PosCartApplicationModel.d.ts +34 -1
  42. package/sdk/application/PosCart/PosCartApplicationModel.js +24 -0
  43. package/sdk/application/Theme/ThemeApplicationClient.d.ts +1 -1
  44. package/sdk/application/Theme/ThemeApplicationClient.js +7 -3
  45. package/sdk/application/Theme/ThemeApplicationModel.d.ts +222 -36
  46. package/sdk/application/Theme/ThemeApplicationModel.js +322 -26
  47. package/sdk/application/Theme/ThemeApplicationValidator.d.ts +10 -0
  48. package/sdk/application/Theme/ThemeApplicationValidator.js +4 -0
  49. package/sdk/application/User/UserApplicationClient.d.ts +33 -0
  50. package/sdk/application/User/UserApplicationClient.js +239 -0
  51. package/sdk/application/User/UserApplicationModel.d.ts +28 -13
  52. package/sdk/application/User/UserApplicationModel.js +36 -12
  53. package/sdk/application/User/UserApplicationValidator.d.ts +34 -1
  54. package/sdk/application/User/UserApplicationValidator.js +36 -0
  55. package/sdk/partner/Lead/LeadPartnerClient.d.ts +125 -0
  56. package/sdk/partner/Lead/LeadPartnerClient.js +785 -0
  57. package/sdk/partner/Lead/LeadPartnerModel.d.ts +1127 -0
  58. package/sdk/partner/Lead/LeadPartnerModel.js +896 -0
  59. package/sdk/partner/Lead/LeadPartnerValidator.d.ts +12 -0
  60. package/sdk/partner/Lead/LeadPartnerValidator.js +67 -0
  61. package/sdk/partner/Logistics/LogisticsPartnerClient.d.ts +155 -0
  62. package/sdk/partner/Logistics/LogisticsPartnerClient.js +1195 -0
  63. package/sdk/partner/Logistics/LogisticsPartnerModel.d.ts +372 -0
  64. package/sdk/partner/Logistics/LogisticsPartnerModel.js +442 -0
  65. package/sdk/partner/Logistics/LogisticsPartnerValidator.d.ts +16 -0
  66. package/sdk/partner/Logistics/LogisticsPartnerValidator.js +123 -0
  67. package/sdk/partner/PartnerClient.d.ts +6 -0
  68. package/sdk/partner/PartnerClient.js +9 -0
  69. package/sdk/partner/Theme/ThemePartnerClient.d.ts +10 -0
  70. package/sdk/partner/Theme/ThemePartnerClient.js +80 -0
  71. package/sdk/partner/Theme/ThemePartnerModel.d.ts +100 -43
  72. package/sdk/partner/Theme/ThemePartnerModel.js +74 -30
  73. package/sdk/partner/Theme/ThemePartnerValidator.d.ts +1 -0
  74. package/sdk/partner/Theme/ThemePartnerValidator.js +9 -0
  75. package/sdk/partner/Webhook/WebhookPartnerClient.d.ts +99 -0
  76. package/sdk/partner/Webhook/WebhookPartnerClient.js +753 -0
  77. package/sdk/partner/Webhook/WebhookPartnerModel.d.ts +566 -0
  78. package/sdk/partner/Webhook/WebhookPartnerModel.js +583 -0
  79. package/sdk/partner/Webhook/WebhookPartnerValidator.d.ts +12 -0
  80. package/sdk/partner/Webhook/WebhookPartnerValidator.js +74 -0
  81. package/sdk/partner/index.d.ts +3 -0
  82. package/sdk/partner/index.js +6 -0
  83. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +2 -2
  84. package/sdk/platform/Billing/BillingPlatformClient.d.ts +11 -1
  85. package/sdk/platform/Billing/BillingPlatformClient.js +110 -3
  86. package/sdk/platform/Billing/BillingPlatformModel.d.ts +67 -1
  87. package/sdk/platform/Billing/BillingPlatformModel.js +78 -0
  88. package/sdk/platform/Billing/BillingPlatformValidator.d.ts +43 -4
  89. package/sdk/platform/Billing/BillingPlatformValidator.js +29 -2
  90. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +1 -1
  91. package/sdk/platform/Cart/CartPlatformApplicationClient.js +7 -1
  92. package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +4 -0
  93. package/sdk/platform/Cart/CartPlatformApplicationValidator.js +4 -0
  94. package/sdk/platform/Cart/CartPlatformModel.d.ts +100 -5
  95. package/sdk/platform/Cart/CartPlatformModel.js +71 -4
  96. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +15 -11
  97. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +52 -21
  98. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +27 -0
  99. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +11 -0
  100. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +26 -4
  101. package/sdk/platform/Catalog/CatalogPlatformClient.js +173 -7
  102. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +304 -1
  103. package/sdk/platform/Catalog/CatalogPlatformModel.js +335 -0
  104. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +31 -3
  105. package/sdk/platform/Catalog/CatalogPlatformValidator.js +27 -2
  106. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +138 -36
  107. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +739 -57
  108. package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.d.ts +128 -3
  109. package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +111 -1
  110. package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +150 -1
  111. package/sdk/platform/Communication/CommunicationPlatformModel.js +172 -0
  112. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +8 -2
  113. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +32 -4
  114. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +38 -9
  115. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +42 -8
  116. package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.d.ts +14 -0
  117. package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +6 -0
  118. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +8 -8
  119. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +4 -4
  120. package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +371 -132
  121. package/sdk/platform/Configuration/ConfigurationPlatformModel.js +288 -77
  122. package/sdk/platform/Configuration/ConfigurationPlatformValidator.d.ts +2 -2
  123. package/sdk/platform/Configuration/ConfigurationPlatformValidator.js +2 -2
  124. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +391 -0
  125. package/sdk/platform/Content/ContentPlatformApplicationClient.js +3630 -1059
  126. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +342 -1
  127. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +401 -0
  128. package/sdk/platform/Content/ContentPlatformClient.d.ts +277 -0
  129. package/sdk/platform/Content/ContentPlatformClient.js +2000 -0
  130. package/sdk/platform/Content/ContentPlatformModel.d.ts +1094 -1
  131. package/sdk/platform/Content/ContentPlatformModel.js +1356 -46
  132. package/sdk/platform/Content/ContentPlatformValidator.d.ts +238 -0
  133. package/sdk/platform/Content/ContentPlatformValidator.js +310 -0
  134. package/sdk/platform/Discount/DiscountPlatformClient.d.ts +2 -2
  135. package/sdk/platform/Discount/DiscountPlatformClient.js +2 -2
  136. package/sdk/platform/Discount/DiscountPlatformModel.d.ts +96 -13
  137. package/sdk/platform/Discount/DiscountPlatformModel.js +104 -12
  138. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +16 -6
  139. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +117 -8
  140. package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +55 -4
  141. package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +39 -2
  142. package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +16 -5
  143. package/sdk/platform/FileStorage/FileStoragePlatformModel.js +18 -4
  144. package/sdk/platform/Finance/FinancePlatformClient.d.ts +33 -0
  145. package/sdk/platform/Finance/FinancePlatformClient.js +240 -0
  146. package/sdk/platform/Finance/FinancePlatformModel.d.ts +151 -5
  147. package/sdk/platform/Finance/FinancePlatformModel.js +190 -4
  148. package/sdk/platform/Finance/FinancePlatformValidator.d.ts +38 -1
  149. package/sdk/platform/Finance/FinancePlatformValidator.js +38 -0
  150. package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +38 -28
  151. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +137 -56
  152. package/sdk/platform/Lead/LeadPlatformApplicationValidator.d.ts +41 -29
  153. package/sdk/platform/Lead/LeadPlatformApplicationValidator.js +33 -21
  154. package/sdk/platform/Lead/LeadPlatformModel.d.ts +12 -3
  155. package/sdk/platform/Lead/LeadPlatformModel.js +16 -2
  156. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +23 -1
  157. package/sdk/platform/Order/OrderPlatformApplicationClient.js +178 -1
  158. package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +39 -1
  159. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +32 -0
  160. package/sdk/platform/Order/OrderPlatformClient.d.ts +202 -31
  161. package/sdk/platform/Order/OrderPlatformClient.js +2010 -586
  162. package/sdk/platform/Order/OrderPlatformModel.d.ts +1030 -468
  163. package/sdk/platform/Order/OrderPlatformModel.js +1176 -523
  164. package/sdk/platform/Order/OrderPlatformValidator.d.ts +318 -35
  165. package/sdk/platform/Order/OrderPlatformValidator.js +292 -29
  166. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +119 -13
  167. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +749 -39
  168. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +143 -7
  169. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +133 -6
  170. package/sdk/platform/Payment/PaymentPlatformClient.d.ts +1 -1
  171. package/sdk/platform/Payment/PaymentPlatformClient.js +1 -1
  172. package/sdk/platform/Payment/PaymentPlatformModel.d.ts +996 -134
  173. package/sdk/platform/Payment/PaymentPlatformModel.js +721 -58
  174. package/sdk/platform/PlatformApplicationClient.d.ts +2 -2
  175. package/sdk/platform/PlatformApplicationClient.js +4 -4
  176. package/sdk/platform/PlatformClient.d.ts +4 -2
  177. package/sdk/platform/PlatformClient.js +8 -4
  178. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.d.ts +142 -66
  179. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +645 -147
  180. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.d.ts +131 -63
  181. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.js +126 -47
  182. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.d.ts +217 -105
  183. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +1136 -347
  184. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +912 -313
  185. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +1071 -355
  186. package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.d.ts +382 -133
  187. package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.js +266 -102
  188. package/sdk/platform/Theme/ThemePlatformClient.d.ts +11 -1
  189. package/sdk/platform/Theme/ThemePlatformClient.js +87 -3
  190. package/sdk/platform/Theme/ThemePlatformModel.d.ts +333 -47
  191. package/sdk/platform/Theme/ThemePlatformModel.js +395 -35
  192. package/sdk/platform/Theme/ThemePlatformValidator.d.ts +28 -4
  193. package/sdk/platform/Theme/ThemePlatformValidator.js +21 -2
  194. package/sdk/platform/User/UserPlatformApplicationClient.d.ts +116 -1
  195. package/sdk/platform/User/UserPlatformApplicationClient.js +931 -85
  196. package/sdk/platform/User/UserPlatformApplicationValidator.d.ts +224 -7
  197. package/sdk/platform/User/UserPlatformApplicationValidator.js +173 -5
  198. package/sdk/platform/User/UserPlatformModel.d.ts +344 -7
  199. package/sdk/platform/User/UserPlatformModel.js +256 -5
  200. package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +47 -39
  201. package/sdk/platform/Webhook/WebhookPlatformClient.js +63 -61
  202. package/sdk/platform/Webhook/WebhookPlatformModel.d.ts +264 -156
  203. package/sdk/platform/Webhook/WebhookPlatformModel.js +276 -153
  204. package/sdk/platform/Webhook/WebhookPlatformValidator.d.ts +7 -10
  205. package/sdk/platform/Webhook/WebhookPlatformValidator.js +6 -6
  206. package/sdk/platform/index.d.ts +1 -1
  207. package/sdk/platform/index.js +2 -2
  208. package/sdk/public/Billing/BillingPublicClient.d.ts +23 -0
  209. package/sdk/public/Billing/BillingPublicClient.js +116 -0
  210. package/sdk/public/Billing/BillingPublicModel.d.ts +92 -0
  211. package/sdk/public/Billing/BillingPublicModel.js +96 -0
  212. package/sdk/public/Billing/BillingPublicValidator.d.ts +18 -0
  213. package/sdk/public/Billing/BillingPublicValidator.js +19 -0
  214. package/sdk/public/Content/ContentPublicClient.d.ts +22 -0
  215. package/sdk/public/Content/ContentPublicClient.js +114 -0
  216. package/sdk/public/Content/ContentPublicModel.d.ts +53 -0
  217. package/sdk/public/Content/ContentPublicModel.js +60 -0
  218. package/sdk/public/Content/ContentPublicValidator.d.ts +18 -0
  219. package/sdk/public/Content/ContentPublicValidator.js +19 -0
  220. package/sdk/public/PublicClient.d.ts +4 -0
  221. package/sdk/public/PublicClient.js +8 -0
  222. package/sdk/public/Webhook/WebhookPublicClient.d.ts +33 -0
  223. package/sdk/public/Webhook/WebhookPublicClient.js +242 -0
  224. package/sdk/public/Webhook/WebhookPublicModel.d.ts +147 -1
  225. package/sdk/public/Webhook/WebhookPublicModel.js +177 -1
  226. package/sdk/public/Webhook/WebhookPublicValidator.d.ts +23 -1
  227. package/sdk/public/Webhook/WebhookPublicValidator.js +31 -0
  228. package/sdk/public/index.d.ts +2 -0
  229. package/sdk/public/index.js +4 -0
@@ -0,0 +1,2000 @@
1
+ const PlatformAPIClient = require("../PlatformAPIClient");
2
+ const {
3
+ FDKClientValidationError,
4
+ FDKResponseValidationError,
5
+ } = require("../../common/FDKError");
6
+ const Paginator = require("../../common/Paginator");
7
+ const ContentPlatformValidator = require("./ContentPlatformValidator");
8
+ const ContentPlatformModel = require("./ContentPlatformModel");
9
+ const { Logger } = require("./../../common/Logger");
10
+ const Joi = require("joi");
11
+
12
+ class Content {
13
+ constructor(config) {
14
+ this.config = config;
15
+ }
16
+
17
+ /**
18
+ * @param {ContentPlatformValidator.CreateCustomFieldByResourceIdParam} arg
19
+ * - Arg object
20
+ *
21
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
22
+ * @param {import("../PlatformAPIClient").Options} - Options
23
+ * @returns {Promise<ContentPlatformModel.CustomFieldsResponseByResourceIdSchema>}
24
+ * - Success response
25
+ *
26
+ * @name createCustomFieldByResourceId
27
+ * @summary: Create custom field entries for gives resource and resource_id
28
+ * @description: Use this API to create the custom field entry for given resource and resource_id in param. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/createCustomFieldByResourceId/).
29
+ */
30
+ async createCustomFieldByResourceId(
31
+ { resource, resourceId, body, requestHeaders } = { requestHeaders: {} },
32
+ { responseHeaders } = { responseHeaders: false }
33
+ ) {
34
+ const {
35
+ error,
36
+ } = ContentPlatformValidator.createCustomFieldByResourceId().validate(
37
+ {
38
+ resource,
39
+ resourceId,
40
+ body,
41
+ },
42
+ { abortEarly: false, allowUnknown: true }
43
+ );
44
+ if (error) {
45
+ return Promise.reject(new FDKClientValidationError(error));
46
+ }
47
+
48
+ // Showing warrnings if extra unknown parameters are found
49
+ const {
50
+ error: warrning,
51
+ } = ContentPlatformValidator.createCustomFieldByResourceId().validate(
52
+ {
53
+ resource,
54
+ resourceId,
55
+ body,
56
+ },
57
+ { abortEarly: false, allowUnknown: false }
58
+ );
59
+ if (warrning) {
60
+ Logger({
61
+ level: "WARN",
62
+ message: `Parameter Validation warrnings for platform > Content > createCustomFieldByResourceId \n ${warrning}`,
63
+ });
64
+ }
65
+
66
+ const query_params = {};
67
+
68
+ const xHeaders = {};
69
+
70
+ const response = await PlatformAPIClient.execute(
71
+ this.config,
72
+ "put",
73
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metafields/${resource}/${resourceId}`,
74
+ query_params,
75
+ body,
76
+ { ...xHeaders, ...requestHeaders },
77
+ { responseHeaders }
78
+ );
79
+
80
+ let responseData = response;
81
+ if (responseHeaders) {
82
+ responseData = response[0];
83
+ }
84
+
85
+ const {
86
+ error: res_error,
87
+ } = ContentPlatformModel.CustomFieldsResponseByResourceIdSchema().validate(
88
+ responseData,
89
+ { abortEarly: false, allowUnknown: true }
90
+ );
91
+
92
+ if (res_error) {
93
+ if (this.config.options.strictResponseCheck === true) {
94
+ return Promise.reject(new FDKResponseValidationError(res_error));
95
+ } else {
96
+ Logger({
97
+ level: "WARN",
98
+ message: `Response Validation Warnings for platform > Content > createCustomFieldByResourceId \n ${res_error}`,
99
+ });
100
+ }
101
+ }
102
+
103
+ return response;
104
+ }
105
+
106
+ /**
107
+ * @param {ContentPlatformValidator.CreateCustomFieldDefinitionParam} arg - Arg object
108
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
109
+ * @param {import("../PlatformAPIClient").Options} - Options
110
+ * @returns {Promise<ContentPlatformModel.CustomFieldDefinitionDetailResSchema>}
111
+ * - Success response
112
+ *
113
+ * @name createCustomFieldDefinition
114
+ * @summary: Create custom field definition
115
+ * @description: Use this API to create a custom field definition for your application. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/createCustomFieldDefinition/).
116
+ */
117
+ async createCustomFieldDefinition(
118
+ { body, requestHeaders } = { requestHeaders: {} },
119
+ { responseHeaders } = { responseHeaders: false }
120
+ ) {
121
+ const {
122
+ error,
123
+ } = ContentPlatformValidator.createCustomFieldDefinition().validate(
124
+ {
125
+ body,
126
+ },
127
+ { abortEarly: false, allowUnknown: true }
128
+ );
129
+ if (error) {
130
+ return Promise.reject(new FDKClientValidationError(error));
131
+ }
132
+
133
+ // Showing warrnings if extra unknown parameters are found
134
+ const {
135
+ error: warrning,
136
+ } = ContentPlatformValidator.createCustomFieldDefinition().validate(
137
+ {
138
+ body,
139
+ },
140
+ { abortEarly: false, allowUnknown: false }
141
+ );
142
+ if (warrning) {
143
+ Logger({
144
+ level: "WARN",
145
+ message: `Parameter Validation warrnings for platform > Content > createCustomFieldDefinition \n ${warrning}`,
146
+ });
147
+ }
148
+
149
+ const query_params = {};
150
+
151
+ const xHeaders = {};
152
+
153
+ const response = await PlatformAPIClient.execute(
154
+ this.config,
155
+ "post",
156
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metafields/definitions`,
157
+ query_params,
158
+ body,
159
+ { ...xHeaders, ...requestHeaders },
160
+ { responseHeaders }
161
+ );
162
+
163
+ let responseData = response;
164
+ if (responseHeaders) {
165
+ responseData = response[0];
166
+ }
167
+
168
+ const {
169
+ error: res_error,
170
+ } = ContentPlatformModel.CustomFieldDefinitionDetailResSchema().validate(
171
+ responseData,
172
+ { abortEarly: false, allowUnknown: true }
173
+ );
174
+
175
+ if (res_error) {
176
+ if (this.config.options.strictResponseCheck === true) {
177
+ return Promise.reject(new FDKResponseValidationError(res_error));
178
+ } else {
179
+ Logger({
180
+ level: "WARN",
181
+ message: `Response Validation Warnings for platform > Content > createCustomFieldDefinition \n ${res_error}`,
182
+ });
183
+ }
184
+ }
185
+
186
+ return response;
187
+ }
188
+
189
+ /**
190
+ * @param {ContentPlatformValidator.CreateCustomObjectParam} arg - Arg object
191
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
192
+ * @param {import("../PlatformAPIClient").Options} - Options
193
+ * @returns {Promise<ContentPlatformModel.CustomObjectSchema>} - Success response
194
+ * @name createCustomObject
195
+ * @summary: Create custom object entries
196
+ * @description: Use this API to create the custom object entry. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/createCustomObject/).
197
+ */
198
+ async createCustomObject(
199
+ { body, requestHeaders } = { requestHeaders: {} },
200
+ { responseHeaders } = { responseHeaders: false }
201
+ ) {
202
+ const { error } = ContentPlatformValidator.createCustomObject().validate(
203
+ {
204
+ body,
205
+ },
206
+ { abortEarly: false, allowUnknown: true }
207
+ );
208
+ if (error) {
209
+ return Promise.reject(new FDKClientValidationError(error));
210
+ }
211
+
212
+ // Showing warrnings if extra unknown parameters are found
213
+ const {
214
+ error: warrning,
215
+ } = ContentPlatformValidator.createCustomObject().validate(
216
+ {
217
+ body,
218
+ },
219
+ { abortEarly: false, allowUnknown: false }
220
+ );
221
+ if (warrning) {
222
+ Logger({
223
+ level: "WARN",
224
+ message: `Parameter Validation warrnings for platform > Content > createCustomObject \n ${warrning}`,
225
+ });
226
+ }
227
+
228
+ const query_params = {};
229
+
230
+ const xHeaders = {};
231
+
232
+ const response = await PlatformAPIClient.execute(
233
+ this.config,
234
+ "post",
235
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metaobjects`,
236
+ query_params,
237
+ body,
238
+ { ...xHeaders, ...requestHeaders },
239
+ { responseHeaders }
240
+ );
241
+
242
+ let responseData = response;
243
+ if (responseHeaders) {
244
+ responseData = response[0];
245
+ }
246
+
247
+ const {
248
+ error: res_error,
249
+ } = ContentPlatformModel.CustomObjectSchema().validate(responseData, {
250
+ abortEarly: false,
251
+ allowUnknown: true,
252
+ });
253
+
254
+ if (res_error) {
255
+ if (this.config.options.strictResponseCheck === true) {
256
+ return Promise.reject(new FDKResponseValidationError(res_error));
257
+ } else {
258
+ Logger({
259
+ level: "WARN",
260
+ message: `Response Validation Warnings for platform > Content > createCustomObject \n ${res_error}`,
261
+ });
262
+ }
263
+ }
264
+
265
+ return response;
266
+ }
267
+
268
+ /**
269
+ * @param {ContentPlatformValidator.CreateCustomObjectDefinitionParam} arg
270
+ * - Arg object
271
+ *
272
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
273
+ * @param {import("../PlatformAPIClient").Options} - Options
274
+ * @returns {Promise<ContentPlatformModel.CustomObjectDefinitionSchema>} -
275
+ * Success response
276
+ * @name createCustomObjectDefinition
277
+ * @summary: Create custom object definition
278
+ * @description: Use this API to create custom object defintion - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/createCustomObjectDefinition/).
279
+ */
280
+ async createCustomObjectDefinition(
281
+ { body, requestHeaders } = { requestHeaders: {} },
282
+ { responseHeaders } = { responseHeaders: false }
283
+ ) {
284
+ const {
285
+ error,
286
+ } = ContentPlatformValidator.createCustomObjectDefinition().validate(
287
+ {
288
+ body,
289
+ },
290
+ { abortEarly: false, allowUnknown: true }
291
+ );
292
+ if (error) {
293
+ return Promise.reject(new FDKClientValidationError(error));
294
+ }
295
+
296
+ // Showing warrnings if extra unknown parameters are found
297
+ const {
298
+ error: warrning,
299
+ } = ContentPlatformValidator.createCustomObjectDefinition().validate(
300
+ {
301
+ body,
302
+ },
303
+ { abortEarly: false, allowUnknown: false }
304
+ );
305
+ if (warrning) {
306
+ Logger({
307
+ level: "WARN",
308
+ message: `Parameter Validation warrnings for platform > Content > createCustomObjectDefinition \n ${warrning}`,
309
+ });
310
+ }
311
+
312
+ const query_params = {};
313
+
314
+ const xHeaders = {};
315
+
316
+ const response = await PlatformAPIClient.execute(
317
+ this.config,
318
+ "post",
319
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metaobjects/definitions`,
320
+ query_params,
321
+ body,
322
+ { ...xHeaders, ...requestHeaders },
323
+ { responseHeaders }
324
+ );
325
+
326
+ let responseData = response;
327
+ if (responseHeaders) {
328
+ responseData = response[0];
329
+ }
330
+
331
+ const {
332
+ error: res_error,
333
+ } = ContentPlatformModel.CustomObjectDefinitionSchema().validate(
334
+ responseData,
335
+ { abortEarly: false, allowUnknown: true }
336
+ );
337
+
338
+ if (res_error) {
339
+ if (this.config.options.strictResponseCheck === true) {
340
+ return Promise.reject(new FDKResponseValidationError(res_error));
341
+ } else {
342
+ Logger({
343
+ level: "WARN",
344
+ message: `Response Validation Warnings for platform > Content > createCustomObjectDefinition \n ${res_error}`,
345
+ });
346
+ }
347
+ }
348
+
349
+ return response;
350
+ }
351
+
352
+ /**
353
+ * @param {ContentPlatformValidator.DeleteCustomFieldDefinitionParam} arg - Arg object
354
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
355
+ * @param {import("../PlatformAPIClient").Options} - Options
356
+ * @returns {Promise<ContentPlatformModel.CustomDataDeleteSchema>} - Success response
357
+ * @name deleteCustomFieldDefinition
358
+ * @summary: Delete custom fields definition.
359
+ * @description: Use this API to delete the definitions of custom fields using definition_id. This will also delete related custom fields entries related to this definition. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/deleteCustomFieldDefinition/).
360
+ */
361
+ async deleteCustomFieldDefinition(
362
+ { definitionId, requestHeaders } = { requestHeaders: {} },
363
+ { responseHeaders } = { responseHeaders: false }
364
+ ) {
365
+ const {
366
+ error,
367
+ } = ContentPlatformValidator.deleteCustomFieldDefinition().validate(
368
+ {
369
+ definitionId,
370
+ },
371
+ { abortEarly: false, allowUnknown: true }
372
+ );
373
+ if (error) {
374
+ return Promise.reject(new FDKClientValidationError(error));
375
+ }
376
+
377
+ // Showing warrnings if extra unknown parameters are found
378
+ const {
379
+ error: warrning,
380
+ } = ContentPlatformValidator.deleteCustomFieldDefinition().validate(
381
+ {
382
+ definitionId,
383
+ },
384
+ { abortEarly: false, allowUnknown: false }
385
+ );
386
+ if (warrning) {
387
+ Logger({
388
+ level: "WARN",
389
+ message: `Parameter Validation warrnings for platform > Content > deleteCustomFieldDefinition \n ${warrning}`,
390
+ });
391
+ }
392
+
393
+ const query_params = {};
394
+
395
+ const xHeaders = {};
396
+
397
+ const response = await PlatformAPIClient.execute(
398
+ this.config,
399
+ "delete",
400
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metafields/definitions/${definitionId}`,
401
+ query_params,
402
+ undefined,
403
+ { ...xHeaders, ...requestHeaders },
404
+ { responseHeaders }
405
+ );
406
+
407
+ let responseData = response;
408
+ if (responseHeaders) {
409
+ responseData = response[0];
410
+ }
411
+
412
+ const {
413
+ error: res_error,
414
+ } = ContentPlatformModel.CustomDataDeleteSchema().validate(responseData, {
415
+ abortEarly: false,
416
+ allowUnknown: true,
417
+ });
418
+
419
+ if (res_error) {
420
+ if (this.config.options.strictResponseCheck === true) {
421
+ return Promise.reject(new FDKResponseValidationError(res_error));
422
+ } else {
423
+ Logger({
424
+ level: "WARN",
425
+ message: `Response Validation Warnings for platform > Content > deleteCustomFieldDefinition \n ${res_error}`,
426
+ });
427
+ }
428
+ }
429
+
430
+ return response;
431
+ }
432
+
433
+ /**
434
+ * @param {ContentPlatformValidator.DeleteCustomObjectParam} arg - Arg object
435
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
436
+ * @param {import("../PlatformAPIClient").Options} - Options
437
+ * @returns {Promise<ContentPlatformModel.CustomDataDeleteSchema>} - Success response
438
+ * @name deleteCustomObject
439
+ * @summary: Delete custom object
440
+ * @description: Use this API to delete the custom object entry by id. This will also delete related custom fields entries related to this custom object. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/deleteCustomObject/).
441
+ */
442
+ async deleteCustomObject(
443
+ { metaobjectId, requestHeaders } = { requestHeaders: {} },
444
+ { responseHeaders } = { responseHeaders: false }
445
+ ) {
446
+ const { error } = ContentPlatformValidator.deleteCustomObject().validate(
447
+ {
448
+ metaobjectId,
449
+ },
450
+ { abortEarly: false, allowUnknown: true }
451
+ );
452
+ if (error) {
453
+ return Promise.reject(new FDKClientValidationError(error));
454
+ }
455
+
456
+ // Showing warrnings if extra unknown parameters are found
457
+ const {
458
+ error: warrning,
459
+ } = ContentPlatformValidator.deleteCustomObject().validate(
460
+ {
461
+ metaobjectId,
462
+ },
463
+ { abortEarly: false, allowUnknown: false }
464
+ );
465
+ if (warrning) {
466
+ Logger({
467
+ level: "WARN",
468
+ message: `Parameter Validation warrnings for platform > Content > deleteCustomObject \n ${warrning}`,
469
+ });
470
+ }
471
+
472
+ const query_params = {};
473
+
474
+ const xHeaders = {};
475
+
476
+ const response = await PlatformAPIClient.execute(
477
+ this.config,
478
+ "delete",
479
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metaobjects/${metaobjectId}`,
480
+ query_params,
481
+ undefined,
482
+ { ...xHeaders, ...requestHeaders },
483
+ { responseHeaders }
484
+ );
485
+
486
+ let responseData = response;
487
+ if (responseHeaders) {
488
+ responseData = response[0];
489
+ }
490
+
491
+ const {
492
+ error: res_error,
493
+ } = ContentPlatformModel.CustomDataDeleteSchema().validate(responseData, {
494
+ abortEarly: false,
495
+ allowUnknown: true,
496
+ });
497
+
498
+ if (res_error) {
499
+ if (this.config.options.strictResponseCheck === true) {
500
+ return Promise.reject(new FDKResponseValidationError(res_error));
501
+ } else {
502
+ Logger({
503
+ level: "WARN",
504
+ message: `Response Validation Warnings for platform > Content > deleteCustomObject \n ${res_error}`,
505
+ });
506
+ }
507
+ }
508
+
509
+ return response;
510
+ }
511
+
512
+ /**
513
+ * @param {ContentPlatformValidator.DeleteCustomObjectDefinitionParam} arg
514
+ * - Arg object
515
+ *
516
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
517
+ * @param {import("../PlatformAPIClient").Options} - Options
518
+ * @returns {Promise<ContentPlatformModel.CustomObjectDefinitionDeleteResponseSchema>}
519
+ * - Success response
520
+ *
521
+ * @name deleteCustomObjectDefinition
522
+ * @summary: delete custom object definition by id
523
+ * @description: Use this API to delete a custom object definition and related data for your application. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/deleteCustomObjectDefinition/).
524
+ */
525
+ async deleteCustomObjectDefinition(
526
+ { definitionId, requestHeaders } = { requestHeaders: {} },
527
+ { responseHeaders } = { responseHeaders: false }
528
+ ) {
529
+ const {
530
+ error,
531
+ } = ContentPlatformValidator.deleteCustomObjectDefinition().validate(
532
+ {
533
+ definitionId,
534
+ },
535
+ { abortEarly: false, allowUnknown: true }
536
+ );
537
+ if (error) {
538
+ return Promise.reject(new FDKClientValidationError(error));
539
+ }
540
+
541
+ // Showing warrnings if extra unknown parameters are found
542
+ const {
543
+ error: warrning,
544
+ } = ContentPlatformValidator.deleteCustomObjectDefinition().validate(
545
+ {
546
+ definitionId,
547
+ },
548
+ { abortEarly: false, allowUnknown: false }
549
+ );
550
+ if (warrning) {
551
+ Logger({
552
+ level: "WARN",
553
+ message: `Parameter Validation warrnings for platform > Content > deleteCustomObjectDefinition \n ${warrning}`,
554
+ });
555
+ }
556
+
557
+ const query_params = {};
558
+
559
+ const xHeaders = {};
560
+
561
+ const response = await PlatformAPIClient.execute(
562
+ this.config,
563
+ "delete",
564
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metaobjects/definitions/${definitionId}`,
565
+ query_params,
566
+ undefined,
567
+ { ...xHeaders, ...requestHeaders },
568
+ { responseHeaders }
569
+ );
570
+
571
+ let responseData = response;
572
+ if (responseHeaders) {
573
+ responseData = response[0];
574
+ }
575
+
576
+ const {
577
+ error: res_error,
578
+ } = ContentPlatformModel.CustomObjectDefinitionDeleteResponseSchema().validate(
579
+ responseData,
580
+ { abortEarly: false, allowUnknown: true }
581
+ );
582
+
583
+ if (res_error) {
584
+ if (this.config.options.strictResponseCheck === true) {
585
+ return Promise.reject(new FDKResponseValidationError(res_error));
586
+ } else {
587
+ Logger({
588
+ level: "WARN",
589
+ message: `Response Validation Warnings for platform > Content > deleteCustomObjectDefinition \n ${res_error}`,
590
+ });
591
+ }
592
+ }
593
+
594
+ return response;
595
+ }
596
+
597
+ /**
598
+ * @param {ContentPlatformValidator.ExportCustomObjectEntriesParam} arg - Arg object
599
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
600
+ * @param {import("../PlatformAPIClient").Options} - Options
601
+ * @returns {Promise<ContentPlatformModel.CustomObjectBulkEntryInitiateDownload>}
602
+ * - Success response
603
+ *
604
+ * @name exportCustomObjectEntries
605
+ * @summary: Initiate download for bulk custom object entries
606
+ * @description: Use this api to initiate download of bulk entries - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/exportCustomObjectEntries/).
607
+ */
608
+ async exportCustomObjectEntries(
609
+ { definitionId, requestHeaders } = { requestHeaders: {} },
610
+ { responseHeaders } = { responseHeaders: false }
611
+ ) {
612
+ const {
613
+ error,
614
+ } = ContentPlatformValidator.exportCustomObjectEntries().validate(
615
+ {
616
+ definitionId,
617
+ },
618
+ { abortEarly: false, allowUnknown: true }
619
+ );
620
+ if (error) {
621
+ return Promise.reject(new FDKClientValidationError(error));
622
+ }
623
+
624
+ // Showing warrnings if extra unknown parameters are found
625
+ const {
626
+ error: warrning,
627
+ } = ContentPlatformValidator.exportCustomObjectEntries().validate(
628
+ {
629
+ definitionId,
630
+ },
631
+ { abortEarly: false, allowUnknown: false }
632
+ );
633
+ if (warrning) {
634
+ Logger({
635
+ level: "WARN",
636
+ message: `Parameter Validation warrnings for platform > Content > exportCustomObjectEntries \n ${warrning}`,
637
+ });
638
+ }
639
+
640
+ const query_params = {};
641
+
642
+ const xHeaders = {};
643
+
644
+ const response = await PlatformAPIClient.execute(
645
+ this.config,
646
+ "get",
647
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metaobjects/bulk/${definitionId}/download`,
648
+ query_params,
649
+ undefined,
650
+ { ...xHeaders, ...requestHeaders },
651
+ { responseHeaders }
652
+ );
653
+
654
+ let responseData = response;
655
+ if (responseHeaders) {
656
+ responseData = response[0];
657
+ }
658
+
659
+ const {
660
+ error: res_error,
661
+ } = ContentPlatformModel.CustomObjectBulkEntryInitiateDownload().validate(
662
+ responseData,
663
+ { abortEarly: false, allowUnknown: true }
664
+ );
665
+
666
+ if (res_error) {
667
+ if (this.config.options.strictResponseCheck === true) {
668
+ return Promise.reject(new FDKResponseValidationError(res_error));
669
+ } else {
670
+ Logger({
671
+ level: "WARN",
672
+ message: `Response Validation Warnings for platform > Content > exportCustomObjectEntries \n ${res_error}`,
673
+ });
674
+ }
675
+ }
676
+
677
+ return response;
678
+ }
679
+
680
+ /**
681
+ * @param {ContentPlatformValidator.GetCustomFieldDefinitionParam} arg - Arg object
682
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
683
+ * @param {import("../PlatformAPIClient").Options} - Options
684
+ * @returns {Promise<ContentPlatformModel.CustomFieldDefinitionDetailResSchema>}
685
+ * - Success response
686
+ *
687
+ * @name getCustomFieldDefinition
688
+ * @summary: Get custom fields definition by id
689
+ * @description: Use this API to retrieve the definitions of custom fields using definition_id. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/getCustomFieldDefinition/).
690
+ */
691
+ async getCustomFieldDefinition(
692
+ { definitionId, requestHeaders } = { requestHeaders: {} },
693
+ { responseHeaders } = { responseHeaders: false }
694
+ ) {
695
+ const {
696
+ error,
697
+ } = ContentPlatformValidator.getCustomFieldDefinition().validate(
698
+ {
699
+ definitionId,
700
+ },
701
+ { abortEarly: false, allowUnknown: true }
702
+ );
703
+ if (error) {
704
+ return Promise.reject(new FDKClientValidationError(error));
705
+ }
706
+
707
+ // Showing warrnings if extra unknown parameters are found
708
+ const {
709
+ error: warrning,
710
+ } = ContentPlatformValidator.getCustomFieldDefinition().validate(
711
+ {
712
+ definitionId,
713
+ },
714
+ { abortEarly: false, allowUnknown: false }
715
+ );
716
+ if (warrning) {
717
+ Logger({
718
+ level: "WARN",
719
+ message: `Parameter Validation warrnings for platform > Content > getCustomFieldDefinition \n ${warrning}`,
720
+ });
721
+ }
722
+
723
+ const query_params = {};
724
+
725
+ const xHeaders = {};
726
+
727
+ const response = await PlatformAPIClient.execute(
728
+ this.config,
729
+ "get",
730
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metafields/definitions/${definitionId}`,
731
+ query_params,
732
+ undefined,
733
+ { ...xHeaders, ...requestHeaders },
734
+ { responseHeaders }
735
+ );
736
+
737
+ let responseData = response;
738
+ if (responseHeaders) {
739
+ responseData = response[0];
740
+ }
741
+
742
+ const {
743
+ error: res_error,
744
+ } = ContentPlatformModel.CustomFieldDefinitionDetailResSchema().validate(
745
+ responseData,
746
+ { abortEarly: false, allowUnknown: true }
747
+ );
748
+
749
+ if (res_error) {
750
+ if (this.config.options.strictResponseCheck === true) {
751
+ return Promise.reject(new FDKResponseValidationError(res_error));
752
+ } else {
753
+ Logger({
754
+ level: "WARN",
755
+ message: `Response Validation Warnings for platform > Content > getCustomFieldDefinition \n ${res_error}`,
756
+ });
757
+ }
758
+ }
759
+
760
+ return response;
761
+ }
762
+
763
+ /**
764
+ * @param {ContentPlatformValidator.GetCustomFieldDefinitionsParam} arg - Arg object
765
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
766
+ * @param {import("../PlatformAPIClient").Options} - Options
767
+ * @returns {Promise<ContentPlatformModel.CustomFieldDefinitionsSchema>} -
768
+ * Success response
769
+ * @name getCustomFieldDefinitions
770
+ * @summary: Get custom fields definitions
771
+ * @description: Use this API to retrieve the definitions of custom fields. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/getCustomFieldDefinitions/).
772
+ */
773
+ async getCustomFieldDefinitions(
774
+ { pageNo, pageSize, resource, type, search, requestHeaders } = {
775
+ requestHeaders: {},
776
+ },
777
+ { responseHeaders } = { responseHeaders: false }
778
+ ) {
779
+ const {
780
+ error,
781
+ } = ContentPlatformValidator.getCustomFieldDefinitions().validate(
782
+ {
783
+ pageNo,
784
+ pageSize,
785
+ resource,
786
+ type,
787
+ search,
788
+ },
789
+ { abortEarly: false, allowUnknown: true }
790
+ );
791
+ if (error) {
792
+ return Promise.reject(new FDKClientValidationError(error));
793
+ }
794
+
795
+ // Showing warrnings if extra unknown parameters are found
796
+ const {
797
+ error: warrning,
798
+ } = ContentPlatformValidator.getCustomFieldDefinitions().validate(
799
+ {
800
+ pageNo,
801
+ pageSize,
802
+ resource,
803
+ type,
804
+ search,
805
+ },
806
+ { abortEarly: false, allowUnknown: false }
807
+ );
808
+ if (warrning) {
809
+ Logger({
810
+ level: "WARN",
811
+ message: `Parameter Validation warrnings for platform > Content > getCustomFieldDefinitions \n ${warrning}`,
812
+ });
813
+ }
814
+
815
+ const query_params = {};
816
+ query_params["page_no"] = pageNo;
817
+ query_params["page_size"] = pageSize;
818
+ query_params["resource"] = resource;
819
+ query_params["type"] = type;
820
+ query_params["search"] = search;
821
+
822
+ const xHeaders = {};
823
+
824
+ const response = await PlatformAPIClient.execute(
825
+ this.config,
826
+ "get",
827
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metafields/definitions`,
828
+ query_params,
829
+ undefined,
830
+ { ...xHeaders, ...requestHeaders },
831
+ { responseHeaders }
832
+ );
833
+
834
+ let responseData = response;
835
+ if (responseHeaders) {
836
+ responseData = response[0];
837
+ }
838
+
839
+ const {
840
+ error: res_error,
841
+ } = ContentPlatformModel.CustomFieldDefinitionsSchema().validate(
842
+ responseData,
843
+ { abortEarly: false, allowUnknown: true }
844
+ );
845
+
846
+ if (res_error) {
847
+ if (this.config.options.strictResponseCheck === true) {
848
+ return Promise.reject(new FDKResponseValidationError(res_error));
849
+ } else {
850
+ Logger({
851
+ level: "WARN",
852
+ message: `Response Validation Warnings for platform > Content > getCustomFieldDefinitions \n ${res_error}`,
853
+ });
854
+ }
855
+ }
856
+
857
+ return response;
858
+ }
859
+
860
+ /**
861
+ * @param {ContentPlatformValidator.GetCustomFieldTypesParam} arg - Arg object
862
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
863
+ * @param {import("../PlatformAPIClient").Options} - Options
864
+ * @returns {Promise<ContentPlatformModel.CustomObjectByIdSchema>} - Success response
865
+ * @name getCustomFieldTypes
866
+ * @summary: Get custom field types
867
+ * @description: Use this API to retrieve the custom field types - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/getCustomFieldTypes/).
868
+ */
869
+ async getCustomFieldTypes(
870
+ { requestHeaders } = { requestHeaders: {} },
871
+ { responseHeaders } = { responseHeaders: false }
872
+ ) {
873
+ const { error } = ContentPlatformValidator.getCustomFieldTypes().validate(
874
+ {},
875
+ { abortEarly: false, allowUnknown: true }
876
+ );
877
+ if (error) {
878
+ return Promise.reject(new FDKClientValidationError(error));
879
+ }
880
+
881
+ // Showing warrnings if extra unknown parameters are found
882
+ const {
883
+ error: warrning,
884
+ } = ContentPlatformValidator.getCustomFieldTypes().validate(
885
+ {},
886
+ { abortEarly: false, allowUnknown: false }
887
+ );
888
+ if (warrning) {
889
+ Logger({
890
+ level: "WARN",
891
+ message: `Parameter Validation warrnings for platform > Content > getCustomFieldTypes \n ${warrning}`,
892
+ });
893
+ }
894
+
895
+ const query_params = {};
896
+
897
+ const xHeaders = {};
898
+
899
+ const response = await PlatformAPIClient.execute(
900
+ this.config,
901
+ "get",
902
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metafields/types`,
903
+ query_params,
904
+ undefined,
905
+ { ...xHeaders, ...requestHeaders },
906
+ { responseHeaders }
907
+ );
908
+
909
+ let responseData = response;
910
+ if (responseHeaders) {
911
+ responseData = response[0];
912
+ }
913
+
914
+ const {
915
+ error: res_error,
916
+ } = ContentPlatformModel.CustomObjectByIdSchema().validate(responseData, {
917
+ abortEarly: false,
918
+ allowUnknown: true,
919
+ });
920
+
921
+ if (res_error) {
922
+ if (this.config.options.strictResponseCheck === true) {
923
+ return Promise.reject(new FDKResponseValidationError(res_error));
924
+ } else {
925
+ Logger({
926
+ level: "WARN",
927
+ message: `Response Validation Warnings for platform > Content > getCustomFieldTypes \n ${res_error}`,
928
+ });
929
+ }
930
+ }
931
+
932
+ return response;
933
+ }
934
+
935
+ /**
936
+ * @param {ContentPlatformValidator.GetCustomFieldsParam} arg - Arg object
937
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
938
+ * @param {import("../PlatformAPIClient").Options} - Options
939
+ * @returns {Promise<ContentPlatformModel.CustomFieldsResponseSchema>} -
940
+ * Success response
941
+ * @name getCustomFields
942
+ * @summary: Get list of custom fields of given resource
943
+ * @description: Use this API to retrieve the custom fields for given resource in param. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/getCustomFields/).
944
+ */
945
+ async getCustomFields(
946
+ { resource, requestHeaders } = { requestHeaders: {} },
947
+ { responseHeaders } = { responseHeaders: false }
948
+ ) {
949
+ const { error } = ContentPlatformValidator.getCustomFields().validate(
950
+ {
951
+ resource,
952
+ },
953
+ { abortEarly: false, allowUnknown: true }
954
+ );
955
+ if (error) {
956
+ return Promise.reject(new FDKClientValidationError(error));
957
+ }
958
+
959
+ // Showing warrnings if extra unknown parameters are found
960
+ const {
961
+ error: warrning,
962
+ } = ContentPlatformValidator.getCustomFields().validate(
963
+ {
964
+ resource,
965
+ },
966
+ { abortEarly: false, allowUnknown: false }
967
+ );
968
+ if (warrning) {
969
+ Logger({
970
+ level: "WARN",
971
+ message: `Parameter Validation warrnings for platform > Content > getCustomFields \n ${warrning}`,
972
+ });
973
+ }
974
+
975
+ const query_params = {};
976
+
977
+ const xHeaders = {};
978
+
979
+ const response = await PlatformAPIClient.execute(
980
+ this.config,
981
+ "get",
982
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metafields/${resource}`,
983
+ query_params,
984
+ undefined,
985
+ { ...xHeaders, ...requestHeaders },
986
+ { responseHeaders }
987
+ );
988
+
989
+ let responseData = response;
990
+ if (responseHeaders) {
991
+ responseData = response[0];
992
+ }
993
+
994
+ const {
995
+ error: res_error,
996
+ } = ContentPlatformModel.CustomFieldsResponseSchema().validate(
997
+ responseData,
998
+ { abortEarly: false, allowUnknown: true }
999
+ );
1000
+
1001
+ if (res_error) {
1002
+ if (this.config.options.strictResponseCheck === true) {
1003
+ return Promise.reject(new FDKResponseValidationError(res_error));
1004
+ } else {
1005
+ Logger({
1006
+ level: "WARN",
1007
+ message: `Response Validation Warnings for platform > Content > getCustomFields \n ${res_error}`,
1008
+ });
1009
+ }
1010
+ }
1011
+
1012
+ return response;
1013
+ }
1014
+
1015
+ /**
1016
+ * @param {ContentPlatformValidator.GetCustomFieldsByResourceIdParam} arg - Arg object
1017
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1018
+ * @param {import("../PlatformAPIClient").Options} - Options
1019
+ * @returns {Promise<ContentPlatformModel.CustomFieldsResponseByResourceIdSchema>}
1020
+ * - Success response
1021
+ *
1022
+ * @name getCustomFieldsByResourceId
1023
+ * @summary: Get list of custom fields of given resource and resource id
1024
+ * @description: Use this API to retrieve the custom fields for given resource in param. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/getCustomFieldsByResourceId/).
1025
+ */
1026
+ async getCustomFieldsByResourceId(
1027
+ { resource, resourceId, requestHeaders } = { requestHeaders: {} },
1028
+ { responseHeaders } = { responseHeaders: false }
1029
+ ) {
1030
+ const {
1031
+ error,
1032
+ } = ContentPlatformValidator.getCustomFieldsByResourceId().validate(
1033
+ {
1034
+ resource,
1035
+ resourceId,
1036
+ },
1037
+ { abortEarly: false, allowUnknown: true }
1038
+ );
1039
+ if (error) {
1040
+ return Promise.reject(new FDKClientValidationError(error));
1041
+ }
1042
+
1043
+ // Showing warrnings if extra unknown parameters are found
1044
+ const {
1045
+ error: warrning,
1046
+ } = ContentPlatformValidator.getCustomFieldsByResourceId().validate(
1047
+ {
1048
+ resource,
1049
+ resourceId,
1050
+ },
1051
+ { abortEarly: false, allowUnknown: false }
1052
+ );
1053
+ if (warrning) {
1054
+ Logger({
1055
+ level: "WARN",
1056
+ message: `Parameter Validation warrnings for platform > Content > getCustomFieldsByResourceId \n ${warrning}`,
1057
+ });
1058
+ }
1059
+
1060
+ const query_params = {};
1061
+
1062
+ const xHeaders = {};
1063
+
1064
+ const response = await PlatformAPIClient.execute(
1065
+ this.config,
1066
+ "get",
1067
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metafields/${resource}/${resourceId}`,
1068
+ query_params,
1069
+ undefined,
1070
+ { ...xHeaders, ...requestHeaders },
1071
+ { responseHeaders }
1072
+ );
1073
+
1074
+ let responseData = response;
1075
+ if (responseHeaders) {
1076
+ responseData = response[0];
1077
+ }
1078
+
1079
+ const {
1080
+ error: res_error,
1081
+ } = ContentPlatformModel.CustomFieldsResponseByResourceIdSchema().validate(
1082
+ responseData,
1083
+ { abortEarly: false, allowUnknown: true }
1084
+ );
1085
+
1086
+ if (res_error) {
1087
+ if (this.config.options.strictResponseCheck === true) {
1088
+ return Promise.reject(new FDKResponseValidationError(res_error));
1089
+ } else {
1090
+ Logger({
1091
+ level: "WARN",
1092
+ message: `Response Validation Warnings for platform > Content > getCustomFieldsByResourceId \n ${res_error}`,
1093
+ });
1094
+ }
1095
+ }
1096
+
1097
+ return response;
1098
+ }
1099
+
1100
+ /**
1101
+ * @param {ContentPlatformValidator.GetCustomObjectParam} arg - Arg object
1102
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1103
+ * @param {import("../PlatformAPIClient").Options} - Options
1104
+ * @returns {Promise<ContentPlatformModel.CustomObjectByIdSchema>} - Success response
1105
+ * @name getCustomObject
1106
+ * @summary: Get custom object details
1107
+ * @description: Use this API to retrieve the custom object details and their fields details and definitions and references. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/getCustomObject/).
1108
+ */
1109
+ async getCustomObject(
1110
+ { metaobjectId, requestHeaders } = { requestHeaders: {} },
1111
+ { responseHeaders } = { responseHeaders: false }
1112
+ ) {
1113
+ const { error } = ContentPlatformValidator.getCustomObject().validate(
1114
+ {
1115
+ metaobjectId,
1116
+ },
1117
+ { abortEarly: false, allowUnknown: true }
1118
+ );
1119
+ if (error) {
1120
+ return Promise.reject(new FDKClientValidationError(error));
1121
+ }
1122
+
1123
+ // Showing warrnings if extra unknown parameters are found
1124
+ const {
1125
+ error: warrning,
1126
+ } = ContentPlatformValidator.getCustomObject().validate(
1127
+ {
1128
+ metaobjectId,
1129
+ },
1130
+ { abortEarly: false, allowUnknown: false }
1131
+ );
1132
+ if (warrning) {
1133
+ Logger({
1134
+ level: "WARN",
1135
+ message: `Parameter Validation warrnings for platform > Content > getCustomObject \n ${warrning}`,
1136
+ });
1137
+ }
1138
+
1139
+ const query_params = {};
1140
+
1141
+ const xHeaders = {};
1142
+
1143
+ const response = await PlatformAPIClient.execute(
1144
+ this.config,
1145
+ "get",
1146
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metaobjects/${metaobjectId}`,
1147
+ query_params,
1148
+ undefined,
1149
+ { ...xHeaders, ...requestHeaders },
1150
+ { responseHeaders }
1151
+ );
1152
+
1153
+ let responseData = response;
1154
+ if (responseHeaders) {
1155
+ responseData = response[0];
1156
+ }
1157
+
1158
+ const {
1159
+ error: res_error,
1160
+ } = ContentPlatformModel.CustomObjectByIdSchema().validate(responseData, {
1161
+ abortEarly: false,
1162
+ allowUnknown: true,
1163
+ });
1164
+
1165
+ if (res_error) {
1166
+ if (this.config.options.strictResponseCheck === true) {
1167
+ return Promise.reject(new FDKResponseValidationError(res_error));
1168
+ } else {
1169
+ Logger({
1170
+ level: "WARN",
1171
+ message: `Response Validation Warnings for platform > Content > getCustomObject \n ${res_error}`,
1172
+ });
1173
+ }
1174
+ }
1175
+
1176
+ return response;
1177
+ }
1178
+
1179
+ /**
1180
+ * @param {ContentPlatformValidator.GetCustomObjectDefinitionParam} arg - Arg object
1181
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1182
+ * @param {import("../PlatformAPIClient").Options} - Options
1183
+ * @returns {Promise<ContentPlatformModel.CustomObjectDefinitionSchema>} -
1184
+ * Success response
1185
+ * @name getCustomObjectDefinition
1186
+ * @summary: get custom object definition by id
1187
+ * @description: Use this API to update a custom object definition for your application. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/getCustomObjectDefinition/).
1188
+ */
1189
+ async getCustomObjectDefinition(
1190
+ { definitionId, requestHeaders } = { requestHeaders: {} },
1191
+ { responseHeaders } = { responseHeaders: false }
1192
+ ) {
1193
+ const {
1194
+ error,
1195
+ } = ContentPlatformValidator.getCustomObjectDefinition().validate(
1196
+ {
1197
+ definitionId,
1198
+ },
1199
+ { abortEarly: false, allowUnknown: true }
1200
+ );
1201
+ if (error) {
1202
+ return Promise.reject(new FDKClientValidationError(error));
1203
+ }
1204
+
1205
+ // Showing warrnings if extra unknown parameters are found
1206
+ const {
1207
+ error: warrning,
1208
+ } = ContentPlatformValidator.getCustomObjectDefinition().validate(
1209
+ {
1210
+ definitionId,
1211
+ },
1212
+ { abortEarly: false, allowUnknown: false }
1213
+ );
1214
+ if (warrning) {
1215
+ Logger({
1216
+ level: "WARN",
1217
+ message: `Parameter Validation warrnings for platform > Content > getCustomObjectDefinition \n ${warrning}`,
1218
+ });
1219
+ }
1220
+
1221
+ const query_params = {};
1222
+
1223
+ const xHeaders = {};
1224
+
1225
+ const response = await PlatformAPIClient.execute(
1226
+ this.config,
1227
+ "get",
1228
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metaobjects/definitions/${definitionId}`,
1229
+ query_params,
1230
+ undefined,
1231
+ { ...xHeaders, ...requestHeaders },
1232
+ { responseHeaders }
1233
+ );
1234
+
1235
+ let responseData = response;
1236
+ if (responseHeaders) {
1237
+ responseData = response[0];
1238
+ }
1239
+
1240
+ const {
1241
+ error: res_error,
1242
+ } = ContentPlatformModel.CustomObjectDefinitionSchema().validate(
1243
+ responseData,
1244
+ { abortEarly: false, allowUnknown: true }
1245
+ );
1246
+
1247
+ if (res_error) {
1248
+ if (this.config.options.strictResponseCheck === true) {
1249
+ return Promise.reject(new FDKResponseValidationError(res_error));
1250
+ } else {
1251
+ Logger({
1252
+ level: "WARN",
1253
+ message: `Response Validation Warnings for platform > Content > getCustomObjectDefinition \n ${res_error}`,
1254
+ });
1255
+ }
1256
+ }
1257
+
1258
+ return response;
1259
+ }
1260
+
1261
+ /**
1262
+ * @param {ContentPlatformValidator.GetCustomObjectDefinitionsParam} arg - Arg object
1263
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1264
+ * @param {import("../PlatformAPIClient").Options} - Options
1265
+ * @returns {Promise<ContentPlatformModel.CustomObjectDefinitionsSchema>} -
1266
+ * Success response
1267
+ * @name getCustomObjectDefinitions
1268
+ * @summary: Get custom object definitions
1269
+ * @description: Use this API to retrieve the custom object definitions - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/getCustomObjectDefinitions/).
1270
+ */
1271
+ async getCustomObjectDefinitions(
1272
+ { pageNo, pageSize, search, requestHeaders } = { requestHeaders: {} },
1273
+ { responseHeaders } = { responseHeaders: false }
1274
+ ) {
1275
+ const {
1276
+ error,
1277
+ } = ContentPlatformValidator.getCustomObjectDefinitions().validate(
1278
+ {
1279
+ pageNo,
1280
+ pageSize,
1281
+ search,
1282
+ },
1283
+ { abortEarly: false, allowUnknown: true }
1284
+ );
1285
+ if (error) {
1286
+ return Promise.reject(new FDKClientValidationError(error));
1287
+ }
1288
+
1289
+ // Showing warrnings if extra unknown parameters are found
1290
+ const {
1291
+ error: warrning,
1292
+ } = ContentPlatformValidator.getCustomObjectDefinitions().validate(
1293
+ {
1294
+ pageNo,
1295
+ pageSize,
1296
+ search,
1297
+ },
1298
+ { abortEarly: false, allowUnknown: false }
1299
+ );
1300
+ if (warrning) {
1301
+ Logger({
1302
+ level: "WARN",
1303
+ message: `Parameter Validation warrnings for platform > Content > getCustomObjectDefinitions \n ${warrning}`,
1304
+ });
1305
+ }
1306
+
1307
+ const query_params = {};
1308
+ query_params["page_no"] = pageNo;
1309
+ query_params["page_size"] = pageSize;
1310
+ query_params["search"] = search;
1311
+
1312
+ const xHeaders = {};
1313
+
1314
+ const response = await PlatformAPIClient.execute(
1315
+ this.config,
1316
+ "get",
1317
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metaobjects/definitions`,
1318
+ query_params,
1319
+ undefined,
1320
+ { ...xHeaders, ...requestHeaders },
1321
+ { responseHeaders }
1322
+ );
1323
+
1324
+ let responseData = response;
1325
+ if (responseHeaders) {
1326
+ responseData = response[0];
1327
+ }
1328
+
1329
+ const {
1330
+ error: res_error,
1331
+ } = ContentPlatformModel.CustomObjectDefinitionsSchema().validate(
1332
+ responseData,
1333
+ { abortEarly: false, allowUnknown: true }
1334
+ );
1335
+
1336
+ if (res_error) {
1337
+ if (this.config.options.strictResponseCheck === true) {
1338
+ return Promise.reject(new FDKResponseValidationError(res_error));
1339
+ } else {
1340
+ Logger({
1341
+ level: "WARN",
1342
+ message: `Response Validation Warnings for platform > Content > getCustomObjectDefinitions \n ${res_error}`,
1343
+ });
1344
+ }
1345
+ }
1346
+
1347
+ return response;
1348
+ }
1349
+
1350
+ /**
1351
+ * @param {ContentPlatformValidator.GetCustomObjectsParam} arg - Arg object
1352
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1353
+ * @param {import("../PlatformAPIClient").Options} - Options
1354
+ * @returns {Promise<ContentPlatformModel.CustomObjectsSchema>} - Success response
1355
+ * @name getCustomObjects
1356
+ * @summary: Get list of custom objects
1357
+ * @description: Use this API to retrieve the custom objects. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/getCustomObjects/).
1358
+ */
1359
+ async getCustomObjects(
1360
+ { requestHeaders } = { requestHeaders: {} },
1361
+ { responseHeaders } = { responseHeaders: false }
1362
+ ) {
1363
+ const { error } = ContentPlatformValidator.getCustomObjects().validate(
1364
+ {},
1365
+ { abortEarly: false, allowUnknown: true }
1366
+ );
1367
+ if (error) {
1368
+ return Promise.reject(new FDKClientValidationError(error));
1369
+ }
1370
+
1371
+ // Showing warrnings if extra unknown parameters are found
1372
+ const {
1373
+ error: warrning,
1374
+ } = ContentPlatformValidator.getCustomObjects().validate(
1375
+ {},
1376
+ { abortEarly: false, allowUnknown: false }
1377
+ );
1378
+ if (warrning) {
1379
+ Logger({
1380
+ level: "WARN",
1381
+ message: `Parameter Validation warrnings for platform > Content > getCustomObjects \n ${warrning}`,
1382
+ });
1383
+ }
1384
+
1385
+ const query_params = {};
1386
+
1387
+ const xHeaders = {};
1388
+
1389
+ const response = await PlatformAPIClient.execute(
1390
+ this.config,
1391
+ "get",
1392
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metaobjects`,
1393
+ query_params,
1394
+ undefined,
1395
+ { ...xHeaders, ...requestHeaders },
1396
+ { responseHeaders }
1397
+ );
1398
+
1399
+ let responseData = response;
1400
+ if (responseHeaders) {
1401
+ responseData = response[0];
1402
+ }
1403
+
1404
+ const {
1405
+ error: res_error,
1406
+ } = ContentPlatformModel.CustomObjectsSchema().validate(responseData, {
1407
+ abortEarly: false,
1408
+ allowUnknown: true,
1409
+ });
1410
+
1411
+ if (res_error) {
1412
+ if (this.config.options.strictResponseCheck === true) {
1413
+ return Promise.reject(new FDKResponseValidationError(res_error));
1414
+ } else {
1415
+ Logger({
1416
+ level: "WARN",
1417
+ message: `Response Validation Warnings for platform > Content > getCustomObjects \n ${res_error}`,
1418
+ });
1419
+ }
1420
+ }
1421
+
1422
+ return response;
1423
+ }
1424
+
1425
+ /**
1426
+ * @param {ContentPlatformValidator.GetJobsParam} arg - Arg object
1427
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1428
+ * @param {import("../PlatformAPIClient").Options} - Options
1429
+ * @returns {Promise<ContentPlatformModel.CustomObjectBulkEntry>} - Success response
1430
+ * @name getJobs
1431
+ * @summary: Fetch bulk import and export job list.
1432
+ * @description: Use this api to get list of jobs of bulk import and exports - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/getJobs/).
1433
+ */
1434
+ async getJobs(
1435
+ { page, pageSize, actionType, requestHeaders } = { requestHeaders: {} },
1436
+ { responseHeaders } = { responseHeaders: false }
1437
+ ) {
1438
+ const { error } = ContentPlatformValidator.getJobs().validate(
1439
+ {
1440
+ page,
1441
+ pageSize,
1442
+ actionType,
1443
+ },
1444
+ { abortEarly: false, allowUnknown: true }
1445
+ );
1446
+ if (error) {
1447
+ return Promise.reject(new FDKClientValidationError(error));
1448
+ }
1449
+
1450
+ // Showing warrnings if extra unknown parameters are found
1451
+ const { error: warrning } = ContentPlatformValidator.getJobs().validate(
1452
+ {
1453
+ page,
1454
+ pageSize,
1455
+ actionType,
1456
+ },
1457
+ { abortEarly: false, allowUnknown: false }
1458
+ );
1459
+ if (warrning) {
1460
+ Logger({
1461
+ level: "WARN",
1462
+ message: `Parameter Validation warrnings for platform > Content > getJobs \n ${warrning}`,
1463
+ });
1464
+ }
1465
+
1466
+ const query_params = {};
1467
+ query_params["page"] = page;
1468
+ query_params["page_size"] = pageSize;
1469
+ query_params["action_type"] = actionType;
1470
+
1471
+ const xHeaders = {};
1472
+
1473
+ const response = await PlatformAPIClient.execute(
1474
+ this.config,
1475
+ "get",
1476
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metaobjects/jobs`,
1477
+ query_params,
1478
+ undefined,
1479
+ { ...xHeaders, ...requestHeaders },
1480
+ { responseHeaders }
1481
+ );
1482
+
1483
+ let responseData = response;
1484
+ if (responseHeaders) {
1485
+ responseData = response[0];
1486
+ }
1487
+
1488
+ const {
1489
+ error: res_error,
1490
+ } = ContentPlatformModel.CustomObjectBulkEntry().validate(responseData, {
1491
+ abortEarly: false,
1492
+ allowUnknown: true,
1493
+ });
1494
+
1495
+ if (res_error) {
1496
+ if (this.config.options.strictResponseCheck === true) {
1497
+ return Promise.reject(new FDKResponseValidationError(res_error));
1498
+ } else {
1499
+ Logger({
1500
+ level: "WARN",
1501
+ message: `Response Validation Warnings for platform > Content > getJobs \n ${res_error}`,
1502
+ });
1503
+ }
1504
+ }
1505
+
1506
+ return response;
1507
+ }
1508
+
1509
+ /**
1510
+ * @param {ContentPlatformValidator.GetResourcesParam} arg - Arg object
1511
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1512
+ * @param {import("../PlatformAPIClient").Options} - Options
1513
+ * @returns {Promise<ContentPlatformModel.ResourcesSchema>} - Success response
1514
+ * @name getResources
1515
+ * @summary: Get resources
1516
+ * @description: Use this API to retrieve the resources, such as products, collections, customers, selling locations, etc. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/getResources/).
1517
+ */
1518
+ async getResources(
1519
+ { requestHeaders } = { requestHeaders: {} },
1520
+ { responseHeaders } = { responseHeaders: false }
1521
+ ) {
1522
+ const { error } = ContentPlatformValidator.getResources().validate(
1523
+ {},
1524
+ { abortEarly: false, allowUnknown: true }
1525
+ );
1526
+ if (error) {
1527
+ return Promise.reject(new FDKClientValidationError(error));
1528
+ }
1529
+
1530
+ // Showing warrnings if extra unknown parameters are found
1531
+ const {
1532
+ error: warrning,
1533
+ } = ContentPlatformValidator.getResources().validate(
1534
+ {},
1535
+ { abortEarly: false, allowUnknown: false }
1536
+ );
1537
+ if (warrning) {
1538
+ Logger({
1539
+ level: "WARN",
1540
+ message: `Parameter Validation warrnings for platform > Content > getResources \n ${warrning}`,
1541
+ });
1542
+ }
1543
+
1544
+ const query_params = {};
1545
+
1546
+ const xHeaders = {};
1547
+
1548
+ const response = await PlatformAPIClient.execute(
1549
+ this.config,
1550
+ "get",
1551
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metafields/resources`,
1552
+ query_params,
1553
+ undefined,
1554
+ { ...xHeaders, ...requestHeaders },
1555
+ { responseHeaders }
1556
+ );
1557
+
1558
+ let responseData = response;
1559
+ if (responseHeaders) {
1560
+ responseData = response[0];
1561
+ }
1562
+
1563
+ const {
1564
+ error: res_error,
1565
+ } = ContentPlatformModel.ResourcesSchema().validate(responseData, {
1566
+ abortEarly: false,
1567
+ allowUnknown: true,
1568
+ });
1569
+
1570
+ if (res_error) {
1571
+ if (this.config.options.strictResponseCheck === true) {
1572
+ return Promise.reject(new FDKResponseValidationError(res_error));
1573
+ } else {
1574
+ Logger({
1575
+ level: "WARN",
1576
+ message: `Response Validation Warnings for platform > Content > getResources \n ${res_error}`,
1577
+ });
1578
+ }
1579
+ }
1580
+
1581
+ return response;
1582
+ }
1583
+
1584
+ /**
1585
+ * @param {ContentPlatformValidator.ImportCustomObjectEntriesParam} arg - Arg object
1586
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1587
+ * @param {import("../PlatformAPIClient").Options} - Options
1588
+ * @returns {Promise<ContentPlatformModel.CustomObjectEntryBulkUploadResponse>}
1589
+ * - Success response
1590
+ *
1591
+ * @name importCustomObjectEntries
1592
+ * @summary: Bulk custom object entries upload
1593
+ * @description: Use this API to upload custom object entries - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/importCustomObjectEntries/).
1594
+ */
1595
+ async importCustomObjectEntries(
1596
+ { definitionId, body, requestHeaders } = { requestHeaders: {} },
1597
+ { responseHeaders } = { responseHeaders: false }
1598
+ ) {
1599
+ const {
1600
+ error,
1601
+ } = ContentPlatformValidator.importCustomObjectEntries().validate(
1602
+ {
1603
+ definitionId,
1604
+ body,
1605
+ },
1606
+ { abortEarly: false, allowUnknown: true }
1607
+ );
1608
+ if (error) {
1609
+ return Promise.reject(new FDKClientValidationError(error));
1610
+ }
1611
+
1612
+ // Showing warrnings if extra unknown parameters are found
1613
+ const {
1614
+ error: warrning,
1615
+ } = ContentPlatformValidator.importCustomObjectEntries().validate(
1616
+ {
1617
+ definitionId,
1618
+ body,
1619
+ },
1620
+ { abortEarly: false, allowUnknown: false }
1621
+ );
1622
+ if (warrning) {
1623
+ Logger({
1624
+ level: "WARN",
1625
+ message: `Parameter Validation warrnings for platform > Content > importCustomObjectEntries \n ${warrning}`,
1626
+ });
1627
+ }
1628
+
1629
+ const query_params = {};
1630
+
1631
+ const xHeaders = {};
1632
+
1633
+ const response = await PlatformAPIClient.execute(
1634
+ this.config,
1635
+ "post",
1636
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metaobjects/bulk/${definitionId}/upload`,
1637
+ query_params,
1638
+ body,
1639
+ { ...xHeaders, ...requestHeaders },
1640
+ { responseHeaders }
1641
+ );
1642
+
1643
+ let responseData = response;
1644
+ if (responseHeaders) {
1645
+ responseData = response[0];
1646
+ }
1647
+
1648
+ const {
1649
+ error: res_error,
1650
+ } = ContentPlatformModel.CustomObjectEntryBulkUploadResponse().validate(
1651
+ responseData,
1652
+ { abortEarly: false, allowUnknown: true }
1653
+ );
1654
+
1655
+ if (res_error) {
1656
+ if (this.config.options.strictResponseCheck === true) {
1657
+ return Promise.reject(new FDKResponseValidationError(res_error));
1658
+ } else {
1659
+ Logger({
1660
+ level: "WARN",
1661
+ message: `Response Validation Warnings for platform > Content > importCustomObjectEntries \n ${res_error}`,
1662
+ });
1663
+ }
1664
+ }
1665
+
1666
+ return response;
1667
+ }
1668
+
1669
+ /**
1670
+ * @param {ContentPlatformValidator.SampleCustomObjectBulkEntryParam} arg - Arg object
1671
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1672
+ * @param {import("../PlatformAPIClient").Options} - Options
1673
+ * @returns {Promise<string>} - Success response
1674
+ * @name sampleCustomObjectBulkEntry
1675
+ * @summary: download sample for custom object bulk entry
1676
+ * @description: Use this api to get sample csv file - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/sampleCustomObjectBulkEntry/).
1677
+ */
1678
+ async sampleCustomObjectBulkEntry(
1679
+ { definitionId, requestHeaders } = { requestHeaders: {} },
1680
+ { responseHeaders } = { responseHeaders: false }
1681
+ ) {
1682
+ const {
1683
+ error,
1684
+ } = ContentPlatformValidator.sampleCustomObjectBulkEntry().validate(
1685
+ {
1686
+ definitionId,
1687
+ },
1688
+ { abortEarly: false, allowUnknown: true }
1689
+ );
1690
+ if (error) {
1691
+ return Promise.reject(new FDKClientValidationError(error));
1692
+ }
1693
+
1694
+ // Showing warrnings if extra unknown parameters are found
1695
+ const {
1696
+ error: warrning,
1697
+ } = ContentPlatformValidator.sampleCustomObjectBulkEntry().validate(
1698
+ {
1699
+ definitionId,
1700
+ },
1701
+ { abortEarly: false, allowUnknown: false }
1702
+ );
1703
+ if (warrning) {
1704
+ Logger({
1705
+ level: "WARN",
1706
+ message: `Parameter Validation warrnings for platform > Content > sampleCustomObjectBulkEntry \n ${warrning}`,
1707
+ });
1708
+ }
1709
+
1710
+ const query_params = {};
1711
+
1712
+ const xHeaders = {};
1713
+
1714
+ const response = await PlatformAPIClient.execute(
1715
+ this.config,
1716
+ "get",
1717
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metaobjects/bulk/${definitionId}/sample`,
1718
+ query_params,
1719
+ undefined,
1720
+ { ...xHeaders, ...requestHeaders },
1721
+ { responseHeaders }
1722
+ );
1723
+
1724
+ let responseData = response;
1725
+ if (responseHeaders) {
1726
+ responseData = response[0];
1727
+ }
1728
+
1729
+ const { error: res_error } = Joi.string()
1730
+ .allow("")
1731
+ .validate(responseData, { abortEarly: false, allowUnknown: true });
1732
+
1733
+ if (res_error) {
1734
+ if (this.config.options.strictResponseCheck === true) {
1735
+ return Promise.reject(new FDKResponseValidationError(res_error));
1736
+ } else {
1737
+ Logger({
1738
+ level: "WARN",
1739
+ message: `Response Validation Warnings for platform > Content > sampleCustomObjectBulkEntry \n ${res_error}`,
1740
+ });
1741
+ }
1742
+ }
1743
+
1744
+ return response;
1745
+ }
1746
+
1747
+ /**
1748
+ * @param {ContentPlatformValidator.UpdateCustomFieldDefinitionParam} arg - Arg object
1749
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1750
+ * @param {import("../PlatformAPIClient").Options} - Options
1751
+ * @returns {Promise<ContentPlatformModel.CustomFieldDefinitionDetailResSchema>}
1752
+ * - Success response
1753
+ *
1754
+ * @name updateCustomFieldDefinition
1755
+ * @summary: Update custom field definition
1756
+ * @description: Use this API to update a custom field definition for your application. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/updateCustomFieldDefinition/).
1757
+ */
1758
+ async updateCustomFieldDefinition(
1759
+ { definitionId, body, requestHeaders } = { requestHeaders: {} },
1760
+ { responseHeaders } = { responseHeaders: false }
1761
+ ) {
1762
+ const {
1763
+ error,
1764
+ } = ContentPlatformValidator.updateCustomFieldDefinition().validate(
1765
+ {
1766
+ definitionId,
1767
+ body,
1768
+ },
1769
+ { abortEarly: false, allowUnknown: true }
1770
+ );
1771
+ if (error) {
1772
+ return Promise.reject(new FDKClientValidationError(error));
1773
+ }
1774
+
1775
+ // Showing warrnings if extra unknown parameters are found
1776
+ const {
1777
+ error: warrning,
1778
+ } = ContentPlatformValidator.updateCustomFieldDefinition().validate(
1779
+ {
1780
+ definitionId,
1781
+ body,
1782
+ },
1783
+ { abortEarly: false, allowUnknown: false }
1784
+ );
1785
+ if (warrning) {
1786
+ Logger({
1787
+ level: "WARN",
1788
+ message: `Parameter Validation warrnings for platform > Content > updateCustomFieldDefinition \n ${warrning}`,
1789
+ });
1790
+ }
1791
+
1792
+ const query_params = {};
1793
+
1794
+ const xHeaders = {};
1795
+
1796
+ const response = await PlatformAPIClient.execute(
1797
+ this.config,
1798
+ "put",
1799
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metafields/definitions/${definitionId}`,
1800
+ query_params,
1801
+ body,
1802
+ { ...xHeaders, ...requestHeaders },
1803
+ { responseHeaders }
1804
+ );
1805
+
1806
+ let responseData = response;
1807
+ if (responseHeaders) {
1808
+ responseData = response[0];
1809
+ }
1810
+
1811
+ const {
1812
+ error: res_error,
1813
+ } = ContentPlatformModel.CustomFieldDefinitionDetailResSchema().validate(
1814
+ responseData,
1815
+ { abortEarly: false, allowUnknown: true }
1816
+ );
1817
+
1818
+ if (res_error) {
1819
+ if (this.config.options.strictResponseCheck === true) {
1820
+ return Promise.reject(new FDKResponseValidationError(res_error));
1821
+ } else {
1822
+ Logger({
1823
+ level: "WARN",
1824
+ message: `Response Validation Warnings for platform > Content > updateCustomFieldDefinition \n ${res_error}`,
1825
+ });
1826
+ }
1827
+ }
1828
+
1829
+ return response;
1830
+ }
1831
+
1832
+ /**
1833
+ * @param {ContentPlatformValidator.UpdateCustomObjectParam} arg - Arg object
1834
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1835
+ * @param {import("../PlatformAPIClient").Options} - Options
1836
+ * @returns {Promise<ContentPlatformModel.CustomObjectByIdSchema>} - Success response
1837
+ * @name updateCustomObject
1838
+ * @summary: Update custom object details
1839
+ * @description: Use this API to update a custom object detail for your application. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/updateCustomObject/).
1840
+ */
1841
+ async updateCustomObject(
1842
+ { metaobjectId, body, requestHeaders } = { requestHeaders: {} },
1843
+ { responseHeaders } = { responseHeaders: false }
1844
+ ) {
1845
+ const { error } = ContentPlatformValidator.updateCustomObject().validate(
1846
+ {
1847
+ metaobjectId,
1848
+ body,
1849
+ },
1850
+ { abortEarly: false, allowUnknown: true }
1851
+ );
1852
+ if (error) {
1853
+ return Promise.reject(new FDKClientValidationError(error));
1854
+ }
1855
+
1856
+ // Showing warrnings if extra unknown parameters are found
1857
+ const {
1858
+ error: warrning,
1859
+ } = ContentPlatformValidator.updateCustomObject().validate(
1860
+ {
1861
+ metaobjectId,
1862
+ body,
1863
+ },
1864
+ { abortEarly: false, allowUnknown: false }
1865
+ );
1866
+ if (warrning) {
1867
+ Logger({
1868
+ level: "WARN",
1869
+ message: `Parameter Validation warrnings for platform > Content > updateCustomObject \n ${warrning}`,
1870
+ });
1871
+ }
1872
+
1873
+ const query_params = {};
1874
+
1875
+ const xHeaders = {};
1876
+
1877
+ const response = await PlatformAPIClient.execute(
1878
+ this.config,
1879
+ "put",
1880
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metaobjects/${metaobjectId}`,
1881
+ query_params,
1882
+ body,
1883
+ { ...xHeaders, ...requestHeaders },
1884
+ { responseHeaders }
1885
+ );
1886
+
1887
+ let responseData = response;
1888
+ if (responseHeaders) {
1889
+ responseData = response[0];
1890
+ }
1891
+
1892
+ const {
1893
+ error: res_error,
1894
+ } = ContentPlatformModel.CustomObjectByIdSchema().validate(responseData, {
1895
+ abortEarly: false,
1896
+ allowUnknown: true,
1897
+ });
1898
+
1899
+ if (res_error) {
1900
+ if (this.config.options.strictResponseCheck === true) {
1901
+ return Promise.reject(new FDKResponseValidationError(res_error));
1902
+ } else {
1903
+ Logger({
1904
+ level: "WARN",
1905
+ message: `Response Validation Warnings for platform > Content > updateCustomObject \n ${res_error}`,
1906
+ });
1907
+ }
1908
+ }
1909
+
1910
+ return response;
1911
+ }
1912
+
1913
+ /**
1914
+ * @param {ContentPlatformValidator.UpdateCustomObjectDefinitionParam} arg
1915
+ * - Arg object
1916
+ *
1917
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1918
+ * @param {import("../PlatformAPIClient").Options} - Options
1919
+ * @returns {Promise<ContentPlatformModel.CustomObjectDefinitionSchema>} -
1920
+ * Success response
1921
+ * @name updateCustomObjectDefinition
1922
+ * @summary: Update custom object definition
1923
+ * @description: Use this API to update a custom object definition for your application. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/updateCustomObjectDefinition/).
1924
+ */
1925
+ async updateCustomObjectDefinition(
1926
+ { definitionId, body, requestHeaders } = { requestHeaders: {} },
1927
+ { responseHeaders } = { responseHeaders: false }
1928
+ ) {
1929
+ const {
1930
+ error,
1931
+ } = ContentPlatformValidator.updateCustomObjectDefinition().validate(
1932
+ {
1933
+ definitionId,
1934
+ body,
1935
+ },
1936
+ { abortEarly: false, allowUnknown: true }
1937
+ );
1938
+ if (error) {
1939
+ return Promise.reject(new FDKClientValidationError(error));
1940
+ }
1941
+
1942
+ // Showing warrnings if extra unknown parameters are found
1943
+ const {
1944
+ error: warrning,
1945
+ } = ContentPlatformValidator.updateCustomObjectDefinition().validate(
1946
+ {
1947
+ definitionId,
1948
+ body,
1949
+ },
1950
+ { abortEarly: false, allowUnknown: false }
1951
+ );
1952
+ if (warrning) {
1953
+ Logger({
1954
+ level: "WARN",
1955
+ message: `Parameter Validation warrnings for platform > Content > updateCustomObjectDefinition \n ${warrning}`,
1956
+ });
1957
+ }
1958
+
1959
+ const query_params = {};
1960
+
1961
+ const xHeaders = {};
1962
+
1963
+ const response = await PlatformAPIClient.execute(
1964
+ this.config,
1965
+ "put",
1966
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metaobjects/definitions/${definitionId}`,
1967
+ query_params,
1968
+ body,
1969
+ { ...xHeaders, ...requestHeaders },
1970
+ { responseHeaders }
1971
+ );
1972
+
1973
+ let responseData = response;
1974
+ if (responseHeaders) {
1975
+ responseData = response[0];
1976
+ }
1977
+
1978
+ const {
1979
+ error: res_error,
1980
+ } = ContentPlatformModel.CustomObjectDefinitionSchema().validate(
1981
+ responseData,
1982
+ { abortEarly: false, allowUnknown: true }
1983
+ );
1984
+
1985
+ if (res_error) {
1986
+ if (this.config.options.strictResponseCheck === true) {
1987
+ return Promise.reject(new FDKResponseValidationError(res_error));
1988
+ } else {
1989
+ Logger({
1990
+ level: "WARN",
1991
+ message: `Response Validation Warnings for platform > Content > updateCustomObjectDefinition \n ${res_error}`,
1992
+ });
1993
+ }
1994
+ }
1995
+
1996
+ return response;
1997
+ }
1998
+ }
1999
+
2000
+ module.exports = Content;