@gofynd/fdk-client-javascript 1.3.11-beta.7 → 1.4.0-beta.1

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 (231) 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/FileStorage/FileStoragePartnerModel.d.ts +3 -15
  56. package/sdk/partner/FileStorage/FileStoragePartnerModel.js +2 -14
  57. package/sdk/partner/Lead/LeadPartnerClient.d.ts +125 -0
  58. package/sdk/partner/Lead/LeadPartnerClient.js +785 -0
  59. package/sdk/partner/Lead/LeadPartnerModel.d.ts +1127 -0
  60. package/sdk/partner/Lead/LeadPartnerModel.js +896 -0
  61. package/sdk/partner/Lead/LeadPartnerValidator.d.ts +12 -0
  62. package/sdk/partner/Lead/LeadPartnerValidator.js +67 -0
  63. package/sdk/partner/Logistics/LogisticsPartnerClient.d.ts +155 -0
  64. package/sdk/partner/Logistics/LogisticsPartnerClient.js +1195 -0
  65. package/sdk/partner/Logistics/LogisticsPartnerModel.d.ts +372 -0
  66. package/sdk/partner/Logistics/LogisticsPartnerModel.js +442 -0
  67. package/sdk/partner/Logistics/LogisticsPartnerValidator.d.ts +16 -0
  68. package/sdk/partner/Logistics/LogisticsPartnerValidator.js +123 -0
  69. package/sdk/partner/PartnerClient.d.ts +6 -0
  70. package/sdk/partner/PartnerClient.js +9 -0
  71. package/sdk/partner/Theme/ThemePartnerClient.d.ts +10 -0
  72. package/sdk/partner/Theme/ThemePartnerClient.js +80 -0
  73. package/sdk/partner/Theme/ThemePartnerModel.d.ts +100 -43
  74. package/sdk/partner/Theme/ThemePartnerModel.js +74 -30
  75. package/sdk/partner/Theme/ThemePartnerValidator.d.ts +1 -0
  76. package/sdk/partner/Theme/ThemePartnerValidator.js +9 -0
  77. package/sdk/partner/Webhook/WebhookPartnerClient.d.ts +99 -0
  78. package/sdk/partner/Webhook/WebhookPartnerClient.js +753 -0
  79. package/sdk/partner/Webhook/WebhookPartnerModel.d.ts +566 -0
  80. package/sdk/partner/Webhook/WebhookPartnerModel.js +583 -0
  81. package/sdk/partner/Webhook/WebhookPartnerValidator.d.ts +12 -0
  82. package/sdk/partner/Webhook/WebhookPartnerValidator.js +74 -0
  83. package/sdk/partner/index.d.ts +3 -0
  84. package/sdk/partner/index.js +6 -0
  85. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +2 -2
  86. package/sdk/platform/Billing/BillingPlatformClient.d.ts +11 -1
  87. package/sdk/platform/Billing/BillingPlatformClient.js +110 -3
  88. package/sdk/platform/Billing/BillingPlatformModel.d.ts +67 -1
  89. package/sdk/platform/Billing/BillingPlatformModel.js +78 -0
  90. package/sdk/platform/Billing/BillingPlatformValidator.d.ts +43 -4
  91. package/sdk/platform/Billing/BillingPlatformValidator.js +29 -2
  92. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +1 -1
  93. package/sdk/platform/Cart/CartPlatformApplicationClient.js +7 -1
  94. package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +4 -0
  95. package/sdk/platform/Cart/CartPlatformApplicationValidator.js +4 -0
  96. package/sdk/platform/Cart/CartPlatformModel.d.ts +100 -5
  97. package/sdk/platform/Cart/CartPlatformModel.js +71 -4
  98. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +15 -11
  99. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +52 -21
  100. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +27 -0
  101. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +11 -0
  102. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +26 -4
  103. package/sdk/platform/Catalog/CatalogPlatformClient.js +173 -7
  104. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +304 -1
  105. package/sdk/platform/Catalog/CatalogPlatformModel.js +335 -0
  106. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +31 -3
  107. package/sdk/platform/Catalog/CatalogPlatformValidator.js +27 -2
  108. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +138 -36
  109. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +739 -57
  110. package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.d.ts +128 -3
  111. package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +111 -1
  112. package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +150 -1
  113. package/sdk/platform/Communication/CommunicationPlatformModel.js +172 -0
  114. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +8 -2
  115. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +32 -4
  116. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +38 -9
  117. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +42 -8
  118. package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.d.ts +14 -0
  119. package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +6 -0
  120. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +8 -8
  121. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +4 -4
  122. package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +371 -132
  123. package/sdk/platform/Configuration/ConfigurationPlatformModel.js +288 -77
  124. package/sdk/platform/Configuration/ConfigurationPlatformValidator.d.ts +2 -2
  125. package/sdk/platform/Configuration/ConfigurationPlatformValidator.js +2 -2
  126. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +391 -0
  127. package/sdk/platform/Content/ContentPlatformApplicationClient.js +3641 -1059
  128. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +351 -1
  129. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +410 -0
  130. package/sdk/platform/Content/ContentPlatformClient.d.ts +277 -0
  131. package/sdk/platform/Content/ContentPlatformClient.js +2011 -0
  132. package/sdk/platform/Content/ContentPlatformModel.d.ts +1100 -1
  133. package/sdk/platform/Content/ContentPlatformModel.js +1362 -46
  134. package/sdk/platform/Content/ContentPlatformValidator.d.ts +247 -0
  135. package/sdk/platform/Content/ContentPlatformValidator.js +319 -0
  136. package/sdk/platform/Discount/DiscountPlatformClient.d.ts +2 -2
  137. package/sdk/platform/Discount/DiscountPlatformClient.js +2 -2
  138. package/sdk/platform/Discount/DiscountPlatformModel.d.ts +96 -13
  139. package/sdk/platform/Discount/DiscountPlatformModel.js +104 -12
  140. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +16 -6
  141. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +117 -8
  142. package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +55 -4
  143. package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +39 -2
  144. package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +18 -19
  145. package/sdk/platform/FileStorage/FileStoragePlatformModel.js +20 -18
  146. package/sdk/platform/Finance/FinancePlatformClient.d.ts +33 -0
  147. package/sdk/platform/Finance/FinancePlatformClient.js +240 -0
  148. package/sdk/platform/Finance/FinancePlatformModel.d.ts +151 -5
  149. package/sdk/platform/Finance/FinancePlatformModel.js +190 -4
  150. package/sdk/platform/Finance/FinancePlatformValidator.d.ts +38 -1
  151. package/sdk/platform/Finance/FinancePlatformValidator.js +38 -0
  152. package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +38 -28
  153. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +137 -56
  154. package/sdk/platform/Lead/LeadPlatformApplicationValidator.d.ts +41 -29
  155. package/sdk/platform/Lead/LeadPlatformApplicationValidator.js +33 -21
  156. package/sdk/platform/Lead/LeadPlatformModel.d.ts +12 -3
  157. package/sdk/platform/Lead/LeadPlatformModel.js +16 -2
  158. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +23 -1
  159. package/sdk/platform/Order/OrderPlatformApplicationClient.js +178 -1
  160. package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +39 -1
  161. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +32 -0
  162. package/sdk/platform/Order/OrderPlatformClient.d.ts +202 -31
  163. package/sdk/platform/Order/OrderPlatformClient.js +2010 -586
  164. package/sdk/platform/Order/OrderPlatformModel.d.ts +1032 -470
  165. package/sdk/platform/Order/OrderPlatformModel.js +1187 -534
  166. package/sdk/platform/Order/OrderPlatformValidator.d.ts +318 -35
  167. package/sdk/platform/Order/OrderPlatformValidator.js +292 -29
  168. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +119 -13
  169. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +749 -39
  170. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +143 -7
  171. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +133 -6
  172. package/sdk/platform/Payment/PaymentPlatformClient.d.ts +1 -1
  173. package/sdk/platform/Payment/PaymentPlatformClient.js +1 -1
  174. package/sdk/platform/Payment/PaymentPlatformModel.d.ts +996 -134
  175. package/sdk/platform/Payment/PaymentPlatformModel.js +721 -58
  176. package/sdk/platform/PlatformApplicationClient.d.ts +2 -2
  177. package/sdk/platform/PlatformApplicationClient.js +4 -4
  178. package/sdk/platform/PlatformClient.d.ts +4 -2
  179. package/sdk/platform/PlatformClient.js +8 -4
  180. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.d.ts +142 -66
  181. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +645 -147
  182. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.d.ts +131 -63
  183. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.js +126 -47
  184. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.d.ts +217 -105
  185. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +1136 -347
  186. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +912 -313
  187. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +1071 -355
  188. package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.d.ts +382 -133
  189. package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.js +266 -102
  190. package/sdk/platform/Theme/ThemePlatformClient.d.ts +11 -1
  191. package/sdk/platform/Theme/ThemePlatformClient.js +87 -3
  192. package/sdk/platform/Theme/ThemePlatformModel.d.ts +333 -47
  193. package/sdk/platform/Theme/ThemePlatformModel.js +395 -35
  194. package/sdk/platform/Theme/ThemePlatformValidator.d.ts +28 -4
  195. package/sdk/platform/Theme/ThemePlatformValidator.js +21 -2
  196. package/sdk/platform/User/UserPlatformApplicationClient.d.ts +116 -1
  197. package/sdk/platform/User/UserPlatformApplicationClient.js +931 -85
  198. package/sdk/platform/User/UserPlatformApplicationValidator.d.ts +224 -7
  199. package/sdk/platform/User/UserPlatformApplicationValidator.js +173 -5
  200. package/sdk/platform/User/UserPlatformModel.d.ts +344 -7
  201. package/sdk/platform/User/UserPlatformModel.js +256 -5
  202. package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +47 -39
  203. package/sdk/platform/Webhook/WebhookPlatformClient.js +63 -61
  204. package/sdk/platform/Webhook/WebhookPlatformModel.d.ts +264 -156
  205. package/sdk/platform/Webhook/WebhookPlatformModel.js +276 -153
  206. package/sdk/platform/Webhook/WebhookPlatformValidator.d.ts +7 -10
  207. package/sdk/platform/Webhook/WebhookPlatformValidator.js +6 -6
  208. package/sdk/platform/index.d.ts +1 -1
  209. package/sdk/platform/index.js +2 -2
  210. package/sdk/public/Billing/BillingPublicClient.d.ts +23 -0
  211. package/sdk/public/Billing/BillingPublicClient.js +116 -0
  212. package/sdk/public/Billing/BillingPublicModel.d.ts +92 -0
  213. package/sdk/public/Billing/BillingPublicModel.js +96 -0
  214. package/sdk/public/Billing/BillingPublicValidator.d.ts +18 -0
  215. package/sdk/public/Billing/BillingPublicValidator.js +19 -0
  216. package/sdk/public/Content/ContentPublicClient.d.ts +22 -0
  217. package/sdk/public/Content/ContentPublicClient.js +114 -0
  218. package/sdk/public/Content/ContentPublicModel.d.ts +53 -0
  219. package/sdk/public/Content/ContentPublicModel.js +60 -0
  220. package/sdk/public/Content/ContentPublicValidator.d.ts +18 -0
  221. package/sdk/public/Content/ContentPublicValidator.js +19 -0
  222. package/sdk/public/PublicClient.d.ts +4 -0
  223. package/sdk/public/PublicClient.js +8 -0
  224. package/sdk/public/Webhook/WebhookPublicClient.d.ts +33 -0
  225. package/sdk/public/Webhook/WebhookPublicClient.js +242 -0
  226. package/sdk/public/Webhook/WebhookPublicModel.d.ts +147 -1
  227. package/sdk/public/Webhook/WebhookPublicModel.js +177 -1
  228. package/sdk/public/Webhook/WebhookPublicValidator.d.ts +23 -1
  229. package/sdk/public/Webhook/WebhookPublicValidator.js +31 -0
  230. package/sdk/public/index.d.ts +2 -0
  231. package/sdk/public/index.js +4 -0
@@ -0,0 +1,2011 @@
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
+ { pageNo, pageSize, definitionId, requestHeaders } = { requestHeaders: {} },
1361
+ { responseHeaders } = { responseHeaders: false }
1362
+ ) {
1363
+ const { error } = ContentPlatformValidator.getCustomObjects().validate(
1364
+ {
1365
+ pageNo,
1366
+ pageSize,
1367
+ definitionId,
1368
+ },
1369
+ { abortEarly: false, allowUnknown: true }
1370
+ );
1371
+ if (error) {
1372
+ return Promise.reject(new FDKClientValidationError(error));
1373
+ }
1374
+
1375
+ // Showing warrnings if extra unknown parameters are found
1376
+ const {
1377
+ error: warrning,
1378
+ } = ContentPlatformValidator.getCustomObjects().validate(
1379
+ {
1380
+ pageNo,
1381
+ pageSize,
1382
+ definitionId,
1383
+ },
1384
+ { abortEarly: false, allowUnknown: false }
1385
+ );
1386
+ if (warrning) {
1387
+ Logger({
1388
+ level: "WARN",
1389
+ message: `Parameter Validation warrnings for platform > Content > getCustomObjects \n ${warrning}`,
1390
+ });
1391
+ }
1392
+
1393
+ const query_params = {};
1394
+ query_params["definition_id"] = definitionId;
1395
+ query_params["page_no"] = pageNo;
1396
+ query_params["page_size"] = pageSize;
1397
+
1398
+ const xHeaders = {};
1399
+
1400
+ const response = await PlatformAPIClient.execute(
1401
+ this.config,
1402
+ "get",
1403
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metaobjects`,
1404
+ query_params,
1405
+ undefined,
1406
+ { ...xHeaders, ...requestHeaders },
1407
+ { responseHeaders }
1408
+ );
1409
+
1410
+ let responseData = response;
1411
+ if (responseHeaders) {
1412
+ responseData = response[0];
1413
+ }
1414
+
1415
+ const {
1416
+ error: res_error,
1417
+ } = ContentPlatformModel.CustomObjectsSchema().validate(responseData, {
1418
+ abortEarly: false,
1419
+ allowUnknown: true,
1420
+ });
1421
+
1422
+ if (res_error) {
1423
+ if (this.config.options.strictResponseCheck === true) {
1424
+ return Promise.reject(new FDKResponseValidationError(res_error));
1425
+ } else {
1426
+ Logger({
1427
+ level: "WARN",
1428
+ message: `Response Validation Warnings for platform > Content > getCustomObjects \n ${res_error}`,
1429
+ });
1430
+ }
1431
+ }
1432
+
1433
+ return response;
1434
+ }
1435
+
1436
+ /**
1437
+ * @param {ContentPlatformValidator.GetJobsParam} arg - Arg object
1438
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1439
+ * @param {import("../PlatformAPIClient").Options} - Options
1440
+ * @returns {Promise<ContentPlatformModel.CustomObjectBulkEntry>} - Success response
1441
+ * @name getJobs
1442
+ * @summary: Fetch bulk import and export job list.
1443
+ * @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/).
1444
+ */
1445
+ async getJobs(
1446
+ { page, pageSize, actionType, requestHeaders } = { requestHeaders: {} },
1447
+ { responseHeaders } = { responseHeaders: false }
1448
+ ) {
1449
+ const { error } = ContentPlatformValidator.getJobs().validate(
1450
+ {
1451
+ page,
1452
+ pageSize,
1453
+ actionType,
1454
+ },
1455
+ { abortEarly: false, allowUnknown: true }
1456
+ );
1457
+ if (error) {
1458
+ return Promise.reject(new FDKClientValidationError(error));
1459
+ }
1460
+
1461
+ // Showing warrnings if extra unknown parameters are found
1462
+ const { error: warrning } = ContentPlatformValidator.getJobs().validate(
1463
+ {
1464
+ page,
1465
+ pageSize,
1466
+ actionType,
1467
+ },
1468
+ { abortEarly: false, allowUnknown: false }
1469
+ );
1470
+ if (warrning) {
1471
+ Logger({
1472
+ level: "WARN",
1473
+ message: `Parameter Validation warrnings for platform > Content > getJobs \n ${warrning}`,
1474
+ });
1475
+ }
1476
+
1477
+ const query_params = {};
1478
+ query_params["page"] = page;
1479
+ query_params["page_size"] = pageSize;
1480
+ query_params["action_type"] = actionType;
1481
+
1482
+ const xHeaders = {};
1483
+
1484
+ const response = await PlatformAPIClient.execute(
1485
+ this.config,
1486
+ "get",
1487
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metaobjects/jobs`,
1488
+ query_params,
1489
+ undefined,
1490
+ { ...xHeaders, ...requestHeaders },
1491
+ { responseHeaders }
1492
+ );
1493
+
1494
+ let responseData = response;
1495
+ if (responseHeaders) {
1496
+ responseData = response[0];
1497
+ }
1498
+
1499
+ const {
1500
+ error: res_error,
1501
+ } = ContentPlatformModel.CustomObjectBulkEntry().validate(responseData, {
1502
+ abortEarly: false,
1503
+ allowUnknown: true,
1504
+ });
1505
+
1506
+ if (res_error) {
1507
+ if (this.config.options.strictResponseCheck === true) {
1508
+ return Promise.reject(new FDKResponseValidationError(res_error));
1509
+ } else {
1510
+ Logger({
1511
+ level: "WARN",
1512
+ message: `Response Validation Warnings for platform > Content > getJobs \n ${res_error}`,
1513
+ });
1514
+ }
1515
+ }
1516
+
1517
+ return response;
1518
+ }
1519
+
1520
+ /**
1521
+ * @param {ContentPlatformValidator.GetResourcesParam} arg - Arg object
1522
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1523
+ * @param {import("../PlatformAPIClient").Options} - Options
1524
+ * @returns {Promise<ContentPlatformModel.ResourcesSchema>} - Success response
1525
+ * @name getResources
1526
+ * @summary: Get resources
1527
+ * @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/).
1528
+ */
1529
+ async getResources(
1530
+ { requestHeaders } = { requestHeaders: {} },
1531
+ { responseHeaders } = { responseHeaders: false }
1532
+ ) {
1533
+ const { error } = ContentPlatformValidator.getResources().validate(
1534
+ {},
1535
+ { abortEarly: false, allowUnknown: true }
1536
+ );
1537
+ if (error) {
1538
+ return Promise.reject(new FDKClientValidationError(error));
1539
+ }
1540
+
1541
+ // Showing warrnings if extra unknown parameters are found
1542
+ const {
1543
+ error: warrning,
1544
+ } = ContentPlatformValidator.getResources().validate(
1545
+ {},
1546
+ { abortEarly: false, allowUnknown: false }
1547
+ );
1548
+ if (warrning) {
1549
+ Logger({
1550
+ level: "WARN",
1551
+ message: `Parameter Validation warrnings for platform > Content > getResources \n ${warrning}`,
1552
+ });
1553
+ }
1554
+
1555
+ const query_params = {};
1556
+
1557
+ const xHeaders = {};
1558
+
1559
+ const response = await PlatformAPIClient.execute(
1560
+ this.config,
1561
+ "get",
1562
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metafields/resources`,
1563
+ query_params,
1564
+ undefined,
1565
+ { ...xHeaders, ...requestHeaders },
1566
+ { responseHeaders }
1567
+ );
1568
+
1569
+ let responseData = response;
1570
+ if (responseHeaders) {
1571
+ responseData = response[0];
1572
+ }
1573
+
1574
+ const {
1575
+ error: res_error,
1576
+ } = ContentPlatformModel.ResourcesSchema().validate(responseData, {
1577
+ abortEarly: false,
1578
+ allowUnknown: true,
1579
+ });
1580
+
1581
+ if (res_error) {
1582
+ if (this.config.options.strictResponseCheck === true) {
1583
+ return Promise.reject(new FDKResponseValidationError(res_error));
1584
+ } else {
1585
+ Logger({
1586
+ level: "WARN",
1587
+ message: `Response Validation Warnings for platform > Content > getResources \n ${res_error}`,
1588
+ });
1589
+ }
1590
+ }
1591
+
1592
+ return response;
1593
+ }
1594
+
1595
+ /**
1596
+ * @param {ContentPlatformValidator.ImportCustomObjectEntriesParam} arg - Arg object
1597
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1598
+ * @param {import("../PlatformAPIClient").Options} - Options
1599
+ * @returns {Promise<ContentPlatformModel.CustomObjectEntryBulkUploadResponse>}
1600
+ * - Success response
1601
+ *
1602
+ * @name importCustomObjectEntries
1603
+ * @summary: Bulk custom object entries upload
1604
+ * @description: Use this API to upload custom object entries - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/importCustomObjectEntries/).
1605
+ */
1606
+ async importCustomObjectEntries(
1607
+ { definitionId, body, requestHeaders } = { requestHeaders: {} },
1608
+ { responseHeaders } = { responseHeaders: false }
1609
+ ) {
1610
+ const {
1611
+ error,
1612
+ } = ContentPlatformValidator.importCustomObjectEntries().validate(
1613
+ {
1614
+ definitionId,
1615
+ body,
1616
+ },
1617
+ { abortEarly: false, allowUnknown: true }
1618
+ );
1619
+ if (error) {
1620
+ return Promise.reject(new FDKClientValidationError(error));
1621
+ }
1622
+
1623
+ // Showing warrnings if extra unknown parameters are found
1624
+ const {
1625
+ error: warrning,
1626
+ } = ContentPlatformValidator.importCustomObjectEntries().validate(
1627
+ {
1628
+ definitionId,
1629
+ body,
1630
+ },
1631
+ { abortEarly: false, allowUnknown: false }
1632
+ );
1633
+ if (warrning) {
1634
+ Logger({
1635
+ level: "WARN",
1636
+ message: `Parameter Validation warrnings for platform > Content > importCustomObjectEntries \n ${warrning}`,
1637
+ });
1638
+ }
1639
+
1640
+ const query_params = {};
1641
+
1642
+ const xHeaders = {};
1643
+
1644
+ const response = await PlatformAPIClient.execute(
1645
+ this.config,
1646
+ "post",
1647
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metaobjects/bulk/${definitionId}/upload`,
1648
+ query_params,
1649
+ body,
1650
+ { ...xHeaders, ...requestHeaders },
1651
+ { responseHeaders }
1652
+ );
1653
+
1654
+ let responseData = response;
1655
+ if (responseHeaders) {
1656
+ responseData = response[0];
1657
+ }
1658
+
1659
+ const {
1660
+ error: res_error,
1661
+ } = ContentPlatformModel.CustomObjectEntryBulkUploadResponse().validate(
1662
+ responseData,
1663
+ { abortEarly: false, allowUnknown: true }
1664
+ );
1665
+
1666
+ if (res_error) {
1667
+ if (this.config.options.strictResponseCheck === true) {
1668
+ return Promise.reject(new FDKResponseValidationError(res_error));
1669
+ } else {
1670
+ Logger({
1671
+ level: "WARN",
1672
+ message: `Response Validation Warnings for platform > Content > importCustomObjectEntries \n ${res_error}`,
1673
+ });
1674
+ }
1675
+ }
1676
+
1677
+ return response;
1678
+ }
1679
+
1680
+ /**
1681
+ * @param {ContentPlatformValidator.SampleCustomObjectBulkEntryParam} arg - Arg object
1682
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1683
+ * @param {import("../PlatformAPIClient").Options} - Options
1684
+ * @returns {Promise<string>} - Success response
1685
+ * @name sampleCustomObjectBulkEntry
1686
+ * @summary: download sample for custom object bulk entry
1687
+ * @description: Use this api to get sample csv file - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/content/sampleCustomObjectBulkEntry/).
1688
+ */
1689
+ async sampleCustomObjectBulkEntry(
1690
+ { definitionId, requestHeaders } = { requestHeaders: {} },
1691
+ { responseHeaders } = { responseHeaders: false }
1692
+ ) {
1693
+ const {
1694
+ error,
1695
+ } = ContentPlatformValidator.sampleCustomObjectBulkEntry().validate(
1696
+ {
1697
+ definitionId,
1698
+ },
1699
+ { abortEarly: false, allowUnknown: true }
1700
+ );
1701
+ if (error) {
1702
+ return Promise.reject(new FDKClientValidationError(error));
1703
+ }
1704
+
1705
+ // Showing warrnings if extra unknown parameters are found
1706
+ const {
1707
+ error: warrning,
1708
+ } = ContentPlatformValidator.sampleCustomObjectBulkEntry().validate(
1709
+ {
1710
+ definitionId,
1711
+ },
1712
+ { abortEarly: false, allowUnknown: false }
1713
+ );
1714
+ if (warrning) {
1715
+ Logger({
1716
+ level: "WARN",
1717
+ message: `Parameter Validation warrnings for platform > Content > sampleCustomObjectBulkEntry \n ${warrning}`,
1718
+ });
1719
+ }
1720
+
1721
+ const query_params = {};
1722
+
1723
+ const xHeaders = {};
1724
+
1725
+ const response = await PlatformAPIClient.execute(
1726
+ this.config,
1727
+ "get",
1728
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metaobjects/bulk/${definitionId}/sample`,
1729
+ query_params,
1730
+ undefined,
1731
+ { ...xHeaders, ...requestHeaders },
1732
+ { responseHeaders }
1733
+ );
1734
+
1735
+ let responseData = response;
1736
+ if (responseHeaders) {
1737
+ responseData = response[0];
1738
+ }
1739
+
1740
+ const { error: res_error } = Joi.string()
1741
+ .allow("")
1742
+ .validate(responseData, { abortEarly: false, allowUnknown: true });
1743
+
1744
+ if (res_error) {
1745
+ if (this.config.options.strictResponseCheck === true) {
1746
+ return Promise.reject(new FDKResponseValidationError(res_error));
1747
+ } else {
1748
+ Logger({
1749
+ level: "WARN",
1750
+ message: `Response Validation Warnings for platform > Content > sampleCustomObjectBulkEntry \n ${res_error}`,
1751
+ });
1752
+ }
1753
+ }
1754
+
1755
+ return response;
1756
+ }
1757
+
1758
+ /**
1759
+ * @param {ContentPlatformValidator.UpdateCustomFieldDefinitionParam} arg - Arg object
1760
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1761
+ * @param {import("../PlatformAPIClient").Options} - Options
1762
+ * @returns {Promise<ContentPlatformModel.CustomFieldDefinitionDetailResSchema>}
1763
+ * - Success response
1764
+ *
1765
+ * @name updateCustomFieldDefinition
1766
+ * @summary: Update custom field definition
1767
+ * @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/).
1768
+ */
1769
+ async updateCustomFieldDefinition(
1770
+ { definitionId, body, requestHeaders } = { requestHeaders: {} },
1771
+ { responseHeaders } = { responseHeaders: false }
1772
+ ) {
1773
+ const {
1774
+ error,
1775
+ } = ContentPlatformValidator.updateCustomFieldDefinition().validate(
1776
+ {
1777
+ definitionId,
1778
+ body,
1779
+ },
1780
+ { abortEarly: false, allowUnknown: true }
1781
+ );
1782
+ if (error) {
1783
+ return Promise.reject(new FDKClientValidationError(error));
1784
+ }
1785
+
1786
+ // Showing warrnings if extra unknown parameters are found
1787
+ const {
1788
+ error: warrning,
1789
+ } = ContentPlatformValidator.updateCustomFieldDefinition().validate(
1790
+ {
1791
+ definitionId,
1792
+ body,
1793
+ },
1794
+ { abortEarly: false, allowUnknown: false }
1795
+ );
1796
+ if (warrning) {
1797
+ Logger({
1798
+ level: "WARN",
1799
+ message: `Parameter Validation warrnings for platform > Content > updateCustomFieldDefinition \n ${warrning}`,
1800
+ });
1801
+ }
1802
+
1803
+ const query_params = {};
1804
+
1805
+ const xHeaders = {};
1806
+
1807
+ const response = await PlatformAPIClient.execute(
1808
+ this.config,
1809
+ "put",
1810
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metafields/definitions/${definitionId}`,
1811
+ query_params,
1812
+ body,
1813
+ { ...xHeaders, ...requestHeaders },
1814
+ { responseHeaders }
1815
+ );
1816
+
1817
+ let responseData = response;
1818
+ if (responseHeaders) {
1819
+ responseData = response[0];
1820
+ }
1821
+
1822
+ const {
1823
+ error: res_error,
1824
+ } = ContentPlatformModel.CustomFieldDefinitionDetailResSchema().validate(
1825
+ responseData,
1826
+ { abortEarly: false, allowUnknown: true }
1827
+ );
1828
+
1829
+ if (res_error) {
1830
+ if (this.config.options.strictResponseCheck === true) {
1831
+ return Promise.reject(new FDKResponseValidationError(res_error));
1832
+ } else {
1833
+ Logger({
1834
+ level: "WARN",
1835
+ message: `Response Validation Warnings for platform > Content > updateCustomFieldDefinition \n ${res_error}`,
1836
+ });
1837
+ }
1838
+ }
1839
+
1840
+ return response;
1841
+ }
1842
+
1843
+ /**
1844
+ * @param {ContentPlatformValidator.UpdateCustomObjectParam} arg - Arg object
1845
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1846
+ * @param {import("../PlatformAPIClient").Options} - Options
1847
+ * @returns {Promise<ContentPlatformModel.CustomObjectByIdSchema>} - Success response
1848
+ * @name updateCustomObject
1849
+ * @summary: Update custom object details
1850
+ * @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/).
1851
+ */
1852
+ async updateCustomObject(
1853
+ { metaobjectId, body, requestHeaders } = { requestHeaders: {} },
1854
+ { responseHeaders } = { responseHeaders: false }
1855
+ ) {
1856
+ const { error } = ContentPlatformValidator.updateCustomObject().validate(
1857
+ {
1858
+ metaobjectId,
1859
+ body,
1860
+ },
1861
+ { abortEarly: false, allowUnknown: true }
1862
+ );
1863
+ if (error) {
1864
+ return Promise.reject(new FDKClientValidationError(error));
1865
+ }
1866
+
1867
+ // Showing warrnings if extra unknown parameters are found
1868
+ const {
1869
+ error: warrning,
1870
+ } = ContentPlatformValidator.updateCustomObject().validate(
1871
+ {
1872
+ metaobjectId,
1873
+ body,
1874
+ },
1875
+ { abortEarly: false, allowUnknown: false }
1876
+ );
1877
+ if (warrning) {
1878
+ Logger({
1879
+ level: "WARN",
1880
+ message: `Parameter Validation warrnings for platform > Content > updateCustomObject \n ${warrning}`,
1881
+ });
1882
+ }
1883
+
1884
+ const query_params = {};
1885
+
1886
+ const xHeaders = {};
1887
+
1888
+ const response = await PlatformAPIClient.execute(
1889
+ this.config,
1890
+ "put",
1891
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metaobjects/${metaobjectId}`,
1892
+ query_params,
1893
+ body,
1894
+ { ...xHeaders, ...requestHeaders },
1895
+ { responseHeaders }
1896
+ );
1897
+
1898
+ let responseData = response;
1899
+ if (responseHeaders) {
1900
+ responseData = response[0];
1901
+ }
1902
+
1903
+ const {
1904
+ error: res_error,
1905
+ } = ContentPlatformModel.CustomObjectByIdSchema().validate(responseData, {
1906
+ abortEarly: false,
1907
+ allowUnknown: true,
1908
+ });
1909
+
1910
+ if (res_error) {
1911
+ if (this.config.options.strictResponseCheck === true) {
1912
+ return Promise.reject(new FDKResponseValidationError(res_error));
1913
+ } else {
1914
+ Logger({
1915
+ level: "WARN",
1916
+ message: `Response Validation Warnings for platform > Content > updateCustomObject \n ${res_error}`,
1917
+ });
1918
+ }
1919
+ }
1920
+
1921
+ return response;
1922
+ }
1923
+
1924
+ /**
1925
+ * @param {ContentPlatformValidator.UpdateCustomObjectDefinitionParam} arg
1926
+ * - Arg object
1927
+ *
1928
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
1929
+ * @param {import("../PlatformAPIClient").Options} - Options
1930
+ * @returns {Promise<ContentPlatformModel.CustomObjectDefinitionSchema>} -
1931
+ * Success response
1932
+ * @name updateCustomObjectDefinition
1933
+ * @summary: Update custom object definition
1934
+ * @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/).
1935
+ */
1936
+ async updateCustomObjectDefinition(
1937
+ { definitionId, body, requestHeaders } = { requestHeaders: {} },
1938
+ { responseHeaders } = { responseHeaders: false }
1939
+ ) {
1940
+ const {
1941
+ error,
1942
+ } = ContentPlatformValidator.updateCustomObjectDefinition().validate(
1943
+ {
1944
+ definitionId,
1945
+ body,
1946
+ },
1947
+ { abortEarly: false, allowUnknown: true }
1948
+ );
1949
+ if (error) {
1950
+ return Promise.reject(new FDKClientValidationError(error));
1951
+ }
1952
+
1953
+ // Showing warrnings if extra unknown parameters are found
1954
+ const {
1955
+ error: warrning,
1956
+ } = ContentPlatformValidator.updateCustomObjectDefinition().validate(
1957
+ {
1958
+ definitionId,
1959
+ body,
1960
+ },
1961
+ { abortEarly: false, allowUnknown: false }
1962
+ );
1963
+ if (warrning) {
1964
+ Logger({
1965
+ level: "WARN",
1966
+ message: `Parameter Validation warrnings for platform > Content > updateCustomObjectDefinition \n ${warrning}`,
1967
+ });
1968
+ }
1969
+
1970
+ const query_params = {};
1971
+
1972
+ const xHeaders = {};
1973
+
1974
+ const response = await PlatformAPIClient.execute(
1975
+ this.config,
1976
+ "put",
1977
+ `/service/platform/content/v1.0/company/${this.config.companyId}/metaobjects/definitions/${definitionId}`,
1978
+ query_params,
1979
+ body,
1980
+ { ...xHeaders, ...requestHeaders },
1981
+ { responseHeaders }
1982
+ );
1983
+
1984
+ let responseData = response;
1985
+ if (responseHeaders) {
1986
+ responseData = response[0];
1987
+ }
1988
+
1989
+ const {
1990
+ error: res_error,
1991
+ } = ContentPlatformModel.CustomObjectDefinitionSchema().validate(
1992
+ responseData,
1993
+ { abortEarly: false, allowUnknown: true }
1994
+ );
1995
+
1996
+ if (res_error) {
1997
+ if (this.config.options.strictResponseCheck === true) {
1998
+ return Promise.reject(new FDKResponseValidationError(res_error));
1999
+ } else {
2000
+ Logger({
2001
+ level: "WARN",
2002
+ message: `Response Validation Warnings for platform > Content > updateCustomObjectDefinition \n ${res_error}`,
2003
+ });
2004
+ }
2005
+ }
2006
+
2007
+ return response;
2008
+ }
2009
+ }
2010
+
2011
+ module.exports = Content;