@trycourier/courier 6.4.0 → 6.4.2
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/Client.d.ts +14 -48
- package/Client.js +20 -49
- package/README.md +113 -808
- package/api/client/requests/SendMessageRequest.d.ts +12 -47
- package/api/resources/audiences/client/Client.d.ts +10 -5
- package/api/resources/audiences/client/Client.js +45 -15
- package/api/resources/auditEvents/client/Client.d.ts +4 -2
- package/api/resources/auditEvents/client/Client.js +17 -5
- package/api/resources/authTokens/client/Client.d.ts +2 -1
- package/api/resources/authTokens/client/Client.js +8 -2
- package/api/resources/automations/client/Client.d.ts +4 -2
- package/api/resources/automations/client/Client.js +16 -4
- package/api/resources/brands/client/Client.d.ts +10 -5
- package/api/resources/brands/client/Client.js +45 -15
- package/api/resources/bulk/client/Client.d.ts +10 -5
- package/api/resources/bulk/client/Client.js +45 -15
- package/api/resources/commons/errors/AlreadyExistsError.d.ts +2 -1
- package/api/resources/commons/errors/AlreadyExistsError.js +2 -1
- package/api/resources/commons/errors/BadRequestError.d.ts +2 -1
- package/api/resources/commons/errors/BadRequestError.js +2 -1
- package/api/resources/commons/errors/ConflictError.d.ts +2 -1
- package/api/resources/commons/errors/ConflictError.js +2 -1
- package/api/resources/commons/errors/MessageNotFoundError.d.ts +2 -1
- package/api/resources/commons/errors/MessageNotFoundError.js +2 -1
- package/api/resources/commons/errors/NotFoundError.d.ts +2 -1
- package/api/resources/commons/errors/NotFoundError.js +2 -1
- package/api/resources/commons/errors/PaymentRequiredError.d.ts +2 -1
- package/api/resources/commons/errors/PaymentRequiredError.js +2 -1
- package/api/resources/inbound/client/Client.d.ts +2 -1
- package/api/resources/inbound/client/Client.js +10 -4
- package/api/resources/lists/client/Client.d.ts +20 -10
- package/api/resources/lists/client/Client.js +89 -29
- package/api/resources/messages/client/Client.d.ts +12 -6
- package/api/resources/messages/client/Client.js +56 -20
- package/api/resources/notifications/client/Client.d.ts +12 -6
- package/api/resources/notifications/client/Client.js +58 -13
- package/api/resources/profiles/client/Client.d.ts +16 -8
- package/api/resources/profiles/client/Client.js +75 -24
- package/api/resources/templates/client/Client.d.ts +2 -1
- package/api/resources/templates/client/Client.js +9 -3
- package/api/resources/tenants/client/Client.d.ts +14 -7
- package/api/resources/tenants/client/Client.js +61 -19
- package/api/resources/translations/client/Client.d.ts +4 -2
- package/api/resources/translations/client/Client.js +18 -6
- package/api/resources/users/resources/preferences/client/Client.d.ts +6 -3
- package/api/resources/users/resources/preferences/client/Client.js +38 -11
- package/api/resources/users/resources/tenants/client/Client.d.ts +10 -5
- package/api/resources/users/resources/tenants/client/Client.js +45 -12
- package/api/resources/users/resources/tokens/client/Client.d.ts +12 -6
- package/api/resources/users/resources/tokens/client/Client.js +53 -17
- package/core/fetcher/APIResponse.d.ts +10 -0
- package/core/fetcher/Fetcher.js +7 -0
- package/core/fetcher/Headers.d.ts +2 -0
- package/core/fetcher/Headers.js +84 -0
- package/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/core/fetcher/HttpResponsePromise.js +103 -0
- package/core/fetcher/RawResponse.d.ts +29 -0
- package/core/fetcher/RawResponse.js +44 -0
- package/core/fetcher/index.d.ts +3 -0
- package/core/fetcher/index.js +7 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +1 -1
- package/dist/Client.d.ts +14 -48
- package/dist/Client.js +20 -49
- package/dist/api/client/requests/SendMessageRequest.d.ts +12 -47
- package/dist/api/resources/audiences/client/Client.d.ts +10 -5
- package/dist/api/resources/audiences/client/Client.js +45 -15
- package/dist/api/resources/auditEvents/client/Client.d.ts +4 -2
- package/dist/api/resources/auditEvents/client/Client.js +17 -5
- package/dist/api/resources/authTokens/client/Client.d.ts +2 -1
- package/dist/api/resources/authTokens/client/Client.js +8 -2
- package/dist/api/resources/automations/client/Client.d.ts +4 -2
- package/dist/api/resources/automations/client/Client.js +16 -4
- package/dist/api/resources/brands/client/Client.d.ts +10 -5
- package/dist/api/resources/brands/client/Client.js +45 -15
- package/dist/api/resources/bulk/client/Client.d.ts +10 -5
- package/dist/api/resources/bulk/client/Client.js +45 -15
- package/dist/api/resources/commons/errors/AlreadyExistsError.d.ts +2 -1
- package/dist/api/resources/commons/errors/AlreadyExistsError.js +2 -1
- package/dist/api/resources/commons/errors/BadRequestError.d.ts +2 -1
- package/dist/api/resources/commons/errors/BadRequestError.js +2 -1
- package/dist/api/resources/commons/errors/ConflictError.d.ts +2 -1
- package/dist/api/resources/commons/errors/ConflictError.js +2 -1
- package/dist/api/resources/commons/errors/MessageNotFoundError.d.ts +2 -1
- package/dist/api/resources/commons/errors/MessageNotFoundError.js +2 -1
- package/dist/api/resources/commons/errors/NotFoundError.d.ts +2 -1
- package/dist/api/resources/commons/errors/NotFoundError.js +2 -1
- package/dist/api/resources/commons/errors/PaymentRequiredError.d.ts +2 -1
- package/dist/api/resources/commons/errors/PaymentRequiredError.js +2 -1
- package/dist/api/resources/inbound/client/Client.d.ts +2 -1
- package/dist/api/resources/inbound/client/Client.js +10 -4
- package/dist/api/resources/lists/client/Client.d.ts +20 -10
- package/dist/api/resources/lists/client/Client.js +89 -29
- package/dist/api/resources/messages/client/Client.d.ts +12 -6
- package/dist/api/resources/messages/client/Client.js +56 -20
- package/dist/api/resources/notifications/client/Client.d.ts +12 -6
- package/dist/api/resources/notifications/client/Client.js +58 -13
- package/dist/api/resources/profiles/client/Client.d.ts +16 -8
- package/dist/api/resources/profiles/client/Client.js +75 -24
- package/dist/api/resources/templates/client/Client.d.ts +2 -1
- package/dist/api/resources/templates/client/Client.js +9 -3
- package/dist/api/resources/tenants/client/Client.d.ts +14 -7
- package/dist/api/resources/tenants/client/Client.js +61 -19
- package/dist/api/resources/translations/client/Client.d.ts +4 -2
- package/dist/api/resources/translations/client/Client.js +18 -6
- package/dist/api/resources/users/resources/preferences/client/Client.d.ts +6 -3
- package/dist/api/resources/users/resources/preferences/client/Client.js +38 -11
- package/dist/api/resources/users/resources/tenants/client/Client.d.ts +10 -5
- package/dist/api/resources/users/resources/tenants/client/Client.js +45 -12
- package/dist/api/resources/users/resources/tokens/client/Client.d.ts +12 -6
- package/dist/api/resources/users/resources/tokens/client/Client.js +53 -17
- package/dist/core/fetcher/APIResponse.d.ts +10 -0
- package/dist/core/fetcher/Fetcher.js +7 -0
- package/dist/core/fetcher/Headers.d.ts +2 -0
- package/dist/core/fetcher/Headers.js +84 -0
- package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/dist/core/fetcher/HttpResponsePromise.js +103 -0
- package/dist/core/fetcher/RawResponse.d.ts +29 -0
- package/dist/core/fetcher/RawResponse.js +44 -0
- package/dist/core/fetcher/index.d.ts +3 -0
- package/dist/core/fetcher/index.js +7 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/errors/CourierError.d.ts +4 -1
- package/dist/errors/CourierError.js +4 -7
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/errors/CourierError.d.ts +4 -1
- package/errors/CourierError.js +4 -7
- package/package.json +3 -2
- package/reference.md +12 -50
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -74,12 +74,15 @@ class Automations {
|
|
|
74
74
|
* })
|
|
75
75
|
*/
|
|
76
76
|
invokeAutomationTemplate(templateId, request, requestOptions) {
|
|
77
|
+
return core.HttpResponsePromise.fromPromise(this.__invokeAutomationTemplate(templateId, request, requestOptions));
|
|
78
|
+
}
|
|
79
|
+
__invokeAutomationTemplate(templateId, request, requestOptions) {
|
|
77
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
78
81
|
var _a, _b, _c;
|
|
79
82
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
80
83
|
url: (0, url_join_1.default)((_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.CourierEnvironment.Production, `/automations/${encodeURIComponent(templateId)}/invoke`),
|
|
81
84
|
method: "POST",
|
|
82
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
85
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.2", "User-Agent": "@trycourier/courier/6.4.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, "Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined, "X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
83
86
|
contentType: "application/json",
|
|
84
87
|
requestType: "json",
|
|
85
88
|
body: request,
|
|
@@ -88,12 +91,13 @@ class Automations {
|
|
|
88
91
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
89
92
|
});
|
|
90
93
|
if (_response.ok) {
|
|
91
|
-
return _response.body;
|
|
94
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
92
95
|
}
|
|
93
96
|
if (_response.error.reason === "status-code") {
|
|
94
97
|
throw new errors.CourierError({
|
|
95
98
|
statusCode: _response.error.statusCode,
|
|
96
99
|
body: _response.error.body,
|
|
100
|
+
rawResponse: _response.rawResponse,
|
|
97
101
|
});
|
|
98
102
|
}
|
|
99
103
|
switch (_response.error.reason) {
|
|
@@ -101,12 +105,14 @@ class Automations {
|
|
|
101
105
|
throw new errors.CourierError({
|
|
102
106
|
statusCode: _response.error.statusCode,
|
|
103
107
|
body: _response.error.rawBody,
|
|
108
|
+
rawResponse: _response.rawResponse,
|
|
104
109
|
});
|
|
105
110
|
case "timeout":
|
|
106
111
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling POST /automations/{templateId}/invoke.");
|
|
107
112
|
case "unknown":
|
|
108
113
|
throw new errors.CourierError({
|
|
109
114
|
message: _response.error.errorMessage,
|
|
115
|
+
rawResponse: _response.rawResponse,
|
|
110
116
|
});
|
|
111
117
|
}
|
|
112
118
|
});
|
|
@@ -139,12 +145,15 @@ class Automations {
|
|
|
139
145
|
* })
|
|
140
146
|
*/
|
|
141
147
|
invokeAdHocAutomation(request, requestOptions) {
|
|
148
|
+
return core.HttpResponsePromise.fromPromise(this.__invokeAdHocAutomation(request, requestOptions));
|
|
149
|
+
}
|
|
150
|
+
__invokeAdHocAutomation(request, requestOptions) {
|
|
142
151
|
return __awaiter(this, void 0, void 0, function* () {
|
|
143
152
|
var _a, _b, _c;
|
|
144
153
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
145
154
|
url: (0, url_join_1.default)((_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.CourierEnvironment.Production, "/automations/invoke"),
|
|
146
155
|
method: "POST",
|
|
147
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
156
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.2", "User-Agent": "@trycourier/courier/6.4.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, "Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined, "X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
148
157
|
contentType: "application/json",
|
|
149
158
|
requestType: "json",
|
|
150
159
|
body: request,
|
|
@@ -153,12 +162,13 @@ class Automations {
|
|
|
153
162
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
154
163
|
});
|
|
155
164
|
if (_response.ok) {
|
|
156
|
-
return _response.body;
|
|
165
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
157
166
|
}
|
|
158
167
|
if (_response.error.reason === "status-code") {
|
|
159
168
|
throw new errors.CourierError({
|
|
160
169
|
statusCode: _response.error.statusCode,
|
|
161
170
|
body: _response.error.body,
|
|
171
|
+
rawResponse: _response.rawResponse,
|
|
162
172
|
});
|
|
163
173
|
}
|
|
164
174
|
switch (_response.error.reason) {
|
|
@@ -166,12 +176,14 @@ class Automations {
|
|
|
166
176
|
throw new errors.CourierError({
|
|
167
177
|
statusCode: _response.error.statusCode,
|
|
168
178
|
body: _response.error.rawBody,
|
|
179
|
+
rawResponse: _response.rawResponse,
|
|
169
180
|
});
|
|
170
181
|
case "timeout":
|
|
171
182
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling POST /automations/invoke.");
|
|
172
183
|
case "unknown":
|
|
173
184
|
throw new errors.CourierError({
|
|
174
185
|
message: _response.error.errorMessage,
|
|
186
|
+
rawResponse: _response.rawResponse,
|
|
175
187
|
});
|
|
176
188
|
}
|
|
177
189
|
});
|
|
@@ -50,7 +50,8 @@ export declare class Brands {
|
|
|
50
50
|
* snippets: undefined
|
|
51
51
|
* })
|
|
52
52
|
*/
|
|
53
|
-
create(request: Courier.BrandParameters, requestOptions?: Brands.IdempotentRequestOptions):
|
|
53
|
+
create(request: Courier.BrandParameters, requestOptions?: Brands.IdempotentRequestOptions): core.HttpResponsePromise<Courier.Brand>;
|
|
54
|
+
private __create;
|
|
54
55
|
/**
|
|
55
56
|
* Fetch a specific brand by brand ID.
|
|
56
57
|
*
|
|
@@ -60,7 +61,8 @@ export declare class Brands {
|
|
|
60
61
|
* @example
|
|
61
62
|
* await client.brands.get("brand_id")
|
|
62
63
|
*/
|
|
63
|
-
get(brandId: string, requestOptions?: Brands.RequestOptions):
|
|
64
|
+
get(brandId: string, requestOptions?: Brands.RequestOptions): core.HttpResponsePromise<Courier.Brand>;
|
|
65
|
+
private __get;
|
|
64
66
|
/**
|
|
65
67
|
* Get the list of brands.
|
|
66
68
|
*
|
|
@@ -70,7 +72,8 @@ export declare class Brands {
|
|
|
70
72
|
* @example
|
|
71
73
|
* await client.brands.list()
|
|
72
74
|
*/
|
|
73
|
-
list(request?: Courier.ListBrandsRequest, requestOptions?: Brands.RequestOptions):
|
|
75
|
+
list(request?: Courier.ListBrandsRequest, requestOptions?: Brands.RequestOptions): core.HttpResponsePromise<Courier.BrandsResponse>;
|
|
76
|
+
private __list;
|
|
74
77
|
/**
|
|
75
78
|
* Delete a brand by brand ID.
|
|
76
79
|
*
|
|
@@ -82,7 +85,8 @@ export declare class Brands {
|
|
|
82
85
|
* @example
|
|
83
86
|
* await client.brands.delete("brand_id")
|
|
84
87
|
*/
|
|
85
|
-
delete(brandId: string, requestOptions?: Brands.RequestOptions):
|
|
88
|
+
delete(brandId: string, requestOptions?: Brands.RequestOptions): core.HttpResponsePromise<void>;
|
|
89
|
+
private __delete;
|
|
86
90
|
/**
|
|
87
91
|
* Replace an existing brand with the supplied values.
|
|
88
92
|
*
|
|
@@ -97,6 +101,7 @@ export declare class Brands {
|
|
|
97
101
|
* snippets: undefined
|
|
98
102
|
* })
|
|
99
103
|
*/
|
|
100
|
-
replace(brandId: string, request: Courier.BrandUpdateParameters, requestOptions?: Brands.RequestOptions):
|
|
104
|
+
replace(brandId: string, request: Courier.BrandUpdateParameters, requestOptions?: Brands.RequestOptions): core.HttpResponsePromise<Courier.Brand>;
|
|
105
|
+
private __replace;
|
|
101
106
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
102
107
|
}
|
|
@@ -79,12 +79,15 @@ class Brands {
|
|
|
79
79
|
* })
|
|
80
80
|
*/
|
|
81
81
|
create(request, requestOptions) {
|
|
82
|
+
return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
|
|
83
|
+
}
|
|
84
|
+
__create(request, requestOptions) {
|
|
82
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
86
|
var _a, _b, _c;
|
|
84
87
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
85
88
|
url: (0, url_join_1.default)((_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.CourierEnvironment.Production, "/brands"),
|
|
86
89
|
method: "POST",
|
|
87
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
90
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.2", "User-Agent": "@trycourier/courier/6.4.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, "Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined, "X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
88
91
|
contentType: "application/json",
|
|
89
92
|
requestType: "json",
|
|
90
93
|
body: request,
|
|
@@ -93,20 +96,21 @@ class Brands {
|
|
|
93
96
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
94
97
|
});
|
|
95
98
|
if (_response.ok) {
|
|
96
|
-
return _response.body;
|
|
99
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
97
100
|
}
|
|
98
101
|
if (_response.error.reason === "status-code") {
|
|
99
102
|
switch (_response.error.statusCode) {
|
|
100
103
|
case 400:
|
|
101
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
104
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
102
105
|
case 402:
|
|
103
|
-
throw new Courier.PaymentRequiredError(_response.error.body);
|
|
106
|
+
throw new Courier.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
104
107
|
case 409:
|
|
105
|
-
throw new Courier.AlreadyExistsError(_response.error.body);
|
|
108
|
+
throw new Courier.AlreadyExistsError(_response.error.body, _response.rawResponse);
|
|
106
109
|
default:
|
|
107
110
|
throw new errors.CourierError({
|
|
108
111
|
statusCode: _response.error.statusCode,
|
|
109
112
|
body: _response.error.body,
|
|
113
|
+
rawResponse: _response.rawResponse,
|
|
110
114
|
});
|
|
111
115
|
}
|
|
112
116
|
}
|
|
@@ -115,12 +119,14 @@ class Brands {
|
|
|
115
119
|
throw new errors.CourierError({
|
|
116
120
|
statusCode: _response.error.statusCode,
|
|
117
121
|
body: _response.error.rawBody,
|
|
122
|
+
rawResponse: _response.rawResponse,
|
|
118
123
|
});
|
|
119
124
|
case "timeout":
|
|
120
125
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling POST /brands.");
|
|
121
126
|
case "unknown":
|
|
122
127
|
throw new errors.CourierError({
|
|
123
128
|
message: _response.error.errorMessage,
|
|
129
|
+
rawResponse: _response.rawResponse,
|
|
124
130
|
});
|
|
125
131
|
}
|
|
126
132
|
});
|
|
@@ -135,12 +141,15 @@ class Brands {
|
|
|
135
141
|
* await client.brands.get("brand_id")
|
|
136
142
|
*/
|
|
137
143
|
get(brandId, requestOptions) {
|
|
144
|
+
return core.HttpResponsePromise.fromPromise(this.__get(brandId, requestOptions));
|
|
145
|
+
}
|
|
146
|
+
__get(brandId, requestOptions) {
|
|
138
147
|
return __awaiter(this, void 0, void 0, function* () {
|
|
139
148
|
var _a, _b, _c;
|
|
140
149
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
141
150
|
url: (0, url_join_1.default)((_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.CourierEnvironment.Production, `/brands/${encodeURIComponent(brandId)}`),
|
|
142
151
|
method: "GET",
|
|
143
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
152
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.2", "User-Agent": "@trycourier/courier/6.4.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
144
153
|
contentType: "application/json",
|
|
145
154
|
requestType: "json",
|
|
146
155
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -148,12 +157,13 @@ class Brands {
|
|
|
148
157
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
149
158
|
});
|
|
150
159
|
if (_response.ok) {
|
|
151
|
-
return _response.body;
|
|
160
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
152
161
|
}
|
|
153
162
|
if (_response.error.reason === "status-code") {
|
|
154
163
|
throw new errors.CourierError({
|
|
155
164
|
statusCode: _response.error.statusCode,
|
|
156
165
|
body: _response.error.body,
|
|
166
|
+
rawResponse: _response.rawResponse,
|
|
157
167
|
});
|
|
158
168
|
}
|
|
159
169
|
switch (_response.error.reason) {
|
|
@@ -161,12 +171,14 @@ class Brands {
|
|
|
161
171
|
throw new errors.CourierError({
|
|
162
172
|
statusCode: _response.error.statusCode,
|
|
163
173
|
body: _response.error.rawBody,
|
|
174
|
+
rawResponse: _response.rawResponse,
|
|
164
175
|
});
|
|
165
176
|
case "timeout":
|
|
166
177
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /brands/{brand_id}.");
|
|
167
178
|
case "unknown":
|
|
168
179
|
throw new errors.CourierError({
|
|
169
180
|
message: _response.error.errorMessage,
|
|
181
|
+
rawResponse: _response.rawResponse,
|
|
170
182
|
});
|
|
171
183
|
}
|
|
172
184
|
});
|
|
@@ -180,7 +192,10 @@ class Brands {
|
|
|
180
192
|
* @example
|
|
181
193
|
* await client.brands.list()
|
|
182
194
|
*/
|
|
183
|
-
list() {
|
|
195
|
+
list(request = {}, requestOptions) {
|
|
196
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
197
|
+
}
|
|
198
|
+
__list() {
|
|
184
199
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
185
200
|
var _a, _b, _c;
|
|
186
201
|
const { cursor } = request;
|
|
@@ -191,7 +206,7 @@ class Brands {
|
|
|
191
206
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
192
207
|
url: (0, url_join_1.default)((_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.CourierEnvironment.Production, "/brands"),
|
|
193
208
|
method: "GET",
|
|
194
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
209
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.2", "User-Agent": "@trycourier/courier/6.4.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
195
210
|
contentType: "application/json",
|
|
196
211
|
queryParameters: _queryParams,
|
|
197
212
|
requestType: "json",
|
|
@@ -200,12 +215,13 @@ class Brands {
|
|
|
200
215
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
201
216
|
});
|
|
202
217
|
if (_response.ok) {
|
|
203
|
-
return _response.body;
|
|
218
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
204
219
|
}
|
|
205
220
|
if (_response.error.reason === "status-code") {
|
|
206
221
|
throw new errors.CourierError({
|
|
207
222
|
statusCode: _response.error.statusCode,
|
|
208
223
|
body: _response.error.body,
|
|
224
|
+
rawResponse: _response.rawResponse,
|
|
209
225
|
});
|
|
210
226
|
}
|
|
211
227
|
switch (_response.error.reason) {
|
|
@@ -213,12 +229,14 @@ class Brands {
|
|
|
213
229
|
throw new errors.CourierError({
|
|
214
230
|
statusCode: _response.error.statusCode,
|
|
215
231
|
body: _response.error.rawBody,
|
|
232
|
+
rawResponse: _response.rawResponse,
|
|
216
233
|
});
|
|
217
234
|
case "timeout":
|
|
218
235
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /brands.");
|
|
219
236
|
case "unknown":
|
|
220
237
|
throw new errors.CourierError({
|
|
221
238
|
message: _response.error.errorMessage,
|
|
239
|
+
rawResponse: _response.rawResponse,
|
|
222
240
|
});
|
|
223
241
|
}
|
|
224
242
|
});
|
|
@@ -235,12 +253,15 @@ class Brands {
|
|
|
235
253
|
* await client.brands.delete("brand_id")
|
|
236
254
|
*/
|
|
237
255
|
delete(brandId, requestOptions) {
|
|
256
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(brandId, requestOptions));
|
|
257
|
+
}
|
|
258
|
+
__delete(brandId, requestOptions) {
|
|
238
259
|
return __awaiter(this, void 0, void 0, function* () {
|
|
239
260
|
var _a, _b, _c;
|
|
240
261
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
241
262
|
url: (0, url_join_1.default)((_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.CourierEnvironment.Production, `/brands/${encodeURIComponent(brandId)}`),
|
|
242
263
|
method: "DELETE",
|
|
243
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
264
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.2", "User-Agent": "@trycourier/courier/6.4.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
244
265
|
contentType: "application/json",
|
|
245
266
|
requestType: "json",
|
|
246
267
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -248,16 +269,17 @@ class Brands {
|
|
|
248
269
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
249
270
|
});
|
|
250
271
|
if (_response.ok) {
|
|
251
|
-
return;
|
|
272
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
252
273
|
}
|
|
253
274
|
if (_response.error.reason === "status-code") {
|
|
254
275
|
switch (_response.error.statusCode) {
|
|
255
276
|
case 409:
|
|
256
|
-
throw new Courier.ConflictError(_response.error.body);
|
|
277
|
+
throw new Courier.ConflictError(_response.error.body, _response.rawResponse);
|
|
257
278
|
default:
|
|
258
279
|
throw new errors.CourierError({
|
|
259
280
|
statusCode: _response.error.statusCode,
|
|
260
281
|
body: _response.error.body,
|
|
282
|
+
rawResponse: _response.rawResponse,
|
|
261
283
|
});
|
|
262
284
|
}
|
|
263
285
|
}
|
|
@@ -266,12 +288,14 @@ class Brands {
|
|
|
266
288
|
throw new errors.CourierError({
|
|
267
289
|
statusCode: _response.error.statusCode,
|
|
268
290
|
body: _response.error.rawBody,
|
|
291
|
+
rawResponse: _response.rawResponse,
|
|
269
292
|
});
|
|
270
293
|
case "timeout":
|
|
271
294
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /brands/{brand_id}.");
|
|
272
295
|
case "unknown":
|
|
273
296
|
throw new errors.CourierError({
|
|
274
297
|
message: _response.error.errorMessage,
|
|
298
|
+
rawResponse: _response.rawResponse,
|
|
275
299
|
});
|
|
276
300
|
}
|
|
277
301
|
});
|
|
@@ -291,12 +315,15 @@ class Brands {
|
|
|
291
315
|
* })
|
|
292
316
|
*/
|
|
293
317
|
replace(brandId, request, requestOptions) {
|
|
318
|
+
return core.HttpResponsePromise.fromPromise(this.__replace(brandId, request, requestOptions));
|
|
319
|
+
}
|
|
320
|
+
__replace(brandId, request, requestOptions) {
|
|
294
321
|
return __awaiter(this, void 0, void 0, function* () {
|
|
295
322
|
var _a, _b, _c;
|
|
296
323
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
297
324
|
url: (0, url_join_1.default)((_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.CourierEnvironment.Production, `/brands/${encodeURIComponent(brandId)}`),
|
|
298
325
|
method: "PUT",
|
|
299
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
326
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.2", "User-Agent": "@trycourier/courier/6.4.2", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
300
327
|
contentType: "application/json",
|
|
301
328
|
requestType: "json",
|
|
302
329
|
body: request,
|
|
@@ -305,12 +332,13 @@ class Brands {
|
|
|
305
332
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
306
333
|
});
|
|
307
334
|
if (_response.ok) {
|
|
308
|
-
return _response.body;
|
|
335
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
309
336
|
}
|
|
310
337
|
if (_response.error.reason === "status-code") {
|
|
311
338
|
throw new errors.CourierError({
|
|
312
339
|
statusCode: _response.error.statusCode,
|
|
313
340
|
body: _response.error.body,
|
|
341
|
+
rawResponse: _response.rawResponse,
|
|
314
342
|
});
|
|
315
343
|
}
|
|
316
344
|
switch (_response.error.reason) {
|
|
@@ -318,12 +346,14 @@ class Brands {
|
|
|
318
346
|
throw new errors.CourierError({
|
|
319
347
|
statusCode: _response.error.statusCode,
|
|
320
348
|
body: _response.error.rawBody,
|
|
349
|
+
rawResponse: _response.rawResponse,
|
|
321
350
|
});
|
|
322
351
|
case "timeout":
|
|
323
352
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /brands/{brand_id}.");
|
|
324
353
|
case "unknown":
|
|
325
354
|
throw new errors.CourierError({
|
|
326
355
|
message: _response.error.errorMessage,
|
|
356
|
+
rawResponse: _response.rawResponse,
|
|
327
357
|
});
|
|
328
358
|
}
|
|
329
359
|
});
|
|
@@ -48,7 +48,8 @@ export declare class Bulk {
|
|
|
48
48
|
* }
|
|
49
49
|
* })
|
|
50
50
|
*/
|
|
51
|
-
createJob(request: Courier.BulkCreateJobParams, requestOptions?: Bulk.IdempotentRequestOptions):
|
|
51
|
+
createJob(request: Courier.BulkCreateJobParams, requestOptions?: Bulk.IdempotentRequestOptions): core.HttpResponsePromise<Courier.BulkCreateJobResponse>;
|
|
52
|
+
private __createJob;
|
|
52
53
|
/**
|
|
53
54
|
* Ingest user data into a Bulk Job
|
|
54
55
|
*
|
|
@@ -73,7 +74,8 @@ export declare class Bulk {
|
|
|
73
74
|
* }]
|
|
74
75
|
* })
|
|
75
76
|
*/
|
|
76
|
-
ingestUsers(jobId: string, request: Courier.BulkIngestUsersParams, requestOptions?: Bulk.IdempotentRequestOptions):
|
|
77
|
+
ingestUsers(jobId: string, request: Courier.BulkIngestUsersParams, requestOptions?: Bulk.IdempotentRequestOptions): core.HttpResponsePromise<void>;
|
|
78
|
+
private __ingestUsers;
|
|
77
79
|
/**
|
|
78
80
|
* Run a bulk job
|
|
79
81
|
*
|
|
@@ -85,7 +87,8 @@ export declare class Bulk {
|
|
|
85
87
|
* @example
|
|
86
88
|
* await client.bulk.runJob("job_id")
|
|
87
89
|
*/
|
|
88
|
-
runJob(jobId: string, requestOptions?: Bulk.IdempotentRequestOptions):
|
|
90
|
+
runJob(jobId: string, requestOptions?: Bulk.IdempotentRequestOptions): core.HttpResponsePromise<void>;
|
|
91
|
+
private __runJob;
|
|
89
92
|
/**
|
|
90
93
|
* Get a bulk job
|
|
91
94
|
*
|
|
@@ -97,7 +100,8 @@ export declare class Bulk {
|
|
|
97
100
|
* @example
|
|
98
101
|
* await client.bulk.getJob("job_id")
|
|
99
102
|
*/
|
|
100
|
-
getJob(jobId: string, requestOptions?: Bulk.RequestOptions):
|
|
103
|
+
getJob(jobId: string, requestOptions?: Bulk.RequestOptions): core.HttpResponsePromise<Courier.BulkGetJobResponse>;
|
|
104
|
+
private __getJob;
|
|
101
105
|
/**
|
|
102
106
|
* Get Bulk Job Users
|
|
103
107
|
*
|
|
@@ -110,6 +114,7 @@ export declare class Bulk {
|
|
|
110
114
|
* @example
|
|
111
115
|
* await client.bulk.getUsers("job_id")
|
|
112
116
|
*/
|
|
113
|
-
getUsers(jobId: string, request?: Courier.BulkGetUsersParams, requestOptions?: Bulk.RequestOptions):
|
|
117
|
+
getUsers(jobId: string, request?: Courier.BulkGetUsersParams, requestOptions?: Bulk.RequestOptions): core.HttpResponsePromise<Courier.BulkGetJobUsersResponse>;
|
|
118
|
+
private __getUsers;
|
|
114
119
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
115
120
|
}
|