fork of hey-api/openapi-ts because I need some additional things
at main 445 lines 11 kB view raw
1// This file is auto-generated by @hey-api/openapi-ts 2 3import type { Client, Options as Options2, TDataShape } from './client'; 4import { client } from './client.gen'; 5import type { 6 AddPetData, 7 AddPetErrors, 8 AddPetResponses, 9 CreateUserData, 10 CreateUserErrors, 11 CreateUserResponses, 12 CreateUsersWithListInputData, 13 CreateUsersWithListInputErrors, 14 CreateUsersWithListInputResponses, 15 DeleteOrderData, 16 DeleteOrderErrors, 17 DeleteOrderResponses, 18 DeletePetData, 19 DeletePetErrors, 20 DeletePetResponses, 21 DeleteUserData, 22 DeleteUserErrors, 23 DeleteUserResponses, 24 FindPetsByStatusData, 25 FindPetsByStatusErrors, 26 FindPetsByStatusResponses, 27 FindPetsByTagsData, 28 FindPetsByTagsErrors, 29 FindPetsByTagsResponses, 30 GetInventoryData, 31 GetInventoryErrors, 32 GetInventoryResponses, 33 GetOrderByIdData, 34 GetOrderByIdErrors, 35 GetOrderByIdResponses, 36 GetPetByIdData, 37 GetPetByIdErrors, 38 GetPetByIdResponses, 39 GetUserByNameData, 40 GetUserByNameErrors, 41 GetUserByNameResponses, 42 LoginUserData, 43 LoginUserErrors, 44 LoginUserResponses, 45 LogoutUserData, 46 LogoutUserErrors, 47 LogoutUserResponses, 48 PlaceOrderData, 49 PlaceOrderErrors, 50 PlaceOrderResponses, 51 UpdatePetData, 52 UpdatePetErrors, 53 UpdatePetResponses, 54 UpdatePetWithFormData, 55 UpdatePetWithFormErrors, 56 UpdatePetWithFormResponses, 57 UpdateUserData, 58 UpdateUserErrors, 59 UpdateUserResponses, 60 UploadFileData, 61 UploadFileErrors, 62 UploadFileResponses, 63} from './types.gen'; 64 65export type Options< 66 TData extends TDataShape = TDataShape, 67 ThrowOnError extends boolean = boolean, 68> = Options2<TData, ThrowOnError> & { 69 /** 70 * You can provide a client instance returned by `createClient()` instead of 71 * individual options. This might be also useful if you want to implement a 72 * custom client. 73 */ 74 client?: Client; 75 /** 76 * You can pass arbitrary values through the `meta` object. This can be 77 * used to access values that aren't defined as part of the SDK function. 78 */ 79 meta?: Record<string, unknown>; 80}; 81 82/** 83 * Add a new pet to the store. 84 * 85 * Add a new pet to the store. 86 */ 87export const addPet = <ThrowOnError extends boolean = false>( 88 options: Options<AddPetData, ThrowOnError>, 89) => 90 (options.client ?? client).post<AddPetResponses, AddPetErrors, ThrowOnError>({ 91 responseType: 'json', 92 security: [{ scheme: 'bearer', type: 'http' }], 93 url: '/pet', 94 ...options, 95 headers: { 96 'Content-Type': 'application/json', 97 ...options.headers, 98 }, 99 }); 100 101/** 102 * Update an existing pet. 103 * 104 * Update an existing pet by Id. 105 */ 106export const updatePet = <ThrowOnError extends boolean = false>( 107 options: Options<UpdatePetData, ThrowOnError>, 108) => 109 (options.client ?? client).put< 110 UpdatePetResponses, 111 UpdatePetErrors, 112 ThrowOnError 113 >({ 114 responseType: 'json', 115 security: [{ scheme: 'bearer', type: 'http' }], 116 url: '/pet', 117 ...options, 118 headers: { 119 'Content-Type': 'application/json', 120 ...options.headers, 121 }, 122 }); 123 124/** 125 * Finds Pets by status. 126 * 127 * Multiple status values can be provided with comma separated strings. 128 */ 129export const findPetsByStatus = <ThrowOnError extends boolean = false>( 130 options: Options<FindPetsByStatusData, ThrowOnError>, 131) => 132 (options.client ?? client).get< 133 FindPetsByStatusResponses, 134 FindPetsByStatusErrors, 135 ThrowOnError 136 >({ 137 responseType: 'json', 138 security: [{ scheme: 'bearer', type: 'http' }], 139 url: '/pet/findByStatus', 140 ...options, 141 }); 142 143/** 144 * Finds Pets by tags. 145 * 146 * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. 147 */ 148export const findPetsByTags = <ThrowOnError extends boolean = false>( 149 options: Options<FindPetsByTagsData, ThrowOnError>, 150) => 151 (options.client ?? client).get< 152 FindPetsByTagsResponses, 153 FindPetsByTagsErrors, 154 ThrowOnError 155 >({ 156 responseType: 'json', 157 security: [{ scheme: 'bearer', type: 'http' }], 158 url: '/pet/findByTags', 159 ...options, 160 }); 161 162/** 163 * Deletes a pet. 164 * 165 * Delete a pet. 166 */ 167export const deletePet = <ThrowOnError extends boolean = false>( 168 options: Options<DeletePetData, ThrowOnError>, 169) => 170 (options.client ?? client).delete< 171 DeletePetResponses, 172 DeletePetErrors, 173 ThrowOnError 174 >({ 175 security: [{ scheme: 'bearer', type: 'http' }], 176 url: '/pet/{petId}', 177 ...options, 178 }); 179 180/** 181 * Find pet by ID. 182 * 183 * Returns a single pet. 184 */ 185export const getPetById = <ThrowOnError extends boolean = false>( 186 options: Options<GetPetByIdData, ThrowOnError>, 187) => 188 (options.client ?? client).get< 189 GetPetByIdResponses, 190 GetPetByIdErrors, 191 ThrowOnError 192 >({ 193 responseType: 'json', 194 security: [ 195 { name: 'api_key', type: 'apiKey' }, 196 { scheme: 'bearer', type: 'http' }, 197 ], 198 url: '/pet/{petId}', 199 ...options, 200 }); 201 202/** 203 * Updates a pet in the store with form data. 204 * 205 * Updates a pet resource based on the form data. 206 */ 207export const updatePetWithForm = <ThrowOnError extends boolean = false>( 208 options: Options<UpdatePetWithFormData, ThrowOnError>, 209) => 210 (options.client ?? client).post< 211 UpdatePetWithFormResponses, 212 UpdatePetWithFormErrors, 213 ThrowOnError 214 >({ 215 responseType: 'json', 216 security: [{ scheme: 'bearer', type: 'http' }], 217 url: '/pet/{petId}', 218 ...options, 219 }); 220 221/** 222 * Uploads an image. 223 * 224 * Upload image of the pet. 225 */ 226export const uploadFile = <ThrowOnError extends boolean = false>( 227 options: Options<UploadFileData, ThrowOnError>, 228) => 229 (options.client ?? client).post< 230 UploadFileResponses, 231 UploadFileErrors, 232 ThrowOnError 233 >({ 234 bodySerializer: null, 235 responseType: 'json', 236 security: [{ scheme: 'bearer', type: 'http' }], 237 url: '/pet/{petId}/uploadImage', 238 ...options, 239 headers: { 240 'Content-Type': 'application/octet-stream', 241 ...options.headers, 242 }, 243 }); 244 245/** 246 * Returns pet inventories by status. 247 * 248 * Returns a map of status codes to quantities. 249 */ 250export const getInventory = <ThrowOnError extends boolean = false>( 251 options?: Options<GetInventoryData, ThrowOnError>, 252) => 253 (options?.client ?? client).get< 254 GetInventoryResponses, 255 GetInventoryErrors, 256 ThrowOnError 257 >({ 258 responseType: 'json', 259 security: [{ name: 'api_key', type: 'apiKey' }], 260 url: '/store/inventory', 261 ...options, 262 }); 263 264/** 265 * Place an order for a pet. 266 * 267 * Place a new order in the store. 268 */ 269export const placeOrder = <ThrowOnError extends boolean = false>( 270 options?: Options<PlaceOrderData, ThrowOnError>, 271) => 272 (options?.client ?? client).post< 273 PlaceOrderResponses, 274 PlaceOrderErrors, 275 ThrowOnError 276 >({ 277 responseType: 'json', 278 url: '/store/order', 279 ...options, 280 headers: { 281 'Content-Type': 'application/json', 282 ...options?.headers, 283 }, 284 }); 285 286/** 287 * Delete purchase order by identifier. 288 * 289 * For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API errors. 290 */ 291export const deleteOrder = <ThrowOnError extends boolean = false>( 292 options: Options<DeleteOrderData, ThrowOnError>, 293) => 294 (options.client ?? client).delete< 295 DeleteOrderResponses, 296 DeleteOrderErrors, 297 ThrowOnError 298 >({ url: '/store/order/{orderId}', ...options }); 299 300/** 301 * Find purchase order by ID. 302 * 303 * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. 304 */ 305export const getOrderById = <ThrowOnError extends boolean = false>( 306 options: Options<GetOrderByIdData, ThrowOnError>, 307) => 308 (options.client ?? client).get< 309 GetOrderByIdResponses, 310 GetOrderByIdErrors, 311 ThrowOnError 312 >({ 313 responseType: 'json', 314 url: '/store/order/{orderId}', 315 ...options, 316 }); 317 318/** 319 * Create user. 320 * 321 * This can only be done by the logged in user. 322 */ 323export const createUser = <ThrowOnError extends boolean = false>( 324 options?: Options<CreateUserData, ThrowOnError>, 325) => 326 (options?.client ?? client).post< 327 CreateUserResponses, 328 CreateUserErrors, 329 ThrowOnError 330 >({ 331 responseType: 'json', 332 url: '/user', 333 ...options, 334 headers: { 335 'Content-Type': 'application/json', 336 ...options?.headers, 337 }, 338 }); 339 340/** 341 * Creates list of users with given input array. 342 * 343 * Creates list of users with given input array. 344 */ 345export const createUsersWithListInput = <ThrowOnError extends boolean = false>( 346 options?: Options<CreateUsersWithListInputData, ThrowOnError>, 347) => 348 (options?.client ?? client).post< 349 CreateUsersWithListInputResponses, 350 CreateUsersWithListInputErrors, 351 ThrowOnError 352 >({ 353 responseType: 'json', 354 url: '/user/createWithList', 355 ...options, 356 headers: { 357 'Content-Type': 'application/json', 358 ...options?.headers, 359 }, 360 }); 361 362/** 363 * Logs user into the system. 364 * 365 * Log into the system. 366 */ 367export const loginUser = <ThrowOnError extends boolean = false>( 368 options?: Options<LoginUserData, ThrowOnError>, 369) => 370 (options?.client ?? client).get< 371 LoginUserResponses, 372 LoginUserErrors, 373 ThrowOnError 374 >({ 375 responseType: 'json', 376 url: '/user/login', 377 ...options, 378 }); 379 380/** 381 * Logs out current logged in user session. 382 * 383 * Log user out of the system. 384 */ 385export const logoutUser = <ThrowOnError extends boolean = false>( 386 options?: Options<LogoutUserData, ThrowOnError>, 387) => 388 (options?.client ?? client).get< 389 LogoutUserResponses, 390 LogoutUserErrors, 391 ThrowOnError 392 >({ url: '/user/logout', ...options }); 393 394/** 395 * Delete user resource. 396 * 397 * This can only be done by the logged in user. 398 */ 399export const deleteUser = <ThrowOnError extends boolean = false>( 400 options: Options<DeleteUserData, ThrowOnError>, 401) => 402 (options.client ?? client).delete< 403 DeleteUserResponses, 404 DeleteUserErrors, 405 ThrowOnError 406 >({ url: '/user/{username}', ...options }); 407 408/** 409 * Get user by user name. 410 * 411 * Get user detail based on username. 412 */ 413export const getUserByName = <ThrowOnError extends boolean = false>( 414 options: Options<GetUserByNameData, ThrowOnError>, 415) => 416 (options.client ?? client).get< 417 GetUserByNameResponses, 418 GetUserByNameErrors, 419 ThrowOnError 420 >({ 421 responseType: 'json', 422 url: '/user/{username}', 423 ...options, 424 }); 425 426/** 427 * Update user resource. 428 * 429 * This can only be done by the logged in user. 430 */ 431export const updateUser = <ThrowOnError extends boolean = false>( 432 options: Options<UpdateUserData, ThrowOnError>, 433) => 434 (options.client ?? client).put< 435 UpdateUserResponses, 436 UpdateUserErrors, 437 ThrowOnError 438 >({ 439 url: '/user/{username}', 440 ...options, 441 headers: { 442 'Content-Type': 'application/json', 443 ...options.headers, 444 }, 445 });