Skip to content

Commit f6110da

Browse files
committed
update types for all other requests
1 parent ed6ab67 commit f6110da

29 files changed

+58
-290
lines changed
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { PostOptions } from '../../common/interfaces';
2-
import type { ErrorResponse } from '../../interfaces';
2+
import type { Response } from '../../interfaces';
33

44
export interface CreateApiKeyOptions {
55
name: string;
@@ -14,12 +14,4 @@ export interface CreateApiKeyResponseSuccess {
1414
id: string;
1515
}
1616

17-
export type CreateApiKeyResponse =
18-
| {
19-
data: CreateApiKeyResponseSuccess;
20-
error: null;
21-
}
22-
| {
23-
data: null;
24-
error: ErrorResponse;
25-
};
17+
export type CreateApiKeyResponse = Response<CreateApiKeyResponseSuccess>;
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
import type { ErrorResponse } from '../../interfaces';
1+
import type { Response } from '../../interfaces';
22
import type { ApiKey } from './api-key';
33

44
export type ListApiKeysResponseSuccess = Pick<
55
ApiKey,
66
'name' | 'id' | 'created_at'
77
>[];
88

9-
export type ListApiKeysResponse =
10-
| {
11-
data: ListApiKeysResponseSuccess;
12-
error: null;
13-
}
14-
| {
15-
data: null;
16-
error: ErrorResponse;
17-
};
9+
export type ListApiKeysResponse = Response<ListApiKeysResponseSuccess>;
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
1-
import type { ErrorResponse } from '../../interfaces';
1+
import type { Response } from '../../interfaces';
22

33
// biome-ignore lint/complexity/noBannedTypes: <explanation>
44
export type RemoveApiKeyResponseSuccess = {};
55

6-
export type RemoveApiKeyResponse =
7-
| {
8-
data: RemoveApiKeyResponseSuccess;
9-
error: null;
10-
}
11-
| {
12-
data: null;
13-
error: ErrorResponse;
14-
};
6+
export type RemoveApiKeyResponse = Response<RemoveApiKeyResponseSuccess>;
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { PostOptions } from '../../common/interfaces';
2-
import type { ErrorResponse } from '../../interfaces';
2+
import type { Response } from '../../interfaces';
33
import type { Audience } from './audience';
44

55
export interface CreateAudienceOptions {
@@ -13,12 +13,4 @@ export interface CreateAudienceResponseSuccess
1313
object: 'audience';
1414
}
1515

16-
export type CreateAudienceResponse =
17-
| {
18-
data: CreateAudienceResponseSuccess;
19-
error: null;
20-
}
21-
| {
22-
data: null;
23-
error: ErrorResponse;
24-
};
16+
export type CreateAudienceResponse = Response<CreateAudienceResponseSuccess>;
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
import type { ErrorResponse } from '../../interfaces';
1+
import type { Response } from '../../interfaces';
22
import type { Audience } from './audience';
33

44
export interface GetAudienceResponseSuccess
55
extends Pick<Audience, 'id' | 'name' | 'created_at'> {
66
object: 'audience';
77
}
88

9-
export type GetAudienceResponse =
10-
| {
11-
data: GetAudienceResponseSuccess;
12-
error: null;
13-
}
14-
| {
15-
data: null;
16-
error: ErrorResponse;
17-
};
9+
export type GetAudienceResponse = Response<GetAudienceResponseSuccess>;
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
import type { ErrorResponse } from '../../interfaces';
1+
import type { Response } from '../../interfaces';
22
import type { Audience } from './audience';
33

44
export type ListAudiencesResponseSuccess = {
55
object: 'list';
66
data: Audience[];
77
};
88

9-
export type ListAudiencesResponse =
10-
| {
11-
data: ListAudiencesResponseSuccess;
12-
error: null;
13-
}
14-
| {
15-
data: null;
16-
error: ErrorResponse;
17-
};
9+
export type ListAudiencesResponse = Response<ListAudiencesResponseSuccess>;
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
import type { ErrorResponse } from '../../interfaces';
1+
import type { Response } from '../../interfaces';
22
import type { Audience } from './audience';
33

44
export interface RemoveAudiencesResponseSuccess extends Pick<Audience, 'id'> {
55
object: 'audience';
66
deleted: boolean;
77
}
88

9-
export type RemoveAudiencesResponse =
10-
| {
11-
data: RemoveAudiencesResponseSuccess;
12-
error: null;
13-
}
14-
| {
15-
data: null;
16-
error: ErrorResponse;
17-
};
9+
export type RemoveAudiencesResponse = Response<RemoveAudiencesResponseSuccess>;
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { PostOptions } from '../../common/interfaces';
22
import type { IdempotentRequest } from '../../common/interfaces/idempotent-request.interface';
33
import type { CreateEmailOptions } from '../../emails/interfaces/create-email-options.interface';
4-
import type { ErrorResponse } from '../../interfaces';
4+
import type { Response } from '../../interfaces';
55

66
export type CreateBatchOptions = CreateEmailOptions[];
77

@@ -16,12 +16,4 @@ export interface CreateBatchSuccessResponse {
1616
}[];
1717
}
1818

19-
export type CreateBatchResponse =
20-
| {
21-
data: CreateBatchSuccessResponse;
22-
error: null;
23-
}
24-
| {
25-
data: null;
26-
error: ErrorResponse;
27-
};
19+
export type CreateBatchResponse = Response<CreateBatchSuccessResponse>;

src/broadcasts/interfaces/create-broadcast-options.interface.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type * as React from 'react';
22
import type { PostOptions } from '../../common/interfaces';
33
import type { RequireAtLeastOne } from '../../common/interfaces/require-at-least-one';
4-
import type { ErrorResponse } from '../../interfaces';
4+
import type { Response } from '../../interfaces';
55

66
interface EmailRenderOptions {
77
/**
@@ -73,12 +73,4 @@ export interface CreateBroadcastResponseSuccess {
7373
id: string;
7474
}
7575

76-
export type CreateBroadcastResponse =
77-
| {
78-
data: CreateBroadcastResponseSuccess;
79-
error: null;
80-
}
81-
| {
82-
data: null;
83-
error: ErrorResponse;
84-
};
76+
export type CreateBroadcastResponse = Response<CreateBroadcastResponseSuccess>;
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
import type { ErrorResponse } from '../../interfaces';
1+
import type { Response } from '../../interfaces';
22
import type { Broadcast } from './broadcast';
33

44
export interface GetBroadcastResponseSuccess extends Broadcast {
55
object: 'broadcast';
66
}
77

8-
export type GetBroadcastResponse =
9-
| {
10-
data: GetBroadcastResponseSuccess;
11-
error: null;
12-
}
13-
| {
14-
data: null;
15-
error: ErrorResponse;
16-
};
8+
export type GetBroadcastResponse = Response<GetBroadcastResponseSuccess>;

0 commit comments

Comments
 (0)