@team-supercharge/oasg 17.1.0 → 18.0.0-temp-chore-fix-tanstack-query-version.2eaaff54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +260 -47
- package/bin/oasg +23 -4
- package/bin/save-lock.js +101 -0
- package/bin/target-version.js +84 -0
- package/config.schema.yml +15 -0
- package/package.json +1 -1
- package/targets/android/generate.sh +2 -2
- package/targets/android/generator-config.json +2 -1
- package/targets/android/publish.sh +1 -1
- package/targets/android/templates/build.gradle.mustache +63 -46
- package/targets/angular/generate.sh +35 -9
- package/targets/angular/publish.sh +1 -1
- package/targets/apple-swift/generate.sh +1 -1
- package/targets/apple-swift/publish.sh +1 -1
- package/targets/common.sh +3 -1
- package/targets/contract-testing/generate.sh +1 -1
- package/targets/contract-testing/publish.sh +1 -1
- package/targets/dependency-lock-utils.sh +290 -0
- package/targets/feign/generate.sh +1 -1
- package/targets/feign/publish.sh +1 -1
- package/targets/feign-kotlin/generate.sh +1 -1
- package/targets/feign-kotlin/publish.sh +1 -1
- package/targets/flutter/generate.sh +1 -1
- package/targets/flutter/publish.sh +1 -1
- package/targets/ios/generate.sh +1 -1
- package/targets/ios/publish.sh +1 -1
- package/targets/kmp/generate.sh +1 -1
- package/targets/kmp/publish.sh +1 -1
- package/targets/kmp/templates/build.gradle.kts.mustache +17 -13
- package/targets/kmp/templates/libraries/multiplatform/api.mustache +2 -0
- package/targets/msw/generate.sh +25 -0
- package/targets/msw/generator-config.json +28 -0
- package/targets/msw/templates/apis.index.mustache +9 -0
- package/targets/msw/templates/apis.mustache +178 -0
- package/targets/msw/templates/config.mustache +23 -0
- package/targets/msw/templates/index.mustache +11 -0
- package/targets/msw/templates/modelEnum.mustache +1 -0
- package/targets/msw/templates/modelGeneric.mustache +7 -0
- package/targets/msw/templates/package.mustache +35 -0
- package/targets/msw/templates/prettierrc.mustache +6 -0
- package/targets/msw/templates/tsconfig.mustache +18 -0
- package/targets/msw/templates/utils.mustache +15 -0
- package/targets/nestjs/generate.sh +36 -4
- package/targets/nestjs/publish.sh +1 -1
- package/targets/nestjs/templates/api.service.mustache +8 -14
- package/targets/plain-java/generate.sh +1 -1
- package/targets/plain-java/publish.sh +1 -1
- package/targets/python/generate.sh +1 -1
- package/targets/python/publish.sh +1 -1
- package/targets/python-fastapi/generate.sh +1 -1
- package/targets/python-fastapi/publish.sh +1 -1
- package/targets/python-fastapi-raw-request/generate.sh +1 -1
- package/targets/python-fastapi-raw-request/publish.sh +1 -1
- package/targets/python-legacy/generate.sh +1 -1
- package/targets/python-legacy/publish.sh +1 -1
- package/targets/react/generate.sh +17 -5
- package/targets/react/publish.sh +1 -1
- package/targets/react/templates/hook.mustache +172 -51
- package/targets/react/templates/package.mustache +1 -1
- package/targets/react/templates/use-api.hook.mustache +2 -0
- package/targets/spring/generate.sh +1 -1
- package/targets/spring/publish.sh +1 -1
- package/targets/spring-kotlin/generate.sh +1 -1
- package/targets/spring-kotlin/publish.sh +1 -1
- package/targets/stubby/generate.sh +1 -1
- package/targets/stubby/publish.sh +1 -1
- package/targets/typescript-axios/generate.sh +16 -5
- package/targets/typescript-axios/publish.sh +1 -1
- package/targets/typescript-fetch/generate.sh +17 -5
- package/targets/typescript-fetch/publish.sh +1 -1
- package/targets/android/templates/libraries/jvm-retrofit2/api.mustache +0 -157
- package/targets/android/templates/libraries/jvm-retrofit2/infrastructure/ApiClient.kt.mustache +0 -354
package/targets/react/publish.sh
CHANGED
|
@@ -2,8 +2,23 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
{{>licenseInfo}}
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
useMutation,
|
|
7
|
+
useQuery,
|
|
8
|
+
useSuspenseQuery,
|
|
9
|
+
type UseMutationOptions,
|
|
10
|
+
type UseMutationResult,
|
|
11
|
+
type UseQueryOptions,
|
|
12
|
+
type UseQueryResult,
|
|
13
|
+
type DefaultError,
|
|
14
|
+
type DefinedInitialDataOptions,
|
|
15
|
+
type UndefinedInitialDataOptions,
|
|
16
|
+
type DefinedUseQueryResult,
|
|
17
|
+
type NoInfer,
|
|
18
|
+
type UseSuspenseQueryOptions,
|
|
19
|
+
type UseSuspenseQueryResult,
|
|
20
|
+
} from '@tanstack/react-query';
|
|
21
|
+
import { useApi, HEADERS } from './use-api.hook';
|
|
7
22
|
{{#imports.0}}
|
|
8
23
|
import type {
|
|
9
24
|
{{#imports}}
|
|
@@ -25,15 +40,15 @@ import {
|
|
|
25
40
|
{{#operations}}
|
|
26
41
|
{{#operation}}
|
|
27
42
|
|
|
28
|
-
export type {{classname}}{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}
|
|
29
|
-
{{^
|
|
30
|
-
{ parameters: Parameters<{{classname}}['{{nickname}}']>};
|
|
31
|
-
{{/useSingleRequestParameter}}
|
|
32
|
-
{{#useSingleRequestParameter}}
|
|
33
|
-
{{#allParams.0}}{{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request{{/allParams.0}}{{^allParams.0}}void{{/allParams.0}};
|
|
34
|
-
{{/useSingleRequestParameter}}
|
|
43
|
+
export type {{classname}}{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Params =
|
|
44
|
+
{{#allParams.0}}{{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request{{/allParams.0}}{{^allParams.0}}void{{/allParams.0}} & { [HEADERS]?: Record<string, string> };
|
|
35
45
|
|
|
36
46
|
/**
|
|
47
|
+
* `{{httpMethod}} {{path}}`
|
|
48
|
+
*
|
|
49
|
+
{{#description}}
|
|
50
|
+
* {{&description}}
|
|
51
|
+
{{/description}}
|
|
37
52
|
{{#notes}}
|
|
38
53
|
* {{¬es}}
|
|
39
54
|
{{/notes}}
|
|
@@ -44,26 +59,101 @@ export type {{classname}}{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}P
|
|
|
44
59
|
* @deprecated
|
|
45
60
|
{{/isDeprecated}}
|
|
46
61
|
*/
|
|
47
|
-
export
|
|
48
|
-
|
|
49
|
-
|
|
62
|
+
export function use{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Mutation<TError = DefaultError, TContext = unknown>(
|
|
63
|
+
{{!
|
|
64
|
+
TanStack React Query expects you to pass an options object to useMutation,
|
|
65
|
+
but we make it optional, because most of the time the only thing you need
|
|
66
|
+
is a `mutationFn` which is defined for all the mutation here by default.
|
|
67
|
+
}}
|
|
68
|
+
{ [HEADERS]: optionsHeaders, ...options }: Omit<UseMutationOptions<{{{returnType}}}{{^returnType}}void{{/returnType}}, TError, {{classname}}{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Params, TContext>, 'mutationFn'> & { [HEADERS]?: Record<string, string> } = {},
|
|
69
|
+
): UseMutationResult<{{{returnType}}}{{^returnType}}void{{/returnType}}, TError, {{classname}}{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Params, TContext> {
|
|
50
70
|
const api = useApi({{classname}});
|
|
51
|
-
|
|
52
|
-
{{^
|
|
53
|
-
|
|
54
|
-
{{
|
|
55
|
-
{{
|
|
56
|
-
{{
|
|
57
|
-
mutationFn: (parameters) => api.{{nickname}}(parameters),
|
|
58
|
-
{{/allParams.0}}
|
|
59
|
-
{{^allParams.0}}
|
|
71
|
+
|
|
72
|
+
return useMutation<{{{returnType}}}{{^returnType}}void{{/returnType}}, TError, {{classname}}{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Params, TContext>({
|
|
73
|
+
{{#allParams.0}}
|
|
74
|
+
mutationFn: ({ [HEADERS]: headers, ...params }) => api.{{nickname}}(params, { headers: { ...optionsHeaders, ...headers } }),
|
|
75
|
+
{{/allParams.0}}
|
|
76
|
+
{{^allParams.0}}
|
|
60
77
|
mutationFn: () => api.{{nickname}}(),
|
|
61
|
-
{{/allParams.0}}
|
|
62
|
-
{{/useSingleRequestParameter}}
|
|
78
|
+
{{/allParams.0}}
|
|
63
79
|
...options,
|
|
64
80
|
});
|
|
65
81
|
}
|
|
82
|
+
|
|
83
|
+
{{!
|
|
84
|
+
We would like to make it easier for our users to use our hooks,
|
|
85
|
+
so we provide them built-in query keys. For this we export this object
|
|
86
|
+
that provides a type-safe way to invalidate or refetch queries by their auto-generated query keys.
|
|
87
|
+
|
|
88
|
+
An example for invalidation would be:
|
|
89
|
+
```
|
|
90
|
+
queryClient.invalidateQueries({ queryKey: getUsersQueryKey.params({ status: 'active' })});
|
|
91
|
+
// or
|
|
92
|
+
queryClient.invalidateQueries({ querykey: getUsersQueryKey.all() });
|
|
93
|
+
```
|
|
94
|
+
}}
|
|
95
|
+
export const {{#lambda.camelcase}}{{nickname}}{{/lambda.camelcase}}QueryKey = {
|
|
96
|
+
all: (headers?: Record<string, string>) => headers
|
|
97
|
+
? ['{{#lambda.camelcase}}{{nickname}}{{/lambda.camelcase}}', headers] as const
|
|
98
|
+
: ['{{#lambda.camelcase}}{{nickname}}{{/lambda.camelcase}}'] as const,
|
|
99
|
+
{{#allParams.0}}
|
|
100
|
+
withParams: (params: {{classname}}{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Params, headers?: Record<string, string>) => [
|
|
101
|
+
'{{#lambda.camelcase}}{{nickname}}{{/lambda.camelcase}}',
|
|
102
|
+
params,
|
|
103
|
+
headers,
|
|
104
|
+
] as const,
|
|
105
|
+
{{/allParams.0}}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
{{!
|
|
109
|
+
TanStack React Query provides multiple overrides for useQuery,
|
|
110
|
+
we want to keep the same options for our users.
|
|
111
|
+
These are the things we do here as an extra:
|
|
112
|
+
1. Provide a default first generic parameter (called `TQueryFnData` originally)
|
|
113
|
+
because we know that is the result of the underlaying API call. Users can still
|
|
114
|
+
override the result of the actual query by providing `TData`, or a `select` function in the options object.
|
|
115
|
+
2. Omit `queryFn` from the options object as we provide it automatically.
|
|
116
|
+
3. Add an extra `params` parameter, which contains all the data that is required to make the API call.
|
|
117
|
+
This parameter is also automatically part of the default `queryKey` we provide.
|
|
118
|
+
4. Provide a default `queryKey` in the options object.
|
|
119
|
+
5. Make `options`optional as both `queryFn` and `queryKey` are handled automatically.
|
|
120
|
+
}}
|
|
121
|
+
export function use{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Query<
|
|
122
|
+
TError = DefaultError,
|
|
123
|
+
TData = {{{returnType}}}{{^returnType}}void{{/returnType}},
|
|
124
|
+
>(
|
|
125
|
+
{{#allParams.0}}
|
|
126
|
+
params?: {{classname}}{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Params,
|
|
127
|
+
{{/allParams.0}}
|
|
128
|
+
options?: Omit<DefinedInitialDataOptions<{{{returnType}}}{{^returnType}}void{{/returnType}}, TError, TData>, 'queryFn' | 'queryKey'> & { [HEADERS]?: Record<string, string> },
|
|
129
|
+
): DefinedUseQueryResult<NoInfer<TData>, TError>;
|
|
130
|
+
|
|
131
|
+
export function use{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Query<
|
|
132
|
+
TError = DefaultError,
|
|
133
|
+
TData = {{{returnType}}}{{^returnType}}void{{/returnType}},
|
|
134
|
+
>(
|
|
135
|
+
{{#allParams.0}}
|
|
136
|
+
params?: {{classname}}{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Params,
|
|
137
|
+
{{/allParams.0}}
|
|
138
|
+
options?: Omit<UndefinedInitialDataOptions<{{{returnType}}}{{^returnType}}void{{/returnType}}, TError, TData>, 'queryFn' | 'queryKey'> & { [HEADERS]?: Record<string, string> },
|
|
139
|
+
): UseQueryResult<NoInfer<TData>, TError>;
|
|
140
|
+
|
|
141
|
+
export function use{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Query<
|
|
142
|
+
TError = DefaultError,
|
|
143
|
+
TData = {{{returnType}}}{{^returnType}}void{{/returnType}},
|
|
144
|
+
>(
|
|
145
|
+
{{#allParams.0}}
|
|
146
|
+
params?: {{classname}}{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Params,
|
|
147
|
+
{{/allParams.0}}
|
|
148
|
+
options?: Omit<UseQueryOptions<{{{returnType}}}{{^returnType}}void{{/returnType}}, TError, TData>, 'queryFn' | 'queryKey'> & { [HEADERS]?: Record<string, string> },
|
|
149
|
+
): UseQueryResult<NoInfer<TData>, TError>;
|
|
150
|
+
|
|
66
151
|
/**
|
|
152
|
+
* `{{httpMethod}} {{path}}`
|
|
153
|
+
*
|
|
154
|
+
{{#description}}
|
|
155
|
+
* {{&description}}
|
|
156
|
+
{{/description}}
|
|
67
157
|
{{#notes}}
|
|
68
158
|
* {{¬es}}
|
|
69
159
|
{{/notes}}
|
|
@@ -74,38 +164,69 @@ export const use{{classname}}{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecas
|
|
|
74
164
|
* @deprecated
|
|
75
165
|
{{/isDeprecated}}
|
|
76
166
|
*/
|
|
77
|
-
export
|
|
78
|
-
|
|
79
|
-
{{
|
|
80
|
-
|
|
81
|
-
{{
|
|
82
|
-
{
|
|
83
|
-
{{#allParams.0}}
|
|
84
|
-
,parameter: {{classname}}{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Parameters | undefined
|
|
85
|
-
{{/allParams.0}}
|
|
86
|
-
{{/useSingleRequestParameter}}
|
|
87
|
-
): UseQueryResult<{{{returnType}}}{{^returnType}}void{{/returnType}}> => {
|
|
167
|
+
export function use{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Query(
|
|
168
|
+
{{#allParams.0}}
|
|
169
|
+
params: {{classname}}{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Params | undefined = undefined,
|
|
170
|
+
{{/allParams.0}}
|
|
171
|
+
{ [HEADERS]: headers, enabled = true, ...options}: Omit<UseQueryOptions, 'queryFn' | 'queryKey'> & { [HEADERS]?: Record<string, string> } = {},
|
|
172
|
+
): UseQueryResult {
|
|
88
173
|
const api = useApi({{classname}});
|
|
89
|
-
|
|
90
|
-
{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
{{
|
|
96
|
-
{{
|
|
97
|
-
queryKey:
|
|
98
|
-
queryFn: ({ signal }) => api.{{nickname}}(
|
|
99
|
-
enabled
|
|
100
|
-
{{/allParams.0}}
|
|
101
|
-
{{^allParams.0}}
|
|
102
|
-
queryKey: ['{{classname}}','{{nickname}}'],
|
|
103
|
-
queryFn: ({ signal }) => api.{{nickname}}({ signal }),
|
|
104
|
-
{{/allParams.0}}
|
|
105
|
-
{{/useSingleRequestParameter}}
|
|
174
|
+
|
|
175
|
+
return useQuery({
|
|
176
|
+
{{#allParams.0}}
|
|
177
|
+
queryKey: {{#lambda.camelcase}}{{nickname}}{{/lambda.camelcase}}QueryKey.withParams(params, headers),
|
|
178
|
+
queryFn: ({ signal }) => api.{{nickname}}(params, { signal, headers }),
|
|
179
|
+
enabled: typeof params !== 'undefined' && enabled,
|
|
180
|
+
{{/allParams.0}}
|
|
181
|
+
{{^allParams.0}}
|
|
182
|
+
queryKey: {{#lambda.camelcase}}{{nickname}}{{/lambda.camelcase}}QueryKey.all(headers),
|
|
183
|
+
queryFn: ({ signal }) => api.{{nickname}}({ signal, headers }),
|
|
184
|
+
enabled,
|
|
185
|
+
{{/allParams.0}}
|
|
106
186
|
...options,
|
|
107
187
|
});
|
|
108
188
|
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* `{{httpMethod}} {{path}}`
|
|
192
|
+
*
|
|
193
|
+
{{#description}}
|
|
194
|
+
* {{&description}}
|
|
195
|
+
{{/description}}
|
|
196
|
+
{{#notes}}
|
|
197
|
+
* {{¬es}}
|
|
198
|
+
{{/notes}}
|
|
199
|
+
{{#summary}}
|
|
200
|
+
* {{&summary}}
|
|
201
|
+
{{/summary}}
|
|
202
|
+
{{#isDeprecated}}
|
|
203
|
+
* @deprecated
|
|
204
|
+
{{/isDeprecated}}
|
|
205
|
+
*/
|
|
206
|
+
export function use{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}SuspenseQuery<
|
|
207
|
+
TError = DefaultError,
|
|
208
|
+
TData = {{{returnType}}}{{^returnType}}void{{/returnType}},
|
|
209
|
+
>(
|
|
210
|
+
{{#allParams.0}}
|
|
211
|
+
params: {{classname}}{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Params,
|
|
212
|
+
{{/allParams.0}}
|
|
213
|
+
{ [HEADERS]: headers, ...options}: Omit<UseSuspenseQueryOptions<{{{returnType}}}{{^returnType}}void{{/returnType}}, TError, TData>, 'queryFn' | 'queryKey'> & { [HEADERS]?: Record<string, string> } = {}
|
|
214
|
+
): UseSuspenseQueryResult<TData, TError> {
|
|
215
|
+
const api = useApi({{classname}});
|
|
216
|
+
|
|
217
|
+
return useSuspenseQuery({
|
|
218
|
+
{{#allParams.0}}
|
|
219
|
+
queryKey: {{#lambda.camelcase}}{{nickname}}{{/lambda.camelcase}}QueryKey.withParams(params, headers),
|
|
220
|
+
queryFn: ({ signal }) => api.{{nickname}}(params, { signal, headers }),
|
|
221
|
+
{{/allParams.0}}
|
|
222
|
+
{{^allParams.0}}
|
|
223
|
+
queryKey: {{#lambda.camelcase}}{{nickname}}{{/lambda.camelcase}}QueryKey.all(headers),
|
|
224
|
+
queryFn: ({ signal }) => api.{{nickname}}({ signal, headers }),
|
|
225
|
+
{{/allParams.0}}
|
|
226
|
+
...options,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
109
230
|
{{/operation}}
|
|
110
231
|
|
|
111
232
|
{{/operations}}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
#!/bin/bash
|
|
2
2
|
|
|
3
3
|
source $(dirname "$0")/../common.sh
|
|
4
|
+
source $(dirname "$0")/../dependency-lock-utils.sh
|
|
4
5
|
|
|
5
6
|
rm -rf out/$targetId
|
|
6
7
|
mkdir -p out/$targetId
|
|
@@ -13,8 +14,18 @@ java -jar $binary generate \
|
|
|
13
14
|
-c $(dirname "$0")/generator-config.json \
|
|
14
15
|
-p "npmVersion=$version,npmName=$packageName,npmRepository=$repository" $generatorCustomArgs
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
# No framework version for typescript-axios target
|
|
18
|
+
framework_version=""
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
# Use dependency locking mechanism for build
|
|
21
|
+
echo "Building typescript-axios target with dependency locking support..."
|
|
22
|
+
|
|
23
|
+
install_cmd="npm install"
|
|
24
|
+
build_cmd="npm run build"
|
|
25
|
+
|
|
26
|
+
if build_with_dependency_locking "$targetId" "$framework_version" "out/$targetId" "$install_cmd" "$build_cmd" "$forceLock"; then
|
|
27
|
+
echo "typescript-axios target generation completed successfully!"
|
|
28
|
+
else
|
|
29
|
+
echo "typescript-axios target generation failed!"
|
|
30
|
+
exit 1
|
|
31
|
+
fi
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
#!/bin/bash
|
|
2
2
|
|
|
3
3
|
source $(dirname "$0")/../common.sh
|
|
4
|
+
source $(dirname "$0")/../dependency-lock-utils.sh
|
|
4
5
|
|
|
5
6
|
rm -rf out/$targetId
|
|
6
7
|
mkdir -p out/$targetId
|
|
@@ -13,7 +14,18 @@ java -jar $binary generate \
|
|
|
13
14
|
-c $(dirname "$0")/generator-config.json \
|
|
14
15
|
-p "npmVersion=$version,npmName=$packageName,npmRepository=$repository" $generatorCustomArgs
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
# No framework version for typescript-fetch target
|
|
18
|
+
framework_version=""
|
|
19
|
+
|
|
20
|
+
# Use dependency locking mechanism for build
|
|
21
|
+
echo "Building typescript-fetch target with dependency locking support..."
|
|
22
|
+
|
|
23
|
+
install_cmd="npm install"
|
|
24
|
+
build_cmd="npm run build"
|
|
25
|
+
|
|
26
|
+
if build_with_dependency_locking "$targetId" "$framework_version" "out/$targetId" "$install_cmd" "$build_cmd" "$forceLock"; then
|
|
27
|
+
echo "typescript-fetch target generation completed successfully!"
|
|
28
|
+
else
|
|
29
|
+
echo "typescript-fetch target generation failed!"
|
|
30
|
+
exit 1
|
|
31
|
+
fi
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
package {{apiPackage}}
|
|
2
|
-
|
|
3
|
-
import {{packageName}}.infrastructure.CollectionFormats.*
|
|
4
|
-
import retrofit2.http.*
|
|
5
|
-
{{#doNotUseRxAndCoroutines}}
|
|
6
|
-
import retrofit2.Call
|
|
7
|
-
{{/doNotUseRxAndCoroutines}}
|
|
8
|
-
{{^doNotUseRxAndCoroutines}}
|
|
9
|
-
{{#useCoroutines}}
|
|
10
|
-
import retrofit2.Response
|
|
11
|
-
{{/useCoroutines}}
|
|
12
|
-
{{/doNotUseRxAndCoroutines}}
|
|
13
|
-
import okhttp3.RequestBody
|
|
14
|
-
{{#isResponseFile}}
|
|
15
|
-
import okhttp3.ResponseBody
|
|
16
|
-
{{/isResponseFile}}
|
|
17
|
-
{{#isMultipart}}
|
|
18
|
-
import okhttp3.MultipartBody
|
|
19
|
-
{{/isMultipart}}
|
|
20
|
-
{{^doNotUseRxAndCoroutines}}
|
|
21
|
-
{{#useRxJava}}
|
|
22
|
-
import rx.Observable
|
|
23
|
-
{{/useRxJava}}
|
|
24
|
-
{{#useRxJava2}}
|
|
25
|
-
import io.reactivex.Single
|
|
26
|
-
{{/useRxJava2}}
|
|
27
|
-
{{#useRxJava3}}
|
|
28
|
-
import io.reactivex.rxjava3.core.Single
|
|
29
|
-
{{/useRxJava3}}
|
|
30
|
-
{{^returnType}}
|
|
31
|
-
{{#useRxJava2}}
|
|
32
|
-
import io.reactivex.Completable
|
|
33
|
-
{{/useRxJava2}}
|
|
34
|
-
{{#useRxJava3}}
|
|
35
|
-
import io.reactivex.rxjava3.core.Completable
|
|
36
|
-
{{/useRxJava3}}
|
|
37
|
-
{{/returnType}}
|
|
38
|
-
{{/doNotUseRxAndCoroutines}}
|
|
39
|
-
{{^multiplatform}}
|
|
40
|
-
{{#gson}}
|
|
41
|
-
import com.google.gson.annotations.SerializedName
|
|
42
|
-
{{/gson}}
|
|
43
|
-
{{#moshi}}
|
|
44
|
-
import com.squareup.moshi.Json
|
|
45
|
-
{{/moshi}}
|
|
46
|
-
{{#jackson}}
|
|
47
|
-
import com.fasterxml.jackson.annotation.JsonProperty
|
|
48
|
-
{{/jackson}}
|
|
49
|
-
{{#kotlinx_serialization}}
|
|
50
|
-
import kotlinx.serialization.SerialName
|
|
51
|
-
import kotlinx.serialization.Serializable
|
|
52
|
-
{{/kotlinx_serialization}}
|
|
53
|
-
{{/multiplatform}}
|
|
54
|
-
{{#multiplatform}}
|
|
55
|
-
import kotlinx.serialization.*
|
|
56
|
-
{{/multiplatform}}
|
|
57
|
-
|
|
58
|
-
{{#imports}}import {{import}}
|
|
59
|
-
{{/imports}}
|
|
60
|
-
|
|
61
|
-
{{#operations}}
|
|
62
|
-
{{#x-kotlin-multipart-import}}
|
|
63
|
-
{{^isMultipart}}
|
|
64
|
-
import okhttp3.MultipartBody
|
|
65
|
-
|
|
66
|
-
{{/isMultipart}}
|
|
67
|
-
{{/x-kotlin-multipart-import}}
|
|
68
|
-
interface {{classname}} {
|
|
69
|
-
{{#operation}}
|
|
70
|
-
{{#allParams}}
|
|
71
|
-
{{#isEnum}}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* enum for parameter {{paramName}}
|
|
75
|
-
*/
|
|
76
|
-
{{#nonPublicApi}}internal {{/nonPublicApi}}enum class {{enumName}}{{operationIdCamelCase}}(val value: {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}kotlin.String{{/isContainer}}) {
|
|
77
|
-
{{^enumUnknownDefaultCase}}
|
|
78
|
-
{{#allowableValues}}
|
|
79
|
-
{{#enumVars}}
|
|
80
|
-
{{^multiplatform}}
|
|
81
|
-
{{#moshi}}
|
|
82
|
-
@Json(name = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}
|
|
83
|
-
{{/moshi}}
|
|
84
|
-
{{#gson}}
|
|
85
|
-
@SerializedName(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}
|
|
86
|
-
{{/gson}}
|
|
87
|
-
{{#jackson}}
|
|
88
|
-
@JsonProperty(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}
|
|
89
|
-
{{/jackson}}
|
|
90
|
-
{{#kotlinx_serialization}}
|
|
91
|
-
@SerialName(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}
|
|
92
|
-
{{/kotlinx_serialization}}
|
|
93
|
-
{{/multiplatform}}
|
|
94
|
-
{{#multiplatform}}
|
|
95
|
-
@SerialName(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}){{^-last}},{{/-last}}
|
|
96
|
-
{{/multiplatform}}
|
|
97
|
-
{{/enumVars}}
|
|
98
|
-
{{/allowableValues}}
|
|
99
|
-
{{/enumUnknownDefaultCase}}
|
|
100
|
-
{{#enumUnknownDefaultCase}}
|
|
101
|
-
{{#allowableValues}}
|
|
102
|
-
{{#enumVars}}
|
|
103
|
-
{{^-last}}
|
|
104
|
-
{{^multiplatform}}
|
|
105
|
-
{{#moshi}}
|
|
106
|
-
@Json(name = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}),
|
|
107
|
-
{{/moshi}}
|
|
108
|
-
{{#gson}}
|
|
109
|
-
@SerializedName(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}),
|
|
110
|
-
{{/gson}}
|
|
111
|
-
{{#jackson}}
|
|
112
|
-
@JsonProperty(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}),
|
|
113
|
-
{{/jackson}}
|
|
114
|
-
{{#kotlinx_serialization}}
|
|
115
|
-
@SerialName(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}),
|
|
116
|
-
{{/kotlinx_serialization}}
|
|
117
|
-
{{/multiplatform}}
|
|
118
|
-
{{#multiplatform}}
|
|
119
|
-
@SerialName(value = {{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{&name}}({{{value}}}),
|
|
120
|
-
{{/multiplatform}}
|
|
121
|
-
{{/-last}}
|
|
122
|
-
{{/enumVars}}
|
|
123
|
-
{{/allowableValues}}
|
|
124
|
-
{{/enumUnknownDefaultCase}}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
{{/isEnum}}
|
|
128
|
-
{{/allParams}}
|
|
129
|
-
/**
|
|
130
|
-
* {{summary}}
|
|
131
|
-
* {{notes}}
|
|
132
|
-
* Responses:{{#responses}}
|
|
133
|
-
* - {{code}}: {{{message}}}{{/responses}}
|
|
134
|
-
*{{>paramJavadoc}}
|
|
135
|
-
* @return {{^useCoroutines}}[Call]<{{/useCoroutines}}{{#isResponseFile}}[ResponseBody]{{/isResponseFile}}{{^isResponseFile}}{{#returnType}}[{{{.}}}]{{/returnType}}{{^returnType}}[Unit]{{/returnType}}{{/isResponseFile}}{{^useCoroutines}}>{{/useCoroutines}}
|
|
136
|
-
*/
|
|
137
|
-
{{#isDeprecated}}
|
|
138
|
-
@Deprecated("This api was deprecated")
|
|
139
|
-
{{/isDeprecated}}
|
|
140
|
-
{{#formParams}}
|
|
141
|
-
{{#-first}}
|
|
142
|
-
{{#isMultipart}}@Multipart{{/isMultipart}}{{^isMultipart}}@FormUrlEncoded{{/isMultipart}}
|
|
143
|
-
{{/-first}}
|
|
144
|
-
{{/formParams}}
|
|
145
|
-
{{^formParams}}
|
|
146
|
-
{{#prioritizedContentTypes}}
|
|
147
|
-
{{#-first}}
|
|
148
|
-
@Headers("Content-Type:{{{mediaType}}}")
|
|
149
|
-
{{/-first}}
|
|
150
|
-
{{/prioritizedContentTypes}}
|
|
151
|
-
{{/formParams}}
|
|
152
|
-
@{{httpMethod}}("{{{path}}}")
|
|
153
|
-
{{^doNotUseRxAndCoroutines}}{{#useCoroutines}}suspend {{/useCoroutines}}{{/doNotUseRxAndCoroutines}}fun {{operationId}}({{^allParams}}){{/allParams}}{{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}}, {{/-last}}{{#-last}}){{/-last}}{{/allParams}}: {{^doNotUseRxAndCoroutines}}{{#useRxJava}}Observable<{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{^returnType}}Unit{{/returnType}}{{/isResponseFile}}>{{/useRxJava}}{{#useRxJava2}}{{#returnType}}Single<{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}>{{/returnType}}{{^returnType}}Completable{{/returnType}}{{/useRxJava2}}{{#useRxJava3}}{{#returnType}}Single<{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{/isResponseFile}}>{{/returnType}}{{^returnType}}Completable{{/returnType}}{{/useRxJava3}}{{#useCoroutines}}{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{^returnType}}Unit{{/returnType}}{{/isResponseFile}}{{/useCoroutines}}{{/doNotUseRxAndCoroutines}}{{#doNotUseRxAndCoroutines}}Call<{{#isResponseFile}}ResponseBody{{/isResponseFile}}{{^isResponseFile}}{{{returnType}}}{{^returnType}}Unit{{/returnType}}{{/isResponseFile}}>{{/doNotUseRxAndCoroutines}}
|
|
154
|
-
|
|
155
|
-
{{/operation}}
|
|
156
|
-
}
|
|
157
|
-
{{/operations}}
|