@redhat-ecosystem-engineering/petstore-client-test 0.0.1

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.
Files changed (81) hide show
  1. package/.openapi-generator/FILES +29 -0
  2. package/.openapi-generator/VERSION +1 -0
  3. package/.openapi-generator-ignore +23 -0
  4. package/README.md +156 -0
  5. package/dist/apis/PetApi.d.ts +354 -0
  6. package/dist/apis/PetApi.js +423 -0
  7. package/dist/apis/StoreApi.d.ts +181 -0
  8. package/dist/apis/StoreApi.js +193 -0
  9. package/dist/apis/UserApi.d.ts +293 -0
  10. package/dist/apis/UserApi.js +318 -0
  11. package/dist/apis/index.d.ts +3 -0
  12. package/dist/apis/index.js +21 -0
  13. package/dist/esm/apis/PetApi.d.ts +354 -0
  14. package/dist/esm/apis/PetApi.js +419 -0
  15. package/dist/esm/apis/StoreApi.d.ts +181 -0
  16. package/dist/esm/apis/StoreApi.js +189 -0
  17. package/dist/esm/apis/UserApi.d.ts +293 -0
  18. package/dist/esm/apis/UserApi.js +314 -0
  19. package/dist/esm/apis/index.d.ts +3 -0
  20. package/dist/esm/apis/index.js +5 -0
  21. package/dist/esm/index.d.ts +3 -0
  22. package/dist/esm/index.js +5 -0
  23. package/dist/esm/models/Category.d.ts +38 -0
  24. package/dist/esm/models/Category.js +43 -0
  25. package/dist/esm/models/ModelApiResponse.d.ts +44 -0
  26. package/dist/esm/models/ModelApiResponse.js +45 -0
  27. package/dist/esm/models/Order.d.ts +71 -0
  28. package/dist/esm/models/Order.js +59 -0
  29. package/dist/esm/models/Pet.d.ts +73 -0
  30. package/dist/esm/models/Pet.js +65 -0
  31. package/dist/esm/models/Tag.d.ts +38 -0
  32. package/dist/esm/models/Tag.js +43 -0
  33. package/dist/esm/models/User.d.ts +74 -0
  34. package/dist/esm/models/User.js +55 -0
  35. package/dist/esm/models/index.d.ts +6 -0
  36. package/dist/esm/models/index.js +8 -0
  37. package/dist/esm/runtime.d.ts +184 -0
  38. package/dist/esm/runtime.js +334 -0
  39. package/dist/index.d.ts +3 -0
  40. package/dist/index.js +21 -0
  41. package/dist/models/Category.d.ts +38 -0
  42. package/dist/models/Category.js +50 -0
  43. package/dist/models/ModelApiResponse.d.ts +44 -0
  44. package/dist/models/ModelApiResponse.js +52 -0
  45. package/dist/models/Order.d.ts +71 -0
  46. package/dist/models/Order.js +67 -0
  47. package/dist/models/Pet.d.ts +73 -0
  48. package/dist/models/Pet.js +73 -0
  49. package/dist/models/Tag.d.ts +38 -0
  50. package/dist/models/Tag.js +50 -0
  51. package/dist/models/User.d.ts +74 -0
  52. package/dist/models/User.js +62 -0
  53. package/dist/models/index.d.ts +6 -0
  54. package/dist/models/index.js +24 -0
  55. package/dist/runtime.d.ts +184 -0
  56. package/dist/runtime.js +350 -0
  57. package/docs/Category.md +36 -0
  58. package/docs/ModelApiResponse.md +38 -0
  59. package/docs/Order.md +44 -0
  60. package/docs/Pet.md +44 -0
  61. package/docs/PetApi.md +622 -0
  62. package/docs/StoreApi.md +286 -0
  63. package/docs/Tag.md +36 -0
  64. package/docs/User.md +48 -0
  65. package/docs/UserApi.md +496 -0
  66. package/package.json +21 -0
  67. package/src/apis/PetApi.ts +739 -0
  68. package/src/apis/StoreApi.ts +323 -0
  69. package/src/apis/UserApi.ts +550 -0
  70. package/src/apis/index.ts +5 -0
  71. package/src/index.ts +5 -0
  72. package/src/models/Category.ts +73 -0
  73. package/src/models/ModelApiResponse.ts +81 -0
  74. package/src/models/Order.ts +117 -0
  75. package/src/models/Pet.ts +134 -0
  76. package/src/models/Tag.ts +73 -0
  77. package/src/models/User.ts +121 -0
  78. package/src/models/index.ts +8 -0
  79. package/src/runtime.ts +432 -0
  80. package/tsconfig.esm.json +7 -0
  81. package/tsconfig.json +16 -0
@@ -0,0 +1,350 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * Swagger Petstore - OpenAPI 3.0
6
+ * This is a sample Pet Store Server based on the OpenAPI 3.0 specification. You can find out more about Swagger at [https://swagger.io](https://swagger.io). In the third iteration of the pet store, we\'ve switched to the design first approach! You can now help us improve the API whether it\'s by making changes to the definition itself or to the code. That way, with time, we can improve the API in general, and expose some of the new features in OAS3. Some useful links: - [The Pet Store repository](https://github.com/swagger-api/swagger-petstore) - [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)
7
+ *
8
+ * The version of the OpenAPI document: 1.0.27
9
+ * Contact: apiteam@swagger.io
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
+ return new (P || (P = Promise))(function (resolve, reject) {
18
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
22
+ });
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.TextApiResponse = exports.BlobApiResponse = exports.VoidApiResponse = exports.JSONApiResponse = exports.COLLECTION_FORMATS = exports.RequiredError = exports.FetchError = exports.ResponseError = exports.BaseAPI = exports.DefaultConfig = exports.Configuration = exports.BASE_PATH = void 0;
26
+ exports.querystring = querystring;
27
+ exports.exists = exists;
28
+ exports.mapValues = mapValues;
29
+ exports.canConsumeForm = canConsumeForm;
30
+ exports.BASE_PATH = "https://petstore3.swagger.io/api/v3".replace(/\/+$/, "");
31
+ class Configuration {
32
+ constructor(configuration = {}) {
33
+ this.configuration = configuration;
34
+ }
35
+ set config(configuration) {
36
+ this.configuration = configuration;
37
+ }
38
+ get basePath() {
39
+ return this.configuration.basePath != null ? this.configuration.basePath : exports.BASE_PATH;
40
+ }
41
+ get fetchApi() {
42
+ return this.configuration.fetchApi;
43
+ }
44
+ get middleware() {
45
+ return this.configuration.middleware || [];
46
+ }
47
+ get queryParamsStringify() {
48
+ return this.configuration.queryParamsStringify || querystring;
49
+ }
50
+ get username() {
51
+ return this.configuration.username;
52
+ }
53
+ get password() {
54
+ return this.configuration.password;
55
+ }
56
+ get apiKey() {
57
+ const apiKey = this.configuration.apiKey;
58
+ if (apiKey) {
59
+ return typeof apiKey === 'function' ? apiKey : () => apiKey;
60
+ }
61
+ return undefined;
62
+ }
63
+ get accessToken() {
64
+ const accessToken = this.configuration.accessToken;
65
+ if (accessToken) {
66
+ return typeof accessToken === 'function' ? accessToken : () => __awaiter(this, void 0, void 0, function* () { return accessToken; });
67
+ }
68
+ return undefined;
69
+ }
70
+ get headers() {
71
+ return this.configuration.headers;
72
+ }
73
+ get credentials() {
74
+ return this.configuration.credentials;
75
+ }
76
+ }
77
+ exports.Configuration = Configuration;
78
+ exports.DefaultConfig = new Configuration();
79
+ /**
80
+ * This is the base class for all generated API classes.
81
+ */
82
+ class BaseAPI {
83
+ constructor(configuration = exports.DefaultConfig) {
84
+ this.configuration = configuration;
85
+ this.fetchApi = (url, init) => __awaiter(this, void 0, void 0, function* () {
86
+ let fetchParams = { url, init };
87
+ for (const middleware of this.middleware) {
88
+ if (middleware.pre) {
89
+ fetchParams = (yield middleware.pre(Object.assign({ fetch: this.fetchApi }, fetchParams))) || fetchParams;
90
+ }
91
+ }
92
+ let response = undefined;
93
+ try {
94
+ response = yield (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
95
+ }
96
+ catch (e) {
97
+ for (const middleware of this.middleware) {
98
+ if (middleware.onError) {
99
+ response = (yield middleware.onError({
100
+ fetch: this.fetchApi,
101
+ url: fetchParams.url,
102
+ init: fetchParams.init,
103
+ error: e,
104
+ response: response ? response.clone() : undefined,
105
+ })) || response;
106
+ }
107
+ }
108
+ if (response === undefined) {
109
+ if (e instanceof Error) {
110
+ throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
111
+ }
112
+ else {
113
+ throw e;
114
+ }
115
+ }
116
+ }
117
+ for (const middleware of this.middleware) {
118
+ if (middleware.post) {
119
+ response = (yield middleware.post({
120
+ fetch: this.fetchApi,
121
+ url: fetchParams.url,
122
+ init: fetchParams.init,
123
+ response: response.clone(),
124
+ })) || response;
125
+ }
126
+ }
127
+ return response;
128
+ });
129
+ this.middleware = configuration.middleware;
130
+ }
131
+ withMiddleware(...middlewares) {
132
+ const next = this.clone();
133
+ next.middleware = next.middleware.concat(...middlewares);
134
+ return next;
135
+ }
136
+ withPreMiddleware(...preMiddlewares) {
137
+ const middlewares = preMiddlewares.map((pre) => ({ pre }));
138
+ return this.withMiddleware(...middlewares);
139
+ }
140
+ withPostMiddleware(...postMiddlewares) {
141
+ const middlewares = postMiddlewares.map((post) => ({ post }));
142
+ return this.withMiddleware(...middlewares);
143
+ }
144
+ /**
145
+ * Check if the given MIME is a JSON MIME.
146
+ * JSON MIME examples:
147
+ * application/json
148
+ * application/json; charset=UTF8
149
+ * APPLICATION/JSON
150
+ * application/vnd.company+json
151
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
152
+ * @return True if the given MIME is JSON, false otherwise.
153
+ */
154
+ isJsonMime(mime) {
155
+ if (!mime) {
156
+ return false;
157
+ }
158
+ return BaseAPI.jsonRegex.test(mime);
159
+ }
160
+ request(context, initOverrides) {
161
+ return __awaiter(this, void 0, void 0, function* () {
162
+ const { url, init } = yield this.createFetchParams(context, initOverrides);
163
+ const response = yield this.fetchApi(url, init);
164
+ if (response && (response.status >= 200 && response.status < 300)) {
165
+ return response;
166
+ }
167
+ throw new ResponseError(response, 'Response returned an error code');
168
+ });
169
+ }
170
+ createFetchParams(context, initOverrides) {
171
+ return __awaiter(this, void 0, void 0, function* () {
172
+ let url = this.configuration.basePath + context.path;
173
+ if (context.query !== undefined && Object.keys(context.query).length !== 0) {
174
+ // only add the querystring to the URL if there are query parameters.
175
+ // this is done to avoid urls ending with a "?" character which buggy webservers
176
+ // do not handle correctly sometimes.
177
+ url += '?' + this.configuration.queryParamsStringify(context.query);
178
+ }
179
+ const headers = Object.assign({}, this.configuration.headers, context.headers);
180
+ Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
181
+ const initOverrideFn = typeof initOverrides === "function"
182
+ ? initOverrides
183
+ : () => __awaiter(this, void 0, void 0, function* () { return initOverrides; });
184
+ const initParams = {
185
+ method: context.method,
186
+ headers,
187
+ body: context.body,
188
+ credentials: this.configuration.credentials,
189
+ };
190
+ const overriddenInit = Object.assign(Object.assign({}, initParams), (yield initOverrideFn({
191
+ init: initParams,
192
+ context,
193
+ })));
194
+ let body;
195
+ if (isFormData(overriddenInit.body)
196
+ || (overriddenInit.body instanceof URLSearchParams)
197
+ || isBlob(overriddenInit.body)) {
198
+ body = overriddenInit.body;
199
+ }
200
+ else if (this.isJsonMime(headers['Content-Type'])) {
201
+ body = JSON.stringify(overriddenInit.body);
202
+ }
203
+ else {
204
+ body = overriddenInit.body;
205
+ }
206
+ const init = Object.assign(Object.assign({}, overriddenInit), { body });
207
+ return { url, init };
208
+ });
209
+ }
210
+ /**
211
+ * Create a shallow clone of `this` by constructing a new instance
212
+ * and then shallow cloning data members.
213
+ */
214
+ clone() {
215
+ const constructor = this.constructor;
216
+ const next = new constructor(this.configuration);
217
+ next.middleware = this.middleware.slice();
218
+ return next;
219
+ }
220
+ }
221
+ exports.BaseAPI = BaseAPI;
222
+ BaseAPI.jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
223
+ ;
224
+ function isBlob(value) {
225
+ return typeof Blob !== 'undefined' && value instanceof Blob;
226
+ }
227
+ function isFormData(value) {
228
+ return typeof FormData !== "undefined" && value instanceof FormData;
229
+ }
230
+ class ResponseError extends Error {
231
+ constructor(response, msg) {
232
+ super(msg);
233
+ this.response = response;
234
+ this.name = "ResponseError";
235
+ }
236
+ }
237
+ exports.ResponseError = ResponseError;
238
+ class FetchError extends Error {
239
+ constructor(cause, msg) {
240
+ super(msg);
241
+ this.cause = cause;
242
+ this.name = "FetchError";
243
+ }
244
+ }
245
+ exports.FetchError = FetchError;
246
+ class RequiredError extends Error {
247
+ constructor(field, msg) {
248
+ super(msg);
249
+ this.field = field;
250
+ this.name = "RequiredError";
251
+ }
252
+ }
253
+ exports.RequiredError = RequiredError;
254
+ exports.COLLECTION_FORMATS = {
255
+ csv: ",",
256
+ ssv: " ",
257
+ tsv: "\t",
258
+ pipes: "|",
259
+ };
260
+ function querystring(params, prefix = '') {
261
+ return Object.keys(params)
262
+ .map(key => querystringSingleKey(key, params[key], prefix))
263
+ .filter(part => part.length > 0)
264
+ .join('&');
265
+ }
266
+ function querystringSingleKey(key, value, keyPrefix = '') {
267
+ const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
268
+ if (value instanceof Array) {
269
+ const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
270
+ .join(`&${encodeURIComponent(fullKey)}=`);
271
+ return `${encodeURIComponent(fullKey)}=${multiValue}`;
272
+ }
273
+ if (value instanceof Set) {
274
+ const valueAsArray = Array.from(value);
275
+ return querystringSingleKey(key, valueAsArray, keyPrefix);
276
+ }
277
+ if (value instanceof Date) {
278
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
279
+ }
280
+ if (value instanceof Object) {
281
+ return querystring(value, fullKey);
282
+ }
283
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
284
+ }
285
+ function exists(json, key) {
286
+ const value = json[key];
287
+ return value !== null && value !== undefined;
288
+ }
289
+ function mapValues(data, fn) {
290
+ const result = {};
291
+ for (const key of Object.keys(data)) {
292
+ result[key] = fn(data[key]);
293
+ }
294
+ return result;
295
+ }
296
+ function canConsumeForm(consumes) {
297
+ for (const consume of consumes) {
298
+ if ('multipart/form-data' === consume.contentType) {
299
+ return true;
300
+ }
301
+ }
302
+ return false;
303
+ }
304
+ class JSONApiResponse {
305
+ constructor(raw, transformer = (jsonValue) => jsonValue) {
306
+ this.raw = raw;
307
+ this.transformer = transformer;
308
+ }
309
+ value() {
310
+ return __awaiter(this, void 0, void 0, function* () {
311
+ return this.transformer(yield this.raw.json());
312
+ });
313
+ }
314
+ }
315
+ exports.JSONApiResponse = JSONApiResponse;
316
+ class VoidApiResponse {
317
+ constructor(raw) {
318
+ this.raw = raw;
319
+ }
320
+ value() {
321
+ return __awaiter(this, void 0, void 0, function* () {
322
+ return undefined;
323
+ });
324
+ }
325
+ }
326
+ exports.VoidApiResponse = VoidApiResponse;
327
+ class BlobApiResponse {
328
+ constructor(raw) {
329
+ this.raw = raw;
330
+ }
331
+ value() {
332
+ return __awaiter(this, void 0, void 0, function* () {
333
+ return yield this.raw.blob();
334
+ });
335
+ }
336
+ ;
337
+ }
338
+ exports.BlobApiResponse = BlobApiResponse;
339
+ class TextApiResponse {
340
+ constructor(raw) {
341
+ this.raw = raw;
342
+ }
343
+ value() {
344
+ return __awaiter(this, void 0, void 0, function* () {
345
+ return yield this.raw.text();
346
+ });
347
+ }
348
+ ;
349
+ }
350
+ exports.TextApiResponse = TextApiResponse;
@@ -0,0 +1,36 @@
1
+
2
+ # Category
3
+
4
+
5
+ ## Properties
6
+
7
+ Name | Type
8
+ ------------ | -------------
9
+ `id` | number
10
+ `name` | string
11
+
12
+ ## Example
13
+
14
+ ```typescript
15
+ import type { Category } from '@redhat-ecosystem-engineering/petstore-client-test'
16
+
17
+ // TODO: Update the object below with actual values
18
+ const example = {
19
+ "id": 1,
20
+ "name": Dogs,
21
+ } satisfies Category
22
+
23
+ console.log(example)
24
+
25
+ // Convert the instance to a JSON string
26
+ const exampleJSON: string = JSON.stringify(example)
27
+ console.log(exampleJSON)
28
+
29
+ // Parse the JSON string back to an object
30
+ const exampleParsed = JSON.parse(exampleJSON) as Category
31
+ console.log(exampleParsed)
32
+ ```
33
+
34
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
35
+
36
+
@@ -0,0 +1,38 @@
1
+
2
+ # ModelApiResponse
3
+
4
+
5
+ ## Properties
6
+
7
+ Name | Type
8
+ ------------ | -------------
9
+ `code` | number
10
+ `type` | string
11
+ `message` | string
12
+
13
+ ## Example
14
+
15
+ ```typescript
16
+ import type { ModelApiResponse } from '@redhat-ecosystem-engineering/petstore-client-test'
17
+
18
+ // TODO: Update the object below with actual values
19
+ const example = {
20
+ "code": null,
21
+ "type": null,
22
+ "message": null,
23
+ } satisfies ModelApiResponse
24
+
25
+ console.log(example)
26
+
27
+ // Convert the instance to a JSON string
28
+ const exampleJSON: string = JSON.stringify(example)
29
+ console.log(exampleJSON)
30
+
31
+ // Parse the JSON string back to an object
32
+ const exampleParsed = JSON.parse(exampleJSON) as ModelApiResponse
33
+ console.log(exampleParsed)
34
+ ```
35
+
36
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
37
+
38
+
package/docs/Order.md ADDED
@@ -0,0 +1,44 @@
1
+
2
+ # Order
3
+
4
+
5
+ ## Properties
6
+
7
+ Name | Type
8
+ ------------ | -------------
9
+ `id` | number
10
+ `petId` | number
11
+ `quantity` | number
12
+ `shipDate` | Date
13
+ `status` | string
14
+ `complete` | boolean
15
+
16
+ ## Example
17
+
18
+ ```typescript
19
+ import type { Order } from '@redhat-ecosystem-engineering/petstore-client-test'
20
+
21
+ // TODO: Update the object below with actual values
22
+ const example = {
23
+ "id": 10,
24
+ "petId": 198772,
25
+ "quantity": 7,
26
+ "shipDate": null,
27
+ "status": approved,
28
+ "complete": null,
29
+ } satisfies Order
30
+
31
+ console.log(example)
32
+
33
+ // Convert the instance to a JSON string
34
+ const exampleJSON: string = JSON.stringify(example)
35
+ console.log(exampleJSON)
36
+
37
+ // Parse the JSON string back to an object
38
+ const exampleParsed = JSON.parse(exampleJSON) as Order
39
+ console.log(exampleParsed)
40
+ ```
41
+
42
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
43
+
44
+
package/docs/Pet.md ADDED
@@ -0,0 +1,44 @@
1
+
2
+ # Pet
3
+
4
+
5
+ ## Properties
6
+
7
+ Name | Type
8
+ ------------ | -------------
9
+ `id` | number
10
+ `name` | string
11
+ `category` | [Category](Category.md)
12
+ `photoUrls` | Array&lt;string&gt;
13
+ `tags` | [Array&lt;Tag&gt;](Tag.md)
14
+ `status` | string
15
+
16
+ ## Example
17
+
18
+ ```typescript
19
+ import type { Pet } from '@redhat-ecosystem-engineering/petstore-client-test'
20
+
21
+ // TODO: Update the object below with actual values
22
+ const example = {
23
+ "id": 10,
24
+ "name": doggie,
25
+ "category": null,
26
+ "photoUrls": null,
27
+ "tags": null,
28
+ "status": null,
29
+ } satisfies Pet
30
+
31
+ console.log(example)
32
+
33
+ // Convert the instance to a JSON string
34
+ const exampleJSON: string = JSON.stringify(example)
35
+ console.log(exampleJSON)
36
+
37
+ // Parse the JSON string back to an object
38
+ const exampleParsed = JSON.parse(exampleJSON) as Pet
39
+ console.log(exampleParsed)
40
+ ```
41
+
42
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
43
+
44
+