// This file is auto-generated by @hey-api/openapi-ts import { Injectable } from '@angular/core'; import type { Client, Options as Options2, TDataShape } from './client'; import { client } from './client.gen'; import type { AddPetData, AddPetErrors, AddPetResponses, CreateUserData, CreateUserErrors, CreateUserResponses, CreateUsersWithListInputData, CreateUsersWithListInputErrors, CreateUsersWithListInputResponses, DeleteOrderData, DeleteOrderErrors, DeleteOrderResponses, DeletePetData, DeletePetErrors, DeletePetResponses, DeleteUserData, DeleteUserErrors, DeleteUserResponses, FindPetsByStatusData, FindPetsByStatusErrors, FindPetsByStatusResponses, FindPetsByTagsData, FindPetsByTagsErrors, FindPetsByTagsResponses, GetInventoryData, GetInventoryErrors, GetInventoryResponses, GetOrderByIdData, GetOrderByIdErrors, GetOrderByIdResponses, GetPetByIdData, GetPetByIdErrors, GetPetByIdResponses, GetUserByNameData, GetUserByNameErrors, GetUserByNameResponses, LoginUserData, LoginUserErrors, LoginUserResponses, LogoutUserData, LogoutUserErrors, LogoutUserResponses, PlaceOrderData, PlaceOrderErrors, PlaceOrderResponses, UpdatePetData, UpdatePetErrors, UpdatePetResponses, UpdatePetWithFormData, UpdatePetWithFormErrors, UpdatePetWithFormResponses, UpdateUserData, UpdateUserErrors, UpdateUserResponses, UploadFileData, UploadFileErrors, UploadFileResponses, } from './types.gen'; export type Options< TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, > = Options2 & { /** * You can provide a client instance returned by `createClient()` instead of * individual options. This might be also useful if you want to implement a * custom client. */ client?: Client; /** * You can pass arbitrary values through the `meta` object. This can be * used to access values that aren't defined as part of the SDK function. */ meta?: Record; }; @Injectable({ providedIn: 'root' }) export class PetService { /** * Add a new pet to the store. * * Add a new pet to the store. */ public addPet( options: Options, ) { return (options.client ?? client).post< AddPetResponses, AddPetErrors, ThrowOnError >({ security: [{ scheme: 'bearer', type: 'http' }], url: '/pet', ...options, headers: { 'Content-Type': 'application/json', ...options.headers, }, }); } /** * Update an existing pet. * * Update an existing pet by Id. */ public updatePet( options: Options, ) { return (options.client ?? client).put< UpdatePetResponses, UpdatePetErrors, ThrowOnError >({ security: [{ scheme: 'bearer', type: 'http' }], url: '/pet', ...options, headers: { 'Content-Type': 'application/json', ...options.headers, }, }); } /** * Finds Pets by status. * * Multiple status values can be provided with comma separated strings. */ public findPetsByStatus( options: Options, ) { return (options.client ?? client).get< FindPetsByStatusResponses, FindPetsByStatusErrors, ThrowOnError >({ security: [{ scheme: 'bearer', type: 'http' }], url: '/pet/findByStatus', ...options, }); } /** * Finds Pets by tags. * * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. */ public findPetsByTags( options: Options, ) { return (options.client ?? client).get< FindPetsByTagsResponses, FindPetsByTagsErrors, ThrowOnError >({ security: [{ scheme: 'bearer', type: 'http' }], url: '/pet/findByTags', ...options, }); } /** * Deletes a pet. * * Delete a pet. */ public deletePet( options: Options, ) { return (options.client ?? client).delete< DeletePetResponses, DeletePetErrors, ThrowOnError >({ security: [{ scheme: 'bearer', type: 'http' }], url: '/pet/{petId}', ...options, }); } /** * Find pet by ID. * * Returns a single pet. */ public getPetById( options: Options, ) { return (options.client ?? client).get< GetPetByIdResponses, GetPetByIdErrors, ThrowOnError >({ security: [ { name: 'api_key', type: 'apiKey' }, { scheme: 'bearer', type: 'http' }, ], url: '/pet/{petId}', ...options, }); } /** * Updates a pet in the store with form data. * * Updates a pet resource based on the form data. */ public updatePetWithForm( options: Options, ) { return (options.client ?? client).post< UpdatePetWithFormResponses, UpdatePetWithFormErrors, ThrowOnError >({ security: [{ scheme: 'bearer', type: 'http' }], url: '/pet/{petId}', ...options, }); } /** * Uploads an image. * * Upload image of the pet. */ public uploadFile( options: Options, ) { return (options.client ?? client).post< UploadFileResponses, UploadFileErrors, ThrowOnError >({ bodySerializer: null, security: [{ scheme: 'bearer', type: 'http' }], url: '/pet/{petId}/uploadImage', ...options, headers: { 'Content-Type': 'application/octet-stream', ...options.headers, }, }); } } @Injectable({ providedIn: 'root' }) export class StoreService { /** * Returns pet inventories by status. * * Returns a map of status codes to quantities. */ public getInventory( options?: Options, ) { return (options?.client ?? client).get< GetInventoryResponses, GetInventoryErrors, ThrowOnError >({ security: [{ name: 'api_key', type: 'apiKey' }], url: '/store/inventory', ...options, }); } /** * Place an order for a pet. * * Place a new order in the store. */ public placeOrder( options?: Options, ) { return (options?.client ?? client).post< PlaceOrderResponses, PlaceOrderErrors, ThrowOnError >({ url: '/store/order', ...options, headers: { 'Content-Type': 'application/json', ...options?.headers, }, }); } /** * Delete purchase order by identifier. * * For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API errors. */ public deleteOrder( options: Options, ) { return (options.client ?? client).delete< DeleteOrderResponses, DeleteOrderErrors, ThrowOnError >({ url: '/store/order/{orderId}', ...options }); } /** * Find purchase order by ID. * * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. */ public getOrderById( options: Options, ) { return (options.client ?? client).get< GetOrderByIdResponses, GetOrderByIdErrors, ThrowOnError >({ url: '/store/order/{orderId}', ...options }); } } @Injectable({ providedIn: 'root' }) export class UserService { /** * Create user. * * This can only be done by the logged in user. */ public createUser( options?: Options, ) { return (options?.client ?? client).post< CreateUserResponses, CreateUserErrors, ThrowOnError >({ url: '/user', ...options, headers: { 'Content-Type': 'application/json', ...options?.headers, }, }); } /** * Creates list of users with given input array. * * Creates list of users with given input array. */ public createUsersWithListInput( options?: Options, ) { return (options?.client ?? client).post< CreateUsersWithListInputResponses, CreateUsersWithListInputErrors, ThrowOnError >({ url: '/user/createWithList', ...options, headers: { 'Content-Type': 'application/json', ...options?.headers, }, }); } /** * Logs user into the system. * * Log into the system. */ public loginUser( options?: Options, ) { return (options?.client ?? client).get< LoginUserResponses, LoginUserErrors, ThrowOnError >({ url: '/user/login', ...options }); } /** * Logs out current logged in user session. * * Log user out of the system. */ public logoutUser( options?: Options, ) { return (options?.client ?? client).get< LogoutUserResponses, LogoutUserErrors, ThrowOnError >({ url: '/user/logout', ...options }); } /** * Delete user resource. * * This can only be done by the logged in user. */ public deleteUser( options: Options, ) { return (options.client ?? client).delete< DeleteUserResponses, DeleteUserErrors, ThrowOnError >({ url: '/user/{username}', ...options }); } /** * Get user by user name. * * Get user detail based on username. */ public getUserByName( options: Options, ) { return (options.client ?? client).get< GetUserByNameResponses, GetUserByNameErrors, ThrowOnError >({ url: '/user/{username}', ...options }); } /** * Update user resource. * * This can only be done by the logged in user. */ public updateUser( options: Options, ) { return (options.client ?? client).put< UpdateUserResponses, UpdateUserErrors, ThrowOnError >({ url: '/user/{username}', ...options, headers: { 'Content-Type': 'application/json', ...options.headers, }, }); } }