Skip to content

Commit 35545ad

Browse files
committed
feat: enhance API client export to support customizable constructor name
1 parent a886fe1 commit 35545ad

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/src/templates/default.hbs

+7-1
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,14 @@ const endpoints = makeApi([
8282

8383
export const {{options.apiClientName}} = new Zodios({{#if options.baseUrl}}"{{options.baseUrl}}", {{/if}}endpoints);
8484

85+
{{#if options.apiClientConstructorName}}
8586
function createApiClient(baseUrl: string, options?: ZodiosOptions) {
8687
return new Zodios(baseUrl, endpoints, options);
8788
}
8889

89-
export { createApiClient as {{#if options.apiClientConstructorName}}{{options.apiClientConstructorName}}{{else}}createApiClient{{/if}} };
90+
export { createApiClient as {{options.apiClientConstructorName}} };
91+
{{else}}
92+
export function createApiClient(baseUrl: string, options?: ZodiosOptions) {
93+
return new Zodios(baseUrl, endpoints, options);
94+
}
95+
{{/if}}

0 commit comments

Comments
 (0)