@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
|
@@ -35,7 +35,8 @@ export declare class AuditEvents {
|
|
|
35
35
|
* @example
|
|
36
36
|
* await client.auditEvents.list()
|
|
37
37
|
*/
|
|
38
|
-
list(request?: Courier.ListAuditEventsRequest, requestOptions?: AuditEvents.RequestOptions):
|
|
38
|
+
list(request?: Courier.ListAuditEventsRequest, requestOptions?: AuditEvents.RequestOptions): core.HttpResponsePromise<Courier.ListAuditEventsResponse>;
|
|
39
|
+
private __list;
|
|
39
40
|
/**
|
|
40
41
|
* Fetch a specific audit event by ID.
|
|
41
42
|
*
|
|
@@ -45,6 +46,7 @@ export declare class AuditEvents {
|
|
|
45
46
|
* @example
|
|
46
47
|
* await client.auditEvents.get("audit-event-id")
|
|
47
48
|
*/
|
|
48
|
-
get(auditEventId: string, requestOptions?: AuditEvents.RequestOptions):
|
|
49
|
+
get(auditEventId: string, requestOptions?: AuditEvents.RequestOptions): core.HttpResponsePromise<Courier.AuditEvent>;
|
|
50
|
+
private __get;
|
|
49
51
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
50
52
|
}
|
|
@@ -66,7 +66,10 @@ class AuditEvents {
|
|
|
66
66
|
* @example
|
|
67
67
|
* await client.auditEvents.list()
|
|
68
68
|
*/
|
|
69
|
-
list() {
|
|
69
|
+
list(request = {}, requestOptions) {
|
|
70
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
71
|
+
}
|
|
72
|
+
__list() {
|
|
70
73
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
71
74
|
var _a, _b, _c;
|
|
72
75
|
const { cursor } = request;
|
|
@@ -77,7 +80,7 @@ class AuditEvents {
|
|
|
77
80
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
78
81
|
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, "/audit-events"),
|
|
79
82
|
method: "GET",
|
|
80
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
83
|
+
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),
|
|
81
84
|
contentType: "application/json",
|
|
82
85
|
queryParameters: _queryParams,
|
|
83
86
|
requestType: "json",
|
|
@@ -86,12 +89,13 @@ class AuditEvents {
|
|
|
86
89
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
87
90
|
});
|
|
88
91
|
if (_response.ok) {
|
|
89
|
-
return _response.body;
|
|
92
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
90
93
|
}
|
|
91
94
|
if (_response.error.reason === "status-code") {
|
|
92
95
|
throw new errors.CourierError({
|
|
93
96
|
statusCode: _response.error.statusCode,
|
|
94
97
|
body: _response.error.body,
|
|
98
|
+
rawResponse: _response.rawResponse,
|
|
95
99
|
});
|
|
96
100
|
}
|
|
97
101
|
switch (_response.error.reason) {
|
|
@@ -99,12 +103,14 @@ class AuditEvents {
|
|
|
99
103
|
throw new errors.CourierError({
|
|
100
104
|
statusCode: _response.error.statusCode,
|
|
101
105
|
body: _response.error.rawBody,
|
|
106
|
+
rawResponse: _response.rawResponse,
|
|
102
107
|
});
|
|
103
108
|
case "timeout":
|
|
104
109
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /audit-events.");
|
|
105
110
|
case "unknown":
|
|
106
111
|
throw new errors.CourierError({
|
|
107
112
|
message: _response.error.errorMessage,
|
|
113
|
+
rawResponse: _response.rawResponse,
|
|
108
114
|
});
|
|
109
115
|
}
|
|
110
116
|
});
|
|
@@ -119,12 +125,15 @@ class AuditEvents {
|
|
|
119
125
|
* await client.auditEvents.get("audit-event-id")
|
|
120
126
|
*/
|
|
121
127
|
get(auditEventId, requestOptions) {
|
|
128
|
+
return core.HttpResponsePromise.fromPromise(this.__get(auditEventId, requestOptions));
|
|
129
|
+
}
|
|
130
|
+
__get(auditEventId, requestOptions) {
|
|
122
131
|
return __awaiter(this, void 0, void 0, function* () {
|
|
123
132
|
var _a, _b, _c;
|
|
124
133
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
125
134
|
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, `/audit-events/${encodeURIComponent(auditEventId)}`),
|
|
126
135
|
method: "GET",
|
|
127
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
136
|
+
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),
|
|
128
137
|
contentType: "application/json",
|
|
129
138
|
requestType: "json",
|
|
130
139
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -132,12 +141,13 @@ class AuditEvents {
|
|
|
132
141
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
133
142
|
});
|
|
134
143
|
if (_response.ok) {
|
|
135
|
-
return _response.body;
|
|
144
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
136
145
|
}
|
|
137
146
|
if (_response.error.reason === "status-code") {
|
|
138
147
|
throw new errors.CourierError({
|
|
139
148
|
statusCode: _response.error.statusCode,
|
|
140
149
|
body: _response.error.body,
|
|
150
|
+
rawResponse: _response.rawResponse,
|
|
141
151
|
});
|
|
142
152
|
}
|
|
143
153
|
switch (_response.error.reason) {
|
|
@@ -145,12 +155,14 @@ class AuditEvents {
|
|
|
145
155
|
throw new errors.CourierError({
|
|
146
156
|
statusCode: _response.error.statusCode,
|
|
147
157
|
body: _response.error.rawBody,
|
|
158
|
+
rawResponse: _response.rawResponse,
|
|
148
159
|
});
|
|
149
160
|
case "timeout":
|
|
150
161
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /audit-events/{audit-event-id}.");
|
|
151
162
|
case "unknown":
|
|
152
163
|
throw new errors.CourierError({
|
|
153
164
|
message: _response.error.errorMessage,
|
|
165
|
+
rawResponse: _response.rawResponse,
|
|
154
166
|
});
|
|
155
167
|
}
|
|
156
168
|
});
|
|
@@ -42,6 +42,7 @@ export declare class AuthTokens {
|
|
|
42
42
|
* expires_in: "expires_in"
|
|
43
43
|
* })
|
|
44
44
|
*/
|
|
45
|
-
issueToken(request: Courier.IssueTokenParams, requestOptions?: AuthTokens.IdempotentRequestOptions):
|
|
45
|
+
issueToken(request: Courier.IssueTokenParams, requestOptions?: AuthTokens.IdempotentRequestOptions): core.HttpResponsePromise<Courier.IssueTokenResponse>;
|
|
46
|
+
private __issueToken;
|
|
46
47
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
47
48
|
}
|
|
@@ -70,12 +70,15 @@ class AuthTokens {
|
|
|
70
70
|
* })
|
|
71
71
|
*/
|
|
72
72
|
issueToken(request, requestOptions) {
|
|
73
|
+
return core.HttpResponsePromise.fromPromise(this.__issueToken(request, requestOptions));
|
|
74
|
+
}
|
|
75
|
+
__issueToken(request, requestOptions) {
|
|
73
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
77
|
var _a, _b, _c;
|
|
75
78
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
76
79
|
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, "/auth/issue-token"),
|
|
77
80
|
method: "POST",
|
|
78
|
-
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.
|
|
81
|
+
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),
|
|
79
82
|
contentType: "application/json",
|
|
80
83
|
requestType: "json",
|
|
81
84
|
body: request,
|
|
@@ -84,12 +87,13 @@ class AuthTokens {
|
|
|
84
87
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
85
88
|
});
|
|
86
89
|
if (_response.ok) {
|
|
87
|
-
return _response.body;
|
|
90
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
88
91
|
}
|
|
89
92
|
if (_response.error.reason === "status-code") {
|
|
90
93
|
throw new errors.CourierError({
|
|
91
94
|
statusCode: _response.error.statusCode,
|
|
92
95
|
body: _response.error.body,
|
|
96
|
+
rawResponse: _response.rawResponse,
|
|
93
97
|
});
|
|
94
98
|
}
|
|
95
99
|
switch (_response.error.reason) {
|
|
@@ -97,12 +101,14 @@ class AuthTokens {
|
|
|
97
101
|
throw new errors.CourierError({
|
|
98
102
|
statusCode: _response.error.statusCode,
|
|
99
103
|
body: _response.error.rawBody,
|
|
104
|
+
rawResponse: _response.rawResponse,
|
|
100
105
|
});
|
|
101
106
|
case "timeout":
|
|
102
107
|
throw new errors.CourierTimeoutError("Timeout exceeded when calling POST /auth/issue-token.");
|
|
103
108
|
case "unknown":
|
|
104
109
|
throw new errors.CourierError({
|
|
105
110
|
message: _response.error.errorMessage,
|
|
111
|
+
rawResponse: _response.rawResponse,
|
|
106
112
|
});
|
|
107
113
|
}
|
|
108
114
|
});
|
|
@@ -46,7 +46,8 @@ export declare class Automations {
|
|
|
46
46
|
* template: undefined
|
|
47
47
|
* })
|
|
48
48
|
*/
|
|
49
|
-
invokeAutomationTemplate(templateId: string, request: Courier.AutomationInvokeParams, requestOptions?: Automations.IdempotentRequestOptions):
|
|
49
|
+
invokeAutomationTemplate(templateId: string, request: Courier.AutomationInvokeParams, requestOptions?: Automations.IdempotentRequestOptions): core.HttpResponsePromise<Courier.AutomationInvokeResponse>;
|
|
50
|
+
private __invokeAutomationTemplate;
|
|
50
51
|
/**
|
|
51
52
|
* Invoke an ad hoc automation run. This endpoint accepts a JSON payload with a series of automation steps. For information about what steps are available, checkout the ad hoc automation guide [here](https://www.courier.com/docs/automations/steps/).
|
|
52
53
|
*
|
|
@@ -74,6 +75,7 @@ export declare class Automations {
|
|
|
74
75
|
* }
|
|
75
76
|
* })
|
|
76
77
|
*/
|
|
77
|
-
invokeAdHocAutomation(request: Courier.AutomationAdHocInvokeParams, requestOptions?: Automations.IdempotentRequestOptions):
|
|
78
|
+
invokeAdHocAutomation(request: Courier.AutomationAdHocInvokeParams, requestOptions?: Automations.IdempotentRequestOptions): core.HttpResponsePromise<Courier.AutomationInvokeResponse>;
|
|
79
|
+
private __invokeAdHocAutomation;
|
|
78
80
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
79
81
|
}
|
|
@@ -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
|
});
|