@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.
- package/.openapi-generator/FILES +29 -0
- package/.openapi-generator/VERSION +1 -0
- package/.openapi-generator-ignore +23 -0
- package/README.md +156 -0
- package/dist/apis/PetApi.d.ts +354 -0
- package/dist/apis/PetApi.js +423 -0
- package/dist/apis/StoreApi.d.ts +181 -0
- package/dist/apis/StoreApi.js +193 -0
- package/dist/apis/UserApi.d.ts +293 -0
- package/dist/apis/UserApi.js +318 -0
- package/dist/apis/index.d.ts +3 -0
- package/dist/apis/index.js +21 -0
- package/dist/esm/apis/PetApi.d.ts +354 -0
- package/dist/esm/apis/PetApi.js +419 -0
- package/dist/esm/apis/StoreApi.d.ts +181 -0
- package/dist/esm/apis/StoreApi.js +189 -0
- package/dist/esm/apis/UserApi.d.ts +293 -0
- package/dist/esm/apis/UserApi.js +314 -0
- package/dist/esm/apis/index.d.ts +3 -0
- package/dist/esm/apis/index.js +5 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/models/Category.d.ts +38 -0
- package/dist/esm/models/Category.js +43 -0
- package/dist/esm/models/ModelApiResponse.d.ts +44 -0
- package/dist/esm/models/ModelApiResponse.js +45 -0
- package/dist/esm/models/Order.d.ts +71 -0
- package/dist/esm/models/Order.js +59 -0
- package/dist/esm/models/Pet.d.ts +73 -0
- package/dist/esm/models/Pet.js +65 -0
- package/dist/esm/models/Tag.d.ts +38 -0
- package/dist/esm/models/Tag.js +43 -0
- package/dist/esm/models/User.d.ts +74 -0
- package/dist/esm/models/User.js +55 -0
- package/dist/esm/models/index.d.ts +6 -0
- package/dist/esm/models/index.js +8 -0
- package/dist/esm/runtime.d.ts +184 -0
- package/dist/esm/runtime.js +334 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +21 -0
- package/dist/models/Category.d.ts +38 -0
- package/dist/models/Category.js +50 -0
- package/dist/models/ModelApiResponse.d.ts +44 -0
- package/dist/models/ModelApiResponse.js +52 -0
- package/dist/models/Order.d.ts +71 -0
- package/dist/models/Order.js +67 -0
- package/dist/models/Pet.d.ts +73 -0
- package/dist/models/Pet.js +73 -0
- package/dist/models/Tag.d.ts +38 -0
- package/dist/models/Tag.js +50 -0
- package/dist/models/User.d.ts +74 -0
- package/dist/models/User.js +62 -0
- package/dist/models/index.d.ts +6 -0
- package/dist/models/index.js +24 -0
- package/dist/runtime.d.ts +184 -0
- package/dist/runtime.js +350 -0
- package/docs/Category.md +36 -0
- package/docs/ModelApiResponse.md +38 -0
- package/docs/Order.md +44 -0
- package/docs/Pet.md +44 -0
- package/docs/PetApi.md +622 -0
- package/docs/StoreApi.md +286 -0
- package/docs/Tag.md +36 -0
- package/docs/User.md +48 -0
- package/docs/UserApi.md +496 -0
- package/package.json +21 -0
- package/src/apis/PetApi.ts +739 -0
- package/src/apis/StoreApi.ts +323 -0
- package/src/apis/UserApi.ts +550 -0
- package/src/apis/index.ts +5 -0
- package/src/index.ts +5 -0
- package/src/models/Category.ts +73 -0
- package/src/models/ModelApiResponse.ts +81 -0
- package/src/models/Order.ts +117 -0
- package/src/models/Pet.ts +134 -0
- package/src/models/Tag.ts +73 -0
- package/src/models/User.ts +121 -0
- package/src/models/index.ts +8 -0
- package/src/runtime.ts +432 -0
- package/tsconfig.esm.json +7 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,739 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Swagger Petstore - OpenAPI 3.0
|
|
5
|
+
* 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)
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.27
|
|
8
|
+
* Contact: apiteam@swagger.io
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
import * as runtime from '../runtime.js';
|
|
17
|
+
import type {
|
|
18
|
+
ModelApiResponse,
|
|
19
|
+
Pet,
|
|
20
|
+
} from '../models/index.js';
|
|
21
|
+
import {
|
|
22
|
+
ModelApiResponseFromJSON,
|
|
23
|
+
ModelApiResponseToJSON,
|
|
24
|
+
PetFromJSON,
|
|
25
|
+
PetToJSON,
|
|
26
|
+
} from '../models/index.js';
|
|
27
|
+
|
|
28
|
+
export interface AddPetRequest {
|
|
29
|
+
pet: Pet;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface DeletePetRequest {
|
|
33
|
+
petId: number;
|
|
34
|
+
apiKey?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface FindPetsByStatusRequest {
|
|
38
|
+
status: FindPetsByStatusStatusEnum;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface FindPetsByTagsRequest {
|
|
42
|
+
tags: Array<string>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface GetPetByIdRequest {
|
|
46
|
+
petId: number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface UpdatePetRequest {
|
|
50
|
+
pet: Pet;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface UpdatePetWithFormRequest {
|
|
54
|
+
petId: number;
|
|
55
|
+
name?: string;
|
|
56
|
+
status?: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface UploadFileRequest {
|
|
60
|
+
petId: number;
|
|
61
|
+
additionalMetadata?: string;
|
|
62
|
+
body?: Blob;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* PetApi - interface
|
|
67
|
+
*
|
|
68
|
+
* @export
|
|
69
|
+
* @interface PetApiInterface
|
|
70
|
+
*/
|
|
71
|
+
export interface PetApiInterface {
|
|
72
|
+
/**
|
|
73
|
+
* Creates request options for addPet without sending the request
|
|
74
|
+
* @param {Pet} pet Create a new pet in the store
|
|
75
|
+
* @throws {RequiredError}
|
|
76
|
+
* @memberof PetApiInterface
|
|
77
|
+
*/
|
|
78
|
+
addPetRequestOpts(requestParameters: AddPetRequest): Promise<runtime.RequestOpts>;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Add a new pet to the store.
|
|
82
|
+
* @summary Add a new pet to the store.
|
|
83
|
+
* @param {Pet} pet Create a new pet in the store
|
|
84
|
+
* @param {*} [options] Override http request option.
|
|
85
|
+
* @throws {RequiredError}
|
|
86
|
+
* @memberof PetApiInterface
|
|
87
|
+
*/
|
|
88
|
+
addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Pet>>;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Add a new pet to the store.
|
|
92
|
+
* Add a new pet to the store.
|
|
93
|
+
*/
|
|
94
|
+
addPet(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Pet>;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Creates request options for deletePet without sending the request
|
|
98
|
+
* @param {number} petId Pet id to delete
|
|
99
|
+
* @param {string} [apiKey]
|
|
100
|
+
* @throws {RequiredError}
|
|
101
|
+
* @memberof PetApiInterface
|
|
102
|
+
*/
|
|
103
|
+
deletePetRequestOpts(requestParameters: DeletePetRequest): Promise<runtime.RequestOpts>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Delete a pet.
|
|
107
|
+
* @summary Deletes a pet.
|
|
108
|
+
* @param {number} petId Pet id to delete
|
|
109
|
+
* @param {string} [apiKey]
|
|
110
|
+
* @param {*} [options] Override http request option.
|
|
111
|
+
* @throws {RequiredError}
|
|
112
|
+
* @memberof PetApiInterface
|
|
113
|
+
*/
|
|
114
|
+
deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Delete a pet.
|
|
118
|
+
* Deletes a pet.
|
|
119
|
+
*/
|
|
120
|
+
deletePet(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Creates request options for findPetsByStatus without sending the request
|
|
124
|
+
* @param {'available' | 'pending' | 'sold'} status Status values that need to be considered for filter
|
|
125
|
+
* @throws {RequiredError}
|
|
126
|
+
* @memberof PetApiInterface
|
|
127
|
+
*/
|
|
128
|
+
findPetsByStatusRequestOpts(requestParameters: FindPetsByStatusRequest): Promise<runtime.RequestOpts>;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Multiple status values can be provided with comma separated strings.
|
|
132
|
+
* @summary Finds Pets by status.
|
|
133
|
+
* @param {'available' | 'pending' | 'sold'} status Status values that need to be considered for filter
|
|
134
|
+
* @param {*} [options] Override http request option.
|
|
135
|
+
* @throws {RequiredError}
|
|
136
|
+
* @memberof PetApiInterface
|
|
137
|
+
*/
|
|
138
|
+
findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<Pet>>>;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Multiple status values can be provided with comma separated strings.
|
|
142
|
+
* Finds Pets by status.
|
|
143
|
+
*/
|
|
144
|
+
findPetsByStatus(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<Pet>>;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Creates request options for findPetsByTags without sending the request
|
|
148
|
+
* @param {Array<string>} tags Tags to filter by
|
|
149
|
+
* @throws {RequiredError}
|
|
150
|
+
* @memberof PetApiInterface
|
|
151
|
+
*/
|
|
152
|
+
findPetsByTagsRequestOpts(requestParameters: FindPetsByTagsRequest): Promise<runtime.RequestOpts>;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
156
|
+
* @summary Finds Pets by tags.
|
|
157
|
+
* @param {Array<string>} tags Tags to filter by
|
|
158
|
+
* @param {*} [options] Override http request option.
|
|
159
|
+
* @throws {RequiredError}
|
|
160
|
+
* @memberof PetApiInterface
|
|
161
|
+
*/
|
|
162
|
+
findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<Pet>>>;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
166
|
+
* Finds Pets by tags.
|
|
167
|
+
*/
|
|
168
|
+
findPetsByTags(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<Pet>>;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Creates request options for getPetById without sending the request
|
|
172
|
+
* @param {number} petId ID of pet to return
|
|
173
|
+
* @throws {RequiredError}
|
|
174
|
+
* @memberof PetApiInterface
|
|
175
|
+
*/
|
|
176
|
+
getPetByIdRequestOpts(requestParameters: GetPetByIdRequest): Promise<runtime.RequestOpts>;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Returns a single pet.
|
|
180
|
+
* @summary Find pet by ID.
|
|
181
|
+
* @param {number} petId ID of pet to return
|
|
182
|
+
* @param {*} [options] Override http request option.
|
|
183
|
+
* @throws {RequiredError}
|
|
184
|
+
* @memberof PetApiInterface
|
|
185
|
+
*/
|
|
186
|
+
getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Pet>>;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Returns a single pet.
|
|
190
|
+
* Find pet by ID.
|
|
191
|
+
*/
|
|
192
|
+
getPetById(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Pet>;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Creates request options for updatePet without sending the request
|
|
196
|
+
* @param {Pet} pet Update an existent pet in the store
|
|
197
|
+
* @throws {RequiredError}
|
|
198
|
+
* @memberof PetApiInterface
|
|
199
|
+
*/
|
|
200
|
+
updatePetRequestOpts(requestParameters: UpdatePetRequest): Promise<runtime.RequestOpts>;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Update an existing pet by Id.
|
|
204
|
+
* @summary Update an existing pet.
|
|
205
|
+
* @param {Pet} pet Update an existent pet in the store
|
|
206
|
+
* @param {*} [options] Override http request option.
|
|
207
|
+
* @throws {RequiredError}
|
|
208
|
+
* @memberof PetApiInterface
|
|
209
|
+
*/
|
|
210
|
+
updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Pet>>;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Update an existing pet by Id.
|
|
214
|
+
* Update an existing pet.
|
|
215
|
+
*/
|
|
216
|
+
updatePet(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Pet>;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Creates request options for updatePetWithForm without sending the request
|
|
220
|
+
* @param {number} petId ID of pet that needs to be updated
|
|
221
|
+
* @param {string} [name] Name of pet that needs to be updated
|
|
222
|
+
* @param {string} [status] Status of pet that needs to be updated
|
|
223
|
+
* @throws {RequiredError}
|
|
224
|
+
* @memberof PetApiInterface
|
|
225
|
+
*/
|
|
226
|
+
updatePetWithFormRequestOpts(requestParameters: UpdatePetWithFormRequest): Promise<runtime.RequestOpts>;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Updates a pet resource based on the form data.
|
|
230
|
+
* @summary Updates a pet in the store with form data.
|
|
231
|
+
* @param {number} petId ID of pet that needs to be updated
|
|
232
|
+
* @param {string} [name] Name of pet that needs to be updated
|
|
233
|
+
* @param {string} [status] Status of pet that needs to be updated
|
|
234
|
+
* @param {*} [options] Override http request option.
|
|
235
|
+
* @throws {RequiredError}
|
|
236
|
+
* @memberof PetApiInterface
|
|
237
|
+
*/
|
|
238
|
+
updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Pet>>;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Updates a pet resource based on the form data.
|
|
242
|
+
* Updates a pet in the store with form data.
|
|
243
|
+
*/
|
|
244
|
+
updatePetWithForm(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Pet>;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Creates request options for uploadFile without sending the request
|
|
248
|
+
* @param {number} petId ID of pet to update
|
|
249
|
+
* @param {string} [additionalMetadata] Additional Metadata
|
|
250
|
+
* @param {Blob} [body]
|
|
251
|
+
* @throws {RequiredError}
|
|
252
|
+
* @memberof PetApiInterface
|
|
253
|
+
*/
|
|
254
|
+
uploadFileRequestOpts(requestParameters: UploadFileRequest): Promise<runtime.RequestOpts>;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Upload image of the pet.
|
|
258
|
+
* @summary Uploads an image.
|
|
259
|
+
* @param {number} petId ID of pet to update
|
|
260
|
+
* @param {string} [additionalMetadata] Additional Metadata
|
|
261
|
+
* @param {Blob} [body]
|
|
262
|
+
* @param {*} [options] Override http request option.
|
|
263
|
+
* @throws {RequiredError}
|
|
264
|
+
* @memberof PetApiInterface
|
|
265
|
+
*/
|
|
266
|
+
uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ModelApiResponse>>;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Upload image of the pet.
|
|
270
|
+
* Uploads an image.
|
|
271
|
+
*/
|
|
272
|
+
uploadFile(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelApiResponse>;
|
|
273
|
+
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
*
|
|
278
|
+
*/
|
|
279
|
+
export class PetApi extends runtime.BaseAPI implements PetApiInterface {
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Creates request options for addPet without sending the request
|
|
283
|
+
*/
|
|
284
|
+
async addPetRequestOpts(requestParameters: AddPetRequest): Promise<runtime.RequestOpts> {
|
|
285
|
+
if (requestParameters['pet'] == null) {
|
|
286
|
+
throw new runtime.RequiredError(
|
|
287
|
+
'pet',
|
|
288
|
+
'Required parameter "pet" was null or undefined when calling addPet().'
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const queryParameters: any = {};
|
|
293
|
+
|
|
294
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
295
|
+
|
|
296
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
297
|
+
|
|
298
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
299
|
+
// oauth required
|
|
300
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
let urlPath = `/pet`;
|
|
305
|
+
|
|
306
|
+
return {
|
|
307
|
+
path: urlPath,
|
|
308
|
+
method: 'POST',
|
|
309
|
+
headers: headerParameters,
|
|
310
|
+
query: queryParameters,
|
|
311
|
+
body: PetToJSON(requestParameters['pet']),
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Add a new pet to the store.
|
|
317
|
+
* Add a new pet to the store.
|
|
318
|
+
*/
|
|
319
|
+
async addPetRaw(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Pet>> {
|
|
320
|
+
const requestOptions = await this.addPetRequestOpts(requestParameters);
|
|
321
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
322
|
+
|
|
323
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => PetFromJSON(jsonValue));
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Add a new pet to the store.
|
|
328
|
+
* Add a new pet to the store.
|
|
329
|
+
*/
|
|
330
|
+
async addPet(requestParameters: AddPetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Pet> {
|
|
331
|
+
const response = await this.addPetRaw(requestParameters, initOverrides);
|
|
332
|
+
return await response.value();
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Creates request options for deletePet without sending the request
|
|
337
|
+
*/
|
|
338
|
+
async deletePetRequestOpts(requestParameters: DeletePetRequest): Promise<runtime.RequestOpts> {
|
|
339
|
+
if (requestParameters['petId'] == null) {
|
|
340
|
+
throw new runtime.RequiredError(
|
|
341
|
+
'petId',
|
|
342
|
+
'Required parameter "petId" was null or undefined when calling deletePet().'
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
const queryParameters: any = {};
|
|
347
|
+
|
|
348
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
349
|
+
|
|
350
|
+
if (requestParameters['apiKey'] != null) {
|
|
351
|
+
headerParameters['api_key'] = String(requestParameters['apiKey']);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
355
|
+
// oauth required
|
|
356
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
let urlPath = `/pet/{petId}`;
|
|
361
|
+
urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId'])));
|
|
362
|
+
|
|
363
|
+
return {
|
|
364
|
+
path: urlPath,
|
|
365
|
+
method: 'DELETE',
|
|
366
|
+
headers: headerParameters,
|
|
367
|
+
query: queryParameters,
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Delete a pet.
|
|
373
|
+
* Deletes a pet.
|
|
374
|
+
*/
|
|
375
|
+
async deletePetRaw(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
376
|
+
const requestOptions = await this.deletePetRequestOpts(requestParameters);
|
|
377
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
378
|
+
|
|
379
|
+
return new runtime.VoidApiResponse(response);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Delete a pet.
|
|
384
|
+
* Deletes a pet.
|
|
385
|
+
*/
|
|
386
|
+
async deletePet(requestParameters: DeletePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
387
|
+
await this.deletePetRaw(requestParameters, initOverrides);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Creates request options for findPetsByStatus without sending the request
|
|
392
|
+
*/
|
|
393
|
+
async findPetsByStatusRequestOpts(requestParameters: FindPetsByStatusRequest): Promise<runtime.RequestOpts> {
|
|
394
|
+
if (requestParameters['status'] == null) {
|
|
395
|
+
throw new runtime.RequiredError(
|
|
396
|
+
'status',
|
|
397
|
+
'Required parameter "status" was null or undefined when calling findPetsByStatus().'
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
const queryParameters: any = {};
|
|
402
|
+
|
|
403
|
+
if (requestParameters['status'] != null) {
|
|
404
|
+
queryParameters['status'] = requestParameters['status'];
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
408
|
+
|
|
409
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
410
|
+
// oauth required
|
|
411
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
let urlPath = `/pet/findByStatus`;
|
|
416
|
+
|
|
417
|
+
return {
|
|
418
|
+
path: urlPath,
|
|
419
|
+
method: 'GET',
|
|
420
|
+
headers: headerParameters,
|
|
421
|
+
query: queryParameters,
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Multiple status values can be provided with comma separated strings.
|
|
427
|
+
* Finds Pets by status.
|
|
428
|
+
*/
|
|
429
|
+
async findPetsByStatusRaw(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<Pet>>> {
|
|
430
|
+
const requestOptions = await this.findPetsByStatusRequestOpts(requestParameters);
|
|
431
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
432
|
+
|
|
433
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PetFromJSON));
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Multiple status values can be provided with comma separated strings.
|
|
438
|
+
* Finds Pets by status.
|
|
439
|
+
*/
|
|
440
|
+
async findPetsByStatus(requestParameters: FindPetsByStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<Pet>> {
|
|
441
|
+
const response = await this.findPetsByStatusRaw(requestParameters, initOverrides);
|
|
442
|
+
return await response.value();
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Creates request options for findPetsByTags without sending the request
|
|
447
|
+
*/
|
|
448
|
+
async findPetsByTagsRequestOpts(requestParameters: FindPetsByTagsRequest): Promise<runtime.RequestOpts> {
|
|
449
|
+
if (requestParameters['tags'] == null) {
|
|
450
|
+
throw new runtime.RequiredError(
|
|
451
|
+
'tags',
|
|
452
|
+
'Required parameter "tags" was null or undefined when calling findPetsByTags().'
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
const queryParameters: any = {};
|
|
457
|
+
|
|
458
|
+
if (requestParameters['tags'] != null) {
|
|
459
|
+
queryParameters['tags'] = requestParameters['tags'];
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
463
|
+
|
|
464
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
465
|
+
// oauth required
|
|
466
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
let urlPath = `/pet/findByTags`;
|
|
471
|
+
|
|
472
|
+
return {
|
|
473
|
+
path: urlPath,
|
|
474
|
+
method: 'GET',
|
|
475
|
+
headers: headerParameters,
|
|
476
|
+
query: queryParameters,
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
482
|
+
* Finds Pets by tags.
|
|
483
|
+
*/
|
|
484
|
+
async findPetsByTagsRaw(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<Pet>>> {
|
|
485
|
+
const requestOptions = await this.findPetsByTagsRequestOpts(requestParameters);
|
|
486
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
487
|
+
|
|
488
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PetFromJSON));
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
493
|
+
* Finds Pets by tags.
|
|
494
|
+
*/
|
|
495
|
+
async findPetsByTags(requestParameters: FindPetsByTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<Pet>> {
|
|
496
|
+
const response = await this.findPetsByTagsRaw(requestParameters, initOverrides);
|
|
497
|
+
return await response.value();
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Creates request options for getPetById without sending the request
|
|
502
|
+
*/
|
|
503
|
+
async getPetByIdRequestOpts(requestParameters: GetPetByIdRequest): Promise<runtime.RequestOpts> {
|
|
504
|
+
if (requestParameters['petId'] == null) {
|
|
505
|
+
throw new runtime.RequiredError(
|
|
506
|
+
'petId',
|
|
507
|
+
'Required parameter "petId" was null or undefined when calling getPetById().'
|
|
508
|
+
);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
const queryParameters: any = {};
|
|
512
|
+
|
|
513
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
514
|
+
|
|
515
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
516
|
+
// oauth required
|
|
517
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
521
|
+
headerParameters["api_key"] = await this.configuration.apiKey("api_key"); // api_key authentication
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
let urlPath = `/pet/{petId}`;
|
|
526
|
+
urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId'])));
|
|
527
|
+
|
|
528
|
+
return {
|
|
529
|
+
path: urlPath,
|
|
530
|
+
method: 'GET',
|
|
531
|
+
headers: headerParameters,
|
|
532
|
+
query: queryParameters,
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Returns a single pet.
|
|
538
|
+
* Find pet by ID.
|
|
539
|
+
*/
|
|
540
|
+
async getPetByIdRaw(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Pet>> {
|
|
541
|
+
const requestOptions = await this.getPetByIdRequestOpts(requestParameters);
|
|
542
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
543
|
+
|
|
544
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => PetFromJSON(jsonValue));
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Returns a single pet.
|
|
549
|
+
* Find pet by ID.
|
|
550
|
+
*/
|
|
551
|
+
async getPetById(requestParameters: GetPetByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Pet> {
|
|
552
|
+
const response = await this.getPetByIdRaw(requestParameters, initOverrides);
|
|
553
|
+
return await response.value();
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* Creates request options for updatePet without sending the request
|
|
558
|
+
*/
|
|
559
|
+
async updatePetRequestOpts(requestParameters: UpdatePetRequest): Promise<runtime.RequestOpts> {
|
|
560
|
+
if (requestParameters['pet'] == null) {
|
|
561
|
+
throw new runtime.RequiredError(
|
|
562
|
+
'pet',
|
|
563
|
+
'Required parameter "pet" was null or undefined when calling updatePet().'
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
const queryParameters: any = {};
|
|
568
|
+
|
|
569
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
570
|
+
|
|
571
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
572
|
+
|
|
573
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
574
|
+
// oauth required
|
|
575
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
let urlPath = `/pet`;
|
|
580
|
+
|
|
581
|
+
return {
|
|
582
|
+
path: urlPath,
|
|
583
|
+
method: 'PUT',
|
|
584
|
+
headers: headerParameters,
|
|
585
|
+
query: queryParameters,
|
|
586
|
+
body: PetToJSON(requestParameters['pet']),
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* Update an existing pet by Id.
|
|
592
|
+
* Update an existing pet.
|
|
593
|
+
*/
|
|
594
|
+
async updatePetRaw(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Pet>> {
|
|
595
|
+
const requestOptions = await this.updatePetRequestOpts(requestParameters);
|
|
596
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
597
|
+
|
|
598
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => PetFromJSON(jsonValue));
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Update an existing pet by Id.
|
|
603
|
+
* Update an existing pet.
|
|
604
|
+
*/
|
|
605
|
+
async updatePet(requestParameters: UpdatePetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Pet> {
|
|
606
|
+
const response = await this.updatePetRaw(requestParameters, initOverrides);
|
|
607
|
+
return await response.value();
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Creates request options for updatePetWithForm without sending the request
|
|
612
|
+
*/
|
|
613
|
+
async updatePetWithFormRequestOpts(requestParameters: UpdatePetWithFormRequest): Promise<runtime.RequestOpts> {
|
|
614
|
+
if (requestParameters['petId'] == null) {
|
|
615
|
+
throw new runtime.RequiredError(
|
|
616
|
+
'petId',
|
|
617
|
+
'Required parameter "petId" was null or undefined when calling updatePetWithForm().'
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
const queryParameters: any = {};
|
|
622
|
+
|
|
623
|
+
if (requestParameters['name'] != null) {
|
|
624
|
+
queryParameters['name'] = requestParameters['name'];
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
if (requestParameters['status'] != null) {
|
|
628
|
+
queryParameters['status'] = requestParameters['status'];
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
632
|
+
|
|
633
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
634
|
+
// oauth required
|
|
635
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
let urlPath = `/pet/{petId}`;
|
|
640
|
+
urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId'])));
|
|
641
|
+
|
|
642
|
+
return {
|
|
643
|
+
path: urlPath,
|
|
644
|
+
method: 'POST',
|
|
645
|
+
headers: headerParameters,
|
|
646
|
+
query: queryParameters,
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Updates a pet resource based on the form data.
|
|
652
|
+
* Updates a pet in the store with form data.
|
|
653
|
+
*/
|
|
654
|
+
async updatePetWithFormRaw(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Pet>> {
|
|
655
|
+
const requestOptions = await this.updatePetWithFormRequestOpts(requestParameters);
|
|
656
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
657
|
+
|
|
658
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => PetFromJSON(jsonValue));
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Updates a pet resource based on the form data.
|
|
663
|
+
* Updates a pet in the store with form data.
|
|
664
|
+
*/
|
|
665
|
+
async updatePetWithForm(requestParameters: UpdatePetWithFormRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Pet> {
|
|
666
|
+
const response = await this.updatePetWithFormRaw(requestParameters, initOverrides);
|
|
667
|
+
return await response.value();
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Creates request options for uploadFile without sending the request
|
|
672
|
+
*/
|
|
673
|
+
async uploadFileRequestOpts(requestParameters: UploadFileRequest): Promise<runtime.RequestOpts> {
|
|
674
|
+
if (requestParameters['petId'] == null) {
|
|
675
|
+
throw new runtime.RequiredError(
|
|
676
|
+
'petId',
|
|
677
|
+
'Required parameter "petId" was null or undefined when calling uploadFile().'
|
|
678
|
+
);
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
const queryParameters: any = {};
|
|
682
|
+
|
|
683
|
+
if (requestParameters['additionalMetadata'] != null) {
|
|
684
|
+
queryParameters['additionalMetadata'] = requestParameters['additionalMetadata'];
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
688
|
+
|
|
689
|
+
headerParameters['Content-Type'] = 'application/octet-stream';
|
|
690
|
+
|
|
691
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
692
|
+
// oauth required
|
|
693
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]);
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
let urlPath = `/pet/{petId}/uploadImage`;
|
|
698
|
+
urlPath = urlPath.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters['petId'])));
|
|
699
|
+
|
|
700
|
+
return {
|
|
701
|
+
path: urlPath,
|
|
702
|
+
method: 'POST',
|
|
703
|
+
headers: headerParameters,
|
|
704
|
+
query: queryParameters,
|
|
705
|
+
body: requestParameters['body'] as any,
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Upload image of the pet.
|
|
711
|
+
* Uploads an image.
|
|
712
|
+
*/
|
|
713
|
+
async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ModelApiResponse>> {
|
|
714
|
+
const requestOptions = await this.uploadFileRequestOpts(requestParameters);
|
|
715
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
716
|
+
|
|
717
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => ModelApiResponseFromJSON(jsonValue));
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* Upload image of the pet.
|
|
722
|
+
* Uploads an image.
|
|
723
|
+
*/
|
|
724
|
+
async uploadFile(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelApiResponse> {
|
|
725
|
+
const response = await this.uploadFileRaw(requestParameters, initOverrides);
|
|
726
|
+
return await response.value();
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* @export
|
|
733
|
+
*/
|
|
734
|
+
export const FindPetsByStatusStatusEnum = {
|
|
735
|
+
Available: 'available',
|
|
736
|
+
Pending: 'pending',
|
|
737
|
+
Sold: 'sold'
|
|
738
|
+
} as const;
|
|
739
|
+
export type FindPetsByStatusStatusEnum = typeof FindPetsByStatusStatusEnum[keyof typeof FindPetsByStatusStatusEnum];
|