@@ -2986,3 +2986,140 @@ export class Client<RequestOption> {
2986
2986
}
2987
2987
"
2988
2988
`;
2989
+
2990
+ exports[`Typedef with template ref-access 1`] = `
2991
+ "//
2992
+ // Generated by @himenon/openapi-typescript-code-generator
2993
+ //
2994
+ // OpenApi : 3.1.0
2995
+ //
2996
+ // License : MIT
2997
+ //
2998
+
2999
+
3000
+ export namespace Schemas {
3001
+ export interface Book {
3002
+ author? : {
3003
+ name? : string ;
3004
+ age? : string ;
3005
+ };
3006
+ publisher? : {
3007
+ name? : any ;
3008
+ address? : string ;
3009
+ };
3010
+ metadata: {
3011
+ description: string ;
3012
+ };
3013
+ }
3014
+ export type Author = {
3015
+ name?: string;
3016
+ age?: string;
3017
+ };
3018
+ export type Publisher = {
3019
+ name?: any;
3020
+ address?: string;
3021
+ };
3022
+ }
3023
+ export interface Parameter$getBook {
3024
+ /** Book ID */
3025
+ id : string ;
3026
+ }
3027
+ export interface Response$getBook$Status$200 {
3028
+ \\" application/json\\ " : Schemas .Book ;
3029
+ }
3030
+ export interface Parameter$getDescription {
3031
+ /** Book ID */
3032
+ id : string ;
3033
+ }
3034
+ export interface Response$getDescription$Status$200 {
3035
+ \\" application/json\\ " : string ;
3036
+ }
3037
+ export interface Parameter$getAuthor {
3038
+ /** Author Id */
3039
+ id : string ;
3040
+ }
3041
+ export interface Response$getAuthor$Status$200 {
3042
+ \\" application/json\\ " : {
3043
+ name?: string;
3044
+ age?: string;
3045
+ };
3046
+ }
3047
+ export interface Parameter$getPublisher {
3048
+ /** Publisher ID */
3049
+ id : string ;
3050
+ }
3051
+ export interface Response$getPublisher$Status$200 {
3052
+ \\" application/json\\ " : Schemas .Publisher ;
3053
+ }
3054
+ export type ResponseContentType$getBook = keyof Response$getBook$Status$200;
3055
+ export interface Params$getBook {
3056
+ parameter : Parameter$getBook ;
3057
+ }
3058
+ export type ResponseContentType$getDescription = keyof Response$getDescription$Status$200;
3059
+ export interface Params$getDescription {
3060
+ parameter : Parameter$getDescription ;
3061
+ }
3062
+ export type ResponseContentType$getAuthor = keyof Response$getAuthor$Status$200;
3063
+ export interface Params$getAuthor {
3064
+ parameter : Parameter$getAuthor ;
3065
+ }
3066
+ export type ResponseContentType$getPublisher = keyof Response$getPublisher$Status$200;
3067
+ export interface Params$getPublisher {
3068
+ parameter : Parameter$getPublisher ;
3069
+ }
3070
+ export type HttpMethod = \\"GET\\" | \\"PUT\\" | \\"POST\\" | \\"DELETE\\" | \\"OPTIONS\\" | \\"HEAD\\" | \\"PATCH\\" | \\"TRACE\\";
3071
+ export interface ObjectLike {
3072
+ [key : string ]: any ;
3073
+ }
3074
+ export interface QueryParameter {
3075
+ value : any ;
3076
+ style ?: \\" form\\ " | \\" spaceDelimited\\ " | \\" pipeDelimited\\ " | \\" deepObject\\ " ;
3077
+ explode : boolean ;
3078
+ }
3079
+ export interface QueryParameters {
3080
+ [key : string ]: QueryParameter ;
3081
+ }
3082
+ export type SuccessResponses = Response$getBook$Status$200 | Response$getDescription$Status$200 | Response$getAuthor$Status$200 | Response$getPublisher$Status$200;
3083
+ export namespace ErrorResponse {
3084
+ export type getBook = void ;
3085
+ export type getDescription = void ;
3086
+ export type getAuthor = void ;
3087
+ export type getPublisher = void ;
3088
+ }
3089
+ export interface ApiClient<RequestOption > {
3090
+ request : <T = SuccessResponses >(httpMethod: HttpMethod, url: string, headers: ObjectLike | any, requestBody: ObjectLike | any, queryParameters: QueryParameters | undefined, options?: RequestOption) => Promise<T >;
3091
+ }
3092
+ export class Client<RequestOption > {
3093
+ private baseUrl : string ;
3094
+ constructor (private apiClient : ApiClient <RequestOption >, baseUrl: string) { this .baseUrl = baseUrl .replace (/ \\\\/ $ / , \\" \\ " ); }
3095
+ public async getBook(params: Params$getBook, option?: RequestOption): Promise<Response$getBook$Status$200[\\"application/json\\"]> {
3096
+ const url = this .baseUrl + \` /get/book/\$ { params .parameter .id } \` ;
3097
+ const headers = {
3098
+ Accept : \\" application/json\\ "
3099
+ } ;
3100
+ return this.apiClient.request(\\ "GET\\ ", url, headers, undefined, undefined, option);
3101
+ }
3102
+ public async getDescription(params: Params$getDescription, option?: RequestOption): Promise<Response$getDescription$Status$200[\\ "application/json\\ "]> {
3103
+ const url = this .baseUrl + \` /get/book/\$ { params .parameter .id } /description\` ;
3104
+ const headers = {
3105
+ Accept : \\" application/json\\ "
3106
+ } ;
3107
+ return this.apiClient.request(\\ "GET\\ ", url, headers, undefined, undefined, option);
3108
+ }
3109
+ public async getAuthor(params: Params$getAuthor, option?: RequestOption): Promise<Response$getAuthor$Status$200[\\ "application/json\\ "]> {
3110
+ const url = this .baseUrl + \` /get/author/\$ { params .parameter .id } \` ;
3111
+ const headers = {
3112
+ Accept : \\" application/json\\ "
3113
+ } ;
3114
+ return this.apiClient.request(\\ "GET\\ ", url, headers, undefined, undefined, option);
3115
+ }
3116
+ public async getPublisher(params: Params$getPublisher, option?: RequestOption): Promise<Response$getPublisher$Status$200[\\ "application/json\\ "]> {
3117
+ const url = this .baseUrl + \` /get/publisher/\$ { params .parameter .id } \` ;
3118
+ const headers = {
3119
+ Accept : \\" application/json\\ "
3120
+ } ;
3121
+ return this.apiClient.request(\\ "GET\\ ", url, headers, undefined, undefined, option);
3122
+ }
3123
+ }
3124
+ "
3125
+ ` ;
0 commit comments