@51eat/sdk 0.0.20 → 0.0.21
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.
- package/README.md +13 -16
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +6 -0
- package/dist/cjs/Client.js +20 -10
- package/dist/cjs/api/resources/businessMessaging/client/Client.d.ts +32 -0
- package/dist/cjs/api/resources/businessMessaging/client/Client.js +118 -0
- package/dist/cjs/api/resources/businessMessaging/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/businessMessaging/client/index.js +17 -0
- package/dist/cjs/api/resources/businessMessaging/client/requests/BusinessChannelAuthAuthenticateRequest.d.ts +13 -0
- package/dist/cjs/api/resources/businessMessaging/client/requests/BusinessChannelAuthAuthenticateRequest.js +3 -0
- package/dist/cjs/api/resources/businessMessaging/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/businessMessaging/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/businessMessaging/exports.d.ts +2 -0
- package/dist/cjs/api/resources/businessMessaging/exports.js +21 -0
- package/dist/cjs/api/resources/businessMessaging/index.d.ts +1 -0
- package/dist/cjs/api/resources/businessMessaging/index.js +17 -0
- package/dist/cjs/api/resources/businessPushNotifications/client/Client.d.ts +47 -0
- package/dist/cjs/api/resources/businessPushNotifications/client/Client.js +182 -0
- package/dist/cjs/api/resources/businessPushNotifications/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/businessPushNotifications/client/index.js +17 -0
- package/dist/cjs/api/resources/businessPushNotifications/client/requests/UnregisterBusinessPushTokenRequest.d.ts +9 -0
- package/dist/cjs/api/resources/businessPushNotifications/client/requests/UnregisterBusinessPushTokenRequest.js +3 -0
- package/dist/cjs/api/resources/businessPushNotifications/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/businessPushNotifications/client/requests/index.js +5 -0
- package/dist/cjs/api/resources/businessPushNotifications/exports.d.ts +2 -0
- package/dist/cjs/api/resources/businessPushNotifications/exports.js +21 -0
- package/dist/cjs/api/resources/businessPushNotifications/index.d.ts +2 -0
- package/dist/cjs/api/resources/businessPushNotifications/index.js +18 -0
- package/dist/cjs/api/resources/businessPushNotifications/types/RegisterBusinessPushTokenResponse.d.ts +7 -0
- package/dist/cjs/api/resources/businessPushNotifications/types/RegisterBusinessPushTokenResponse.js +3 -0
- package/dist/cjs/api/resources/businessPushNotifications/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/businessPushNotifications/types/index.js +17 -0
- package/dist/cjs/api/resources/customer/resources/pushNotifications/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/customer/resources/pushNotifications/client/Client.js +1 -1
- package/dist/cjs/api/resources/customer/resources/pushNotifications/client/requests/AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest.d.ts +19 -0
- package/dist/cjs/api/resources/customer/resources/pushNotifications/client/requests/AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest.js +11 -0
- package/dist/cjs/api/resources/customer/resources/pushNotifications/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/customer/resources/pushNotifications/client/requests/index.js +3 -3
- package/dist/cjs/api/resources/index.d.ts +5 -0
- package/dist/cjs/api/resources/index.js +6 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +6 -0
- package/dist/esm/Client.mjs +10 -0
- package/dist/esm/api/resources/businessMessaging/client/Client.d.mts +32 -0
- package/dist/esm/api/resources/businessMessaging/client/Client.mjs +81 -0
- package/dist/esm/api/resources/businessMessaging/client/index.d.mts +1 -0
- package/dist/esm/api/resources/businessMessaging/client/index.mjs +1 -0
- package/dist/esm/api/resources/businessMessaging/client/requests/BusinessChannelAuthAuthenticateRequest.d.mts +13 -0
- package/dist/esm/api/resources/businessMessaging/client/requests/BusinessChannelAuthAuthenticateRequest.mjs +2 -0
- package/dist/esm/api/resources/businessMessaging/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/businessMessaging/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/businessMessaging/exports.d.mts +2 -0
- package/dist/esm/api/resources/businessMessaging/exports.mjs +3 -0
- package/dist/esm/api/resources/businessMessaging/index.d.mts +1 -0
- package/dist/esm/api/resources/businessMessaging/index.mjs +1 -0
- package/dist/esm/api/resources/businessPushNotifications/client/Client.d.mts +47 -0
- package/dist/esm/api/resources/businessPushNotifications/client/Client.mjs +145 -0
- package/dist/esm/api/resources/businessPushNotifications/client/index.d.mts +1 -0
- package/dist/esm/api/resources/businessPushNotifications/client/index.mjs +1 -0
- package/dist/esm/api/resources/businessPushNotifications/client/requests/UnregisterBusinessPushTokenRequest.d.mts +9 -0
- package/dist/esm/api/resources/businessPushNotifications/client/requests/UnregisterBusinessPushTokenRequest.mjs +2 -0
- package/dist/esm/api/resources/businessPushNotifications/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/businessPushNotifications/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/businessPushNotifications/exports.d.mts +2 -0
- package/dist/esm/api/resources/businessPushNotifications/exports.mjs +3 -0
- package/dist/esm/api/resources/businessPushNotifications/index.d.mts +2 -0
- package/dist/esm/api/resources/businessPushNotifications/index.mjs +2 -0
- package/dist/esm/api/resources/businessPushNotifications/types/RegisterBusinessPushTokenResponse.d.mts +7 -0
- package/dist/esm/api/resources/businessPushNotifications/types/RegisterBusinessPushTokenResponse.mjs +2 -0
- package/dist/esm/api/resources/businessPushNotifications/types/index.d.mts +1 -0
- package/dist/esm/api/resources/businessPushNotifications/types/index.mjs +1 -0
- package/dist/esm/api/resources/customer/resources/pushNotifications/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/customer/resources/pushNotifications/client/Client.mjs +1 -1
- package/dist/esm/api/resources/customer/resources/pushNotifications/client/requests/AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest.d.mts +19 -0
- package/dist/esm/api/resources/customer/resources/pushNotifications/client/requests/AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest.mjs +8 -0
- package/dist/esm/api/resources/customer/resources/pushNotifications/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/customer/resources/pushNotifications/client/requests/index.mjs +1 -1
- package/dist/esm/api/resources/index.d.mts +5 -0
- package/dist/esm/api/resources/index.mjs +5 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +23 -1
- package/reference.md +203 -1
- /package/dist/cjs/api/resources/{customer/resources/pushNotifications → businessPushNotifications}/client/requests/StorePushTokenRequest.d.ts +0 -0
- /package/dist/cjs/api/resources/{customer/resources/pushNotifications → businessPushNotifications}/client/requests/StorePushTokenRequest.js +0 -0
- /package/dist/esm/api/resources/{customer/resources/pushNotifications → businessPushNotifications}/client/requests/StorePushTokenRequest.d.mts +0 -0
- /package/dist/esm/api/resources/{customer/resources/pushNotifications → businessPushNotifications}/client/requests/StorePushTokenRequest.mjs +0 -0
|
@@ -0,0 +1,182 @@
|
|
|
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.BusinessPushNotificationsClient = 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 BusinessPushNotificationsClient {
|
|
55
|
+
constructor(options = {}) {
|
|
56
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Register (or update) the authenticated business user's Expo push token for a
|
|
60
|
+
* device. If a `device_id` is provided, an existing registration for that device
|
|
61
|
+
* is updated.
|
|
62
|
+
*
|
|
63
|
+
* @param {FiveOneEat.StorePushTokenRequest} request
|
|
64
|
+
* @param {BusinessPushNotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
65
|
+
*
|
|
66
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
67
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* await client.businessPushNotifications.registerBusinessPushToken({
|
|
71
|
+
* token: "token"
|
|
72
|
+
* })
|
|
73
|
+
*/
|
|
74
|
+
registerBusinessPushToken(request, requestOptions) {
|
|
75
|
+
return core.HttpResponsePromise.fromPromise(this.__registerBusinessPushToken(request, requestOptions));
|
|
76
|
+
}
|
|
77
|
+
__registerBusinessPushToken(request, requestOptions) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
80
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
81
|
+
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);
|
|
82
|
+
const _response = yield core.fetcher({
|
|
83
|
+
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/push-tokens"),
|
|
84
|
+
method: "POST",
|
|
85
|
+
headers: _headers,
|
|
86
|
+
contentType: "application/json",
|
|
87
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
88
|
+
requestType: "json",
|
|
89
|
+
body: request,
|
|
90
|
+
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,
|
|
91
|
+
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,
|
|
92
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
93
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
94
|
+
logging: this._options.logging,
|
|
95
|
+
});
|
|
96
|
+
if (_response.ok) {
|
|
97
|
+
return {
|
|
98
|
+
data: _response.body,
|
|
99
|
+
rawResponse: _response.rawResponse,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
if (_response.error.reason === "status-code") {
|
|
103
|
+
switch (_response.error.statusCode) {
|
|
104
|
+
case 401:
|
|
105
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
106
|
+
case 422:
|
|
107
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
108
|
+
default:
|
|
109
|
+
throw new errors.FiveOneEatError({
|
|
110
|
+
statusCode: _response.error.statusCode,
|
|
111
|
+
body: _response.error.body,
|
|
112
|
+
rawResponse: _response.rawResponse,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/business/push-tokens");
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Delete the authenticated business user's Expo push token registration.
|
|
121
|
+
*
|
|
122
|
+
* @param {FiveOneEat.UnregisterBusinessPushTokenRequest} request
|
|
123
|
+
* @param {BusinessPushNotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
124
|
+
*
|
|
125
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
126
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* await client.businessPushNotifications.unregisterBusinessPushToken({
|
|
130
|
+
* token: "token"
|
|
131
|
+
* })
|
|
132
|
+
*/
|
|
133
|
+
unregisterBusinessPushToken(request, requestOptions) {
|
|
134
|
+
return core.HttpResponsePromise.fromPromise(this.__unregisterBusinessPushToken(request, requestOptions));
|
|
135
|
+
}
|
|
136
|
+
__unregisterBusinessPushToken(request, requestOptions) {
|
|
137
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
139
|
+
const { token } = request;
|
|
140
|
+
const _queryParams = {
|
|
141
|
+
token,
|
|
142
|
+
};
|
|
143
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
144
|
+
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);
|
|
145
|
+
const _response = yield core.fetcher({
|
|
146
|
+
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/push-tokens"),
|
|
147
|
+
method: "DELETE",
|
|
148
|
+
headers: _headers,
|
|
149
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
150
|
+
queryString: core.url
|
|
151
|
+
.queryBuilder()
|
|
152
|
+
.addMany(_queryParams)
|
|
153
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
154
|
+
.build(),
|
|
155
|
+
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,
|
|
156
|
+
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,
|
|
157
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
158
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
159
|
+
logging: this._options.logging,
|
|
160
|
+
});
|
|
161
|
+
if (_response.ok) {
|
|
162
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
163
|
+
}
|
|
164
|
+
if (_response.error.reason === "status-code") {
|
|
165
|
+
switch (_response.error.statusCode) {
|
|
166
|
+
case 401:
|
|
167
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
168
|
+
case 422:
|
|
169
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
170
|
+
default:
|
|
171
|
+
throw new errors.FiveOneEatError({
|
|
172
|
+
statusCode: _response.error.statusCode,
|
|
173
|
+
body: _response.error.body,
|
|
174
|
+
rawResponse: _response.rawResponse,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/business/push-tokens");
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
exports.BusinessPushNotificationsClient = BusinessPushNotificationsClient;
|
|
@@ -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,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StorePushTokenRequest = void 0;
|
|
4
|
+
var StorePushTokenRequest_js_1 = require("./StorePushTokenRequest.js");
|
|
5
|
+
Object.defineProperty(exports, "StorePushTokenRequest", { enumerable: true, get: function () { return StorePushTokenRequest_js_1.StorePushTokenRequest; } });
|
|
@@ -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.BusinessPushNotificationsClient = void 0;
|
|
19
|
+
var Client_js_1 = require("./client/Client.js");
|
|
20
|
+
Object.defineProperty(exports, "BusinessPushNotificationsClient", { enumerable: true, get: function () { return Client_js_1.BusinessPushNotificationsClient; } });
|
|
21
|
+
__exportStar(require("./client/index.js"), exports);
|
|
@@ -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 @@
|
|
|
1
|
+
export * from "./RegisterBusinessPushTokenResponse.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("./RegisterBusinessPushTokenResponse.js"), exports);
|
|
@@ -14,7 +14,7 @@ export declare class PushNotificationsClient {
|
|
|
14
14
|
* Register (or update) the authenticated user's Expo push token for a device. If
|
|
15
15
|
* a `device_id` is provided, an existing registration for that device is updated.
|
|
16
16
|
*
|
|
17
|
-
* @param {FiveOneEat.customer.
|
|
17
|
+
* @param {FiveOneEat.customer.AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest} request
|
|
18
18
|
* @param {PushNotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
19
19
|
*
|
|
20
20
|
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
@@ -25,7 +25,7 @@ export declare class PushNotificationsClient {
|
|
|
25
25
|
* token: "token"
|
|
26
26
|
* })
|
|
27
27
|
*/
|
|
28
|
-
register(request: FiveOneEat.customer.
|
|
28
|
+
register(request: FiveOneEat.customer.AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest, requestOptions?: PushNotificationsClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.RegisterPushNotificationsResponse>;
|
|
29
29
|
private __register;
|
|
30
30
|
/**
|
|
31
31
|
* Delete the authenticated user's Expo push token registration.
|
|
@@ -59,7 +59,7 @@ class PushNotificationsClient {
|
|
|
59
59
|
* Register (or update) the authenticated user's Expo push token for a device. If
|
|
60
60
|
* a `device_id` is provided, an existing registration for that device is updated.
|
|
61
61
|
*
|
|
62
|
-
* @param {FiveOneEat.customer.
|
|
62
|
+
* @param {FiveOneEat.customer.AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest} request
|
|
63
63
|
* @param {PushNotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
64
64
|
*
|
|
65
65
|
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* token: "token"
|
|
5
|
+
* }
|
|
6
|
+
*/
|
|
7
|
+
export interface AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest {
|
|
8
|
+
token: string;
|
|
9
|
+
device_id?: string | null;
|
|
10
|
+
device_name?: string | null;
|
|
11
|
+
platform?: AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest.Platform | null;
|
|
12
|
+
}
|
|
13
|
+
export declare namespace AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest {
|
|
14
|
+
const Platform: {
|
|
15
|
+
readonly Ios: "ios";
|
|
16
|
+
readonly Android: "android";
|
|
17
|
+
};
|
|
18
|
+
type Platform = (typeof Platform)[keyof typeof Platform];
|
|
19
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest = void 0;
|
|
5
|
+
var AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest;
|
|
6
|
+
(function (AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest) {
|
|
7
|
+
AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest.Platform = {
|
|
8
|
+
Ios: "ios",
|
|
9
|
+
Android: "android",
|
|
10
|
+
};
|
|
11
|
+
})(AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest || (exports.AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest = AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest = {}));
|
package/dist/cjs/api/resources/customer/resources/pushNotifications/client/requests/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest } from "./AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest.js";
|
|
2
2
|
export type { UnregisterPushNotificationsRequest } from "./UnregisterPushNotificationsRequest.js";
|
package/dist/cjs/api/resources/customer/resources/pushNotifications/client/requests/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "
|
|
3
|
+
exports.AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest = void 0;
|
|
4
|
+
var AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest_js_1 = require("./AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest.js");
|
|
5
|
+
Object.defineProperty(exports, "AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest", { enumerable: true, get: function () { return AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest_js_1.AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest; } });
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export * as business from "./business/index.js";
|
|
2
|
+
export * from "./businessMessaging/client/requests/index.js";
|
|
3
|
+
export * as businessMessaging from "./businessMessaging/index.js";
|
|
4
|
+
export * from "./businessPushNotifications/client/requests/index.js";
|
|
5
|
+
export * as businessPushNotifications from "./businessPushNotifications/index.js";
|
|
6
|
+
export * from "./businessPushNotifications/types/index.js";
|
|
2
7
|
export * from "./customer/client/requests/index.js";
|
|
3
8
|
export * as customer from "./customer/index.js";
|
|
4
9
|
export * from "./customer/types/index.js";
|
|
@@ -36,8 +36,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.serveAd = exports.recordClick = exports.customerMyAccount = exports.customerEvents = exports.customer = exports.business = void 0;
|
|
39
|
+
exports.serveAd = exports.recordClick = exports.customerMyAccount = exports.customerEvents = exports.customer = exports.businessPushNotifications = exports.businessMessaging = exports.business = void 0;
|
|
40
40
|
exports.business = __importStar(require("./business/index.js"));
|
|
41
|
+
__exportStar(require("./businessMessaging/client/requests/index.js"), exports);
|
|
42
|
+
exports.businessMessaging = __importStar(require("./businessMessaging/index.js"));
|
|
43
|
+
__exportStar(require("./businessPushNotifications/client/requests/index.js"), exports);
|
|
44
|
+
exports.businessPushNotifications = __importStar(require("./businessPushNotifications/index.js"));
|
|
45
|
+
__exportStar(require("./businessPushNotifications/types/index.js"), exports);
|
|
41
46
|
__exportStar(require("./customer/client/requests/index.js"), exports);
|
|
42
47
|
exports.customer = __importStar(require("./customer/index.js"));
|
|
43
48
|
__exportStar(require("./customer/types/index.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.0.
|
|
1
|
+
export declare const SDK_VERSION = "0.0.21";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "@51eat/sdk",
|
|
9
|
-
"X-Fern-SDK-Version": "0.0.
|
|
10
|
-
"User-Agent": "@51eat/sdk/0.0.
|
|
9
|
+
"X-Fern-SDK-Version": "0.0.21",
|
|
10
|
+
"User-Agent": "@51eat/sdk/0.0.21",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
package/dist/esm/Client.d.mts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { BusinessClient } from "./api/resources/business/client/Client.mjs";
|
|
2
|
+
import { BusinessMessagingClient } from "./api/resources/businessMessaging/client/Client.mjs";
|
|
3
|
+
import { BusinessPushNotificationsClient } from "./api/resources/businessPushNotifications/client/Client.mjs";
|
|
2
4
|
import { CustomerClient } from "./api/resources/customer/client/Client.mjs";
|
|
3
5
|
import { CustomerEventsClient } from "./api/resources/customerEvents/client/Client.mjs";
|
|
4
6
|
import { CustomerMyAccountClient } from "./api/resources/customerMyAccount/client/Client.mjs";
|
|
@@ -14,6 +16,8 @@ export declare namespace FiveOneEatClient {
|
|
|
14
16
|
}
|
|
15
17
|
export declare class FiveOneEatClient {
|
|
16
18
|
protected readonly _options: NormalizedClientOptionsWithAuth<FiveOneEatClient.Options>;
|
|
19
|
+
protected _businessMessaging: BusinessMessagingClient | undefined;
|
|
20
|
+
protected _businessPushNotifications: BusinessPushNotificationsClient | undefined;
|
|
17
21
|
protected _customerEvents: CustomerEventsClient | undefined;
|
|
18
22
|
protected _customerMyAccount: CustomerMyAccountClient | undefined;
|
|
19
23
|
protected _customer: CustomerClient | undefined;
|
|
@@ -21,6 +25,8 @@ export declare class FiveOneEatClient {
|
|
|
21
25
|
protected _serveAd: ServeAdClient | undefined;
|
|
22
26
|
protected _business: BusinessClient | undefined;
|
|
23
27
|
constructor(options?: FiveOneEatClient.Options);
|
|
28
|
+
get businessMessaging(): BusinessMessagingClient;
|
|
29
|
+
get businessPushNotifications(): BusinessPushNotificationsClient;
|
|
24
30
|
get customerEvents(): CustomerEventsClient;
|
|
25
31
|
get customerMyAccount(): CustomerMyAccountClient;
|
|
26
32
|
get customer(): CustomerClient;
|
package/dist/esm/Client.mjs
CHANGED
|
@@ -9,6 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
import { BusinessClient } from "./api/resources/business/client/Client.mjs";
|
|
12
|
+
import { BusinessMessagingClient } from "./api/resources/businessMessaging/client/Client.mjs";
|
|
13
|
+
import { BusinessPushNotificationsClient } from "./api/resources/businessPushNotifications/client/Client.mjs";
|
|
12
14
|
import { CustomerClient } from "./api/resources/customer/client/Client.mjs";
|
|
13
15
|
import { CustomerEventsClient } from "./api/resources/customerEvents/client/Client.mjs";
|
|
14
16
|
import { CustomerMyAccountClient } from "./api/resources/customerMyAccount/client/Client.mjs";
|
|
@@ -20,6 +22,14 @@ export class FiveOneEatClient {
|
|
|
20
22
|
constructor(options = {}) {
|
|
21
23
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
22
24
|
}
|
|
25
|
+
get businessMessaging() {
|
|
26
|
+
var _a;
|
|
27
|
+
return ((_a = this._businessMessaging) !== null && _a !== void 0 ? _a : (this._businessMessaging = new BusinessMessagingClient(this._options)));
|
|
28
|
+
}
|
|
29
|
+
get businessPushNotifications() {
|
|
30
|
+
var _a;
|
|
31
|
+
return ((_a = this._businessPushNotifications) !== null && _a !== void 0 ? _a : (this._businessPushNotifications = new BusinessPushNotificationsClient(this._options)));
|
|
32
|
+
}
|
|
23
33
|
get customerEvents() {
|
|
24
34
|
var _a;
|
|
25
35
|
return ((_a = this._customerEvents) !== null && _a !== void 0 ? _a : (this._customerEvents = new CustomerEventsClient(this._options)));
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
3
|
+
import * as core from "../../../../core/index.mjs";
|
|
4
|
+
import * as FiveOneEat from "../../../index.mjs";
|
|
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
|
+
* This endpoint is used by the business companion mobile app to authenticate with
|
|
15
|
+
* Pusher channels. It validates that the authenticated business user has
|
|
16
|
+
* permission to access the requested channel, scoped to their active business.
|
|
17
|
+
*
|
|
18
|
+
* @param {FiveOneEat.BusinessChannelAuthAuthenticateRequest} request
|
|
19
|
+
* @param {BusinessMessagingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
20
|
+
*
|
|
21
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
22
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* await client.businessMessaging.businessChannelAuthAuthenticate({
|
|
26
|
+
* channel_name: "channel_name",
|
|
27
|
+
* socket_id: "socket_id"
|
|
28
|
+
* })
|
|
29
|
+
*/
|
|
30
|
+
businessChannelAuthAuthenticate(request: FiveOneEat.BusinessChannelAuthAuthenticateRequest, requestOptions?: BusinessMessagingClient.RequestOptions): core.HttpResponsePromise<number>;
|
|
31
|
+
private __businessChannelAuthAuthenticate;
|
|
32
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
12
|
+
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
13
|
+
import * as core from "../../../../core/index.mjs";
|
|
14
|
+
import * as environments from "../../../../environments.mjs";
|
|
15
|
+
import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
|
|
16
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
17
|
+
import * as FiveOneEat from "../../../index.mjs";
|
|
18
|
+
export class BusinessMessagingClient {
|
|
19
|
+
constructor(options = {}) {
|
|
20
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* This endpoint is used by the business companion mobile app to authenticate with
|
|
24
|
+
* Pusher channels. It validates that the authenticated business user has
|
|
25
|
+
* permission to access the requested channel, scoped to their active business.
|
|
26
|
+
*
|
|
27
|
+
* @param {FiveOneEat.BusinessChannelAuthAuthenticateRequest} request
|
|
28
|
+
* @param {BusinessMessagingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
29
|
+
*
|
|
30
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
31
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* await client.businessMessaging.businessChannelAuthAuthenticate({
|
|
35
|
+
* channel_name: "channel_name",
|
|
36
|
+
* socket_id: "socket_id"
|
|
37
|
+
* })
|
|
38
|
+
*/
|
|
39
|
+
businessChannelAuthAuthenticate(request, requestOptions) {
|
|
40
|
+
return core.HttpResponsePromise.fromPromise(this.__businessChannelAuthAuthenticate(request, requestOptions));
|
|
41
|
+
}
|
|
42
|
+
__businessChannelAuthAuthenticate(request, requestOptions) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
45
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
46
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
47
|
+
const _response = yield core.fetcher({
|
|
48
|
+
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/channels/auth"),
|
|
49
|
+
method: "POST",
|
|
50
|
+
headers: _headers,
|
|
51
|
+
contentType: "application/json",
|
|
52
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
53
|
+
requestType: "json",
|
|
54
|
+
body: request,
|
|
55
|
+
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,
|
|
56
|
+
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,
|
|
57
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
58
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
59
|
+
logging: this._options.logging,
|
|
60
|
+
});
|
|
61
|
+
if (_response.ok) {
|
|
62
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
63
|
+
}
|
|
64
|
+
if (_response.error.reason === "status-code") {
|
|
65
|
+
switch (_response.error.statusCode) {
|
|
66
|
+
case 401:
|
|
67
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
68
|
+
case 422:
|
|
69
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
70
|
+
default:
|
|
71
|
+
throw new errors.FiveOneEatError({
|
|
72
|
+
statusCode: _response.error.statusCode,
|
|
73
|
+
body: _response.error.body,
|
|
74
|
+
rawResponse: _response.rawResponse,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/business/channels/auth");
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|