ebay-api 1.13.7 → 6.2.0

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 (218) hide show
  1. package/LICENSE +18 -19
  2. package/README.md +512 -118
  3. package/lib/api/apiFactory.d.ts +27 -0
  4. package/lib/api/apiFactory.js +100 -0
  5. package/lib/api/apiFactory.js.map +1 -0
  6. package/lib/api/base.d.ts +13 -0
  7. package/lib/api/base.js +25 -0
  8. package/lib/api/base.js.map +1 -0
  9. package/lib/api/index.d.ts +11 -0
  10. package/lib/api/index.js +18 -0
  11. package/lib/api/index.js.map +1 -0
  12. package/lib/api/restful/buy/browse/index.d.ts +84 -0
  13. package/lib/api/restful/buy/browse/index.js +142 -0
  14. package/lib/api/restful/buy/browse/index.js.map +1 -0
  15. package/lib/api/restful/buy/deal/index.d.ts +55 -0
  16. package/lib/api/restful/buy/deal/index.js +80 -0
  17. package/lib/api/restful/buy/deal/index.js.map +1 -0
  18. package/lib/api/restful/buy/feed/index.d.ts +43 -0
  19. package/lib/api/restful/buy/feed/index.js +85 -0
  20. package/lib/api/restful/buy/feed/index.js.map +1 -0
  21. package/lib/api/restful/buy/index.d.ts +17 -0
  22. package/lib/api/restful/buy/index.js +21 -0
  23. package/lib/api/restful/buy/index.js.map +1 -0
  24. package/lib/api/restful/buy/marketing/index.d.ts +27 -0
  25. package/lib/api/restful/buy/marketing/index.js +51 -0
  26. package/lib/api/restful/buy/marketing/index.js.map +1 -0
  27. package/lib/api/restful/buy/marketplaceInsights/index.d.ts +28 -0
  28. package/lib/api/restful/buy/marketplaceInsights/index.js +51 -0
  29. package/lib/api/restful/buy/marketplaceInsights/index.js.map +1 -0
  30. package/lib/api/restful/buy/offer/index.d.ts +23 -0
  31. package/lib/api/restful/buy/offer/index.js +37 -0
  32. package/lib/api/restful/buy/offer/index.js.map +1 -0
  33. package/lib/api/restful/buy/order/index.d.ts +264 -0
  34. package/lib/api/restful/buy/order/index.js +369 -0
  35. package/lib/api/restful/buy/order/index.js.map +1 -0
  36. package/lib/api/restful/commerce/catalog/index.d.ts +73 -0
  37. package/lib/api/restful/commerce/catalog/index.js +108 -0
  38. package/lib/api/restful/commerce/catalog/index.js.map +1 -0
  39. package/lib/api/restful/commerce/charity/index.d.ts +34 -0
  40. package/lib/api/restful/commerce/charity/index.js +56 -0
  41. package/lib/api/restful/commerce/charity/index.js.map +1 -0
  42. package/lib/api/restful/commerce/identity/index.d.ts +14 -0
  43. package/lib/api/restful/commerce/identity/index.js +27 -0
  44. package/lib/api/restful/commerce/identity/index.js.map +1 -0
  45. package/lib/api/restful/commerce/index.d.ts +15 -0
  46. package/lib/api/restful/commerce/index.js +19 -0
  47. package/lib/api/restful/commerce/index.js.map +1 -0
  48. package/lib/api/restful/commerce/notification/index.d.ts +117 -0
  49. package/lib/api/restful/commerce/notification/index.js +187 -0
  50. package/lib/api/restful/commerce/notification/index.js.map +1 -0
  51. package/lib/api/restful/commerce/taxonomy/index.d.ts +78 -0
  52. package/lib/api/restful/commerce/taxonomy/index.js +135 -0
  53. package/lib/api/restful/commerce/taxonomy/index.js.map +1 -0
  54. package/lib/api/restful/commerce/translation/index.d.ts +15 -0
  55. package/lib/api/restful/commerce/translation/index.js +25 -0
  56. package/lib/api/restful/commerce/translation/index.js.map +1 -0
  57. package/lib/api/restful/developer/analytics/index.d.ts +22 -0
  58. package/lib/api/restful/developer/analytics/index.js +45 -0
  59. package/lib/api/restful/developer/analytics/index.js.map +1 -0
  60. package/lib/api/restful/developer/index.d.ts +5 -0
  61. package/lib/api/restful/developer/index.js +9 -0
  62. package/lib/api/restful/developer/index.js.map +1 -0
  63. package/lib/api/restful/index.d.ts +63 -0
  64. package/lib/api/restful/index.js +165 -0
  65. package/lib/api/restful/index.js.map +1 -0
  66. package/lib/api/restful/postOrder/cancellation/index.d.ts +57 -0
  67. package/lib/api/restful/postOrder/cancellation/index.js +95 -0
  68. package/lib/api/restful/postOrder/cancellation/index.js.map +1 -0
  69. package/lib/api/restful/postOrder/case/index.d.ts +63 -0
  70. package/lib/api/restful/postOrder/case/index.js +97 -0
  71. package/lib/api/restful/postOrder/case/index.js.map +1 -0
  72. package/lib/api/restful/postOrder/index.d.ts +11 -0
  73. package/lib/api/restful/postOrder/index.js +15 -0
  74. package/lib/api/restful/postOrder/index.js.map +1 -0
  75. package/lib/api/restful/postOrder/inquiry/index.d.ts +82 -0
  76. package/lib/api/restful/postOrder/inquiry/index.js +131 -0
  77. package/lib/api/restful/postOrder/inquiry/index.js.map +1 -0
  78. package/lib/api/restful/postOrder/return/index.d.ts +231 -0
  79. package/lib/api/restful/postOrder/return/index.js +361 -0
  80. package/lib/api/restful/postOrder/return/index.js.map +1 -0
  81. package/lib/api/restful/sell/account/index.d.ts +217 -0
  82. package/lib/api/restful/sell/account/index.js +337 -0
  83. package/lib/api/restful/sell/account/index.js.map +1 -0
  84. package/lib/api/restful/sell/analytics/index.d.ts +41 -0
  85. package/lib/api/restful/sell/analytics/index.js +61 -0
  86. package/lib/api/restful/sell/analytics/index.js.map +1 -0
  87. package/lib/api/restful/sell/compliance/index.d.ts +37 -0
  88. package/lib/api/restful/sell/compliance/index.js +57 -0
  89. package/lib/api/restful/sell/compliance/index.js.map +1 -0
  90. package/lib/api/restful/sell/feed/index.d.ts +151 -0
  91. package/lib/api/restful/sell/feed/index.js +255 -0
  92. package/lib/api/restful/sell/feed/index.js.map +1 -0
  93. package/lib/api/restful/sell/finances/index.d.ts +74 -0
  94. package/lib/api/restful/sell/finances/index.js +105 -0
  95. package/lib/api/restful/sell/finances/index.js.map +1 -0
  96. package/lib/api/restful/sell/fulfillment/index.d.ts +137 -0
  97. package/lib/api/restful/sell/fulfillment/index.js +199 -0
  98. package/lib/api/restful/sell/fulfillment/index.js.map +1 -0
  99. package/lib/api/restful/sell/index.d.ts +29 -0
  100. package/lib/api/restful/sell/index.js +33 -0
  101. package/lib/api/restful/sell/index.js.map +1 -0
  102. package/lib/api/restful/sell/inventory/index.d.ts +248 -0
  103. package/lib/api/restful/sell/inventory/index.js +346 -0
  104. package/lib/api/restful/sell/inventory/index.js.map +1 -0
  105. package/lib/api/restful/sell/listing/index.d.ts +14 -0
  106. package/lib/api/restful/sell/listing/index.js +25 -0
  107. package/lib/api/restful/sell/listing/index.js.map +1 -0
  108. package/lib/api/restful/sell/logistics/index.d.ts +44 -0
  109. package/lib/api/restful/sell/logistics/index.js +66 -0
  110. package/lib/api/restful/sell/logistics/index.js.map +1 -0
  111. package/lib/api/restful/sell/marketing/index.d.ts +443 -0
  112. package/lib/api/restful/sell/marketing/index.js +609 -0
  113. package/lib/api/restful/sell/marketing/index.js.map +1 -0
  114. package/lib/api/restful/sell/metadata/index.d.ts +77 -0
  115. package/lib/api/restful/sell/metadata/index.js +131 -0
  116. package/lib/api/restful/sell/metadata/index.js.map +1 -0
  117. package/lib/api/restful/sell/negotiation/index.d.ts +24 -0
  118. package/lib/api/restful/sell/negotiation/index.js +39 -0
  119. package/lib/api/restful/sell/negotiation/index.js.map +1 -0
  120. package/lib/api/restful/sell/recommendation/index.d.ts +26 -0
  121. package/lib/api/restful/sell/recommendation/index.js +39 -0
  122. package/lib/api/restful/sell/recommendation/index.js.map +1 -0
  123. package/lib/api/traditional/XMLRequest.d.ts +98 -0
  124. package/lib/api/traditional/XMLRequest.js +191 -0
  125. package/lib/api/traditional/XMLRequest.js.map +1 -0
  126. package/lib/api/traditional/clientAlerts/index.d.ts +9 -0
  127. package/lib/api/traditional/clientAlerts/index.js +15 -0
  128. package/lib/api/traditional/clientAlerts/index.js.map +1 -0
  129. package/lib/api/traditional/clientAlerts/types.d.ts +31 -0
  130. package/lib/api/traditional/clientAlerts/types.js +36 -0
  131. package/lib/api/traditional/clientAlerts/types.js.map +1 -0
  132. package/lib/api/traditional/fields.d.ts +1948 -0
  133. package/lib/api/traditional/fields.js +1949 -0
  134. package/lib/api/traditional/fields.js.map +1 -0
  135. package/lib/api/traditional/finding/index.d.ts +12 -0
  136. package/lib/api/traditional/finding/index.js +16 -0
  137. package/lib/api/traditional/finding/index.js.map +1 -0
  138. package/lib/api/traditional/index.d.ts +17 -0
  139. package/lib/api/traditional/index.js +207 -0
  140. package/lib/api/traditional/index.js.map +1 -0
  141. package/lib/api/traditional/merchandising/index.d.ts +7 -0
  142. package/lib/api/traditional/merchandising/index.js +11 -0
  143. package/lib/api/traditional/merchandising/index.js.map +1 -0
  144. package/lib/api/traditional/shopping/index.d.ts +11 -0
  145. package/lib/api/traditional/shopping/index.js +16 -0
  146. package/lib/api/traditional/shopping/index.js.map +1 -0
  147. package/lib/api/traditional/trading/index.d.ts +142 -0
  148. package/lib/api/traditional/trading/index.js +146 -0
  149. package/lib/api/traditional/trading/index.js.map +1 -0
  150. package/lib/auth/authNAuth.d.ts +49 -0
  151. package/lib/auth/authNAuth.js +122 -0
  152. package/lib/auth/authNAuth.js.map +1 -0
  153. package/lib/auth/index.d.ts +17 -0
  154. package/lib/auth/index.js +32 -0
  155. package/lib/auth/index.js.map +1 -0
  156. package/lib/auth/oAuth2.d.ts +90 -0
  157. package/lib/auth/oAuth2.js +258 -0
  158. package/lib/auth/oAuth2.js.map +1 -0
  159. package/lib/ebay-api.min.js +2 -0
  160. package/lib/ebay-api.min.js.map +1 -0
  161. package/lib/enums/apiEnums.d.ts +49 -0
  162. package/lib/enums/apiEnums.js +55 -0
  163. package/lib/enums/apiEnums.js.map +1 -0
  164. package/lib/enums/index.d.ts +2 -0
  165. package/lib/enums/index.js +15 -0
  166. package/lib/enums/index.js.map +1 -0
  167. package/lib/enums/restfulEnums.d.ts +966 -0
  168. package/lib/enums/restfulEnums.js +1012 -0
  169. package/lib/enums/restfulEnums.js.map +1 -0
  170. package/lib/errors/index.d.ts +66 -0
  171. package/lib/errors/index.js +208 -0
  172. package/lib/errors/index.js.map +1 -0
  173. package/lib/index.d.ts +56 -0
  174. package/lib/index.js +99 -0
  175. package/lib/index.js.map +1 -0
  176. package/lib/request.d.ts +26 -0
  177. package/lib/request.js +51 -0
  178. package/lib/request.js.map +1 -0
  179. package/lib/types/apiTypes.d.ts +28 -0
  180. package/lib/types/apiTypes.js +3 -0
  181. package/lib/types/apiTypes.js.map +1 -0
  182. package/lib/types/index.d.ts +3 -0
  183. package/lib/types/index.js +16 -0
  184. package/lib/types/index.js.map +1 -0
  185. package/lib/types/restfulTypes.d.ts +1082 -0
  186. package/lib/types/restfulTypes.js +3 -0
  187. package/lib/types/restfulTypes.js.map +1 -0
  188. package/lib/types/traditonalTypes.d.ts +34 -0
  189. package/lib/types/traditonalTypes.js +3 -0
  190. package/lib/types/traditonalTypes.js.map +1 -0
  191. package/package.json +115 -21
  192. package/.npmignore +0 -17
  193. package/.travis.yml +0 -7
  194. package/examples/Finding-FindItemsByKeywords.js +0 -46
  195. package/examples/Merchandising-GetMostWatchedItemsRequest.js +0 -16
  196. package/examples/Shopping-GetSingleItem.js +0 -18
  197. package/examples/Trading-GetOrders.js +0 -26
  198. package/index.js +0 -10
  199. package/lib/deep-to-array.js +0 -42
  200. package/lib/defaults.js +0 -69
  201. package/lib/errors.js +0 -44
  202. package/lib/json-parser.js +0 -336
  203. package/lib/key-lists.js +0 -64
  204. package/lib/urls.js +0 -64
  205. package/lib/versions.js +0 -35
  206. package/lib/xml-converter.js +0 -21
  207. package/lib/xml-request.js +0 -207
  208. package/scripts/parse-input-xml.js +0 -41
  209. package/test/deep-to-array.test.js +0 -100
  210. package/test/errors.test.js +0 -75
  211. package/test/helpers.js +0 -22
  212. package/test/mocha.opts +0 -1
  213. package/test/mocks/GetMultipleItems.xml +0 -115
  214. package/test/mocks/GetOrders-empty.xml +0 -17
  215. package/test/mocks/GetOrders.xml +0 -463
  216. package/test/pagination.test.js +0 -5
  217. package/test/parsing.test.js +0 -248
  218. package/test/xml-request.test.js +0 -447
@@ -0,0 +1,22 @@
1
+ import Restful from '../../';
2
+ /**
3
+ * This method retrieves the call limit and utilization data for an application.
4
+ */
5
+ export default class Analytics extends Restful {
6
+ static id: string;
7
+ get basePath(): string;
8
+ /**
9
+ * This method retrieves the call limit and utilization data for an application.
10
+ *
11
+ * @param apiContext This optional query parameter filters the result to include only the specified API context.
12
+ * @param apiName This optional query parameter filters the result to include only the APIs specified.
13
+ */
14
+ getRateLimits(apiContext: string, apiName: string): Promise<any>;
15
+ /**
16
+ * This method retrieves the call limit and utilization data for an application user.
17
+ *
18
+ * @param apiContext This optional query parameter filters the result to include only the specified API context.
19
+ * @param apiName This optional query parameter filters the result to include only the APIs specified.
20
+ */
21
+ getUserRateLimits(apiContext: string, apiName: string): Promise<any>;
22
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const __1 = __importDefault(require("../../"));
7
+ /**
8
+ * This method retrieves the call limit and utilization data for an application.
9
+ */
10
+ class Analytics extends __1.default {
11
+ get basePath() {
12
+ return '/developer/analytics/v1_beta';
13
+ }
14
+ /**
15
+ * This method retrieves the call limit and utilization data for an application.
16
+ *
17
+ * @param apiContext This optional query parameter filters the result to include only the specified API context.
18
+ * @param apiName This optional query parameter filters the result to include only the APIs specified.
19
+ */
20
+ getRateLimits(apiContext, apiName) {
21
+ return this.get(`/rate_limit/`, {
22
+ params: {
23
+ api_context: apiContext,
24
+ api_name: apiName
25
+ }
26
+ });
27
+ }
28
+ /**
29
+ * This method retrieves the call limit and utilization data for an application user.
30
+ *
31
+ * @param apiContext This optional query parameter filters the result to include only the specified API context.
32
+ * @param apiName This optional query parameter filters the result to include only the APIs specified.
33
+ */
34
+ getUserRateLimits(apiContext, apiName) {
35
+ return this.get(`/user_rate_limit/`, {
36
+ params: {
37
+ api_context: apiContext,
38
+ api_name: apiName
39
+ }
40
+ });
41
+ }
42
+ }
43
+ exports.default = Analytics;
44
+ Analytics.id = 'Analytics';
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/restful/developer/analytics/index.ts"],"names":[],"mappings":";;;;;AAAA,+CAA6B;AAE7B;;GAEG;AACH,MAAqB,SAAU,SAAQ,WAAO;IAI5C,IAAI,QAAQ;QACV,OAAO,8BAA8B,CAAC;IACxC,CAAC;IAED;;;;;OAKG;IACI,aAAa,CAAC,UAAkB,EAAE,OAAe;QACtD,OAAO,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE;YAC9B,MAAM,EAAE;gBACN,WAAW,EAAE,UAAU;gBACvB,QAAQ,EAAE,OAAO;aAClB;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,iBAAiB,CAAC,UAAkB,EAAE,OAAe;QAC1D,OAAO,IAAI,CAAC,GAAG,CAAC,mBAAmB,EAAE;YACnC,MAAM,EAAE;gBACN,WAAW,EAAE,UAAU;gBACvB,QAAQ,EAAE,OAAO;aAClB;SACF,CAAC,CAAC;IACL,CAAC;;AApCH,4BAqCC;AAnCQ,YAAE,GAAG,WAAW,CAAC"}
@@ -0,0 +1,5 @@
1
+ import Analytics from './analytics';
2
+ export declare type Developer = {
3
+ analytics: Analytics;
4
+ };
5
+ export { Analytics };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Analytics = void 0;
7
+ const analytics_1 = __importDefault(require("./analytics"));
8
+ exports.Analytics = analytics_1.default;
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/api/restful/developer/index.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAoC;AAOhC,oBAPG,mBAAS,CAOH"}
@@ -0,0 +1,63 @@
1
+ import Api from '../';
2
+ import Auth from '../../auth';
3
+ import { IEBayApiRequest } from '../../request';
4
+ import { AppConfig } from '../../types';
5
+ export declare const defaultApiHeaders: Record<string, string>;
6
+ export declare type ApiConfig = {
7
+ subdomain?: string;
8
+ useIaf?: boolean;
9
+ apiVersion?: string;
10
+ basePath?: string;
11
+ schema?: string;
12
+ sandbox?: boolean;
13
+ tld?: string;
14
+ headers?: Record<string, string>;
15
+ };
16
+ export declare type ApiRequest = {
17
+ method: keyof IEBayApiRequest;
18
+ url: string;
19
+ config?: any;
20
+ data?: any;
21
+ };
22
+ export interface IRestful {
23
+ new (config: AppConfig, req?: IEBayApiRequest, auth?: Auth, apiConfig?: ApiConfig): Restful;
24
+ id: string;
25
+ }
26
+ export default abstract class Restful extends Api {
27
+ readonly apiConfig: Required<ApiConfig>;
28
+ constructor(config: AppConfig, req?: IEBayApiRequest, auth?: Auth, apiConfig?: ApiConfig);
29
+ static buildServerUrl(schema: string, subdomain: string, sandbox: boolean, tld: string): string;
30
+ abstract get basePath(): string;
31
+ /**
32
+ * Enable to supports the use of OAuth tokens for user authorization.
33
+ */
34
+ get useIaf(): boolean;
35
+ get schema(): string;
36
+ get subdomain(): string;
37
+ get apiVersionPath(): string;
38
+ getServerUrl({ schema, subdomain, apiVersion, basePath, sandbox, tld }: Required<ApiConfig>): string;
39
+ getApiConfig(): Required<ApiConfig>;
40
+ get baseUrl(): string;
41
+ /**
42
+ * Create a new instances of it self with specified api config.
43
+ * @param apiConfig
44
+ */
45
+ api(apiConfig: ApiConfig): this;
46
+ /**
47
+ * Use "apix" subdomain
48
+ */
49
+ get apix(): this;
50
+ /**
51
+ * Use "apiz" subdomain
52
+ */
53
+ get apiz(): this;
54
+ get(url: string, config?: any, apiConfig?: ApiConfig): Promise<any>;
55
+ delete(url: string, config?: any, apiConfig?: ApiConfig): Promise<any>;
56
+ post(url: string, data?: any, config?: any, apiConfig?: ApiConfig): Promise<any>;
57
+ put(url: string, data?: any, config?: any, apiConfig?: ApiConfig): Promise<any>;
58
+ get additionalHeaders(): any;
59
+ enrichRequestConfig(config?: any, apiConfig?: Required<ApiConfig>): Promise<any>;
60
+ private doRequest;
61
+ private shouldRefreshToken;
62
+ private request;
63
+ }
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.defaultApiHeaders = void 0;
7
+ const __1 = __importDefault(require("../"));
8
+ const errors_1 = require("../../errors");
9
+ exports.defaultApiHeaders = {
10
+ 'Content-Type': 'application/json',
11
+ 'Cache-Control': 'no-cache',
12
+ // @ts-ignore
13
+ ...(typeof window === 'undefined' ? {
14
+ 'Accept-Encoding': 'application/gzip'
15
+ } : {})
16
+ };
17
+ const additionalHeaders = {
18
+ marketplaceId: 'X-EBAY-C-MARKETPLACE-ID',
19
+ endUserCtx: 'X-EBAY-C-ENDUSERCTX',
20
+ acceptLanguage: 'Accept-Language',
21
+ contentLanguage: 'Content-Language',
22
+ };
23
+ class Restful extends __1.default {
24
+ constructor(config, req, auth, apiConfig = {}) {
25
+ super(config, req, auth);
26
+ this.apiConfig = {
27
+ ...this.getApiConfig(),
28
+ ...apiConfig
29
+ };
30
+ }
31
+ static buildServerUrl(schema, subdomain, sandbox, tld) {
32
+ return `${schema}${subdomain}.${sandbox ? 'sandbox.' : ''}${tld}`;
33
+ }
34
+ /**
35
+ * Enable to supports the use of OAuth tokens for user authorization.
36
+ */
37
+ get useIaf() {
38
+ return false;
39
+ }
40
+ get schema() {
41
+ return 'https://';
42
+ }
43
+ get subdomain() {
44
+ return 'api';
45
+ }
46
+ get apiVersionPath() {
47
+ return '';
48
+ }
49
+ getServerUrl({ schema, subdomain, apiVersion, basePath, sandbox, tld }) {
50
+ return Restful.buildServerUrl(schema, subdomain, sandbox, tld) + apiVersion + basePath;
51
+ }
52
+ getApiConfig() {
53
+ return {
54
+ subdomain: this.subdomain,
55
+ useIaf: this.useIaf,
56
+ apiVersion: this.apiVersionPath,
57
+ basePath: this.basePath,
58
+ schema: this.schema,
59
+ sandbox: this.config.sandbox,
60
+ tld: 'ebay.com',
61
+ headers: {}
62
+ };
63
+ }
64
+ get baseUrl() {
65
+ return this.getServerUrl(this.apiConfig);
66
+ }
67
+ /**
68
+ * Create a new instances of it self with specified api config.
69
+ * @param apiConfig
70
+ */
71
+ api(apiConfig) {
72
+ // @ts-ignore
73
+ return new this.constructor(this.config, this.req, this.auth, apiConfig);
74
+ }
75
+ /**
76
+ * Use "apix" subdomain
77
+ */
78
+ get apix() {
79
+ return this.api({ subdomain: 'apix' });
80
+ }
81
+ /**
82
+ * Use "apiz" subdomain
83
+ */
84
+ get apiz() {
85
+ return this.api({ subdomain: 'apiz' });
86
+ }
87
+ async get(url, config = {}, apiConfig) {
88
+ return this.doRequest({ method: 'get', url, config }, apiConfig);
89
+ }
90
+ async delete(url, config = {}, apiConfig) {
91
+ return this.doRequest({ method: 'delete', url, config }, apiConfig);
92
+ }
93
+ async post(url, data, config = {}, apiConfig) {
94
+ return this.doRequest({ method: 'post', url, data, config }, apiConfig);
95
+ }
96
+ async put(url, data, config = {}, apiConfig) {
97
+ return this.doRequest({ method: 'put', url, data, config }, apiConfig);
98
+ }
99
+ get additionalHeaders() {
100
+ return Object.keys(additionalHeaders)
101
+ // @ts-ignore
102
+ .filter(key => typeof this.config[key] !== 'undefined')
103
+ .reduce((headers, key) => {
104
+ // @ts-ignore
105
+ headers[additionalHeaders[key]] = this.config[key];
106
+ return headers;
107
+ }, {});
108
+ }
109
+ async enrichRequestConfig(config = {}, apiConfig = this.apiConfig) {
110
+ const authHeader = await this.auth.getHeaderAuthorization(apiConfig.useIaf);
111
+ const headers = {
112
+ ...exports.defaultApiHeaders,
113
+ ...this.additionalHeaders,
114
+ ...authHeader,
115
+ ...apiConfig.headers
116
+ };
117
+ return {
118
+ ...config,
119
+ headers: {
120
+ ...(config.headers || {}),
121
+ ...headers
122
+ }
123
+ };
124
+ }
125
+ async doRequest(payload, apiConfig) {
126
+ try {
127
+ return await this.request(payload, apiConfig);
128
+ }
129
+ catch (error) {
130
+ if (this.shouldRefreshToken(error)) {
131
+ // Try again and refresh token
132
+ return await this.request(payload, apiConfig, true /* refresh token */);
133
+ }
134
+ throw error;
135
+ }
136
+ }
137
+ shouldRefreshToken(error) {
138
+ if (!this.config.autoRefreshToken) {
139
+ return false;
140
+ }
141
+ if (error.name === errors_1.EBayInvalidAccessToken.name) {
142
+ return true;
143
+ }
144
+ return error?.meta?.res?.status === 401 && this.apiConfig.basePath === '/post-order/v2';
145
+ }
146
+ async request(apiRequest, apiConfig = this.apiConfig, refreshToken = false) {
147
+ const { url, method, data, config } = apiRequest;
148
+ const apiCfg = { ...this.apiConfig, ...apiConfig };
149
+ const endpoint = this.getServerUrl(apiCfg) + url;
150
+ try {
151
+ if (refreshToken) {
152
+ await this.auth.OAuth2.refreshToken();
153
+ }
154
+ const enrichedConfig = await this.enrichRequestConfig(config, apiCfg);
155
+ const args = ['get', 'delete'].includes(method) ? [enrichedConfig] : [data, enrichedConfig];
156
+ // @ts-ignore
157
+ return await this.req[method](endpoint, ...args);
158
+ }
159
+ catch (ex) {
160
+ (0, errors_1.handleEBayError)(ex);
161
+ }
162
+ }
163
+ }
164
+ exports.default = Restful;
165
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/restful/index.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAsB;AAEtB,yCAAqE;AAIxD,QAAA,iBAAiB,GAA2B;IACvD,cAAc,EAAE,kBAAkB;IAClC,eAAe,EAAE,UAAU;IAC3B,aAAa;IACb,GAAG,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC;QAClC,iBAAiB,EAAE,kBAAkB;KACtC,CAAC,CAAC,CAAC,EAAE,CAAC;CACR,CAAC;AAEF,MAAM,iBAAiB,GAA2B;IAChD,aAAa,EAAE,yBAAyB;IACxC,UAAU,EAAE,qBAAqB;IACjC,cAAc,EAAE,iBAAiB;IACjC,eAAe,EAA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C,CAAC;YAC5F,aAAa;YACb,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,CAAC;SAClD;QAAC,OAAO,EAAE,EAAE;YACX,IAAA,wBAAe,EAAC,EAAE,CAAC,CAAC;SACrB;IACH,CAAC;CACF;AAtLD,0BAsLC"}
@@ -0,0 +1,57 @@
1
+ import Restful from '../../';
2
+ import { CancellationSearchParams, ConfirmRefundRequest, CreateCancelRequest, RejectCancelRequest } from '../../../../types';
3
+ /**
4
+ * Post-Order Cancellation API
5
+ */
6
+ export default class Cancellation extends Restful {
7
+ static id: string;
8
+ get basePath(): string;
9
+ get useIaf(): boolean;
10
+ /**
11
+ * Seller approves a cancellation request
12
+ *
13
+ * @param cancelId The unique eBay-assigned identifier of the cancellation request to be approved.
14
+ */
15
+ approveCancellationRequest(cancelId: string): Promise<any>;
16
+ /**
17
+ * Check the eligibility of an order cancellation
18
+ *
19
+ * @param legacyOrderId The unique ID of the order being canceled or the order being considered for cancellation.
20
+ */
21
+ checkCancellationEligibility(legacyOrderId: string): Promise<any>;
22
+ /**
23
+ * Buyer confirms the refund from a cancellation was received
24
+ *
25
+ * @param cancelId The unique eBay-assigned identifier of the cancellation/refund being confirmed.
26
+ * @param payload the ConfirmRefundReceivedPayload
27
+ */
28
+ confirmRefundReceived(cancelId: string, payload?: ConfirmRefundRequest): Promise<any>;
29
+ /**
30
+ * Request or perform an order cancellation.
31
+ *
32
+ * @param payload the CreateCancelRequest
33
+ */
34
+ createCancellation(payload: CreateCancelRequest): Promise<any>;
35
+ /**
36
+ * Retrieve the details of an order cancellation.
37
+ *
38
+ * @param cancelId Supply in this path parameter the unique eBay-assigned ID of the cancellation request to
39
+ * retrieve.
40
+ * @param fieldGroups The value set in this query parameter controls the level of detail that is returned in the
41
+ * response.
42
+ */
43
+ getCancellation(cancelId: string, fieldGroups?: string): Promise<any>;
44
+ /**
45
+ * Seller rejects a cancellation request.
46
+ *
47
+ * @param cancelId The unique eBay-assigned identifier of the cancellation request to be rejected.
48
+ * @param payload the RejectCancelRequest
49
+ */
50
+ rejectCancellationRequest(cancelId: string, payload?: RejectCancelRequest): Promise<any>;
51
+ /**
52
+ * Search for cancellations.
53
+ *
54
+ * @param params the SearchParams
55
+ */
56
+ search(params: CancellationSearchParams): Promise<any>;
57
+ }
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const __1 = __importDefault(require("../../"));
7
+ /**
8
+ * Post-Order Cancellation API
9
+ */
10
+ class Cancellation extends __1.default {
11
+ get basePath() {
12
+ return '/post-order/v2';
13
+ }
14
+ get useIaf() {
15
+ return true;
16
+ }
17
+ /**
18
+ * Seller approves a cancellation request
19
+ *
20
+ * @param cancelId The unique eBay-assigned identifier of the cancellation request to be approved.
21
+ */
22
+ approveCancellationRequest(cancelId) {
23
+ cancelId = encodeURIComponent(cancelId);
24
+ return this.post(`/cancellation/${cancelId}/approve`);
25
+ }
26
+ /**
27
+ * Check the eligibility of an order cancellation
28
+ *
29
+ * @param legacyOrderId The unique ID of the order being canceled or the order being considered for cancellation.
30
+ */
31
+ checkCancellationEligibility(legacyOrderId) {
32
+ return this.post(`/cancellation/check_eligibility`, {
33
+ legacyOrderId
34
+ });
35
+ }
36
+ /**
37
+ * Buyer confirms the refund from a cancellation was received
38
+ *
39
+ * @param cancelId The unique eBay-assigned identifier of the cancellation/refund being confirmed.
40
+ * @param payload the ConfirmRefundReceivedPayload
41
+ */
42
+ confirmRefundReceived(cancelId, payload) {
43
+ cancelId = encodeURIComponent(cancelId);
44
+ return this.post(`/cancellation/${cancelId}/confirm`, payload);
45
+ }
46
+ /**
47
+ * Request or perform an order cancellation.
48
+ *
49
+ * @param payload the CreateCancelRequest
50
+ */
51
+ createCancellation(payload) {
52
+ return this.post(`/cancellation`, payload);
53
+ }
54
+ /**
55
+ * Retrieve the details of an order cancellation.
56
+ *
57
+ * @param cancelId Supply in this path parameter the unique eBay-assigned ID of the cancellation request to
58
+ * retrieve.
59
+ * @param fieldGroups The value set in this query parameter controls the level of detail that is returned in the
60
+ * response.
61
+ */
62
+ getCancellation(cancelId, fieldGroups) {
63
+ cancelId = encodeURIComponent(cancelId);
64
+ return this.get(`/cancellation/${cancelId}`, {
65
+ params: {
66
+ fieldgroups: fieldGroups
67
+ }
68
+ });
69
+ }
70
+ /**
71
+ * Seller rejects a cancellation request.
72
+ *
73
+ * @param cancelId The unique eBay-assigned identifier of the cancellation request to be rejected.
74
+ * @param payload the RejectCancelRequest
75
+ */
76
+ rejectCancellationRequest(cancelId, payload) {
77
+ cancelId = encodeURIComponent(cancelId);
78
+ return this.post(`/cancellation/${cancelId}/reject`, payload);
79
+ }
80
+ /**
81
+ * Search for cancellations.
82
+ *
83
+ * @param params the SearchParams
84
+ */
85
+ search(params) {
86
+ return this.get(`/cancellation/search`, {
87
+ params: {
88
+ params
89
+ }
90
+ });
91
+ }
92
+ }
93
+ exports.default = Cancellation;
94
+ Cancellation.id = 'Cancellation';
95
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/restful/postOrder/cancellation/index.ts"],"names":[],"mappings":";;;;;AAAA,+CAA6B;AAQ7B;;GAEG;AACH,MAAqB,YAAa,SAAQ,WAAO;IAI/C,IAAI,QAAQ;QACV,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACI,0BAA0B,CAAC,QAAgB;QAChD,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,QAAQ,UAAU,CAAC,CAAC;IACxD,CAAC;IAED;;;;OAIG;IACI,4BAA4B,CAAC,aAAqB;QACvD,OAAO,IAAI,CAAC,IAAI,CAAC,iCAAiC,EAAE;YAClD,aAAa;SACd,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,qBAAqB,CAAC,QAAgB,EAAE,OAA8B;QAC3E,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,QAAQ,UAAU,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;IAED;;;;OAIG;IACI,kBAAkB,CAAC,OAA4B;QACpD,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;;;OAOG;IACI,eAAe,CAAC,QAAgB,EAAE,WAAoB;QAC3D,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC,GAAG,CAAC,iBAAiB,QAAQ,EAAE,EAAE;YAC3C,MAAM,EAAE;gBACN,WAAW,EAAE,WAAW;aACzB;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,yBAAyB,CAAC,QAAgB,EAAE,OAA6B;QAC9E,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,QAAQ,SAAS,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,MAAgC;QAC5C,OAAO,IAAI,CAAC,GAAG,CAAC,sBAAsB,EAAE;YACtC,MAAM,EAAE;gBACN,MAAM;aACP;SACF,CAAC,CAAC;IACL,CAAC;;AA5FH,+BA6FC;AA3FQ,eAAE,GAAG,cAAc,CAAC"}
@@ -0,0 +1,63 @@
1
+ import Restful from '../../';
2
+ import { AppealRequest, BuyerCloseCaseRequest, CaseSearchParams, ReturnAddressRequest, Text } from '../../../../types';
3
+ /**
4
+ * Post-Order Case Management API
5
+ */
6
+ export default class Case extends Restful {
7
+ static id: string;
8
+ get basePath(): string;
9
+ get useIaf(): boolean;
10
+ /**
11
+ * Buyer or seller appeals a case decision.
12
+ *
13
+ * @param caseId The unique identifier of a case.
14
+ * @param payload the AppealRequest
15
+ */
16
+ appealCaseDecision(caseId: string, payload?: AppealRequest): Promise<any>;
17
+ /**
18
+ * Check the eligibility of an order cancellation.
19
+ *
20
+ * @param caseId The unique identifier of a case.
21
+ * @param payload the BuyerCloseCaseRequest
22
+ */
23
+ closeCase(caseId: string, payload: BuyerCloseCaseRequest): Promise<any>;
24
+ /**
25
+ * Retrieve the details related to a specific case.
26
+ *
27
+ * @param caseId The unique identifier of a case.
28
+ */
29
+ getCase(caseId: string): Promise<any>;
30
+ /**
31
+ * Seller issues a refund for a case.
32
+ *
33
+ * @param caseId The unique identifier of a case.
34
+ * @param payload the CaseVoluntaryRefundRequest (Text)
35
+ */
36
+ issueCaseRefund(caseId: string, payload?: Text): Promise<any>;
37
+ /**
38
+ * This call allows the buyer to provide shipment tracking information for the item that is being returned to the
39
+ * seller.
40
+ *
41
+ * @param caseId The unique identifier of a case.
42
+ * @param shippingCarrierName The shipping carrier that is used to ship the item, such as 'FedEx', 'UPS', or
43
+ * 'USPS'.
44
+ * @param trackingNumber The tracking number assigned by the shipping carrier to the item shipment.
45
+ */
46
+ provideReturnShipmentInfo(caseId: string, { shippingCarrierName, trackingNumber }: {
47
+ shippingCarrierName: string;
48
+ trackingNumber: string;
49
+ }): Promise<any>;
50
+ /**
51
+ * Seller provides a return address to the buyer.
52
+ *
53
+ * @param cancelId The unique eBay-assigned identifier of the cancellation request to be rejected.
54
+ * @param payload the ReturnAddressRequest
55
+ */
56
+ providesReturnAddress(cancelId: string, payload?: ReturnAddressRequest): Promise<any>;
57
+ /**
58
+ * This call is used to search for cases using multiple filter types.
59
+ *
60
+ * @param params the SearchParams
61
+ */
62
+ search(params: CaseSearchParams): Promise<any>;
63
+ }
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const __1 = __importDefault(require("../../"));
7
+ /**
8
+ * Post-Order Case Management API
9
+ */
10
+ class Case extends __1.default {
11
+ get basePath() {
12
+ return '/post-order/v2';
13
+ }
14
+ get useIaf() {
15
+ return true;
16
+ }
17
+ /**
18
+ * Buyer or seller appeals a case decision.
19
+ *
20
+ * @param caseId The unique identifier of a case.
21
+ * @param payload the AppealRequest
22
+ */
23
+ appealCaseDecision(caseId, payload) {
24
+ const id = encodeURIComponent(caseId);
25
+ return this.post(`/casemanagement/${id}/appeal`, payload);
26
+ }
27
+ /**
28
+ * Check the eligibility of an order cancellation.
29
+ *
30
+ * @param caseId The unique identifier of a case.
31
+ * @param payload the BuyerCloseCaseRequest
32
+ */
33
+ closeCase(caseId, payload) {
34
+ const id = encodeURIComponent(caseId);
35
+ return this.post(`/casemanagement/${id}/close`, payload);
36
+ }
37
+ /**
38
+ * Retrieve the details related to a specific case.
39
+ *
40
+ * @param caseId The unique identifier of a case.
41
+ */
42
+ getCase(caseId) {
43
+ const id = encodeURIComponent(caseId);
44
+ return this.get(`/casemanagement/${id}`);
45
+ }
46
+ /**
47
+ * Seller issues a refund for a case.
48
+ *
49
+ * @param caseId The unique identifier of a case.
50
+ * @param payload the CaseVoluntaryRefundRequest (Text)
51
+ */
52
+ issueCaseRefund(caseId, payload) {
53
+ const id = encodeURIComponent(caseId);
54
+ return this.post(`/casemanagement/${id}/issue_refund`, payload);
55
+ }
56
+ /**
57
+ * This call allows the buyer to provide shipment tracking information for the item that is being returned to the
58
+ * seller.
59
+ *
60
+ * @param caseId The unique identifier of a case.
61
+ * @param shippingCarrierName The shipping carrier that is used to ship the item, such as 'FedEx', 'UPS', or
62
+ * 'USPS'.
63
+ * @param trackingNumber The tracking number assigned by the shipping carrier to the item shipment.
64
+ */
65
+ provideReturnShipmentInfo(caseId, { shippingCarrierName, trackingNumber }) {
66
+ const id = encodeURIComponent(caseId);
67
+ return this.post(`/casemanagement/${id}/provide_shipment_info`, {
68
+ shippingCarrierName,
69
+ trackingNumber
70
+ });
71
+ }
72
+ /**
73
+ * Seller provides a return address to the buyer.
74
+ *
75
+ * @param cancelId The unique eBay-assigned identifier of the cancellation request to be rejected.
76
+ * @param payload the ReturnAddressRequest
77
+ */
78
+ providesReturnAddress(cancelId, payload) {
79
+ const id = encodeURIComponent(cancelId);
80
+ return this.post(`/casemanagement/${id}/provide_return_address`, payload);
81
+ }
82
+ /**
83
+ * This call is used to search for cases using multiple filter types.
84
+ *
85
+ * @param params the SearchParams
86
+ */
87
+ search(params) {
88
+ return this.get(`/casemanagement/search`, {
89
+ params: {
90
+ params
91
+ }
92
+ });
93
+ }
94
+ }
95
+ exports.default = Case;
96
+ Case.id = 'Case';
97
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/restful/postOrder/case/index.ts"],"names":[],"mappings":";;;;;AAAA,+CAA6B;AAG7B;;GAEG;AACH,MAAqB,IAAK,SAAQ,WAAO;IAIvC,IAAI,QAAQ;QACV,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACI,kBAAkB,CAAC,MAAc,EAAE,OAAuB;QAC/D,MAAM,EAAE,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED;;;;;OAKG;IACI,SAAS,CAAC,MAAc,EAAE,OAA8B;QAC7D,MAAM,EAAE,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,MAAc;QAC3B,MAAM,EAAE,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,GAAG,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;OAKG;IACI,eAAe,CAAC,MAAc,EAAE,OAAc;QACnD,MAAM,EAAE,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;;;OAQG;IACI,yBAAyB,CAAC,MAAc,EAAE,EAAC,mBAAmB,EAAE,cAAc,EAC5B;QACvD,MAAM,EAAE,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,wBAAwB,EAAE;YAC9D,mBAAmB;YACnB,cAAc;SACf,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,qBAAqB,CAAC,QAAgB,EAAE,OAA8B;QAC3E,MAAM,EAAE,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,yBAAyB,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,MAAwB;QACpC,OAAO,IAAI,CAAC,GAAG,CAAC,wBAAwB,EAAE;YACxC,MAAM,EAAE;gBACN,MAAM;aACP;SACF,CAAC,CAAC;IACL,CAAC;;AA/FH,uBAgGC;AA9FQ,OAAE,GAAG,MAAM,CAAC"}
@@ -0,0 +1,11 @@
1
+ import Cancellation from './cancellation';
2
+ import Case from './case';
3
+ import Inquiry from './inquiry';
4
+ import Return from './return';
5
+ export declare type PostOrder = {
6
+ cancellation: Cancellation;
7
+ case: Case;
8
+ inquiry: Inquiry;
9
+ return: Return;
10
+ };
11
+ export { Cancellation, Case, Inquiry, Return };