Skip to content

Commit 67dc5f9

Browse files
committed
Simpler types
1 parent 70c796b commit 67dc5f9

1 file changed

Lines changed: 10 additions & 53 deletions

File tree

src/index.ts

Lines changed: 10 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -216,24 +216,6 @@ interface PaginationData {
216216
nextPage: string | null;
217217
}
218218

219-
interface TransactionalEmail {
220-
/** The ID of the transactional email. */
221-
id: string;
222-
/**
223-
* The name of the transactional email.
224-
*/
225-
name: string;
226-
/**
227-
* The date the email was last updated in ECMA-262 date-time format.
228-
* @see https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-date-time-string-format
229-
*/
230-
lastUpdated: string;
231-
/**
232-
* Data variables in the transactional email.
233-
*/
234-
dataVariables: string[];
235-
}
236-
237219
interface ContactProperty {
238220
/**
239221
* The property's name.
@@ -249,11 +231,6 @@ interface ContactProperty {
249231
type: "string" | "number" | "boolean" | "date";
250232
}
251233

252-
interface ListTransactionalsResponse {
253-
pagination: PaginationData;
254-
data: TransactionalEmail[];
255-
}
256-
257234
interface TransactionalEmailResource {
258235
/** The ID of the transactional email. */
259236
id: string;
@@ -274,34 +251,17 @@ interface TransactionalEmailResource {
274251
dataVariables: string[];
275252
}
276253

277-
interface ListTransactionalsResourceResponse {
278-
pagination: PaginationData;
279-
data: TransactionalEmailResource[];
280-
}
281-
282-
interface TransactionalResponse {
283-
id: string;
284-
name: string;
285-
draftEmailMessageId: string | null;
286-
publishedEmailMessageId: string | null;
287-
createdAt: string;
288-
updatedAt: string;
289-
dataVariables: string[];
290-
}
291-
292-
interface TransactionalDraftResponse {
293-
id: string;
294-
name: string;
295-
draftEmailMessageId: string | null;
254+
interface TransactionalDraftResponse extends TransactionalEmailResource {
296255
/**
297256
* The `contentRevisionId` of the draft email message.
298257
* Pass this as `expectedRevisionId` on your first update via `updateEmailMessage()`.
299258
*/
300259
draftEmailMessageContentRevisionId: string | null;
301-
publishedEmailMessageId: string | null;
302-
createdAt: string;
303-
updatedAt: string;
304-
dataVariables: string[];
260+
}
261+
262+
interface ListTransactionalsResourceResponse {
263+
pagination: PaginationData;
264+
data: TransactionalEmailResource[];
305265
}
306266

307267
interface CreateUploadResponse {
@@ -1041,7 +1001,7 @@ class LoopsClient {
10411001
*/
10421002
async getTransactionalEmail(
10431003
transactionalId: string
1044-
): Promise<TransactionalResponse> {
1004+
): Promise<TransactionalEmailResource> {
10451005
return this._makeQuery({
10461006
path: `v1/transactional-emails/${transactionalId}`,
10471007
});
@@ -1083,7 +1043,7 @@ class LoopsClient {
10831043
async updateTransactionalEmail(
10841044
transactionalId: string,
10851045
{ name }: { name: string }
1086-
): Promise<TransactionalResponse> {
1046+
): Promise<TransactionalEmailResource> {
10871047
return this._makeQuery({
10881048
path: `v1/transactional-emails/${transactionalId}`,
10891049
method: "POST",
@@ -1120,7 +1080,7 @@ class LoopsClient {
11201080
*/
11211081
async publishTransactionalEmail(
11221082
transactionalId: string
1123-
): Promise<TransactionalResponse> {
1083+
): Promise<TransactionalEmailResource> {
11241084
return this._makeQuery({
11251085
path: `v1/transactional-emails/${transactionalId}/publish`,
11261086
method: "POST",
@@ -1454,12 +1414,9 @@ export {
14541414
TransactionalAttachment,
14551415
MailingList,
14561416
PaginationData,
1457-
TransactionalEmail,
1458-
ListTransactionalsResponse,
14591417
TransactionalEmailResource,
1460-
ListTransactionalsResourceResponse,
1461-
TransactionalResponse,
14621418
TransactionalDraftResponse,
1419+
ListTransactionalsResourceResponse,
14631420
CreateUploadResponse,
14641421
CompleteUploadResponse,
14651422
MailingLists,

0 commit comments

Comments
 (0)