fork of hey-api/openapi-ts because I need some additional things
at feat/skip-token 409 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 = true>( 88 options: Options<AddPetData, ThrowOnError>, 89) => 90 (options.client ?? client).post<AddPetResponses, AddPetErrors, ThrowOnError, 'data'>({ 91 responseStyle: 'data', 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 = true>( 107 options: Options<UpdatePetData, ThrowOnError>, 108) => 109 (options.client ?? client).put<UpdatePetResponses, UpdatePetErrors, ThrowOnError, 'data'>({ 110 responseStyle: 'data', 111 security: [{ scheme: 'bearer', type: 'http' }], 112 url: '/pet', 113 ...options, 114 headers: { 115 'Content-Type': 'application/json', 116 ...options.headers, 117 }, 118 }); 119 120/** 121 * Finds Pets by status. 122 * 123 * Multiple status values can be provided with comma separated strings. 124 */ 125export const findPetsByStatus = <ThrowOnError extends boolean = true>( 126 options: Options<FindPetsByStatusData, ThrowOnError>, 127) => 128 (options.client ?? client).get< 129 FindPetsByStatusResponses, 130 FindPetsByStatusErrors, 131 ThrowOnError, 132 'data' 133 >({ 134 responseStyle: 'data', 135 security: [{ scheme: 'bearer', type: 'http' }], 136 url: '/pet/findByStatus', 137 ...options, 138 }); 139 140/** 141 * Finds Pets by tags. 142 * 143 * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. 144 */ 145export const findPetsByTags = <ThrowOnError extends boolean = true>( 146 options: Options<FindPetsByTagsData, ThrowOnError>, 147) => 148 (options.client ?? client).get< 149 FindPetsByTagsResponses, 150 FindPetsByTagsErrors, 151 ThrowOnError, 152 'data' 153 >({ 154 responseStyle: 'data', 155 security: [{ scheme: 'bearer', type: 'http' }], 156 url: '/pet/findByTags', 157 ...options, 158 }); 159 160/** 161 * Deletes a pet. 162 * 163 * Delete a pet. 164 */ 165export const deletePet = <ThrowOnError extends boolean = true>( 166 options: Options<DeletePetData, ThrowOnError>, 167) => 168 (options.client ?? client).delete<DeletePetResponses, DeletePetErrors, ThrowOnError, 'data'>({ 169 responseStyle: 'data', 170 security: [{ scheme: 'bearer', type: 'http' }], 171 url: '/pet/{petId}', 172 ...options, 173 }); 174 175/** 176 * Find pet by ID. 177 * 178 * Returns a single pet. 179 */ 180export const getPetById = <ThrowOnError extends boolean = true>( 181 options: Options<GetPetByIdData, ThrowOnError>, 182) => 183 (options.client ?? client).get<GetPetByIdResponses, GetPetByIdErrors, ThrowOnError, 'data'>({ 184 responseStyle: 'data', 185 security: [ 186 { name: 'api_key', type: 'apiKey' }, 187 { scheme: 'bearer', type: 'http' }, 188 ], 189 url: '/pet/{petId}', 190 ...options, 191 }); 192 193/** 194 * Updates a pet in the store with form data. 195 * 196 * Updates a pet resource based on the form data. 197 */ 198export const updatePetWithForm = <ThrowOnError extends boolean = true>( 199 options: Options<UpdatePetWithFormData, ThrowOnError>, 200) => 201 (options.client ?? client).post< 202 UpdatePetWithFormResponses, 203 UpdatePetWithFormErrors, 204 ThrowOnError, 205 'data' 206 >({ 207 responseStyle: 'data', 208 security: [{ scheme: 'bearer', type: 'http' }], 209 url: '/pet/{petId}', 210 ...options, 211 }); 212 213/** 214 * Uploads an image. 215 * 216 * Upload image of the pet. 217 */ 218export const uploadFile = <ThrowOnError extends boolean = true>( 219 options: Options<UploadFileData, ThrowOnError>, 220) => 221 (options.client ?? client).post<UploadFileResponses, UploadFileErrors, ThrowOnError, 'data'>({ 222 bodySerializer: null, 223 responseStyle: 'data', 224 security: [{ scheme: 'bearer', type: 'http' }], 225 url: '/pet/{petId}/uploadImage', 226 ...options, 227 headers: { 228 'Content-Type': 'application/octet-stream', 229 ...options.headers, 230 }, 231 }); 232 233/** 234 * Returns pet inventories by status. 235 * 236 * Returns a map of status codes to quantities. 237 */ 238export const getInventory = <ThrowOnError extends boolean = true>( 239 options?: Options<GetInventoryData, ThrowOnError>, 240) => 241 (options?.client ?? client).get<GetInventoryResponses, GetInventoryErrors, ThrowOnError, 'data'>({ 242 responseStyle: 'data', 243 security: [{ name: 'api_key', type: 'apiKey' }], 244 url: '/store/inventory', 245 ...options, 246 }); 247 248/** 249 * Place an order for a pet. 250 * 251 * Place a new order in the store. 252 */ 253export const placeOrder = <ThrowOnError extends boolean = true>( 254 options?: Options<PlaceOrderData, ThrowOnError>, 255) => 256 (options?.client ?? client).post<PlaceOrderResponses, PlaceOrderErrors, ThrowOnError, 'data'>({ 257 responseStyle: 'data', 258 url: '/store/order', 259 ...options, 260 headers: { 261 'Content-Type': 'application/json', 262 ...options?.headers, 263 }, 264 }); 265 266/** 267 * Delete purchase order by identifier. 268 * 269 * For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API errors. 270 */ 271export const deleteOrder = <ThrowOnError extends boolean = true>( 272 options: Options<DeleteOrderData, ThrowOnError>, 273) => 274 (options.client ?? client).delete<DeleteOrderResponses, DeleteOrderErrors, ThrowOnError, 'data'>({ 275 responseStyle: 'data', 276 url: '/store/order/{orderId}', 277 ...options, 278 }); 279 280/** 281 * Find purchase order by ID. 282 * 283 * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. 284 */ 285export const getOrderById = <ThrowOnError extends boolean = true>( 286 options: Options<GetOrderByIdData, ThrowOnError>, 287) => 288 (options.client ?? client).get<GetOrderByIdResponses, GetOrderByIdErrors, ThrowOnError, 'data'>({ 289 responseStyle: 'data', 290 url: '/store/order/{orderId}', 291 ...options, 292 }); 293 294/** 295 * Create user. 296 * 297 * This can only be done by the logged in user. 298 */ 299export const createUser = <ThrowOnError extends boolean = true>( 300 options?: Options<CreateUserData, ThrowOnError>, 301) => 302 (options?.client ?? client).post<CreateUserResponses, CreateUserErrors, ThrowOnError, 'data'>({ 303 responseStyle: 'data', 304 url: '/user', 305 ...options, 306 headers: { 307 'Content-Type': 'application/json', 308 ...options?.headers, 309 }, 310 }); 311 312/** 313 * Creates list of users with given input array. 314 * 315 * Creates list of users with given input array. 316 */ 317export const createUsersWithListInput = <ThrowOnError extends boolean = true>( 318 options?: Options<CreateUsersWithListInputData, ThrowOnError>, 319) => 320 (options?.client ?? client).post< 321 CreateUsersWithListInputResponses, 322 CreateUsersWithListInputErrors, 323 ThrowOnError, 324 'data' 325 >({ 326 responseStyle: 'data', 327 url: '/user/createWithList', 328 ...options, 329 headers: { 330 'Content-Type': 'application/json', 331 ...options?.headers, 332 }, 333 }); 334 335/** 336 * Logs user into the system. 337 * 338 * Log into the system. 339 */ 340export const loginUser = <ThrowOnError extends boolean = true>( 341 options?: Options<LoginUserData, ThrowOnError>, 342) => 343 (options?.client ?? client).get<LoginUserResponses, LoginUserErrors, ThrowOnError, 'data'>({ 344 responseStyle: 'data', 345 url: '/user/login', 346 ...options, 347 }); 348 349/** 350 * Logs out current logged in user session. 351 * 352 * Log user out of the system. 353 */ 354export const logoutUser = <ThrowOnError extends boolean = true>( 355 options?: Options<LogoutUserData, ThrowOnError>, 356) => 357 (options?.client ?? client).get<LogoutUserResponses, LogoutUserErrors, ThrowOnError, 'data'>({ 358 responseStyle: 'data', 359 url: '/user/logout', 360 ...options, 361 }); 362 363/** 364 * Delete user resource. 365 * 366 * This can only be done by the logged in user. 367 */ 368export const deleteUser = <ThrowOnError extends boolean = true>( 369 options: Options<DeleteUserData, ThrowOnError>, 370) => 371 (options.client ?? client).delete<DeleteUserResponses, DeleteUserErrors, ThrowOnError, 'data'>({ 372 responseStyle: 'data', 373 url: '/user/{username}', 374 ...options, 375 }); 376 377/** 378 * Get user by user name. 379 * 380 * Get user detail based on username. 381 */ 382export const getUserByName = <ThrowOnError extends boolean = true>( 383 options: Options<GetUserByNameData, ThrowOnError>, 384) => 385 (options.client ?? client).get<GetUserByNameResponses, GetUserByNameErrors, ThrowOnError, 'data'>( 386 { 387 responseStyle: 'data', 388 url: '/user/{username}', 389 ...options, 390 }, 391 ); 392 393/** 394 * Update user resource. 395 * 396 * This can only be done by the logged in user. 397 */ 398export const updateUser = <ThrowOnError extends boolean = true>( 399 options: Options<UpdateUserData, ThrowOnError>, 400) => 401 (options.client ?? client).put<UpdateUserResponses, UpdateUserErrors, ThrowOnError, 'data'>({ 402 responseStyle: 'data', 403 url: '/user/{username}', 404 ...options, 405 headers: { 406 'Content-Type': 'application/json', 407 ...options.headers, 408 }, 409 });