fork of hey-api/openapi-ts because I need some additional things

feat: Refactor SDK methods to use direct function exports instead of class methods

- Updated the SDK generation to export functions for API operations (e.g., addPet, updatePet) instead of using static class methods.
- Removed Angular service classes for Pet, Store, and User, simplifying the API interaction.
- Enhanced the Angular resource plugin to support customizable class and method name builders for generated resources.
- Adjusted method names in the generated Angular services to follow the new naming conventions.
- Updated the configuration types to include optional builders for class and method names.

Max Scopp f9dd1cd8 fd6326a0

+511 -491
+8 -2
examples/openapi-ts-angular/openapi-ts.config.ts
··· 12 12 '@hey-api/client-angular', 13 13 '@tanstack/angular-query-experimental', 14 14 { 15 - // asClass: true, 15 + asClass: true, 16 16 name: '@hey-api/angular-resource', 17 17 }, 18 18 '@hey-api/schemas', 19 19 { 20 - asClass: true, 20 + asClass: false, 21 + classNameBuilder(name) { 22 + return `${name}Service`; 23 + }, 24 + methodNameBuilder(operation) { 25 + return String(operation.id); 26 + }, 21 27 name: '@hey-api/sdk', 22 28 }, 23 29 {
+62 -42
examples/openapi-ts-angular/src/client/@hey-api/angular-resource.gen.ts
··· 3 3 import { Injectable, resource } from '@angular/core'; 4 4 5 5 import type { Options } from '../sdk.gen'; 6 - import { Pet, Store, User } from '../sdk.gen'; 6 + import { 7 + addPet, 8 + createUser, 9 + createUsersWithListInput, 10 + deleteOrder, 11 + deletePet, 12 + deleteUser, 13 + findPetsByStatus, 14 + findPetsByTags, 15 + getInventory, 16 + getOrderById, 17 + getPetById, 18 + getUserByName, 19 + loginUser, 20 + logoutUser, 21 + placeOrder, 22 + updatePet, 23 + updatePetWithForm, 24 + updateUser, 25 + uploadFile, 26 + } from '../sdk.gen'; 7 27 import type { 8 28 AddPetData, 9 29 CreateUserData, ··· 29 49 @Injectable({ 30 50 providedIn: 'root', 31 51 }) 32 - export class PetResource { 52 + export class PetServiceResources { 33 53 /** 34 54 * Add a new pet to the store. 35 55 * Add a new pet to the store. 36 56 */ 37 - public addPet<ThrowOnError extends boolean = false>( 57 + public addPetResource<ThrowOnError extends boolean = false>( 38 58 options: Options<AddPetData, ThrowOnError>, 39 59 ) { 40 60 return resource({ 41 - loader: async ({ params }) => Pet.addPet(params), 61 + loader: async ({ params }) => addPet(params), 42 62 params: () => options, 43 63 }); 44 64 } ··· 47 67 * Update an existing pet. 48 68 * Update an existing pet by Id. 49 69 */ 50 - public updatePet<ThrowOnError extends boolean = false>( 70 + public updatePetResource<ThrowOnError extends boolean = false>( 51 71 options: Options<UpdatePetData, ThrowOnError>, 52 72 ) { 53 73 return resource({ 54 - loader: async ({ params }) => Pet.updatePet(params), 74 + loader: async ({ params }) => updatePet(params), 55 75 params: () => options, 56 76 }); 57 77 } ··· 60 80 * Finds Pets by status. 61 81 * Multiple status values can be provided with comma separated strings. 62 82 */ 63 - public findPetsByStatus<ThrowOnError extends boolean = false>( 83 + public findPetsByStatusResource<ThrowOnError extends boolean = false>( 64 84 options: Options<FindPetsByStatusData, ThrowOnError>, 65 85 ) { 66 86 return resource({ 67 - loader: async ({ params }) => Pet.findPetsByStatus(params), 87 + loader: async ({ params }) => findPetsByStatus(params), 68 88 params: () => options, 69 89 }); 70 90 } ··· 73 93 * Finds Pets by tags. 74 94 * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. 75 95 */ 76 - public findPetsByTags<ThrowOnError extends boolean = false>( 96 + public findPetsByTagsResource<ThrowOnError extends boolean = false>( 77 97 options: Options<FindPetsByTagsData, ThrowOnError>, 78 98 ) { 79 99 return resource({ 80 - loader: async ({ params }) => Pet.findPetsByTags(params), 100 + loader: async ({ params }) => findPetsByTags(params), 81 101 params: () => options, 82 102 }); 83 103 } ··· 86 106 * Deletes a pet. 87 107 * Delete a pet. 88 108 */ 89 - public deletePet<ThrowOnError extends boolean = false>( 109 + public deletePetResource<ThrowOnError extends boolean = false>( 90 110 options: Options<DeletePetData, ThrowOnError>, 91 111 ) { 92 112 return resource({ 93 - loader: async ({ params }) => Pet.deletePet(params), 113 + loader: async ({ params }) => deletePet(params), 94 114 params: () => options, 95 115 }); 96 116 } ··· 99 119 * Find pet by ID. 100 120 * Returns a single pet. 101 121 */ 102 - public getPetById<ThrowOnError extends boolean = false>( 122 + public getPetByIdResource<ThrowOnError extends boolean = false>( 103 123 options: Options<GetPetByIdData, ThrowOnError>, 104 124 ) { 105 125 return resource({ 106 - loader: async ({ params }) => Pet.getPetById(params), 126 + loader: async ({ params }) => getPetById(params), 107 127 params: () => options, 108 128 }); 109 129 } ··· 112 132 * Updates a pet in the store with form data. 113 133 * Updates a pet resource based on the form data. 114 134 */ 115 - public updatePetWithForm<ThrowOnError extends boolean = false>( 135 + public updatePetWithFormResource<ThrowOnError extends boolean = false>( 116 136 options: Options<UpdatePetWithFormData, ThrowOnError>, 117 137 ) { 118 138 return resource({ 119 - loader: async ({ params }) => Pet.updatePetWithForm(params), 139 + loader: async ({ params }) => updatePetWithForm(params), 120 140 params: () => options, 121 141 }); 122 142 } ··· 125 145 * Uploads an image. 126 146 * Upload image of the pet. 127 147 */ 128 - public uploadFile<ThrowOnError extends boolean = false>( 148 + public uploadFileResource<ThrowOnError extends boolean = false>( 129 149 options: Options<UploadFileData, ThrowOnError>, 130 150 ) { 131 151 return resource({ 132 - loader: async ({ params }) => Pet.uploadFile(params), 152 + loader: async ({ params }) => uploadFile(params), 133 153 params: () => options, 134 154 }); 135 155 } ··· 138 158 @Injectable({ 139 159 providedIn: 'root', 140 160 }) 141 - export class StoreResource { 161 + export class StoreServiceResources { 142 162 /** 143 163 * Returns pet inventories by status. 144 164 * Returns a map of status codes to quantities. 145 165 */ 146 - public getInventory<ThrowOnError extends boolean = false>( 166 + public getInventoryResource<ThrowOnError extends boolean = false>( 147 167 options?: Options<GetInventoryData, ThrowOnError>, 148 168 ) { 149 169 return resource({ 150 - loader: async ({ params }) => Store.getInventory(params), 170 + loader: async ({ params }) => getInventory(params), 151 171 params: () => options, 152 172 }); 153 173 } ··· 156 176 * Place an order for a pet. 157 177 * Place a new order in the store. 158 178 */ 159 - public placeOrder<ThrowOnError extends boolean = false>( 179 + public placeOrderResource<ThrowOnError extends boolean = false>( 160 180 options?: Options<PlaceOrderData, ThrowOnError>, 161 181 ) { 162 182 return resource({ 163 - loader: async ({ params }) => Store.placeOrder(params), 183 + loader: async ({ params }) => placeOrder(params), 164 184 params: () => options, 165 185 }); 166 186 } ··· 169 189 * Delete purchase order by identifier. 170 190 * For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API errors. 171 191 */ 172 - public deleteOrder<ThrowOnError extends boolean = false>( 192 + public deleteOrderResource<ThrowOnError extends boolean = false>( 173 193 options: Options<DeleteOrderData, ThrowOnError>, 174 194 ) { 175 195 return resource({ 176 - loader: async ({ params }) => Store.deleteOrder(params), 196 + loader: async ({ params }) => deleteOrder(params), 177 197 params: () => options, 178 198 }); 179 199 } ··· 182 202 * Find purchase order by ID. 183 203 * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. 184 204 */ 185 - public getOrderById<ThrowOnError extends boolean = false>( 205 + public getOrderByIdResource<ThrowOnError extends boolean = false>( 186 206 options: Options<GetOrderByIdData, ThrowOnError>, 187 207 ) { 188 208 return resource({ 189 - loader: async ({ params }) => Store.getOrderById(params), 209 + loader: async ({ params }) => getOrderById(params), 190 210 params: () => options, 191 211 }); 192 212 } ··· 195 215 @Injectable({ 196 216 providedIn: 'root', 197 217 }) 198 - export class UserResource { 218 + export class UserServiceResources { 199 219 /** 200 220 * Create user. 201 221 * This can only be done by the logged in user. 202 222 */ 203 - public createUser<ThrowOnError extends boolean = false>( 223 + public createUserResource<ThrowOnError extends boolean = false>( 204 224 options?: Options<CreateUserData, ThrowOnError>, 205 225 ) { 206 226 return resource({ 207 - loader: async ({ params }) => User.createUser(params), 227 + loader: async ({ params }) => createUser(params), 208 228 params: () => options, 209 229 }); 210 230 } ··· 213 233 * Creates list of users with given input array. 214 234 * Creates list of users with given input array. 215 235 */ 216 - public createUsersWithListInput<ThrowOnError extends boolean = false>( 236 + public createUsersWithListInputResource<ThrowOnError extends boolean = false>( 217 237 options?: Options<CreateUsersWithListInputData, ThrowOnError>, 218 238 ) { 219 239 return resource({ 220 - loader: async ({ params }) => User.createUsersWithListInput(params), 240 + loader: async ({ params }) => createUsersWithListInput(params), 221 241 params: () => options, 222 242 }); 223 243 } ··· 226 246 * Logs user into the system. 227 247 * Log into the system. 228 248 */ 229 - public loginUser<ThrowOnError extends boolean = false>( 249 + public loginUserResource<ThrowOnError extends boolean = false>( 230 250 options?: Options<LoginUserData, ThrowOnError>, 231 251 ) { 232 252 return resource({ 233 - loader: async ({ params }) => User.loginUser(params), 253 + loader: async ({ params }) => loginUser(params), 234 254 params: () => options, 235 255 }); 236 256 } ··· 239 259 * Logs out current logged in user session. 240 260 * Log user out of the system. 241 261 */ 242 - public logoutUser<ThrowOnError extends boolean = false>( 262 + public logoutUserResource<ThrowOnError extends boolean = false>( 243 263 options?: Options<LogoutUserData, ThrowOnError>, 244 264 ) { 245 265 return resource({ 246 - loader: async ({ params }) => User.logoutUser(params), 266 + loader: async ({ params }) => logoutUser(params), 247 267 params: () => options, 248 268 }); 249 269 } ··· 252 272 * Delete user resource. 253 273 * This can only be done by the logged in user. 254 274 */ 255 - public deleteUser<ThrowOnError extends boolean = false>( 275 + public deleteUserResource<ThrowOnError extends boolean = false>( 256 276 options: Options<DeleteUserData, ThrowOnError>, 257 277 ) { 258 278 return resource({ 259 - loader: async ({ params }) => User.deleteUser(params), 279 + loader: async ({ params }) => deleteUser(params), 260 280 params: () => options, 261 281 }); 262 282 } ··· 265 285 * Get user by user name. 266 286 * Get user detail based on username. 267 287 */ 268 - public getUserByName<ThrowOnError extends boolean = false>( 288 + public getUserByNameResource<ThrowOnError extends boolean = false>( 269 289 options: Options<GetUserByNameData, ThrowOnError>, 270 290 ) { 271 291 return resource({ 272 - loader: async ({ params }) => User.getUserByName(params), 292 + loader: async ({ params }) => getUserByName(params), 273 293 params: () => options, 274 294 }); 275 295 } ··· 278 298 * Update user resource. 279 299 * This can only be done by the logged in user. 280 300 */ 281 - public updateUser<ThrowOnError extends boolean = false>( 301 + public updateUserResource<ThrowOnError extends boolean = false>( 282 302 options: Options<UpdateUserData, ThrowOnError>, 283 303 ) { 284 304 return resource({ 285 - loader: async ({ params }) => User.updateUser(params), 305 + loader: async ({ params }) => updateUser(params), 286 306 params: () => options, 287 307 }); 288 308 }
+47 -26
examples/openapi-ts-angular/src/client/@tanstack/angular-query-experimental.gen.ts
··· 7 7 } from '@tanstack/angular-query-experimental'; 8 8 9 9 import { client as _heyApiClient } from '../client.gen'; 10 - import { type Options, Pet, Store, User } from '../sdk.gen'; 10 + import { 11 + addPet, 12 + createUser, 13 + createUsersWithListInput, 14 + deleteOrder, 15 + deletePet, 16 + deleteUser, 17 + findPetsByStatus, 18 + findPetsByTags, 19 + getInventory, 20 + getOrderById, 21 + getPetById, 22 + getUserByName, 23 + loginUser, 24 + logoutUser, 25 + type Options, 26 + placeOrder, 27 + updatePet, 28 + updatePetWithForm, 29 + updateUser, 30 + uploadFile, 31 + } from '../sdk.gen'; 11 32 import type { 12 33 AddPetData, 13 34 AddPetResponse, ··· 88 109 export const addPetOptions = (options: Options<AddPetData>) => 89 110 queryOptions({ 90 111 queryFn: async ({ queryKey, signal }) => { 91 - const { data } = await Pet.addPet({ 112 + const { data } = await addPet({ 92 113 ...options, 93 114 ...queryKey[0], 94 115 signal, ··· 112 133 Options<AddPetData> 113 134 > = { 114 135 mutationFn: async (localOptions) => { 115 - const { data } = await Pet.addPet({ 136 + const { data } = await addPet({ 116 137 ...options, 117 138 ...localOptions, 118 139 throwOnError: true, ··· 136 157 Options<UpdatePetData> 137 158 > = { 138 159 mutationFn: async (localOptions) => { 139 - const { data } = await Pet.updatePet({ 160 + const { data } = await updatePet({ 140 161 ...options, 141 162 ...localOptions, 142 163 throwOnError: true, ··· 160 181 ) => 161 182 queryOptions({ 162 183 queryFn: async ({ queryKey, signal }) => { 163 - const { data } = await Pet.findPetsByStatus({ 184 + const { data } = await findPetsByStatus({ 164 185 ...options, 165 186 ...queryKey[0], 166 187 signal, ··· 181 202 export const findPetsByTagsOptions = (options: Options<FindPetsByTagsData>) => 182 203 queryOptions({ 183 204 queryFn: async ({ queryKey, signal }) => { 184 - const { data } = await Pet.findPetsByTags({ 205 + const { data } = await findPetsByTags({ 185 206 ...options, 186 207 ...queryKey[0], 187 208 signal, ··· 205 226 Options<DeletePetData> 206 227 > = { 207 228 mutationFn: async (localOptions) => { 208 - const { data } = await Pet.deletePet({ 229 + const { data } = await deletePet({ 209 230 ...options, 210 231 ...localOptions, 211 232 throwOnError: true, ··· 226 247 export const getPetByIdOptions = (options: Options<GetPetByIdData>) => 227 248 queryOptions({ 228 249 queryFn: async ({ queryKey, signal }) => { 229 - const { data } = await Pet.getPetById({ 250 + const { data } = await getPetById({ 230 251 ...options, 231 252 ...queryKey[0], 232 253 signal, ··· 250 271 ) => 251 272 queryOptions({ 252 273 queryFn: async ({ queryKey, signal }) => { 253 - const { data } = await Pet.updatePetWithForm({ 274 + const { data } = await updatePetWithForm({ 254 275 ...options, 255 276 ...queryKey[0], 256 277 signal, ··· 278 299 Options<UpdatePetWithFormData> 279 300 > = { 280 301 mutationFn: async (localOptions) => { 281 - const { data } = await Pet.updatePetWithForm({ 302 + const { data } = await updatePetWithForm({ 282 303 ...options, 283 304 ...localOptions, 284 305 throwOnError: true, ··· 299 320 export const uploadFileOptions = (options: Options<UploadFileData>) => 300 321 queryOptions({ 301 322 queryFn: async ({ queryKey, signal }) => { 302 - const { data } = await Pet.uploadFile({ 323 + const { data } = await uploadFile({ 303 324 ...options, 304 325 ...queryKey[0], 305 326 signal, ··· 327 348 Options<UploadFileData> 328 349 > = { 329 350 mutationFn: async (localOptions) => { 330 - const { data } = await Pet.uploadFile({ 351 + const { data } = await uploadFile({ 331 352 ...options, 332 353 ...localOptions, 333 354 throwOnError: true, ··· 348 369 export const getInventoryOptions = (options?: Options<GetInventoryData>) => 349 370 queryOptions({ 350 371 queryFn: async ({ queryKey, signal }) => { 351 - const { data } = await Store.getInventory({ 372 + const { data } = await getInventory({ 352 373 ...options, 353 374 ...queryKey[0], 354 375 signal, ··· 369 390 export const placeOrderOptions = (options?: Options<PlaceOrderData>) => 370 391 queryOptions({ 371 392 queryFn: async ({ queryKey, signal }) => { 372 - const { data } = await Store.placeOrder({ 393 + const { data } = await placeOrder({ 373 394 ...options, 374 395 ...queryKey[0], 375 396 signal, ··· 397 418 Options<PlaceOrderData> 398 419 > = { 399 420 mutationFn: async (localOptions) => { 400 - const { data } = await Store.placeOrder({ 421 + const { data } = await placeOrder({ 401 422 ...options, 402 423 ...localOptions, 403 424 throwOnError: true, ··· 421 442 Options<DeleteOrderData> 422 443 > = { 423 444 mutationFn: async (localOptions) => { 424 - const { data } = await Store.deleteOrder({ 445 + const { data } = await deleteOrder({ 425 446 ...options, 426 447 ...localOptions, 427 448 throwOnError: true, ··· 442 463 export const getOrderByIdOptions = (options: Options<GetOrderByIdData>) => 443 464 queryOptions({ 444 465 queryFn: async ({ queryKey, signal }) => { 445 - const { data } = await Store.getOrderById({ 466 + const { data } = await getOrderById({ 446 467 ...options, 447 468 ...queryKey[0], 448 469 signal, ··· 463 484 export const createUserOptions = (options?: Options<CreateUserData>) => 464 485 queryOptions({ 465 486 queryFn: async ({ queryKey, signal }) => { 466 - const { data } = await User.createUser({ 487 + const { data } = await createUser({ 467 488 ...options, 468 489 ...queryKey[0], 469 490 signal, ··· 491 512 Options<CreateUserData> 492 513 > = { 493 514 mutationFn: async (localOptions) => { 494 - const { data } = await User.createUser({ 515 + const { data } = await createUser({ 495 516 ...options, 496 517 ...localOptions, 497 518 throwOnError: true, ··· 515 536 ) => 516 537 queryOptions({ 517 538 queryFn: async ({ queryKey, signal }) => { 518 - const { data } = await User.createUsersWithListInput({ 539 + const { data } = await createUsersWithListInput({ 519 540 ...options, 520 541 ...queryKey[0], 521 542 signal, ··· 543 564 Options<CreateUsersWithListInputData> 544 565 > = { 545 566 mutationFn: async (localOptions) => { 546 - const { data } = await User.createUsersWithListInput({ 567 + const { data } = await createUsersWithListInput({ 547 568 ...options, 548 569 ...localOptions, 549 570 throwOnError: true, ··· 564 585 export const loginUserOptions = (options?: Options<LoginUserData>) => 565 586 queryOptions({ 566 587 queryFn: async ({ queryKey, signal }) => { 567 - const { data } = await User.loginUser({ 588 + const { data } = await loginUser({ 568 589 ...options, 569 590 ...queryKey[0], 570 591 signal, ··· 585 606 export const logoutUserOptions = (options?: Options<LogoutUserData>) => 586 607 queryOptions({ 587 608 queryFn: async ({ queryKey, signal }) => { 588 - const { data } = await User.logoutUser({ 609 + const { data } = await logoutUser({ 589 610 ...options, 590 611 ...queryKey[0], 591 612 signal, ··· 609 630 Options<DeleteUserData> 610 631 > = { 611 632 mutationFn: async (localOptions) => { 612 - const { data } = await User.deleteUser({ 633 + const { data } = await deleteUser({ 613 634 ...options, 614 635 ...localOptions, 615 636 throwOnError: true, ··· 630 651 export const getUserByNameOptions = (options: Options<GetUserByNameData>) => 631 652 queryOptions({ 632 653 queryFn: async ({ queryKey, signal }) => { 633 - const { data } = await User.getUserByName({ 654 + const { data } = await getUserByName({ 634 655 ...options, 635 656 ...queryKey[0], 636 657 signal, ··· 654 675 Options<UpdateUserData> 655 676 > = { 656 677 mutationFn: async (localOptions) => { 657 - const { data } = await User.updateUser({ 678 + const { data } = await updateUser({ 658 679 ...options, 659 680 ...localOptions, 660 681 throwOnError: true,
+369 -405
examples/openapi-ts-angular/src/client/sdk.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { Injectable } from '@angular/core'; 4 - 5 3 import type { Client, Options as ClientOptions, TDataShape } from './client'; 6 4 import { client as _heyApiClient } from './client.gen'; 7 5 import type { ··· 81 79 meta?: Record<string, unknown>; 82 80 }; 83 81 84 - @Injectable({ 85 - providedIn: 'root', 86 - }) 87 - export class Pet { 88 - /** 89 - * Add a new pet to the store. 90 - * Add a new pet to the store. 91 - */ 92 - public static addPet<ThrowOnError extends boolean = false>( 93 - options: Options<AddPetData, ThrowOnError>, 94 - ) { 95 - return (options.client ?? _heyApiClient).post< 96 - AddPetResponses, 97 - AddPetErrors, 98 - ThrowOnError 99 - >({ 100 - security: [ 101 - { 102 - scheme: 'bearer', 103 - type: 'http', 104 - }, 105 - ], 106 - url: '/pet', 107 - ...options, 108 - headers: { 109 - 'Content-Type': 'application/json', 110 - ...options.headers, 82 + /** 83 + * Add a new pet to the store. 84 + * Add a new pet to the store. 85 + */ 86 + export const addPet = <ThrowOnError extends boolean = false>( 87 + options: Options<AddPetData, ThrowOnError>, 88 + ) => 89 + (options.client ?? _heyApiClient).post< 90 + AddPetResponses, 91 + AddPetErrors, 92 + ThrowOnError 93 + >({ 94 + security: [ 95 + { 96 + scheme: 'bearer', 97 + type: 'http', 111 98 }, 112 - }); 113 - } 99 + ], 100 + url: '/pet', 101 + ...options, 102 + headers: { 103 + 'Content-Type': 'application/json', 104 + ...options.headers, 105 + }, 106 + }); 114 107 115 - /** 116 - * Update an existing pet. 117 - * Update an existing pet by Id. 118 - */ 119 - public static updatePet<ThrowOnError extends boolean = false>( 120 - options: Options<UpdatePetData, ThrowOnError>, 121 - ) { 122 - return (options.client ?? _heyApiClient).put< 123 - UpdatePetResponses, 124 - UpdatePetErrors, 125 - ThrowOnError 126 - >({ 127 - security: [ 128 - { 129 - scheme: 'bearer', 130 - type: 'http', 131 - }, 132 - ], 133 - url: '/pet', 134 - ...options, 135 - headers: { 136 - 'Content-Type': 'application/json', 137 - ...options.headers, 108 + /** 109 + * Update an existing pet. 110 + * Update an existing pet by Id. 111 + */ 112 + export const updatePet = <ThrowOnError extends boolean = false>( 113 + options: Options<UpdatePetData, ThrowOnError>, 114 + ) => 115 + (options.client ?? _heyApiClient).put< 116 + UpdatePetResponses, 117 + UpdatePetErrors, 118 + ThrowOnError 119 + >({ 120 + security: [ 121 + { 122 + scheme: 'bearer', 123 + type: 'http', 138 124 }, 139 - }); 140 - } 125 + ], 126 + url: '/pet', 127 + ...options, 128 + headers: { 129 + 'Content-Type': 'application/json', 130 + ...options.headers, 131 + }, 132 + }); 141 133 142 - /** 143 - * Finds Pets by status. 144 - * Multiple status values can be provided with comma separated strings. 145 - */ 146 - public static findPetsByStatus<ThrowOnError extends boolean = false>( 147 - options: Options<FindPetsByStatusData, ThrowOnError>, 148 - ) { 149 - return (options.client ?? _heyApiClient).get< 150 - FindPetsByStatusResponses, 151 - FindPetsByStatusErrors, 152 - ThrowOnError 153 - >({ 154 - security: [ 155 - { 156 - scheme: 'bearer', 157 - type: 'http', 158 - }, 159 - ], 160 - url: '/pet/findByStatus', 161 - ...options, 162 - }); 163 - } 134 + /** 135 + * Finds Pets by status. 136 + * Multiple status values can be provided with comma separated strings. 137 + */ 138 + export const findPetsByStatus = <ThrowOnError extends boolean = false>( 139 + options: Options<FindPetsByStatusData, ThrowOnError>, 140 + ) => 141 + (options.client ?? _heyApiClient).get< 142 + FindPetsByStatusResponses, 143 + FindPetsByStatusErrors, 144 + ThrowOnError 145 + >({ 146 + security: [ 147 + { 148 + scheme: 'bearer', 149 + type: 'http', 150 + }, 151 + ], 152 + url: '/pet/findByStatus', 153 + ...options, 154 + }); 164 155 165 - /** 166 - * Finds Pets by tags. 167 - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. 168 - */ 169 - public static findPetsByTags<ThrowOnError extends boolean = false>( 170 - options: Options<FindPetsByTagsData, ThrowOnError>, 171 - ) { 172 - return (options.client ?? _heyApiClient).get< 173 - FindPetsByTagsResponses, 174 - FindPetsByTagsErrors, 175 - ThrowOnError 176 - >({ 177 - security: [ 178 - { 179 - scheme: 'bearer', 180 - type: 'http', 181 - }, 182 - ], 183 - url: '/pet/findByTags', 184 - ...options, 185 - }); 186 - } 156 + /** 157 + * Finds Pets by tags. 158 + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. 159 + */ 160 + export const findPetsByTags = <ThrowOnError extends boolean = false>( 161 + options: Options<FindPetsByTagsData, ThrowOnError>, 162 + ) => 163 + (options.client ?? _heyApiClient).get< 164 + FindPetsByTagsResponses, 165 + FindPetsByTagsErrors, 166 + ThrowOnError 167 + >({ 168 + security: [ 169 + { 170 + scheme: 'bearer', 171 + type: 'http', 172 + }, 173 + ], 174 + url: '/pet/findByTags', 175 + ...options, 176 + }); 187 177 188 - /** 189 - * Deletes a pet. 190 - * Delete a pet. 191 - */ 192 - public static deletePet<ThrowOnError extends boolean = false>( 193 - options: Options<DeletePetData, ThrowOnError>, 194 - ) { 195 - return (options.client ?? _heyApiClient).delete< 196 - DeletePetResponses, 197 - DeletePetErrors, 198 - ThrowOnError 199 - >({ 200 - security: [ 201 - { 202 - scheme: 'bearer', 203 - type: 'http', 204 - }, 205 - ], 206 - url: '/pet/{petId}', 207 - ...options, 208 - }); 209 - } 178 + /** 179 + * Deletes a pet. 180 + * Delete a pet. 181 + */ 182 + export const deletePet = <ThrowOnError extends boolean = false>( 183 + options: Options<DeletePetData, ThrowOnError>, 184 + ) => 185 + (options.client ?? _heyApiClient).delete< 186 + DeletePetResponses, 187 + DeletePetErrors, 188 + ThrowOnError 189 + >({ 190 + security: [ 191 + { 192 + scheme: 'bearer', 193 + type: 'http', 194 + }, 195 + ], 196 + url: '/pet/{petId}', 197 + ...options, 198 + }); 210 199 211 - /** 212 - * Find pet by ID. 213 - * Returns a single pet. 214 - */ 215 - public static getPetById<ThrowOnError extends boolean = false>( 216 - options: Options<GetPetByIdData, ThrowOnError>, 217 - ) { 218 - return (options.client ?? _heyApiClient).get< 219 - GetPetByIdResponses, 220 - GetPetByIdErrors, 221 - ThrowOnError 222 - >({ 223 - security: [ 224 - { 225 - name: 'api_key', 226 - type: 'apiKey', 227 - }, 228 - { 229 - scheme: 'bearer', 230 - type: 'http', 231 - }, 232 - ], 233 - url: '/pet/{petId}', 234 - ...options, 235 - }); 236 - } 200 + /** 201 + * Find pet by ID. 202 + * Returns a single pet. 203 + */ 204 + export const getPetById = <ThrowOnError extends boolean = false>( 205 + options: Options<GetPetByIdData, ThrowOnError>, 206 + ) => 207 + (options.client ?? _heyApiClient).get< 208 + GetPetByIdResponses, 209 + GetPetByIdErrors, 210 + ThrowOnError 211 + >({ 212 + security: [ 213 + { 214 + name: 'api_key', 215 + type: 'apiKey', 216 + }, 217 + { 218 + scheme: 'bearer', 219 + type: 'http', 220 + }, 221 + ], 222 + url: '/pet/{petId}', 223 + ...options, 224 + }); 237 225 238 - /** 239 - * Updates a pet in the store with form data. 240 - * Updates a pet resource based on the form data. 241 - */ 242 - public static updatePetWithForm<ThrowOnError extends boolean = false>( 243 - options: Options<UpdatePetWithFormData, ThrowOnError>, 244 - ) { 245 - return (options.client ?? _heyApiClient).post< 246 - UpdatePetWithFormResponses, 247 - UpdatePetWithFormErrors, 248 - ThrowOnError 249 - >({ 250 - security: [ 251 - { 252 - scheme: 'bearer', 253 - type: 'http', 254 - }, 255 - ], 256 - url: '/pet/{petId}', 257 - ...options, 258 - }); 259 - } 260 - 261 - /** 262 - * Uploads an image. 263 - * Upload image of the pet. 264 - */ 265 - public static uploadFile<ThrowOnError extends boolean = false>( 266 - options: Options<UploadFileData, ThrowOnError>, 267 - ) { 268 - return (options.client ?? _heyApiClient).post< 269 - UploadFileResponses, 270 - UploadFileErrors, 271 - ThrowOnError 272 - >({ 273 - bodySerializer: null, 274 - security: [ 275 - { 276 - scheme: 'bearer', 277 - type: 'http', 278 - }, 279 - ], 280 - url: '/pet/{petId}/uploadImage', 281 - ...options, 282 - headers: { 283 - 'Content-Type': 'application/octet-stream', 284 - ...options.headers, 226 + /** 227 + * Updates a pet in the store with form data. 228 + * Updates a pet resource based on the form data. 229 + */ 230 + export const updatePetWithForm = <ThrowOnError extends boolean = false>( 231 + options: Options<UpdatePetWithFormData, ThrowOnError>, 232 + ) => 233 + (options.client ?? _heyApiClient).post< 234 + UpdatePetWithFormResponses, 235 + UpdatePetWithFormErrors, 236 + ThrowOnError 237 + >({ 238 + security: [ 239 + { 240 + scheme: 'bearer', 241 + type: 'http', 285 242 }, 286 - }); 287 - } 288 - } 243 + ], 244 + url: '/pet/{petId}', 245 + ...options, 246 + }); 289 247 290 - @Injectable({ 291 - providedIn: 'root', 292 - }) 293 - export class Store { 294 - /** 295 - * Returns pet inventories by status. 296 - * Returns a map of status codes to quantities. 297 - */ 298 - public static getInventory<ThrowOnError extends boolean = false>( 299 - options?: Options<GetInventoryData, ThrowOnError>, 300 - ) { 301 - return (options?.client ?? _heyApiClient).get< 302 - GetInventoryResponses, 303 - GetInventoryErrors, 304 - ThrowOnError 305 - >({ 306 - security: [ 307 - { 308 - name: 'api_key', 309 - type: 'apiKey', 310 - }, 311 - ], 312 - url: '/store/inventory', 313 - ...options, 314 - }); 315 - } 248 + /** 249 + * Uploads an image. 250 + * Upload image of the pet. 251 + */ 252 + export const uploadFile = <ThrowOnError extends boolean = false>( 253 + options: Options<UploadFileData, ThrowOnError>, 254 + ) => 255 + (options.client ?? _heyApiClient).post< 256 + UploadFileResponses, 257 + UploadFileErrors, 258 + ThrowOnError 259 + >({ 260 + bodySerializer: null, 261 + security: [ 262 + { 263 + scheme: 'bearer', 264 + type: 'http', 265 + }, 266 + ], 267 + url: '/pet/{petId}/uploadImage', 268 + ...options, 269 + headers: { 270 + 'Content-Type': 'application/octet-stream', 271 + ...options.headers, 272 + }, 273 + }); 316 274 317 - /** 318 - * Place an order for a pet. 319 - * Place a new order in the store. 320 - */ 321 - public static placeOrder<ThrowOnError extends boolean = false>( 322 - options?: Options<PlaceOrderData, ThrowOnError>, 323 - ) { 324 - return (options?.client ?? _heyApiClient).post< 325 - PlaceOrderResponses, 326 - PlaceOrderErrors, 327 - ThrowOnError 328 - >({ 329 - url: '/store/order', 330 - ...options, 331 - headers: { 332 - 'Content-Type': 'application/json', 333 - ...options?.headers, 275 + /** 276 + * Returns pet inventories by status. 277 + * Returns a map of status codes to quantities. 278 + */ 279 + export const getInventory = <ThrowOnError extends boolean = false>( 280 + options?: Options<GetInventoryData, ThrowOnError>, 281 + ) => 282 + (options?.client ?? _heyApiClient).get< 283 + GetInventoryResponses, 284 + GetInventoryErrors, 285 + ThrowOnError 286 + >({ 287 + security: [ 288 + { 289 + name: 'api_key', 290 + type: 'apiKey', 334 291 }, 335 - }); 336 - } 292 + ], 293 + url: '/store/inventory', 294 + ...options, 295 + }); 337 296 338 - /** 339 - * Delete purchase order by identifier. 340 - * For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API errors. 341 - */ 342 - public static deleteOrder<ThrowOnError extends boolean = false>( 343 - options: Options<DeleteOrderData, ThrowOnError>, 344 - ) { 345 - return (options.client ?? _heyApiClient).delete< 346 - DeleteOrderResponses, 347 - DeleteOrderErrors, 348 - ThrowOnError 349 - >({ 350 - url: '/store/order/{orderId}', 351 - ...options, 352 - }); 353 - } 297 + /** 298 + * Place an order for a pet. 299 + * Place a new order in the store. 300 + */ 301 + export const placeOrder = <ThrowOnError extends boolean = false>( 302 + options?: Options<PlaceOrderData, ThrowOnError>, 303 + ) => 304 + (options?.client ?? _heyApiClient).post< 305 + PlaceOrderResponses, 306 + PlaceOrderErrors, 307 + ThrowOnError 308 + >({ 309 + url: '/store/order', 310 + ...options, 311 + headers: { 312 + 'Content-Type': 'application/json', 313 + ...options?.headers, 314 + }, 315 + }); 354 316 355 - /** 356 - * Find purchase order by ID. 357 - * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. 358 - */ 359 - public static getOrderById<ThrowOnError extends boolean = false>( 360 - options: Options<GetOrderByIdData, ThrowOnError>, 361 - ) { 362 - return (options.client ?? _heyApiClient).get< 363 - GetOrderByIdResponses, 364 - GetOrderByIdErrors, 365 - ThrowOnError 366 - >({ 367 - url: '/store/order/{orderId}', 368 - ...options, 369 - }); 370 - } 371 - } 317 + /** 318 + * Delete purchase order by identifier. 319 + * For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API errors. 320 + */ 321 + export const deleteOrder = <ThrowOnError extends boolean = false>( 322 + options: Options<DeleteOrderData, ThrowOnError>, 323 + ) => 324 + (options.client ?? _heyApiClient).delete< 325 + DeleteOrderResponses, 326 + DeleteOrderErrors, 327 + ThrowOnError 328 + >({ 329 + url: '/store/order/{orderId}', 330 + ...options, 331 + }); 332 + 333 + /** 334 + * Find purchase order by ID. 335 + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. 336 + */ 337 + export const getOrderById = <ThrowOnError extends boolean = false>( 338 + options: Options<GetOrderByIdData, ThrowOnError>, 339 + ) => 340 + (options.client ?? _heyApiClient).get< 341 + GetOrderByIdResponses, 342 + GetOrderByIdErrors, 343 + ThrowOnError 344 + >({ 345 + url: '/store/order/{orderId}', 346 + ...options, 347 + }); 372 348 373 - @Injectable({ 374 - providedIn: 'root', 375 - }) 376 - export class User { 377 - /** 378 - * Create user. 379 - * This can only be done by the logged in user. 380 - */ 381 - public static createUser<ThrowOnError extends boolean = false>( 382 - options?: Options<CreateUserData, ThrowOnError>, 383 - ) { 384 - return (options?.client ?? _heyApiClient).post< 385 - CreateUserResponses, 386 - CreateUserErrors, 387 - ThrowOnError 388 - >({ 389 - url: '/user', 390 - ...options, 391 - headers: { 392 - 'Content-Type': 'application/json', 393 - ...options?.headers, 394 - }, 395 - }); 396 - } 349 + /** 350 + * Create user. 351 + * This can only be done by the logged in user. 352 + */ 353 + export const createUser = <ThrowOnError extends boolean = false>( 354 + options?: Options<CreateUserData, ThrowOnError>, 355 + ) => 356 + (options?.client ?? _heyApiClient).post< 357 + CreateUserResponses, 358 + CreateUserErrors, 359 + ThrowOnError 360 + >({ 361 + url: '/user', 362 + ...options, 363 + headers: { 364 + 'Content-Type': 'application/json', 365 + ...options?.headers, 366 + }, 367 + }); 397 368 398 - /** 399 - * Creates list of users with given input array. 400 - * Creates list of users with given input array. 401 - */ 402 - public static createUsersWithListInput<ThrowOnError extends boolean = false>( 403 - options?: Options<CreateUsersWithListInputData, ThrowOnError>, 404 - ) { 405 - return (options?.client ?? _heyApiClient).post< 406 - CreateUsersWithListInputResponses, 407 - CreateUsersWithListInputErrors, 408 - ThrowOnError 409 - >({ 410 - url: '/user/createWithList', 411 - ...options, 412 - headers: { 413 - 'Content-Type': 'application/json', 414 - ...options?.headers, 415 - }, 416 - }); 417 - } 369 + /** 370 + * Creates list of users with given input array. 371 + * Creates list of users with given input array. 372 + */ 373 + export const createUsersWithListInput = <ThrowOnError extends boolean = false>( 374 + options?: Options<CreateUsersWithListInputData, ThrowOnError>, 375 + ) => 376 + (options?.client ?? _heyApiClient).post< 377 + CreateUsersWithListInputResponses, 378 + CreateUsersWithListInputErrors, 379 + ThrowOnError 380 + >({ 381 + url: '/user/createWithList', 382 + ...options, 383 + headers: { 384 + 'Content-Type': 'application/json', 385 + ...options?.headers, 386 + }, 387 + }); 418 388 419 - /** 420 - * Logs user into the system. 421 - * Log into the system. 422 - */ 423 - public static loginUser<ThrowOnError extends boolean = false>( 424 - options?: Options<LoginUserData, ThrowOnError>, 425 - ) { 426 - return (options?.client ?? _heyApiClient).get< 427 - LoginUserResponses, 428 - LoginUserErrors, 429 - ThrowOnError 430 - >({ 431 - url: '/user/login', 432 - ...options, 433 - }); 434 - } 389 + /** 390 + * Logs user into the system. 391 + * Log into the system. 392 + */ 393 + export const loginUser = <ThrowOnError extends boolean = false>( 394 + options?: Options<LoginUserData, ThrowOnError>, 395 + ) => 396 + (options?.client ?? _heyApiClient).get< 397 + LoginUserResponses, 398 + LoginUserErrors, 399 + ThrowOnError 400 + >({ 401 + url: '/user/login', 402 + ...options, 403 + }); 435 404 436 - /** 437 - * Logs out current logged in user session. 438 - * Log user out of the system. 439 - */ 440 - public static logoutUser<ThrowOnError extends boolean = false>( 441 - options?: Options<LogoutUserData, ThrowOnError>, 442 - ) { 443 - return (options?.client ?? _heyApiClient).get< 444 - LogoutUserResponses, 445 - LogoutUserErrors, 446 - ThrowOnError 447 - >({ 448 - url: '/user/logout', 449 - ...options, 450 - }); 451 - } 405 + /** 406 + * Logs out current logged in user session. 407 + * Log user out of the system. 408 + */ 409 + export const logoutUser = <ThrowOnError extends boolean = false>( 410 + options?: Options<LogoutUserData, ThrowOnError>, 411 + ) => 412 + (options?.client ?? _heyApiClient).get< 413 + LogoutUserResponses, 414 + LogoutUserErrors, 415 + ThrowOnError 416 + >({ 417 + url: '/user/logout', 418 + ...options, 419 + }); 452 420 453 - /** 454 - * Delete user resource. 455 - * This can only be done by the logged in user. 456 - */ 457 - public static deleteUser<ThrowOnError extends boolean = false>( 458 - options: Options<DeleteUserData, ThrowOnError>, 459 - ) { 460 - return (options.client ?? _heyApiClient).delete< 461 - DeleteUserResponses, 462 - DeleteUserErrors, 463 - ThrowOnError 464 - >({ 465 - url: '/user/{username}', 466 - ...options, 467 - }); 468 - } 421 + /** 422 + * Delete user resource. 423 + * This can only be done by the logged in user. 424 + */ 425 + export const deleteUser = <ThrowOnError extends boolean = false>( 426 + options: Options<DeleteUserData, ThrowOnError>, 427 + ) => 428 + (options.client ?? _heyApiClient).delete< 429 + DeleteUserResponses, 430 + DeleteUserErrors, 431 + ThrowOnError 432 + >({ 433 + url: '/user/{username}', 434 + ...options, 435 + }); 469 436 470 - /** 471 - * Get user by user name. 472 - * Get user detail based on username. 473 - */ 474 - public static getUserByName<ThrowOnError extends boolean = false>( 475 - options: Options<GetUserByNameData, ThrowOnError>, 476 - ) { 477 - return (options.client ?? _heyApiClient).get< 478 - GetUserByNameResponses, 479 - GetUserByNameErrors, 480 - ThrowOnError 481 - >({ 482 - url: '/user/{username}', 483 - ...options, 484 - }); 485 - } 437 + /** 438 + * Get user by user name. 439 + * Get user detail based on username. 440 + */ 441 + export const getUserByName = <ThrowOnError extends boolean = false>( 442 + options: Options<GetUserByNameData, ThrowOnError>, 443 + ) => 444 + (options.client ?? _heyApiClient).get< 445 + GetUserByNameResponses, 446 + GetUserByNameErrors, 447 + ThrowOnError 448 + >({ 449 + url: '/user/{username}', 450 + ...options, 451 + }); 486 452 487 - /** 488 - * Update user resource. 489 - * This can only be done by the logged in user. 490 - */ 491 - public static updateUser<ThrowOnError extends boolean = false>( 492 - options: Options<UpdateUserData, ThrowOnError>, 493 - ) { 494 - return (options.client ?? _heyApiClient).put< 495 - UpdateUserResponses, 496 - UpdateUserErrors, 497 - ThrowOnError 498 - >({ 499 - url: '/user/{username}', 500 - ...options, 501 - headers: { 502 - 'Content-Type': 'application/json', 503 - ...options.headers, 504 - }, 505 - }); 506 - } 507 - } 453 + /** 454 + * Update user resource. 455 + * This can only be done by the logged in user. 456 + */ 457 + export const updateUser = <ThrowOnError extends boolean = false>( 458 + options: Options<UpdateUserData, ThrowOnError>, 459 + ) => 460 + (options.client ?? _heyApiClient).put< 461 + UpdateUserResponses, 462 + UpdateUserErrors, 463 + ThrowOnError 464 + >({ 465 + url: '/user/{username}', 466 + ...options, 467 + headers: { 468 + 'Content-Type': 'application/json', 469 + ...options.headers, 470 + }, 471 + });
+6
packages/openapi-ts/src/plugins/@hey-api/angular-resource/config.ts
··· 5 5 export const defaultConfig: HeyApiAngularResourcePlugin['Config'] = { 6 6 config: { 7 7 asClass: false, 8 + classNameBuilder(className) { 9 + return className + 'Resources'; 10 + }, 11 + methodNameBuilder(operation) { 12 + return String(operation.id) + 'Resource'; 13 + }, 8 14 }, 9 15 dependencies: [ 10 16 '@hey-api/client-angular',
+12 -16
packages/openapi-ts/src/plugins/@hey-api/angular-resource/plugin.ts
··· 28 28 }); 29 29 30 30 // Import Angular core decorators 31 - if (sdkPlugin.config.asClass) { 31 + if (plugin.config.asClass) { 32 32 file.import({ 33 33 module: '@angular/core', 34 34 name: 'Injectable', ··· 48 48 name: 'Options', 49 49 }); 50 50 51 - if (sdkPlugin.config.asClass) { 51 + if (plugin.config.asClass) { 52 52 generateAngularClassServices({ file, plugin, sdkPlugin }); 53 53 } else { 54 54 generateAngularFunctionServices({ file, plugin, sdkPlugin }); ··· 113 113 } 114 114 115 115 const currentClass = serviceClasses.get(currentClassName)!; 116 + 117 + // Generate the resource method name 118 + const resourceMethodName = plugin.config.methodNameBuilder!(operation); 116 119 117 120 // Avoid duplicate methods 118 - if (currentClass.methods.has(entry.methodName)) { 121 + if (currentClass.methods.has(resourceMethodName)) { 119 122 return; 120 123 } 121 124 ··· 123 126 const methodNode = generateAngularResourceMethod({ 124 127 file, 125 128 isRequiredOptions, 126 - methodName: entry.methodName, 129 + methodName: resourceMethodName, 127 130 operation, 128 131 plugin, 129 132 sdkPlugin, ··· 135 138 currentClass.nodes.push(tsc.identifier({ text: '\n' }), methodNode); 136 139 } 137 140 138 - currentClass.methods.add(entry.methodName); 141 + currentClass.methods.add(resourceMethodName); 139 142 serviceClasses.set(currentClassName, currentClass); 140 143 }); 141 144 } ··· 158 161 initializer: tsc.newExpression({ 159 162 argumentsArray: [], 160 163 expression: tsc.identifier({ 161 - text: `${childClass.className}Resource`, 164 + text: plugin.config.classNameBuilder!(childClass.className), 162 165 }), 163 166 }), 164 167 name: stringCase({ ··· 182 185 } 183 186 : undefined, 184 187 exportClass: currentClass.root, 185 - name: `${currentClass.className}Resource`, 188 + name: plugin.config.classNameBuilder!(currentClass.className), 186 189 nodes: currentClass.nodes, 187 190 }); 188 191 ··· 210 213 operation, 211 214 }); 212 215 213 - const functionName = serviceFunctionIdentifier({ 214 - config: plugin.context.config, 215 - handleIllegal: true, 216 - id: operation.id, 217 - operation, 218 - }); 219 - 220 216 const node = generateAngularResourceFunction({ 221 217 file, 222 - functionName: `${functionName}Resource`, 218 + functionName: plugin.config.methodNameBuilder!(operation), 223 219 isRequiredOptions, 224 220 operation, 225 221 plugin, ··· 312 308 313 309 sdkFunctionCall = tsc.callExpression({ 314 310 functionName: sdkImport.name, 315 - parameters: [tsc.identifier({ text: 'options' })], 311 + parameters: [tsc.identifier({ text: 'params' })], 316 312 }); 317 313 } 318 314
+7
packages/openapi-ts/src/plugins/@hey-api/angular-resource/types.d.ts
··· 1 + import type { Operation } from '../../../types/client'; 1 2 import type { DefinePlugin, Plugin } from '../../types'; 2 3 3 4 export type UserConfig = Plugin.Name<'@hey-api/angular-resource'> & { ··· 6 7 * @default false 7 8 */ 8 9 asClass?: boolean; 10 + 11 + classNameBuilder?: (className: string) => string; 12 + methodNameBuilder?: (operation: IR.OperationObject | Operation) => string; 9 13 10 14 /** 11 15 * Name of the generated file. ··· 21 25 * @default false 22 26 */ 23 27 asClass: boolean; 28 + 29 + classNameBuilder?: (className: string) => string; 30 + methodNameBuilder?: (operation: IR.OperationObject | Operation) => string; 24 31 25 32 /** 26 33 * Name of the generated file.