@51eat/sdk 0.0.41 → 0.0.42

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 (91) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/Client.d.ts +6 -0
  4. package/dist/cjs/Client.js +18 -8
  5. package/dist/cjs/api/resources/businessMessaging/client/Client.d.ts +27 -0
  6. package/dist/cjs/api/resources/businessMessaging/client/Client.js +124 -0
  7. package/dist/cjs/api/resources/businessMessaging/client/index.d.ts +1 -0
  8. package/dist/cjs/api/resources/businessMessaging/client/index.js +17 -0
  9. package/dist/cjs/api/resources/businessMessaging/client/requests/SearchBusinessConversationsRequest.d.ts +14 -0
  10. package/dist/cjs/api/resources/businessMessaging/client/requests/SearchBusinessConversationsRequest.js +3 -0
  11. package/dist/cjs/api/resources/businessMessaging/client/requests/index.d.ts +1 -0
  12. package/dist/cjs/api/resources/businessMessaging/client/requests/index.js +2 -0
  13. package/dist/cjs/api/resources/businessMessaging/exports.d.ts +2 -0
  14. package/dist/cjs/api/resources/businessMessaging/exports.js +21 -0
  15. package/dist/cjs/api/resources/businessMessaging/index.d.ts +2 -0
  16. package/dist/cjs/api/resources/businessMessaging/index.js +18 -0
  17. package/dist/cjs/api/resources/businessMessaging/types/SearchBusinessConversationsResponse.d.ts +4 -0
  18. package/dist/cjs/api/resources/businessMessaging/types/SearchBusinessConversationsResponse.js +3 -0
  19. package/dist/cjs/api/resources/businessMessaging/types/index.d.ts +1 -0
  20. package/dist/cjs/api/resources/businessMessaging/types/index.js +17 -0
  21. package/dist/cjs/api/resources/customerMessaging/client/Client.d.ts +27 -0
  22. package/dist/cjs/api/resources/customerMessaging/client/Client.js +124 -0
  23. package/dist/cjs/api/resources/customerMessaging/client/index.d.ts +1 -0
  24. package/dist/cjs/api/resources/customerMessaging/client/index.js +17 -0
  25. package/dist/cjs/api/resources/customerMessaging/client/requests/SearchCustomerConversationsRequest.d.ts +14 -0
  26. package/dist/cjs/api/resources/customerMessaging/client/requests/SearchCustomerConversationsRequest.js +3 -0
  27. package/dist/cjs/api/resources/customerMessaging/client/requests/index.d.ts +1 -0
  28. package/dist/cjs/api/resources/customerMessaging/client/requests/index.js +2 -0
  29. package/dist/cjs/api/resources/customerMessaging/exports.d.ts +2 -0
  30. package/dist/cjs/api/resources/customerMessaging/exports.js +21 -0
  31. package/dist/cjs/api/resources/customerMessaging/index.d.ts +2 -0
  32. package/dist/cjs/api/resources/customerMessaging/index.js +18 -0
  33. package/dist/cjs/api/resources/customerMessaging/types/SearchCustomerConversationsResponse.d.ts +4 -0
  34. package/dist/cjs/api/resources/customerMessaging/types/SearchCustomerConversationsResponse.js +3 -0
  35. package/dist/cjs/api/resources/customerMessaging/types/index.d.ts +1 -0
  36. package/dist/cjs/api/resources/customerMessaging/types/index.js +17 -0
  37. package/dist/cjs/api/resources/index.d.ts +6 -0
  38. package/dist/cjs/api/resources/index.js +7 -1
  39. package/dist/cjs/api/types/ExploreEvent.d.ts +21 -0
  40. package/dist/cjs/api/types/ExploreEvent.js +3 -0
  41. package/dist/cjs/api/types/ExploreResponse.d.ts +1 -0
  42. package/dist/cjs/api/types/index.d.ts +1 -0
  43. package/dist/cjs/api/types/index.js +1 -0
  44. package/dist/cjs/version.d.ts +1 -1
  45. package/dist/cjs/version.js +1 -1
  46. package/dist/esm/BaseClient.mjs +2 -2
  47. package/dist/esm/Client.d.mts +6 -0
  48. package/dist/esm/Client.mjs +10 -0
  49. package/dist/esm/api/resources/businessMessaging/client/Client.d.mts +27 -0
  50. package/dist/esm/api/resources/businessMessaging/client/Client.mjs +87 -0
  51. package/dist/esm/api/resources/businessMessaging/client/index.d.mts +1 -0
  52. package/dist/esm/api/resources/businessMessaging/client/index.mjs +1 -0
  53. package/dist/esm/api/resources/businessMessaging/client/requests/SearchBusinessConversationsRequest.d.mts +14 -0
  54. package/dist/esm/api/resources/businessMessaging/client/requests/SearchBusinessConversationsRequest.mjs +2 -0
  55. package/dist/esm/api/resources/businessMessaging/client/requests/index.d.mts +1 -0
  56. package/dist/esm/api/resources/businessMessaging/client/requests/index.mjs +1 -0
  57. package/dist/esm/api/resources/businessMessaging/exports.d.mts +2 -0
  58. package/dist/esm/api/resources/businessMessaging/exports.mjs +3 -0
  59. package/dist/esm/api/resources/businessMessaging/index.d.mts +2 -0
  60. package/dist/esm/api/resources/businessMessaging/index.mjs +2 -0
  61. package/dist/esm/api/resources/businessMessaging/types/SearchBusinessConversationsResponse.d.mts +4 -0
  62. package/dist/esm/api/resources/businessMessaging/types/SearchBusinessConversationsResponse.mjs +2 -0
  63. package/dist/esm/api/resources/businessMessaging/types/index.d.mts +1 -0
  64. package/dist/esm/api/resources/businessMessaging/types/index.mjs +1 -0
  65. package/dist/esm/api/resources/customerMessaging/client/Client.d.mts +27 -0
  66. package/dist/esm/api/resources/customerMessaging/client/Client.mjs +87 -0
  67. package/dist/esm/api/resources/customerMessaging/client/index.d.mts +1 -0
  68. package/dist/esm/api/resources/customerMessaging/client/index.mjs +1 -0
  69. package/dist/esm/api/resources/customerMessaging/client/requests/SearchCustomerConversationsRequest.d.mts +14 -0
  70. package/dist/esm/api/resources/customerMessaging/client/requests/SearchCustomerConversationsRequest.mjs +2 -0
  71. package/dist/esm/api/resources/customerMessaging/client/requests/index.d.mts +1 -0
  72. package/dist/esm/api/resources/customerMessaging/client/requests/index.mjs +1 -0
  73. package/dist/esm/api/resources/customerMessaging/exports.d.mts +2 -0
  74. package/dist/esm/api/resources/customerMessaging/exports.mjs +3 -0
  75. package/dist/esm/api/resources/customerMessaging/index.d.mts +2 -0
  76. package/dist/esm/api/resources/customerMessaging/index.mjs +2 -0
  77. package/dist/esm/api/resources/customerMessaging/types/SearchCustomerConversationsResponse.d.mts +4 -0
  78. package/dist/esm/api/resources/customerMessaging/types/SearchCustomerConversationsResponse.mjs +2 -0
  79. package/dist/esm/api/resources/customerMessaging/types/index.d.mts +1 -0
  80. package/dist/esm/api/resources/customerMessaging/types/index.mjs +1 -0
  81. package/dist/esm/api/resources/index.d.mts +6 -0
  82. package/dist/esm/api/resources/index.mjs +6 -0
  83. package/dist/esm/api/types/ExploreEvent.d.mts +21 -0
  84. package/dist/esm/api/types/ExploreEvent.mjs +2 -0
  85. package/dist/esm/api/types/ExploreResponse.d.mts +1 -0
  86. package/dist/esm/api/types/index.d.mts +1 -0
  87. package/dist/esm/api/types/index.mjs +1 -0
  88. package/dist/esm/version.d.mts +1 -1
  89. package/dist/esm/version.mjs +1 -1
  90. package/package.json +23 -1
  91. package/reference.md +104 -0
package/README.md CHANGED
@@ -70,7 +70,7 @@ following namespace:
70
70
  ```typescript
71
71
  import { FiveOneEat } from "@51eat/sdk";
72
72
 
73
- const request: FiveOneEat.GetMyTicketRequest = {
73
+ const request: FiveOneEat.SearchBusinessConversationsRequest = {
74
74
  ...
75
75
  };
76
76
  ```
@@ -147,9 +147,9 @@ For example, `fs.ReadStream` has a `path` property which the SDK uses to retriev
147
147
  This SDK supports direct imports of subpackage clients, which allows JavaScript bundlers to tree-shake and include only the imported subpackage code. This results in much smaller bundle sizes.
148
148
 
149
149
  ```typescript
150
- import { CustomerMyAccountClient } from '@51eat/sdk/customerMyAccount';
150
+ import { BusinessMessagingClient } from '@51eat/sdk/businessMessaging';
151
151
 
152
- const client = new CustomerMyAccountClient({...});
152
+ const client = new BusinessMessagingClient({...});
153
153
  ```
154
154
 
155
155
  ### Additional Headers
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "@51eat/sdk",
46
- "X-Fern-SDK-Version": "0.0.41",
47
- "User-Agent": "@51eat/sdk/0.0.41",
46
+ "X-Fern-SDK-Version": "0.0.42",
47
+ "User-Agent": "@51eat/sdk/0.0.42",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -1,5 +1,7 @@
1
1
  import { BusinessClient } from "./api/resources/business/client/Client.js";
2
+ import { BusinessMessagingClient } from "./api/resources/businessMessaging/client/Client.js";
2
3
  import { CustomerClient } from "./api/resources/customer/client/Client.js";
4
+ import { CustomerMessagingClient } from "./api/resources/customerMessaging/client/Client.js";
3
5
  import { CustomerMyAccountClient } from "./api/resources/customerMyAccount/client/Client.js";
4
6
  import { RecordClickClient } from "./api/resources/recordClick/client/Client.js";
5
7
  import { ServeAdClient } from "./api/resources/serveAd/client/Client.js";
@@ -13,12 +15,16 @@ export declare namespace FiveOneEatClient {
13
15
  }
14
16
  export declare class FiveOneEatClient {
15
17
  protected readonly _options: NormalizedClientOptionsWithAuth<FiveOneEatClient.Options>;
18
+ protected _businessMessaging: BusinessMessagingClient | undefined;
19
+ protected _customerMessaging: CustomerMessagingClient | undefined;
16
20
  protected _customerMyAccount: CustomerMyAccountClient | undefined;
17
21
  protected _customer: CustomerClient | undefined;
18
22
  protected _recordClick: RecordClickClient | undefined;
19
23
  protected _serveAd: ServeAdClient | undefined;
20
24
  protected _business: BusinessClient | undefined;
21
25
  constructor(options?: FiveOneEatClient.Options);
26
+ get businessMessaging(): BusinessMessagingClient;
27
+ get customerMessaging(): CustomerMessagingClient;
22
28
  get customerMyAccount(): CustomerMyAccountClient;
23
29
  get customer(): CustomerClient;
24
30
  get recordClick(): RecordClickClient;
@@ -45,31 +45,41 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
45
45
  Object.defineProperty(exports, "__esModule", { value: true });
46
46
  exports.FiveOneEatClient = void 0;
47
47
  const Client_js_1 = require("./api/resources/business/client/Client.js");
48
- const Client_js_2 = require("./api/resources/customer/client/Client.js");
49
- const Client_js_3 = require("./api/resources/customerMyAccount/client/Client.js");
50
- const Client_js_4 = require("./api/resources/recordClick/client/Client.js");
51
- const Client_js_5 = require("./api/resources/serveAd/client/Client.js");
48
+ const Client_js_2 = require("./api/resources/businessMessaging/client/Client.js");
49
+ const Client_js_3 = require("./api/resources/customer/client/Client.js");
50
+ const Client_js_4 = require("./api/resources/customerMessaging/client/Client.js");
51
+ const Client_js_5 = require("./api/resources/customerMyAccount/client/Client.js");
52
+ const Client_js_6 = require("./api/resources/recordClick/client/Client.js");
53
+ const Client_js_7 = require("./api/resources/serveAd/client/Client.js");
52
54
  const BaseClient_js_1 = require("./BaseClient.js");
53
55
  const core = __importStar(require("./core/index.js"));
54
56
  class FiveOneEatClient {
55
57
  constructor(options = {}) {
56
58
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
59
  }
60
+ get businessMessaging() {
61
+ var _a;
62
+ return ((_a = this._businessMessaging) !== null && _a !== void 0 ? _a : (this._businessMessaging = new Client_js_2.BusinessMessagingClient(this._options)));
63
+ }
64
+ get customerMessaging() {
65
+ var _a;
66
+ return ((_a = this._customerMessaging) !== null && _a !== void 0 ? _a : (this._customerMessaging = new Client_js_4.CustomerMessagingClient(this._options)));
67
+ }
58
68
  get customerMyAccount() {
59
69
  var _a;
60
- return ((_a = this._customerMyAccount) !== null && _a !== void 0 ? _a : (this._customerMyAccount = new Client_js_3.CustomerMyAccountClient(this._options)));
70
+ return ((_a = this._customerMyAccount) !== null && _a !== void 0 ? _a : (this._customerMyAccount = new Client_js_5.CustomerMyAccountClient(this._options)));
61
71
  }
62
72
  get customer() {
63
73
  var _a;
64
- return ((_a = this._customer) !== null && _a !== void 0 ? _a : (this._customer = new Client_js_2.CustomerClient(this._options)));
74
+ return ((_a = this._customer) !== null && _a !== void 0 ? _a : (this._customer = new Client_js_3.CustomerClient(this._options)));
65
75
  }
66
76
  get recordClick() {
67
77
  var _a;
68
- return ((_a = this._recordClick) !== null && _a !== void 0 ? _a : (this._recordClick = new Client_js_4.RecordClickClient(this._options)));
78
+ return ((_a = this._recordClick) !== null && _a !== void 0 ? _a : (this._recordClick = new Client_js_6.RecordClickClient(this._options)));
69
79
  }
70
80
  get serveAd() {
71
81
  var _a;
72
- return ((_a = this._serveAd) !== null && _a !== void 0 ? _a : (this._serveAd = new Client_js_5.ServeAdClient(this._options)));
82
+ return ((_a = this._serveAd) !== null && _a !== void 0 ? _a : (this._serveAd = new Client_js_7.ServeAdClient(this._options)));
73
83
  }
74
84
  get business() {
75
85
  var _a;
@@ -0,0 +1,27 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
3
+ import * as core from "../../../../core/index.js";
4
+ import * as FiveOneEat from "../../../index.js";
5
+ export declare namespace BusinessMessagingClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class BusinessMessagingClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<BusinessMessagingClient.Options>;
12
+ constructor(options?: BusinessMessagingClient.Options);
13
+ /**
14
+ * @param {FiveOneEat.SearchBusinessConversationsRequest} request
15
+ * @param {BusinessMessagingClient.RequestOptions} requestOptions - Request-specific configuration.
16
+ *
17
+ * @throws {@link FiveOneEat.UnauthorizedError}
18
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
19
+ *
20
+ * @example
21
+ * await client.businessMessaging.searchBusinessConversations({
22
+ * q: "john"
23
+ * })
24
+ */
25
+ searchBusinessConversations(request: FiveOneEat.SearchBusinessConversationsRequest, requestOptions?: BusinessMessagingClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.SearchBusinessConversationsResponse>;
26
+ private __searchBusinessConversations;
27
+ }
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.BusinessMessagingClient = void 0;
47
+ const BaseClient_js_1 = require("../../../../BaseClient.js");
48
+ const headers_js_1 = require("../../../../core/headers.js");
49
+ const core = __importStar(require("../../../../core/index.js"));
50
+ const environments = __importStar(require("../../../../environments.js"));
51
+ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
52
+ const errors = __importStar(require("../../../../errors/index.js"));
53
+ const FiveOneEat = __importStar(require("../../../index.js"));
54
+ class BusinessMessagingClient {
55
+ constructor(options = {}) {
56
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
+ }
58
+ /**
59
+ * @param {FiveOneEat.SearchBusinessConversationsRequest} request
60
+ * @param {BusinessMessagingClient.RequestOptions} requestOptions - Request-specific configuration.
61
+ *
62
+ * @throws {@link FiveOneEat.UnauthorizedError}
63
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
64
+ *
65
+ * @example
66
+ * await client.businessMessaging.searchBusinessConversations({
67
+ * q: "john"
68
+ * })
69
+ */
70
+ searchBusinessConversations(request, requestOptions) {
71
+ return core.HttpResponsePromise.fromPromise(this.__searchBusinessConversations(request, requestOptions));
72
+ }
73
+ __searchBusinessConversations(request, requestOptions) {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
76
+ const { q, page, per_page: perPage } = request;
77
+ const _queryParams = {
78
+ q,
79
+ page,
80
+ per_page: perPage,
81
+ };
82
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
83
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
84
+ const _response = yield core.fetcher({
85
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, "business/messaging/conversations/search"),
86
+ method: "GET",
87
+ headers: _headers,
88
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
89
+ queryString: core.url
90
+ .queryBuilder()
91
+ .addMany(_queryParams)
92
+ .mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
93
+ .build(),
94
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
95
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
96
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
97
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
98
+ logging: this._options.logging,
99
+ });
100
+ if (_response.ok) {
101
+ return {
102
+ data: _response.body,
103
+ rawResponse: _response.rawResponse,
104
+ };
105
+ }
106
+ if (_response.error.reason === "status-code") {
107
+ switch (_response.error.statusCode) {
108
+ case 401:
109
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
110
+ case 422:
111
+ throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
112
+ default:
113
+ throw new errors.FiveOneEatError({
114
+ statusCode: _response.error.statusCode,
115
+ body: _response.error.body,
116
+ rawResponse: _response.rawResponse,
117
+ });
118
+ }
119
+ }
120
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/business/messaging/conversations/search");
121
+ });
122
+ }
123
+ }
124
+ exports.BusinessMessagingClient = BusinessMessagingClient;
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * q: "john"
5
+ * }
6
+ */
7
+ export interface SearchBusinessConversationsRequest {
8
+ /** Customer name to search for */
9
+ q: string;
10
+ /** Page number for pagination */
11
+ page?: number;
12
+ /** Number of conversations per page */
13
+ per_page?: number;
14
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type { SearchBusinessConversationsRequest } from "./SearchBusinessConversationsRequest.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export { BusinessMessagingClient } from "./client/Client.js";
2
+ export * from "./client/index.js";
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.BusinessMessagingClient = void 0;
19
+ var Client_js_1 = require("./client/Client.js");
20
+ Object.defineProperty(exports, "BusinessMessagingClient", { enumerable: true, get: function () { return Client_js_1.BusinessMessagingClient; } });
21
+ __exportStar(require("./client/index.js"), exports);
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.js";
2
+ export * from "./types/index.js";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client/index.js"), exports);
18
+ __exportStar(require("./types/index.js"), exports);
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../index.js";
2
+ export interface SearchBusinessConversationsResponse {
3
+ data: FiveOneEat.BusinessConversation[];
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from "./SearchBusinessConversationsResponse.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./SearchBusinessConversationsResponse.js"), exports);
@@ -0,0 +1,27 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
3
+ import * as core from "../../../../core/index.js";
4
+ import * as FiveOneEat from "../../../index.js";
5
+ export declare namespace CustomerMessagingClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class CustomerMessagingClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<CustomerMessagingClient.Options>;
12
+ constructor(options?: CustomerMessagingClient.Options);
13
+ /**
14
+ * @param {FiveOneEat.SearchCustomerConversationsRequest} request
15
+ * @param {CustomerMessagingClient.RequestOptions} requestOptions - Request-specific configuration.
16
+ *
17
+ * @throws {@link FiveOneEat.UnauthorizedError}
18
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
19
+ *
20
+ * @example
21
+ * await client.customerMessaging.searchCustomerConversations({
22
+ * q: "pizza"
23
+ * })
24
+ */
25
+ searchCustomerConversations(request: FiveOneEat.SearchCustomerConversationsRequest, requestOptions?: CustomerMessagingClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.SearchCustomerConversationsResponse>;
26
+ private __searchCustomerConversations;
27
+ }
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.CustomerMessagingClient = void 0;
47
+ const BaseClient_js_1 = require("../../../../BaseClient.js");
48
+ const headers_js_1 = require("../../../../core/headers.js");
49
+ const core = __importStar(require("../../../../core/index.js"));
50
+ const environments = __importStar(require("../../../../environments.js"));
51
+ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
52
+ const errors = __importStar(require("../../../../errors/index.js"));
53
+ const FiveOneEat = __importStar(require("../../../index.js"));
54
+ class CustomerMessagingClient {
55
+ constructor(options = {}) {
56
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
+ }
58
+ /**
59
+ * @param {FiveOneEat.SearchCustomerConversationsRequest} request
60
+ * @param {CustomerMessagingClient.RequestOptions} requestOptions - Request-specific configuration.
61
+ *
62
+ * @throws {@link FiveOneEat.UnauthorizedError}
63
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
64
+ *
65
+ * @example
66
+ * await client.customerMessaging.searchCustomerConversations({
67
+ * q: "pizza"
68
+ * })
69
+ */
70
+ searchCustomerConversations(request, requestOptions) {
71
+ return core.HttpResponsePromise.fromPromise(this.__searchCustomerConversations(request, requestOptions));
72
+ }
73
+ __searchCustomerConversations(request, requestOptions) {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
76
+ const { q, page, per_page: perPage } = request;
77
+ const _queryParams = {
78
+ q,
79
+ page,
80
+ per_page: perPage,
81
+ };
82
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
83
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
84
+ const _response = yield core.fetcher({
85
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, "customer/messaging/conversations/search"),
86
+ method: "GET",
87
+ headers: _headers,
88
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
89
+ queryString: core.url
90
+ .queryBuilder()
91
+ .addMany(_queryParams)
92
+ .mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
93
+ .build(),
94
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
95
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
96
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
97
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
98
+ logging: this._options.logging,
99
+ });
100
+ if (_response.ok) {
101
+ return {
102
+ data: _response.body,
103
+ rawResponse: _response.rawResponse,
104
+ };
105
+ }
106
+ if (_response.error.reason === "status-code") {
107
+ switch (_response.error.statusCode) {
108
+ case 401:
109
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
110
+ case 422:
111
+ throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
112
+ default:
113
+ throw new errors.FiveOneEatError({
114
+ statusCode: _response.error.statusCode,
115
+ body: _response.error.body,
116
+ rawResponse: _response.rawResponse,
117
+ });
118
+ }
119
+ }
120
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/customer/messaging/conversations/search");
121
+ });
122
+ }
123
+ }
124
+ exports.CustomerMessagingClient = CustomerMessagingClient;
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * q: "pizza"
5
+ * }
6
+ */
7
+ export interface SearchCustomerConversationsRequest {
8
+ /** Business name to search for */
9
+ q: string;
10
+ /** Page number for pagination */
11
+ page?: number;
12
+ /** Number of conversations per page */
13
+ per_page?: number;
14
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type { SearchCustomerConversationsRequest } from "./SearchCustomerConversationsRequest.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export { CustomerMessagingClient } from "./client/Client.js";
2
+ export * from "./client/index.js";
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.CustomerMessagingClient = void 0;
19
+ var Client_js_1 = require("./client/Client.js");
20
+ Object.defineProperty(exports, "CustomerMessagingClient", { enumerable: true, get: function () { return Client_js_1.CustomerMessagingClient; } });
21
+ __exportStar(require("./client/index.js"), exports);
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.js";
2
+ export * from "./types/index.js";