@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,785 @@
1
+ const PartnerAPIClient = require("../PartnerAPIClient");
2
+ const {
3
+ FDKClientValidationError,
4
+ FDKResponseValidationError,
5
+ } = require("../../common/FDKError");
6
+ const Paginator = require("../../common/Paginator");
7
+ const LeadPartnerValidator = require("./LeadPartnerValidator");
8
+ const LeadPartnerModel = require("./LeadPartnerModel");
9
+ const { Logger } = require("./../../common/Logger");
10
+ const Joi = require("joi");
11
+
12
+ class Lead {
13
+ constructor(config) {
14
+ this.config = config;
15
+ }
16
+
17
+ /**
18
+ * @param {LeadPartnerValidator.GetTicketsParam} arg - Arg object.
19
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
20
+ * @param {import("../PartnerAPIClient").Options} - Options
21
+ * @returns {Promise<LeadPartnerModel.TicketList>} - Success response
22
+ * @name getTickets
23
+ * @summary: Gets the list of partner level tickets and/or ticket filters depending on query params
24
+ * @description: Gets the list of partner level tickets and/or ticket filters - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/lead/getTickets/).
25
+ */
26
+ async getTickets(
27
+ {
28
+ items,
29
+ filters,
30
+ q,
31
+ status,
32
+ priority,
33
+ category,
34
+ pageNo,
35
+ pageSize,
36
+ requestHeaders,
37
+ } = { requestHeaders: {} },
38
+ { responseHeaders } = { responseHeaders: false }
39
+ ) {
40
+ const { error } = LeadPartnerValidator.getTickets().validate(
41
+ {
42
+ items,
43
+ filters,
44
+ q,
45
+ status,
46
+ priority,
47
+ category,
48
+ pageNo,
49
+ pageSize,
50
+ },
51
+ { abortEarly: false, allowUnknown: true }
52
+ );
53
+ if (error) {
54
+ return Promise.reject(new FDKClientValidationError(error));
55
+ }
56
+
57
+ // Showing warrnings if extra unknown parameters are found
58
+ const { error: warrning } = LeadPartnerValidator.getTickets().validate(
59
+ {
60
+ items,
61
+ filters,
62
+ q,
63
+ status,
64
+ priority,
65
+ category,
66
+ pageNo,
67
+ pageSize,
68
+ },
69
+ { abortEarly: false, allowUnknown: false }
70
+ );
71
+ if (warrning) {
72
+ Logger({
73
+ level: "WARN",
74
+ message: `Parameter Validation warrnings for partner > Lead > getTickets \n ${warrning}`,
75
+ });
76
+ }
77
+
78
+ const query_params = {};
79
+ query_params["items"] = items;
80
+ query_params["filters"] = filters;
81
+ query_params["q"] = q;
82
+ query_params["status"] = status;
83
+ query_params["priority"] = priority;
84
+ query_params["category"] = category;
85
+ query_params["page_no"] = pageNo;
86
+ query_params["page_size"] = pageSize;
87
+
88
+ const response = await PartnerAPIClient.execute(
89
+ this.config,
90
+ "get",
91
+ `/service/partner/lead/v1.0/organization/${this.config.organizationId}/ticket`,
92
+ query_params,
93
+ undefined,
94
+ requestHeaders,
95
+ { responseHeaders }
96
+ );
97
+
98
+ let responseData = response;
99
+ if (responseHeaders) {
100
+ responseData = response[0];
101
+ }
102
+
103
+ const {
104
+ error: res_error,
105
+ } = LeadPartnerModel.TicketList().validate(responseData, {
106
+ abortEarly: false,
107
+ allowUnknown: true,
108
+ });
109
+
110
+ if (res_error) {
111
+ if (this.config.options.strictResponseCheck === true) {
112
+ return Promise.reject(new FDKResponseValidationError(res_error));
113
+ } else {
114
+ Logger({
115
+ level: "WARN",
116
+ message: `Response Validation Warnings for partner > Lead > getTickets \n ${res_error}`,
117
+ });
118
+ }
119
+ }
120
+
121
+ return response;
122
+ }
123
+
124
+ /**
125
+ * @param {Object} arg - Arg object.
126
+ * @param {boolean} [arg.items] - Decides that the reponse will contain the
127
+ * list of tickets
128
+ * @param {boolean} [arg.filters] - Decides that the reponse will contain
129
+ * the ticket filters
130
+ * @param {string} [arg.q] - Search through ticket titles and description
131
+ * @param {string} [arg.status] - Filter tickets on status
132
+ * @param {LeadPartnerModel.PriorityEnum} [arg.priority] - Filter tickets on priority
133
+ * @param {string} [arg.category] - Filter tickets on category
134
+ * @param {number} [arg.pageSize] - Number of items to retrieve in each
135
+ * page. Default is 12.
136
+ * @returns {Paginator<LeadPartnerModel.TicketList>}
137
+ * @summary: Gets the list of partner level tickets and/or ticket filters depending on query params
138
+ * @description: Gets the list of partner level tickets and/or ticket filters
139
+ */
140
+ getTicketsPaginator({
141
+ items,
142
+ filters,
143
+ q,
144
+ status,
145
+ priority,
146
+ category,
147
+ pageSize,
148
+ } = {}) {
149
+ const paginator = new Paginator();
150
+ const callback = async () => {
151
+ const pageId = paginator.nextId;
152
+ const pageNo = paginator.pageNo;
153
+ const pageType = "number";
154
+ const data = await this.getTickets({
155
+ items: items,
156
+ filters: filters,
157
+ q: q,
158
+ status: status,
159
+ priority: priority,
160
+ category: category,
161
+ pageNo: pageNo,
162
+ pageSize: pageSize,
163
+ });
164
+ paginator.setPaginator({
165
+ hasNext: data.page.has_next ? true : false,
166
+ nextId: data.page.next_id,
167
+ });
168
+ return data;
169
+ };
170
+ paginator.setCallback(callback.bind(this));
171
+ return paginator;
172
+ }
173
+
174
+ /**
175
+ * @param {LeadPartnerValidator.CreateTicketParam} arg - Arg object.
176
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
177
+ * @param {import("../PartnerAPIClient").Options} - Options
178
+ * @returns {Promise<LeadPartnerModel.Ticket>} - Success response
179
+ * @name createTicket
180
+ * @summary: Creates a partner level ticket
181
+ * @description: Creates a partner level ticket - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/lead/createTicket/).
182
+ */
183
+ async createTicket(
184
+ { body, requestHeaders } = { requestHeaders: {} },
185
+ { responseHeaders } = { responseHeaders: false }
186
+ ) {
187
+ const { error } = LeadPartnerValidator.createTicket().validate(
188
+ {
189
+ body,
190
+ },
191
+ { abortEarly: false, allowUnknown: true }
192
+ );
193
+ if (error) {
194
+ return Promise.reject(new FDKClientValidationError(error));
195
+ }
196
+
197
+ // Showing warrnings if extra unknown parameters are found
198
+ const { error: warrning } = LeadPartnerValidator.createTicket().validate(
199
+ {
200
+ body,
201
+ },
202
+ { abortEarly: false, allowUnknown: false }
203
+ );
204
+ if (warrning) {
205
+ Logger({
206
+ level: "WARN",
207
+ message: `Parameter Validation warrnings for partner > Lead > createTicket \n ${warrning}`,
208
+ });
209
+ }
210
+
211
+ const query_params = {};
212
+
213
+ const response = await PartnerAPIClient.execute(
214
+ this.config,
215
+ "post",
216
+ `/service/partner/lead/v1.0/organization/${this.config.organizationId}/ticket`,
217
+ query_params,
218
+ body,
219
+ requestHeaders,
220
+ { responseHeaders }
221
+ );
222
+
223
+ let responseData = response;
224
+ if (responseHeaders) {
225
+ responseData = response[0];
226
+ }
227
+
228
+ const {
229
+ error: res_error,
230
+ } = LeadPartnerModel.Ticket().validate(responseData, {
231
+ abortEarly: false,
232
+ allowUnknown: true,
233
+ });
234
+
235
+ if (res_error) {
236
+ if (this.config.options.strictResponseCheck === true) {
237
+ return Promise.reject(new FDKResponseValidationError(res_error));
238
+ } else {
239
+ Logger({
240
+ level: "WARN",
241
+ message: `Response Validation Warnings for partner > Lead > createTicket \n ${res_error}`,
242
+ });
243
+ }
244
+ }
245
+
246
+ return response;
247
+ }
248
+
249
+ /**
250
+ * @param {LeadPartnerValidator.GetTicketParam} arg - Arg object.
251
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
252
+ * @param {import("../PartnerAPIClient").Options} - Options
253
+ * @returns {Promise<LeadPartnerModel.Ticket>} - Success response
254
+ * @name getTicket
255
+ * @summary: Retreives ticket details of a partner level ticket with ticket ID
256
+ * @description: Retreives ticket details of a partner level ticket - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/lead/getTicket/).
257
+ */
258
+ async getTicket(
259
+ { id, requestHeaders } = { requestHeaders: {} },
260
+ { responseHeaders } = { responseHeaders: false }
261
+ ) {
262
+ const { error } = LeadPartnerValidator.getTicket().validate(
263
+ {
264
+ id,
265
+ },
266
+ { abortEarly: false, allowUnknown: true }
267
+ );
268
+ if (error) {
269
+ return Promise.reject(new FDKClientValidationError(error));
270
+ }
271
+
272
+ // Showing warrnings if extra unknown parameters are found
273
+ const { error: warrning } = LeadPartnerValidator.getTicket().validate(
274
+ {
275
+ id,
276
+ },
277
+ { abortEarly: false, allowUnknown: false }
278
+ );
279
+ if (warrning) {
280
+ Logger({
281
+ level: "WARN",
282
+ message: `Parameter Validation warrnings for partner > Lead > getTicket \n ${warrning}`,
283
+ });
284
+ }
285
+
286
+ const query_params = {};
287
+
288
+ const response = await PartnerAPIClient.execute(
289
+ this.config,
290
+ "get",
291
+ `/service/partner/lead/v1.0/organization/${this.config.organizationId}/ticket/${id}`,
292
+ query_params,
293
+ undefined,
294
+ requestHeaders,
295
+ { responseHeaders }
296
+ );
297
+
298
+ let responseData = response;
299
+ if (responseHeaders) {
300
+ responseData = response[0];
301
+ }
302
+
303
+ const {
304
+ error: res_error,
305
+ } = LeadPartnerModel.Ticket().validate(responseData, {
306
+ abortEarly: false,
307
+ allowUnknown: true,
308
+ });
309
+
310
+ if (res_error) {
311
+ if (this.config.options.strictResponseCheck === true) {
312
+ return Promise.reject(new FDKResponseValidationError(res_error));
313
+ } else {
314
+ Logger({
315
+ level: "WARN",
316
+ message: `Response Validation Warnings for partner > Lead > getTicket \n ${res_error}`,
317
+ });
318
+ }
319
+ }
320
+
321
+ return response;
322
+ }
323
+
324
+ /**
325
+ * @param {LeadPartnerValidator.EditTicketParam} arg - Arg object.
326
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
327
+ * @param {import("../PartnerAPIClient").Options} - Options
328
+ * @returns {Promise<LeadPartnerModel.Ticket>} - Success response
329
+ * @name editTicket
330
+ * @summary: Edits ticket details of a partner level ticket
331
+ * @description: Edits ticket details of a partner level ticket such as status, priority, category, tags, attachments, assigne & ticket content changes - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/lead/editTicket/).
332
+ */
333
+ async editTicket(
334
+ { id, body, requestHeaders } = { requestHeaders: {} },
335
+ { responseHeaders } = { responseHeaders: false }
336
+ ) {
337
+ const { error } = LeadPartnerValidator.editTicket().validate(
338
+ {
339
+ id,
340
+ body,
341
+ },
342
+ { abortEarly: false, allowUnknown: true }
343
+ );
344
+ if (error) {
345
+ return Promise.reject(new FDKClientValidationError(error));
346
+ }
347
+
348
+ // Showing warrnings if extra unknown parameters are found
349
+ const { error: warrning } = LeadPartnerValidator.editTicket().validate(
350
+ {
351
+ id,
352
+ body,
353
+ },
354
+ { abortEarly: false, allowUnknown: false }
355
+ );
356
+ if (warrning) {
357
+ Logger({
358
+ level: "WARN",
359
+ message: `Parameter Validation warrnings for partner > Lead > editTicket \n ${warrning}`,
360
+ });
361
+ }
362
+
363
+ const query_params = {};
364
+
365
+ const response = await PartnerAPIClient.execute(
366
+ this.config,
367
+ "put",
368
+ `/service/partner/lead/v1.0/organization/${this.config.organizationId}/ticket/${id}`,
369
+ query_params,
370
+ body,
371
+ requestHeaders,
372
+ { responseHeaders }
373
+ );
374
+
375
+ let responseData = response;
376
+ if (responseHeaders) {
377
+ responseData = response[0];
378
+ }
379
+
380
+ const {
381
+ error: res_error,
382
+ } = LeadPartnerModel.Ticket().validate(responseData, {
383
+ abortEarly: false,
384
+ allowUnknown: true,
385
+ });
386
+
387
+ if (res_error) {
388
+ if (this.config.options.strictResponseCheck === true) {
389
+ return Promise.reject(new FDKResponseValidationError(res_error));
390
+ } else {
391
+ Logger({
392
+ level: "WARN",
393
+ message: `Response Validation Warnings for partner > Lead > editTicket \n ${res_error}`,
394
+ });
395
+ }
396
+ }
397
+
398
+ return response;
399
+ }
400
+
401
+ /**
402
+ * @param {LeadPartnerValidator.CreateHistoryParam} arg - Arg object.
403
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
404
+ * @param {import("../PartnerAPIClient").Options} - Options
405
+ * @returns {Promise<LeadPartnerModel.TicketHistory>} - Success response
406
+ * @name createHistory
407
+ * @summary: Create history for specific partner level ticket
408
+ * @description: Create history for specific partner level ticket, this history is seen on ticket detail page, this can be comment, log or rating. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/lead/createHistory/).
409
+ */
410
+ async createHistory(
411
+ { id, body, requestHeaders } = { requestHeaders: {} },
412
+ { responseHeaders } = { responseHeaders: false }
413
+ ) {
414
+ const { error } = LeadPartnerValidator.createHistory().validate(
415
+ {
416
+ id,
417
+ body,
418
+ },
419
+ { abortEarly: false, allowUnknown: true }
420
+ );
421
+ if (error) {
422
+ return Promise.reject(new FDKClientValidationError(error));
423
+ }
424
+
425
+ // Showing warrnings if extra unknown parameters are found
426
+ const { error: warrning } = LeadPartnerValidator.createHistory().validate(
427
+ {
428
+ id,
429
+ body,
430
+ },
431
+ { abortEarly: false, allowUnknown: false }
432
+ );
433
+ if (warrning) {
434
+ Logger({
435
+ level: "WARN",
436
+ message: `Parameter Validation warrnings for partner > Lead > createHistory \n ${warrning}`,
437
+ });
438
+ }
439
+
440
+ const query_params = {};
441
+
442
+ const response = await PartnerAPIClient.execute(
443
+ this.config,
444
+ "post",
445
+ `/service/partner/lead/v1.0/organization/${this.config.organizationId}/ticket/${id}/history`,
446
+ query_params,
447
+ body,
448
+ requestHeaders,
449
+ { responseHeaders }
450
+ );
451
+
452
+ let responseData = response;
453
+ if (responseHeaders) {
454
+ responseData = response[0];
455
+ }
456
+
457
+ const {
458
+ error: res_error,
459
+ } = LeadPartnerModel.TicketHistory().validate(responseData, {
460
+ abortEarly: false,
461
+ allowUnknown: true,
462
+ });
463
+
464
+ if (res_error) {
465
+ if (this.config.options.strictResponseCheck === true) {
466
+ return Promise.reject(new FDKResponseValidationError(res_error));
467
+ } else {
468
+ Logger({
469
+ level: "WARN",
470
+ message: `Response Validation Warnings for partner > Lead > createHistory \n ${res_error}`,
471
+ });
472
+ }
473
+ }
474
+
475
+ return response;
476
+ }
477
+
478
+ /**
479
+ * @param {LeadPartnerValidator.GetTicketHistoryParam} arg - Arg object.
480
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
481
+ * @param {import("../PartnerAPIClient").Options} - Options
482
+ * @returns {Promise<LeadPartnerModel.TicketHistoryList>} - Success response
483
+ * @name getTicketHistory
484
+ * @summary: Gets history list for specific partner level ticket
485
+ * @description: Gets history list for specific partner level ticket, this history is seen on ticket detail page, this can be comment, log or rating. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/lead/getTicketHistory/).
486
+ */
487
+ async getTicketHistory(
488
+ { id, requestHeaders } = { requestHeaders: {} },
489
+ { responseHeaders } = { responseHeaders: false }
490
+ ) {
491
+ const { error } = LeadPartnerValidator.getTicketHistory().validate(
492
+ {
493
+ id,
494
+ },
495
+ { abortEarly: false, allowUnknown: true }
496
+ );
497
+ if (error) {
498
+ return Promise.reject(new FDKClientValidationError(error));
499
+ }
500
+
501
+ // Showing warrnings if extra unknown parameters are found
502
+ const {
503
+ error: warrning,
504
+ } = LeadPartnerValidator.getTicketHistory().validate(
505
+ {
506
+ id,
507
+ },
508
+ { abortEarly: false, allowUnknown: false }
509
+ );
510
+ if (warrning) {
511
+ Logger({
512
+ level: "WARN",
513
+ message: `Parameter Validation warrnings for partner > Lead > getTicketHistory \n ${warrning}`,
514
+ });
515
+ }
516
+
517
+ const query_params = {};
518
+
519
+ const response = await PartnerAPIClient.execute(
520
+ this.config,
521
+ "get",
522
+ `/service/partner/lead/v1.0/organization/${this.config.organizationId}/ticket/${id}/history`,
523
+ query_params,
524
+ undefined,
525
+ requestHeaders,
526
+ { responseHeaders }
527
+ );
528
+
529
+ let responseData = response;
530
+ if (responseHeaders) {
531
+ responseData = response[0];
532
+ }
533
+
534
+ const {
535
+ error: res_error,
536
+ } = LeadPartnerModel.TicketHistoryList().validate(responseData, {
537
+ abortEarly: false,
538
+ allowUnknown: true,
539
+ });
540
+
541
+ if (res_error) {
542
+ if (this.config.options.strictResponseCheck === true) {
543
+ return Promise.reject(new FDKResponseValidationError(res_error));
544
+ } else {
545
+ Logger({
546
+ level: "WARN",
547
+ message: `Response Validation Warnings for partner > Lead > getTicketHistory \n ${res_error}`,
548
+ });
549
+ }
550
+ }
551
+
552
+ return response;
553
+ }
554
+
555
+ /**
556
+ * @param {LeadPartnerValidator.GetTokenForVideoRoomParam} arg - Arg object.
557
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
558
+ * @param {import("../PartnerAPIClient").Options} - Options
559
+ * @returns {Promise<LeadPartnerModel.GetTokenForVideoRoomResponse>} -
560
+ * Success response
561
+ * @name getTokenForVideoRoom
562
+ * @summary: Get Token to join a specific Video Room using it's unqiue name
563
+ * @description: Get Token to join a specific Video Room using it's unqiue name, this Token is your ticket to Room and also creates your identity there. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/lead/getTokenForVideoRoom/).
564
+ */
565
+ async getTokenForVideoRoom(
566
+ { uniqueName, requestHeaders } = { requestHeaders: {} },
567
+ { responseHeaders } = { responseHeaders: false }
568
+ ) {
569
+ const { error } = LeadPartnerValidator.getTokenForVideoRoom().validate(
570
+ {
571
+ uniqueName,
572
+ },
573
+ { abortEarly: false, allowUnknown: true }
574
+ );
575
+ if (error) {
576
+ return Promise.reject(new FDKClientValidationError(error));
577
+ }
578
+
579
+ // Showing warrnings if extra unknown parameters are found
580
+ const {
581
+ error: warrning,
582
+ } = LeadPartnerValidator.getTokenForVideoRoom().validate(
583
+ {
584
+ uniqueName,
585
+ },
586
+ { abortEarly: false, allowUnknown: false }
587
+ );
588
+ if (warrning) {
589
+ Logger({
590
+ level: "WARN",
591
+ message: `Parameter Validation warrnings for partner > Lead > getTokenForVideoRoom \n ${warrning}`,
592
+ });
593
+ }
594
+
595
+ const query_params = {};
596
+
597
+ const response = await PartnerAPIClient.execute(
598
+ this.config,
599
+ "get",
600
+ `/service/partner/lead/v1.0/organization/${this.config.organizationId}/video/room/${uniqueName}/token`,
601
+ query_params,
602
+ undefined,
603
+ requestHeaders,
604
+ { responseHeaders }
605
+ );
606
+
607
+ let responseData = response;
608
+ if (responseHeaders) {
609
+ responseData = response[0];
610
+ }
611
+
612
+ const {
613
+ error: res_error,
614
+ } = LeadPartnerModel.GetTokenForVideoRoomResponse().validate(responseData, {
615
+ abortEarly: false,
616
+ allowUnknown: true,
617
+ });
618
+
619
+ if (res_error) {
620
+ if (this.config.options.strictResponseCheck === true) {
621
+ return Promise.reject(new FDKResponseValidationError(res_error));
622
+ } else {
623
+ Logger({
624
+ level: "WARN",
625
+ message: `Response Validation Warnings for partner > Lead > getTokenForVideoRoom \n ${res_error}`,
626
+ });
627
+ }
628
+ }
629
+
630
+ return response;
631
+ }
632
+
633
+ /**
634
+ * @param {LeadPartnerValidator.GetVideoParticipantsParam} arg - Arg object.
635
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
636
+ * @param {import("../PartnerAPIClient").Options} - Options
637
+ * @returns {Promise<LeadPartnerModel.GetParticipantsInsideVideoRoomResponse>}
638
+ * - Success response
639
+ *
640
+ * @name getVideoParticipants
641
+ * @summary: Get participants of a specific Video Room using it's unique name
642
+ * @description: Get participants of a specific Video Room using it's unique name, this can be used to check if people are already there in the room and also to show their names. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/lead/getVideoParticipants/).
643
+ */
644
+ async getVideoParticipants(
645
+ { uniqueName, requestHeaders } = { requestHeaders: {} },
646
+ { responseHeaders } = { responseHeaders: false }
647
+ ) {
648
+ const { error } = LeadPartnerValidator.getVideoParticipants().validate(
649
+ {
650
+ uniqueName,
651
+ },
652
+ { abortEarly: false, allowUnknown: true }
653
+ );
654
+ if (error) {
655
+ return Promise.reject(new FDKClientValidationError(error));
656
+ }
657
+
658
+ // Showing warrnings if extra unknown parameters are found
659
+ const {
660
+ error: warrning,
661
+ } = LeadPartnerValidator.getVideoParticipants().validate(
662
+ {
663
+ uniqueName,
664
+ },
665
+ { abortEarly: false, allowUnknown: false }
666
+ );
667
+ if (warrning) {
668
+ Logger({
669
+ level: "WARN",
670
+ message: `Parameter Validation warrnings for partner > Lead > getVideoParticipants \n ${warrning}`,
671
+ });
672
+ }
673
+
674
+ const query_params = {};
675
+
676
+ const response = await PartnerAPIClient.execute(
677
+ this.config,
678
+ "get",
679
+ `/service/partner/lead/v1.0/organization/${this.config.organizationId}/video/room/${uniqueName}/participants`,
680
+ query_params,
681
+ undefined,
682
+ requestHeaders,
683
+ { responseHeaders }
684
+ );
685
+
686
+ let responseData = response;
687
+ if (responseHeaders) {
688
+ responseData = response[0];
689
+ }
690
+
691
+ const {
692
+ error: res_error,
693
+ } = LeadPartnerModel.GetParticipantsInsideVideoRoomResponse().validate(
694
+ responseData,
695
+ { abortEarly: false, allowUnknown: true }
696
+ );
697
+
698
+ if (res_error) {
699
+ if (this.config.options.strictResponseCheck === true) {
700
+ return Promise.reject(new FDKResponseValidationError(res_error));
701
+ } else {
702
+ Logger({
703
+ level: "WARN",
704
+ message: `Response Validation Warnings for partner > Lead > getVideoParticipants \n ${res_error}`,
705
+ });
706
+ }
707
+ }
708
+
709
+ return response;
710
+ }
711
+
712
+ /**
713
+ * @param {LeadPartnerValidator.GetGeneralConfigParam} arg - Arg object.
714
+ * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
715
+ * @param {import("../PartnerAPIClient").Options} - Options
716
+ * @returns {Promise<LeadPartnerModel.GeneralConfigResponse>} - Success response
717
+ * @name getGeneralConfig
718
+ * @summary: Get general support configuration.
719
+ * @description: Get general support configuration. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/lead/getGeneralConfig/).
720
+ */
721
+ async getGeneralConfig(
722
+ { requestHeaders } = { requestHeaders: {} },
723
+ { responseHeaders } = { responseHeaders: false }
724
+ ) {
725
+ const { error } = LeadPartnerValidator.getGeneralConfig().validate(
726
+ {},
727
+ { abortEarly: false, allowUnknown: true }
728
+ );
729
+ if (error) {
730
+ return Promise.reject(new FDKClientValidationError(error));
731
+ }
732
+
733
+ // Showing warrnings if extra unknown parameters are found
734
+ const {
735
+ error: warrning,
736
+ } = LeadPartnerValidator.getGeneralConfig().validate(
737
+ {},
738
+ { abortEarly: false, allowUnknown: false }
739
+ );
740
+ if (warrning) {
741
+ Logger({
742
+ level: "WARN",
743
+ message: `Parameter Validation warrnings for partner > Lead > getGeneralConfig \n ${warrning}`,
744
+ });
745
+ }
746
+
747
+ const query_params = {};
748
+
749
+ const response = await PartnerAPIClient.execute(
750
+ this.config,
751
+ "get",
752
+ `/service/partner/lead/v1.0/organization/${this.config.organizationId}/general-config`,
753
+ query_params,
754
+ undefined,
755
+ requestHeaders,
756
+ { responseHeaders }
757
+ );
758
+
759
+ let responseData = response;
760
+ if (responseHeaders) {
761
+ responseData = response[0];
762
+ }
763
+
764
+ const {
765
+ error: res_error,
766
+ } = LeadPartnerModel.GeneralConfigResponse().validate(responseData, {
767
+ abortEarly: false,
768
+ allowUnknown: true,
769
+ });
770
+
771
+ if (res_error) {
772
+ if (this.config.options.strictResponseCheck === true) {
773
+ return Promise.reject(new FDKResponseValidationError(res_error));
774
+ } else {
775
+ Logger({
776
+ level: "WARN",
777
+ message: `Response Validation Warnings for partner > Lead > getGeneralConfig \n ${res_error}`,
778
+ });
779
+ }
780
+ }
781
+
782
+ return response;
783
+ }
784
+ }
785
+ module.exports = Lead;