Skip to content

Commit 43a7cf9

Browse files
committed
Use RouteResponse and RouteRequestParams
1 parent 73fb0e0 commit 43a7cf9

File tree

2 files changed

+12
-24
lines changed

2 files changed

+12
-24
lines changed
Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
// TODO: Example of non-generated overrides to methods to preserve legacy behavior
2-
import type { Routes } from '@seamapi/types/connect'
1+
import type { RouteRequestParams, RouteResponse } from '@seamapi/types/connect'
32
import type { SetNonNullable } from 'type-fest'
43

54
import { Workspaces } from 'lib/seam/connect/routes/workspaces.js'
65

76
export class LegacyWorkspaces extends Workspaces {
8-
override async get(params: WorkspacesGetParams = {}): Promise<Workspace> {
7+
override async get(
8+
params: WorkspacesGetParams = {},
9+
): Promise<WorkspacesGetResponse['workspace']> {
910
const {
1011
data: { workspace },
1112
} = await this.client.get<WorkspacesGetResponse>('/workspaces/get', {
@@ -16,16 +17,9 @@ export class LegacyWorkspaces extends Workspaces {
1617
}
1718

1819
export type WorkspacesGetParams = SetNonNullable<
19-
Required<Routes['/workspaces/get']['commonParams']>
20+
Required<RouteRequestParams<'/workspaces/get'>>
2021
>
2122

2223
export type WorkspacesGetResponse = SetNonNullable<
23-
Required<Routes['/workspaces/get']['jsonResponse']>
24+
Required<RouteResponse<'/workspaces/get'>>
2425
>
25-
26-
// UPSTREAM: Should come from @seamapi/types/connect
27-
// import type { Workspace } from @seamapi/types
28-
// export type { Workspace } from '@seamapi/types/connect'
29-
export interface Workspace {
30-
workspace_id: string
31-
}
Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// TODO: This file is generated from route spec
2-
import type { Routes } from '@seamapi/types/connect'
1+
import type { RouteRequestParams, RouteResponse } from '@seamapi/types/connect'
32
import type { Axios } from 'axios'
43
import type { SetNonNullable } from 'type-fest'
54

@@ -10,7 +9,9 @@ export class Workspaces {
109
this.client = client
1110
}
1211

13-
async get(params: WorkspacesGetParams = {}): Promise<Workspace> {
12+
async get(
13+
params: WorkspacesGetParams = {},
14+
): Promise<WorkspacesGetResponse['workspace']> {
1415
const {
1516
data: { workspace },
1617
} = await this.client.get<WorkspacesGetResponse>('/workspaces/get', {
@@ -21,16 +22,9 @@ export class Workspaces {
2122
}
2223

2324
export type WorkspacesGetParams = SetNonNullable<
24-
Required<Routes['/workspaces/get']['commonParams']>
25+
Required<RouteRequestParams<'/workspaces/get'>>
2526
>
2627

2728
export type WorkspacesGetResponse = SetNonNullable<
28-
Required<Routes['/workspaces/get']['jsonResponse']>
29+
Required<RouteResponse<'/workspaces/get'>>
2930
>
30-
31-
// UPSTREAM: Should come from @seamapi/types/connect
32-
// import type { Workspace } from @seamapi/types
33-
// export type { Workspace } from '@seamapi/types/connect'
34-
export interface Workspace {
35-
workspace_id: string
36-
}

0 commit comments

Comments
 (0)