Skip to content

Commit 21a27ff

Browse files
committed
Make endpoints template generic
1 parent 3c7610b commit 21a27ff

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

codegen/layouts/endpoints.hbs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
} from './{{fileName}}'
1515
{{/each}}
1616

17-
export class SeamHttpEndpoints {
17+
export class {{className}} {
1818
{{> route-class-methods }}
1919

2020
{{#each endpoints}}
@@ -36,8 +36,8 @@ export class SeamHttpEndpoints {
3636
{{/each}}
3737
}
3838

39-
export type SeamHttpEndpointQueryPaths = {{#each endpointReadPaths}}'{{.}}' {{#unless @last}} | {{/unless}}{{/each}}
39+
export type {{typeNamePrefix}}QueryPaths = {{#each endpointReadPaths}}'{{.}}' {{#unless @last}} | {{/unless}}{{/each}}
4040

41-
export type SeamHttpEndpointPaginatedQueryPaths = {{#each endpointPaginatedPaths}}'{{.}}' {{#unless @last}} | {{/unless}}{{/each}}
41+
export type {{typeNamePrefix}}PaginatedQueryPaths = {{#each endpointPaginatedPaths}}'{{.}}' {{#unless @last}} | {{/unless}}{{/each}}
4242

43-
export type SeamHttpEndpointMutationPaths = {{#each endpointWritePaths}}'{{.}}' {{#unless @last}} | {{/unless}}{{/each}}
43+
export type {{typeNamePrefix}}MutationPaths = {{#each endpointWritePaths}}'{{.}}' {{#unless @last}} | {{/unless}}{{/each}}

codegen/lib/layouts/endpoints.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99

1010
export interface EndpointsLayoutContext {
1111
className: string
12+
typeNamePrefix: string
1213
endpoints: EndpointLayoutContext[]
1314
endpointReadPaths: string[]
1415
endpointPaginatedPaths: string[]
@@ -28,6 +29,7 @@ export const setEndpointsLayoutContext = (
2829
routes: Route[],
2930
): void => {
3031
file.className = getClassName('Endpoints')
32+
file.typeNamePrefix = getClassName('Endpoint')
3133
file.skipClientSessionImport = true
3234
file.endpoints = routes.flatMap((route) =>
3335
route.endpoints.map((endpoint) =>

0 commit comments

Comments
 (0)