···33import { client, type Options } from '@hey-api/client-fetch';
4455import type {
66- AddPetData,
77- AddPetResponse,
88- CreateUserData,
99- CreateUserResponse,
1010- CreateUsersWithListInputData,
1111- CreateUsersWithListInputResponse,
1212- DeleteOrderData,
1313- DeletePetData,
1414- DeleteUserData,
1515- FindPetsByStatusData,
1616- FindPetsByStatusResponse,
1717- FindPetsByTagsData,
1818- FindPetsByTagsResponse,
1919- GetInventoryResponse,
2020- GetOrderByIdData,
2121- GetOrderByIdResponse,
2222- GetPetByIdData,
2323- GetPetByIdResponse,
2424- GetUserByNameData,
2525- GetUserByNameResponse,
2626- LoginUserData,
2727- LoginUserResponse,
2828- LogoutUserResponse,
2929- PlaceOrderData,
3030- PlaceOrderResponse,
3131- UpdatePetData,
3232- UpdatePetResponse,
3333- UpdatePetWithFormData,
3434- UpdateUserData,
3535- UpdateUserResponse,
3636- UploadFileData,
3737- UploadFileResponse,
66+ BuyMuseumTicketsData,
77+ BuyMuseumTicketsResponse2,
88+ CreateSpecialEventData,
99+ CreateSpecialEventResponse,
1010+ DeleteSpecialEventData,
1111+ DeleteSpecialEventResponse,
1212+ GetMuseumHoursData,
1313+ GetMuseumHoursResponse2,
1414+ GetSpecialEventData,
1515+ GetSpecialEventResponse,
1616+ GetTicketCodeData,
1717+ GetTicketCodeResponse2,
1818+ ListSpecialEventsData,
1919+ ListSpecialEventsResponse2,
2020+ UpdateSpecialEventData,
2121+ UpdateSpecialEventResponse,
3822} from './types.gen';
39234024/**
4141- * Add a new pet to the store
4242- * Add a new pet to the store
4343- * @param data The data for the request.
4444- * @param data.requestBody Create a new pet in the store
4545- * @returns Pet Successful operation
4646- * @throws ApiError
4747- */
4848-export const addPet = (options: Options<AddPetData>) =>
4949- client.post<AddPetResponse>({
5050- ...options,
5151- url: '/pet',
5252- });
5353-5454-/**
5555- * Update an existing pet
5656- * Update an existing pet by Id
5757- * @param data The data for the request.
5858- * @param data.requestBody Update an existent pet in the store
5959- * @returns Pet Successful operation
6060- * @throws ApiError
6161- */
6262-export const updatePet = (options: Options<UpdatePetData>) =>
6363- client.put<UpdatePetResponse>({
6464- ...options,
6565- url: '/pet',
6666- });
6767-6868-/**
6969- * Finds Pets by status
7070- * Multiple status values can be provided with comma separated strings
7171- * @param data The data for the request.
7272- * @param data.status Status values that need to be considered for filter
7373- * @returns Pet successful operation
7474- * @throws ApiError
7575- */
7676-export const findPetsByStatus = (options?: Options<FindPetsByStatusData>) =>
7777- client.get<FindPetsByStatusResponse>({
7878- ...options,
7979- url: '/pet/findByStatus',
8080- });
8181-8282-/**
8383- * Finds Pets by tags
8484- * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
8585- * @param data The data for the request.
8686- * @param data.tags Tags to filter by
8787- * @returns Pet successful operation
8888- * @throws ApiError
8989- */
9090-export const findPetsByTags = (options?: Options<FindPetsByTagsData>) =>
9191- client.get<FindPetsByTagsResponse>({
9292- ...options,
9393- url: '/pet/findByTags',
9494- });
9595-9696-/**
9797- * Find pet by ID
9898- * Returns a single pet
9999- * @param data The data for the request.
100100- * @param data.petId ID of pet to return
101101- * @returns Pet successful operation
102102- * @throws ApiError
103103- */
104104-export const getPetById = (options: Options<GetPetByIdData>) =>
105105- client.get<GetPetByIdResponse>({
106106- ...options,
107107- url: '/pet/{petId}',
108108- });
109109-110110-/**
111111- * Updates a pet in the store with form data
112112- * @param data The data for the request.
113113- * @param data.petId ID of pet that needs to be updated
114114- * @param data.name Name of pet that needs to be updated
115115- * @param data.status Status of pet that needs to be updated
116116- * @throws ApiError
117117- */
118118-export const updatePetWithForm = (options: Options<UpdatePetWithFormData>) =>
119119- client.post<void>({
120120- ...options,
121121- url: '/pet/{petId}',
122122- });
123123-124124-/**
125125- * Deletes a pet
2525+ * Get museum hours
2626+ * Get upcoming museum operating hours.
12627 * @param data The data for the request.
127127- * @param data.petId Pet id to delete
128128- * @param data.apiKey
129129- * @throws ApiError
130130- */
131131-export const deletePet = (options: Options<DeletePetData>) =>
132132- client.delete<void>({
133133- ...options,
134134- url: '/pet/{petId}',
135135- });
136136-137137-/**
138138- * uploads an image
139139- * @param data The data for the request.
140140- * @param data.petId ID of pet to update
141141- * @param data.additionalMetadata Additional Metadata
142142- * @param data.requestBody
143143- * @returns ApiResponse successful operation
144144- * @throws ApiError
145145- */
146146-export const uploadFile = (options: Options<UploadFileData>) =>
147147- client.post<UploadFileResponse>({
148148- ...options,
149149- url: '/pet/{petId}/uploadImage',
150150- });
151151-152152-/**
153153- * Returns pet inventories by status
154154- * Returns a map of status codes to quantities
155155- * @returns number successful operation
2828+ * @param data.startDate Starting date to retrieve future operating hours from. Defaults to today's date.
2929+ * @param data.page Page number to retrieve.
3030+ * @param data.limit Number of days per page.
3131+ * @returns GetMuseumHoursResponse Success.
15632 * @throws ApiError
15733 */
158158-export const getInventory = (options?: Options) =>
159159- client.get<GetInventoryResponse>({
3434+export const getMuseumHours = (options?: Options<GetMuseumHoursData>) =>
3535+ client.get<GetMuseumHoursResponse2>({
16036 ...options,
161161- url: '/store/inventory',
3737+ url: '/museum-hours',
16238 });
1633916440/**
165165- * Place an order for a pet
166166- * Place a new order in the store
4141+ * Create special events
4242+ * Creates a new special event for the museum.
16743 * @param data The data for the request.
16844 * @param data.requestBody
169169- * @returns Order successful operation
4545+ * @returns SpecialEventResponse Success.
17046 * @throws ApiError
17147 */
172172-export const placeOrder = (options?: Options<PlaceOrderData>) =>
173173- client.post<PlaceOrderResponse>({
174174- ...options,
175175- url: '/store/order',
176176- });
177177-178178-/**
179179- * Find purchase order by ID
180180- * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
181181- * @param data The data for the request.
182182- * @param data.orderId ID of order that needs to be fetched
183183- * @returns Order successful operation
184184- * @throws ApiError
185185- */
186186-export const getOrderById = (options: Options<GetOrderByIdData>) =>
187187- client.get<GetOrderByIdResponse>({
4848+export const createSpecialEvent = (options: Options<CreateSpecialEventData>) =>
4949+ client.post<CreateSpecialEventResponse>({
18850 ...options,
189189- url: '/store/order/{orderId}',
5151+ url: '/special-events',
19052 });
1915319254/**
193193- * Delete purchase order by ID
194194- * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
5555+ * List special events
5656+ * Return a list of upcoming special events at the museum.
19557 * @param data The data for the request.
196196- * @param data.orderId ID of the order that needs to be deleted
5858+ * @param data.startDate Starting date to retrieve future operating hours from. Defaults to today's date.
5959+ * @param data.endDate End of a date range to retrieve special events for. Defaults to 7 days after `startDate`.
6060+ * @param data.page Page number to retrieve.
6161+ * @param data.limit Number of days per page.
6262+ * @returns ListSpecialEventsResponse Success.
19763 * @throws ApiError
19864 */
199199-export const deleteOrder = (options: Options<DeleteOrderData>) =>
200200- client.delete<void>({
6565+export const listSpecialEvents = (options?: Options<ListSpecialEventsData>) =>
6666+ client.get<ListSpecialEventsResponse2>({
20167 ...options,
202202- url: '/store/order/{orderId}',
6868+ url: '/special-events',
20369 });
2047020571/**
206206- * Create user
207207- * This can only be done by the logged in user.
7272+ * Get special event
7373+ * Get details about a special event.
20874 * @param data The data for the request.
209209- * @param data.requestBody Created user object
210210- * @returns User successful operation
7575+ * @param data.eventId Identifier for a special event.
7676+ * @returns SpecialEventResponse Success.
21177 * @throws ApiError
21278 */
213213-export const createUser = (options?: Options<CreateUserData>) =>
214214- client.post<CreateUserResponse>({
7979+export const getSpecialEvent = (options: Options<GetSpecialEventData>) =>
8080+ client.get<GetSpecialEventResponse>({
21581 ...options,
216216- url: '/user',
8282+ url: '/special-events/{eventId}',
21783 });
2188421985/**
220220- * Creates list of users with given input array
221221- * Creates list of users with given input array
8686+ * Update special event
8787+ * Update the details of a special event.
22288 * @param data The data for the request.
8989+ * @param data.eventId Identifier for a special event.
22390 * @param data.requestBody
224224- * @returns User Successful operation
225225- * @returns unknown successful operation
9191+ * @returns SpecialEventResponse Success.
22692 * @throws ApiError
22793 */
228228-export const createUsersWithListInput = (
229229- options?: Options<CreateUsersWithListInputData>,
230230-) =>
231231- client.post<CreateUsersWithListInputResponse>({
9494+export const updateSpecialEvent = (options: Options<UpdateSpecialEventData>) =>
9595+ client.patch<UpdateSpecialEventResponse>({
23296 ...options,
233233- url: '/user/createWithList',
9797+ url: '/special-events/{eventId}',
23498 });
23599236100/**
237237- * Logs user into the system
238238- * @param data The data for the request.
239239- * @param data.username The user name for login
240240- * @param data.password The password for login in clear text
241241- * @returns string successful operation
242242- * @throws ApiError
243243- */
244244-export const loginUser = (options?: Options<LoginUserData>) =>
245245- client.get<LoginUserResponse>({
246246- ...options,
247247- url: '/user/login',
248248- });
249249-250250-/**
251251- * Logs out current logged in user session
252252- * @returns unknown successful operation
253253- * @throws ApiError
254254- */
255255-export const logoutUser = (options?: Options) =>
256256- client.get<LogoutUserResponse>({
257257- ...options,
258258- url: '/user/logout',
259259- });
260260-261261-/**
262262- * Get user by user name
101101+ * Delete special event
102102+ * Delete a special event from the collection. Allows museum to cancel planned events.
263103 * @param data The data for the request.
264264- * @param data.username The name that needs to be fetched. Use user1 for testing.
265265- * @returns User successful operation
104104+ * @param data.eventId Identifier for a special event.
105105+ * @returns void Success - no content.
266106 * @throws ApiError
267107 */
268268-export const getUserByName = (options: Options<GetUserByNameData>) =>
269269- client.get<GetUserByNameResponse>({
108108+export const deleteSpecialEvent = (options: Options<DeleteSpecialEventData>) =>
109109+ client.delete<DeleteSpecialEventResponse>({
270110 ...options,
271271- url: '/user/{username}',
111111+ url: '/special-events/{eventId}',
272112 });
273113274114/**
275275- * Update user
276276- * This can only be done by the logged in user.
115115+ * Buy museum tickets
116116+ * Purchase museum tickets for general entry or special events.
277117 * @param data The data for the request.
278278- * @param data.username name that needs to be updated
279279- * @param data.requestBody Update an existent user in the store
280280- * @returns unknown successful operation
118118+ * @param data.requestBody
119119+ * @returns BuyMuseumTicketsResponse Success.
281120 * @throws ApiError
282121 */
283283-export const updateUser = (options: Options<UpdateUserData>) =>
284284- client.put<UpdateUserResponse>({
122122+export const buyMuseumTickets = (options: Options<BuyMuseumTicketsData>) =>
123123+ client.post<BuyMuseumTicketsResponse2>({
285124 ...options,
286286- url: '/user/{username}',
125125+ url: '/tickets',
287126 });
288127289128/**
290290- * Delete user
291291- * This can only be done by the logged in user.
129129+ * Get ticket QR code
130130+ * Return an image of your ticket with scannable QR code. Used for event entry.
292131 * @param data The data for the request.
293293- * @param data.username The name that needs to be deleted
132132+ * @param data.ticketId Identifier for a ticket to a museum event. Used to generate ticket image.
133133+ * @returns GetTicketCodeResponse Scannable event ticket in image format.
294134 * @throws ApiError
295135 */
296296-export const deleteUser = (options: Options<DeleteUserData>) =>
297297- client.delete<void>({
136136+export const getTicketCode = (options: Options<GetTicketCodeData>) =>
137137+ client.get<GetTicketCodeResponse2>({
298138 ...options,
299299- url: '/user/{username}',
139139+ url: '/tickets/{ticketId}/qr',
300140 });
+281-496
examples/openapi-ts-fetch/src/client/types.gen.ts
···11// This file is auto-generated by @hey-api/openapi-ts
2233-export type Order = {
44- id?: number;
55- petId?: number;
66- quantity?: number;
77- shipDate?: string;
33+/**
44+ * Type of ticket being purchased. Use `general` for regular museum entry and `event` for tickets to special events.
55+ */
66+export type TicketType = 'event' | 'general';
77+88+export type Date = string;
99+1010+/**
1111+ * Email address for ticket purchaser.
1212+ */
1313+export type Email = string;
1414+1515+/**
1616+ * Phone number for the ticket purchaser (optional).
1717+ */
1818+export type Phone = string;
1919+2020+/**
2121+ * Request payload used for purchasing museum tickets.
2222+ */
2323+export type BuyMuseumTicketsRequest = {
2424+ ticketType: TicketType;
2525+ /**
2626+ * Unique identifier for a special event. Required if purchasing tickets for the museum's special events.
2727+ */
2828+ eventId?: EventId;
829 /**
99- * Order Status
3030+ * Date that the ticket is valid for.
1031 */
1111- status?: 'placed' | 'approved' | 'delivered';
1212- complete?: boolean;
3232+ ticketDate: Date;
3333+ email: Email;
3434+ phone?: Phone;
1335};
14361515-export type Customer = {
1616- id?: number;
1717- username?: string;
1818- address?: Array<Address>;
1919-};
3737+/**
3838+ * Confirmation message after a ticket purchase.
3939+ */
4040+export type TicketMessage = string;
20412121-export type Address = {
2222- street?: string;
2323- city?: string;
2424- state?: string;
2525- zip?: string;
2626-};
4242+/**
4343+ * Unique identifier for museum ticket. Generated when purchased.
4444+ */
4545+export type TicketId = string;
27462828-export type Category = {
2929- id?: number;
3030- name?: string;
3131-};
4747+/**
4848+ * Unique confirmation code used to verify ticket purchase.
4949+ */
5050+export type TicketConfirmation = string;
32513333-export type User = {
3434- id?: number;
3535- username?: string;
3636- firstName?: string;
3737- lastName?: string;
3838- email?: string;
3939- password?: string;
4040- phone?: string;
5252+/**
5353+ * Details for a museum ticket after a successful purchase.
5454+ */
5555+export type BuyMuseumTicketsResponse = {
5656+ message: TicketMessage;
5757+ eventName?: EventName;
5858+ ticketId: TicketId;
5959+ ticketType: TicketType;
4160 /**
4242- * User Status
6161+ * Date the ticket is valid for.
4362 */
4444- userStatus?: number;
6363+ ticketDate: Date;
6464+ confirmationCode: TicketConfirmation;
4565};
46664747-export type Tag = {
4848- id?: number;
4949- name?: string;
5050-};
6767+/**
6868+ * Image of a ticket with a QR code used for museum or event entry.
6969+ */
7070+export type GetTicketCodeResponse = Blob | File;
7171+7272+/**
7373+ * List of museum operating hours for consecutive days.
7474+ */
7575+export type GetMuseumHoursResponse = Array<MuseumDailyHours>;
51765252-export type Pet = {
5353- id?: number;
5454- name: string;
5555- category?: Category;
5656- photoUrls: Array<string>;
5757- tags?: Array<Tag>;
7777+/**
7878+ * Daily operating hours for the museum.
7979+ */
8080+export type MuseumDailyHours = {
8181+ /**
8282+ * Date the operating hours apply to.
8383+ */
8484+ date: Date;
8585+ /**
8686+ * Time the museum opens on a specific date. Uses 24 hour time format (`HH:mm`).
8787+ */
8888+ timeOpen: string;
5889 /**
5959- * pet status in the store
9090+ * Time the museum closes on a specific date. Uses 24 hour time format (`HH:mm`).
6091 */
6161- status?: 'available' | 'pending' | 'sold';
9292+ timeClose: string;
6293};
63946464-export type ApiResponse = {
6565- code?: number;
6666- type?: string;
6767- message?: string;
9595+/**
9696+ * Identifier for a special event.
9797+ */
9898+export type EventId = string;
9999+100100+/**
101101+ * Name of the special event.
102102+ */
103103+export type EventName = string;
104104+105105+/**
106106+ * Location where the special event is held.
107107+ */
108108+export type EventLocation = string;
109109+110110+/**
111111+ * Description of the special event.
112112+ */
113113+export type EventDescription = string;
114114+115115+/**
116116+ * List of planned dates for the special event.
117117+ */
118118+export type EventDates = Array<Date>;
119119+120120+/**
121121+ * Price of a ticket for the special event.
122122+ */
123123+export type EventPrice = number;
124124+125125+/**
126126+ * Request payload for creating new special events at the museum.
127127+ */
128128+export type CreateSpecialEventRequest = {
129129+ name: EventName;
130130+ location: EventLocation;
131131+ eventDescription: EventDescription;
132132+ dates: EventDates;
133133+ price: EventPrice;
68134};
691357070-export type AddPetData = {
7171- /**
7272- * Create a new pet in the store
7373- */
7474- body: Pet;
136136+/**
137137+ * Request payload for updating an existing special event. Only included fields are updated in the event.
138138+ */
139139+export type UpdateSpecialEventRequest = {
140140+ name?: EventName;
141141+ location?: EventLocation;
142142+ eventDescription?: EventDescription;
143143+ dates?: EventDates;
144144+ price?: EventPrice;
75145};
761467777-export type AddPetResponse = Pet;
147147+/**
148148+ * List of upcoming special events.
149149+ */
150150+export type ListSpecialEventsResponse = Array<SpecialEventResponse>;
781517979-export type UpdatePetData = {
8080- /**
8181- * Update an existent pet in the store
8282- */
8383- body: Pet;
152152+/**
153153+ * Information about a special event.
154154+ */
155155+export type SpecialEventResponse = {
156156+ eventId: EventId;
157157+ name: EventName;
158158+ location: EventLocation;
159159+ eventDescription: EventDescription;
160160+ dates: EventDates;
161161+ price: EventPrice;
84162};
851638686-export type UpdatePetResponse = Pet;
164164+export type Error = {
165165+ type?: string;
166166+ title?: string;
167167+};
871688888-export type FindPetsByStatusData = {
8989- query?: {
9090- /**
9191- * Status values that need to be considered for filter
9292- */
9393- status?: 'available' | 'pending' | 'sold';
9494- };
9595-};
169169+/**
170170+ * Page number to retrieve.
171171+ */
172172+export type ParameterPaginationPage = number;
961739797-export type FindPetsByStatusResponse = Array<Pet>;
174174+/**
175175+ * Number of days per page.
176176+ */
177177+export type ParameterPaginationLimit = number;
981789999-export type FindPetsByTagsData = {
100100- query?: {
101101- /**
102102- * Tags to filter by
103103- */
104104- tags?: Array<string>;
105105- };
106106-};
179179+/**
180180+ * Identifier for a special event.
181181+ */
182182+export type ParameterEventId = string;
107183108108-export type FindPetsByTagsResponse = Array<Pet>;
184184+/**
185185+ * Starting date to retrieve future operating hours from. Defaults to today's date.
186186+ */
187187+export type ParameterStartDate = string;
109188110110-export type GetPetByIdData = {
111111- path: {
112112- /**
113113- * ID of pet to return
114114- */
115115- petId: number;
116116- };
117117-};
189189+/**
190190+ * End of a date range to retrieve special events for. Defaults to 7 days after `startDate`.
191191+ */
192192+export type ParameterEndDate = string;
118193119119-export type GetPetByIdResponse = Pet;
194194+/**
195195+ * Identifier for a ticket to a museum event. Used to generate ticket image.
196196+ */
197197+export type ParameterTicketId = string;
120198121121-export type UpdatePetWithFormData = {
122122- path: {
199199+export type GetMuseumHoursData = {
200200+ query?: {
123201 /**
124124- * ID of pet that needs to be updated
202202+ * Number of days per page.
125203 */
126126- petId: number;
127127- };
128128- query?: {
204204+ limit?: number;
129205 /**
130130- * Name of pet that needs to be updated
206206+ * Page number to retrieve.
131207 */
132132- name?: string;
208208+ page?: number;
133209 /**
134134- * Status of pet that needs to be updated
210210+ * Starting date to retrieve future operating hours from. Defaults to today's date.
135211 */
136136- status?: string;
212212+ startDate?: string;
137213 };
138214};
139215140140-export type DeletePetData = {
141141- header?: {
142142- apiKey?: string;
143143- };
144144- path: {
145145- /**
146146- * Pet id to delete
147147- */
148148- petId: number;
149149- };
216216+export type GetMuseumHoursResponse2 = GetMuseumHoursResponse;
217217+218218+export type CreateSpecialEventData = {
219219+ body: CreateSpecialEventRequest;
150220};
151221152152-export type UploadFileData = {
153153- body?: Blob | File;
154154- path: {
222222+export type CreateSpecialEventResponse = SpecialEventResponse;
223223+224224+export type ListSpecialEventsData = {
225225+ query?: {
155226 /**
156156- * ID of pet to update
227227+ * End of a date range to retrieve special events for. Defaults to 7 days after `startDate`.
228228+ */
229229+ endDate?: string;
230230+ /**
231231+ * Number of days per page.
157232 */
158158- petId: number;
159159- };
160160- query?: {
233233+ limit?: number;
161234 /**
162162- * Additional Metadata
235235+ * Page number to retrieve.
163236 */
164164- additionalMetadata?: string;
165165- };
166166-};
167167-168168-export type UploadFileResponse = ApiResponse;
169169-170170-export type GetInventoryResponse = {
171171- [key: string]: number;
172172-};
173173-174174-export type PlaceOrderData = {
175175- body?: Order;
176176-};
177177-178178-export type PlaceOrderResponse = Order;
179179-180180-export type GetOrderByIdData = {
181181- path: {
237237+ page?: number;
182238 /**
183183- * ID of order that needs to be fetched
239239+ * Starting date to retrieve future operating hours from. Defaults to today's date.
184240 */
185185- orderId: number;
241241+ startDate?: string;
186242 };
187243};
188244189189-export type GetOrderByIdResponse = Order;
245245+export type ListSpecialEventsResponse2 = ListSpecialEventsResponse;
190246191191-export type DeleteOrderData = {
247247+export type GetSpecialEventData = {
192248 path: {
193249 /**
194194- * ID of the order that needs to be deleted
250250+ * Identifier for a special event.
195251 */
196196- orderId: number;
252252+ eventId: string;
197253 };
198254};
199255200200-export type CreateUserData = {
201201- /**
202202- * Created user object
203203- */
204204- body?: User;
205205-};
256256+export type GetSpecialEventResponse = SpecialEventResponse;
206257207207-export type CreateUserResponse = User;
208208-209209-export type CreateUsersWithListInputData = {
210210- body?: Array<User>;
211211-};
212212-213213-export type CreateUsersWithListInputResponse = User | unknown;
214214-215215-export type LoginUserData = {
216216- query?: {
217217- /**
218218- * The password for login in clear text
219219- */
220220- password?: string;
258258+export type UpdateSpecialEventData = {
259259+ body: UpdateSpecialEventRequest;
260260+ path: {
221261 /**
222222- * The user name for login
262262+ * Identifier for a special event.
223263 */
224224- username?: string;
264264+ eventId: string;
225265 };
226266};
227267228228-export type LoginUserResponse = string;
229229-230230-export type LogoutUserResponse = unknown;
268268+export type UpdateSpecialEventResponse = SpecialEventResponse;
231269232232-export type GetUserByNameData = {
270270+export type DeleteSpecialEventData = {
233271 path: {
234272 /**
235235- * The name that needs to be fetched. Use user1 for testing.
273273+ * Identifier for a special event.
236274 */
237237- username: string;
275275+ eventId: string;
238276 };
239277};
240278241241-export type GetUserByNameResponse = User;
279279+export type DeleteSpecialEventResponse = void;
242280243243-export type UpdateUserData = {
244244- /**
245245- * Update an existent user in the store
246246- */
247247- body?: User;
248248- path: {
249249- /**
250250- * name that needs to be updated
251251- */
252252- username: string;
253253- };
281281+export type BuyMuseumTicketsData = {
282282+ body: BuyMuseumTicketsRequest;
254283};
255284256256-export type UpdateUserResponse = unknown;
285285+export type BuyMuseumTicketsResponse2 = BuyMuseumTicketsResponse;
257286258258-export type DeleteUserData = {
287287+export type GetTicketCodeData = {
259288 path: {
260289 /**
261261- * The name that needs to be deleted
290290+ * Identifier for a ticket to a museum event. Used to generate ticket image.
262291 */
263263- username: string;
292292+ ticketId: string;
264293 };
265294};
295295+296296+export type GetTicketCodeResponse2 = GetTicketCodeResponse;
266297267298export type $OpenApiTs = {
268268- '/pet': {
269269- post: {
270270- req: {
271271- /**
272272- * Create a new pet in the store
273273- */
274274- body: Pet;
275275- };
276276- res: {
277277- /**
278278- * Successful operation
279279- */
280280- 200: Pet;
281281- /**
282282- * Invalid input
283283- */
284284- 405: unknown;
285285- };
286286- };
287287- put: {
288288- req: {
289289- /**
290290- * Update an existent pet in the store
291291- */
292292- body: Pet;
293293- };
294294- res: {
295295- /**
296296- * Successful operation
297297- */
298298- 200: Pet;
299299- /**
300300- * Invalid ID supplied
301301- */
302302- 400: unknown;
303303- /**
304304- * Pet not found
305305- */
306306- 404: unknown;
307307- /**
308308- * Validation exception
309309- */
310310- 405: unknown;
311311- };
312312- };
313313- };
314314- '/pet/findByStatus': {
299299+ '/museum-hours': {
315300 get: {
316316- req: {
317317- query?: {
318318- /**
319319- * Status values that need to be considered for filter
320320- */
321321- status?: 'available' | 'pending' | 'sold';
322322- };
323323- };
301301+ req: GetMuseumHoursData;
324302 res: {
325303 /**
326326- * successful operation
327327- */
328328- 200: Array<Pet>;
329329- /**
330330- * Invalid status value
304304+ * Success.
331305 */
332332- 400: unknown;
333333- };
334334- };
335335- };
336336- '/pet/findByTags': {
337337- get: {
338338- req: {
339339- query?: {
340340- /**
341341- * Tags to filter by
342342- */
343343- tags?: Array<string>;
344344- };
345345- };
346346- res: {
306306+ 200: GetMuseumHoursResponse;
347307 /**
348348- * successful operation
308308+ * Bad request.
349309 */
350350- 200: Array<Pet>;
310310+ 400: Error;
351311 /**
352352- * Invalid tag value
312312+ * Not found.
353313 */
354354- 400: unknown;
314314+ 404: Error;
355315 };
356316 };
357317 };
358358- '/pet/{petId}': {
359359- get: {
360360- req: {
361361- path: {
362362- /**
363363- * ID of pet to return
364364- */
365365- petId: number;
366366- };
367367- };
318318+ '/special-events': {
319319+ post: {
320320+ req: ListSpecialEventsData;
368321 res: {
369322 /**
370370- * successful operation
323323+ * Success.
371324 */
372372- 200: Pet;
325325+ 200: SpecialEventResponse;
373326 /**
374374- * Invalid ID supplied
327327+ * Bad request.
375328 */
376376- 400: unknown;
329329+ 400: Error;
377330 /**
378378- * Pet not found
331331+ * Not found.
379332 */
380380- 404: unknown;
333333+ 404: Error;
381334 };
382335 };
383383- post: {
384384- req: {
385385- path: {
386386- /**
387387- * ID of pet that needs to be updated
388388- */
389389- petId: number;
390390- };
391391- query?: {
392392- /**
393393- * Name of pet that needs to be updated
394394- */
395395- name?: string;
396396- /**
397397- * Status of pet that needs to be updated
398398- */
399399- status?: string;
400400- };
401401- };
336336+ get: {
337337+ req: ListSpecialEventsData;
402338 res: {
403339 /**
404404- * Invalid input
340340+ * Success.
405341 */
406406- 405: unknown;
407407- };
408408- };
409409- delete: {
410410- req: {
411411- header?: {
412412- apiKey?: string;
413413- };
414414- path: {
415415- /**
416416- * Pet id to delete
417417- */
418418- petId: number;
419419- };
420420- };
421421- res: {
342342+ 200: ListSpecialEventsResponse;
422343 /**
423423- * Invalid pet value
344344+ * Bad request.
424345 */
425425- 400: unknown;
426426- };
427427- };
428428- };
429429- '/pet/{petId}/uploadImage': {
430430- post: {
431431- req: {
432432- body?: Blob | File;
433433- path: {
434434- /**
435435- * ID of pet to update
436436- */
437437- petId: number;
438438- };
439439- query?: {
440440- /**
441441- * Additional Metadata
442442- */
443443- additionalMetadata?: string;
444444- };
445445- };
446446- res: {
346346+ 400: Error;
447347 /**
448448- * successful operation
348348+ * Not found.
449349 */
450450- 200: ApiResponse;
350350+ 404: Error;
451351 };
452352 };
453353 };
454454- '/store/inventory': {
354354+ '/special-events/{eventId}': {
455355 get: {
356356+ req: DeleteSpecialEventData;
456357 res: {
457358 /**
458458- * successful operation
359359+ * Success.
459360 */
460460- 200: {
461461- [key: string]: number;
462462- };
463463- };
464464- };
465465- };
466466- '/store/order': {
467467- post: {
468468- req: {
469469- body?: Order;
470470- };
471471- res: {
361361+ 200: SpecialEventResponse;
472362 /**
473473- * successful operation
363363+ * Bad request.
474364 */
475475- 200: Order;
365365+ 400: Error;
476366 /**
477477- * Invalid input
367367+ * Not found.
478368 */
479479- 405: unknown;
369369+ 404: Error;
480370 };
481371 };
482482- };
483483- '/store/order/{orderId}': {
484484- get: {
485485- req: {
486486- path: {
487487- /**
488488- * ID of order that needs to be fetched
489489- */
490490- orderId: number;
491491- };
492492- };
372372+ patch: {
373373+ req: DeleteSpecialEventData;
493374 res: {
494375 /**
495495- * successful operation
376376+ * Success.
496377 */
497497- 200: Order;
378378+ 200: SpecialEventResponse;
498379 /**
499499- * Invalid ID supplied
380380+ * Bad request.
500381 */
501501- 400: unknown;
382382+ 400: Error;
502383 /**
503503- * Order not found
384384+ * Not found.
504385 */
505505- 404: unknown;
386386+ 404: Error;
506387 };
507388 };
508389 delete: {
509509- req: {
510510- path: {
511511- /**
512512- * ID of the order that needs to be deleted
513513- */
514514- orderId: number;
515515- };
516516- };
390390+ req: DeleteSpecialEventData;
517391 res: {
518392 /**
519519- * Invalid ID supplied
393393+ * Success - no content.
520394 */
521521- 400: unknown;
395395+ 204: void;
522396 /**
523523- * Order not found
397397+ * Bad request.
524398 */
525525- 404: unknown;
526526- };
527527- };
528528- };
529529- '/user': {
530530- post: {
531531- req: {
399399+ 400: Error;
532400 /**
533533- * Created user object
401401+ * Unauthorized.
534402 */
535535- body?: User;
536536- };
537537- res: {
403403+ 401: Error;
538404 /**
539539- * successful operation
405405+ * Not found.
540406 */
541541- default: User;
407407+ 404: Error;
542408 };
543409 };
544410 };
545545- '/user/createWithList': {
411411+ '/tickets': {
546412 post: {
547547- req: {
548548- body?: Array<User>;
549549- };
550550- res: {
551551- /**
552552- * Successful operation
553553- */
554554- 200: User;
555555- /**
556556- * successful operation
557557- */
558558- default: unknown;
559559- };
560560- };
561561- };
562562- '/user/login': {
563563- get: {
564564- req: {
565565- query?: {
566566- /**
567567- * The password for login in clear text
568568- */
569569- password?: string;
570570- /**
571571- * The user name for login
572572- */
573573- username?: string;
574574- };
575575- };
413413+ req: BuyMuseumTicketsData;
576414 res: {
577415 /**
578578- * successful operation
416416+ * Success.
579417 */
580580- 200: string;
418418+ 200: BuyMuseumTicketsResponse;
581419 /**
582582- * Invalid username/password supplied
420420+ * Bad request.
583421 */
584584- 400: unknown;
585585- };
586586- };
587587- };
588588- '/user/logout': {
589589- get: {
590590- res: {
422422+ 400: Error;
591423 /**
592592- * successful operation
424424+ * Not found.
593425 */
594594- default: unknown;
426426+ 404: Error;
595427 };
596428 };
597429 };
598598- '/user/{username}': {
430430+ '/tickets/{ticketId}/qr': {
599431 get: {
600600- req: {
601601- path: {
602602- /**
603603- * The name that needs to be fetched. Use user1 for testing.
604604- */
605605- username: string;
606606- };
607607- };
432432+ req: GetTicketCodeData;
608433 res: {
609434 /**
610610- * successful operation
435435+ * Scannable event ticket in image format.
611436 */
612612- 200: User;
437437+ 200: GetTicketCodeResponse;
613438 /**
614614- * Invalid username supplied
615615- */
616616- 400: unknown;
617617- /**
618618- * User not found
619619- */
620620- 404: unknown;
621621- };
622622- };
623623- put: {
624624- req: {
625625- /**
626626- * Update an existent user in the store
627627- */
628628- body?: User;
629629- path: {
630630- /**
631631- * name that needs to be updated
632632- */
633633- username: string;
634634- };
635635- };
636636- res: {
637637- /**
638638- * successful operation
639639- */
640640- default: unknown;
641641- };
642642- };
643643- delete: {
644644- req: {
645645- path: {
646646- /**
647647- * The name that needs to be deleted
648648- */
649649- username: string;
650650- };
651651- };
652652- res: {
653653- /**
654654- * Invalid username supplied
439439+ * Bad request.
655440 */
656656- 400: unknown;
441441+ 400: Error;
657442 /**
658658- * User not found
443443+ * Not found.
659444 */
660660- 404: unknown;
445445+ 404: Error;
661446 };
662447 };
663448 };
···11-// This file is auto-generated by @hey-api/openapi-ts
22-33-import type { CancelablePromise } from '@hey-api/client-fetch';
44-import { OpenAPI } from '@hey-api/client-fetch';
55-import { request as __request } from '@hey-api/client-fetch';
66-77-import type {
88- AddPetData,
99- AddPetResponse,
1010- CreateUserData,
1111- CreateUserResponse,
1212- CreateUsersWithListInputData,
1313- CreateUsersWithListInputResponse,
1414- DeleteOrderData,
1515- DeletePetData,
1616- DeleteUserData,
1717- FindPetsByStatusData,
1818- FindPetsByStatusResponse,
1919- FindPetsByTagsData,
2020- FindPetsByTagsResponse,
2121- GetInventoryResponse,
2222- GetOrderByIdData,
2323- GetOrderByIdResponse,
2424- GetPetByIdData,
2525- GetPetByIdResponse,
2626- GetUserByNameData,
2727- GetUserByNameResponse,
2828- LoginUserData,
2929- LoginUserResponse,
3030- LogoutUserResponse,
3131- PlaceOrderData,
3232- PlaceOrderResponse,
3333- UpdatePetData,
3434- UpdatePetResponse,
3535- UpdatePetWithFormData,
3636- UpdateUserData,
3737- UpdateUserResponse,
3838- UploadFileData,
3939- UploadFileResponse,
4040-} from './types.gen';
4141-4242-export class PetService {
4343- /**
4444- * Add a new pet to the store
4545- * Add a new pet to the store
4646- * @param data The data for the request.
4747- * @param data.requestBody Create a new pet in the store
4848- * @returns Pet Successful operation
4949- * @throws ApiError
5050- */
5151- public static addPet(data: AddPetData): CancelablePromise<AddPetResponse> {
5252- return __request(OpenAPI, {
5353- body: data.requestBody,
5454- errors: {
5555- 405: 'Invalid input',
5656- },
5757- mediaType: 'application/json',
5858- method: 'POST',
5959- url: '/pet',
6060- });
6161- }
6262-6363- /**
6464- * Update an existing pet
6565- * Update an existing pet by Id
6666- * @param data The data for the request.
6767- * @param data.requestBody Update an existent pet in the store
6868- * @returns Pet Successful operation
6969- * @throws ApiError
7070- */
7171- public static updatePet(
7272- data: UpdatePetData,
7373- ): CancelablePromise<UpdatePetResponse> {
7474- return __request(OpenAPI, {
7575- body: data.requestBody,
7676- errors: {
7777- 400: 'Invalid ID supplied',
7878- 404: 'Pet not found',
7979- 405: 'Validation exception',
8080- },
8181- mediaType: 'application/json',
8282- method: 'PUT',
8383- url: '/pet',
8484- });
8585- }
8686-8787- /**
8888- * Finds Pets by status
8989- * Multiple status values can be provided with comma separated strings
9090- * @param data The data for the request.
9191- * @param data.status Status values that need to be considered for filter
9292- * @returns Pet successful operation
9393- * @throws ApiError
9494- */
9595- public static findPetsByStatus(
9696- data: FindPetsByStatusData = {},
9797- ): CancelablePromise<FindPetsByStatusResponse> {
9898- return __request(OpenAPI, {
9999- errors: {
100100- 400: 'Invalid status value',
101101- },
102102- method: 'GET',
103103- query: {
104104- status: data.status,
105105- },
106106- url: '/pet/findByStatus',
107107- });
108108- }
109109-110110- /**
111111- * Finds Pets by tags
112112- * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
113113- * @param data The data for the request.
114114- * @param data.tags Tags to filter by
115115- * @returns Pet successful operation
116116- * @throws ApiError
117117- */
118118- public static findPetsByTags(
119119- data: FindPetsByTagsData = {},
120120- ): CancelablePromise<FindPetsByTagsResponse> {
121121- return __request(OpenAPI, {
122122- errors: {
123123- 400: 'Invalid tag value',
124124- },
125125- method: 'GET',
126126- query: {
127127- tags: data.tags,
128128- },
129129- url: '/pet/findByTags',
130130- });
131131- }
132132-133133- /**
134134- * Find pet by ID
135135- * Returns a single pet
136136- * @param data The data for the request.
137137- * @param data.petId ID of pet to return
138138- * @returns Pet successful operation
139139- * @throws ApiError
140140- */
141141- public static getPetById(
142142- data: GetPetByIdData,
143143- ): CancelablePromise<GetPetByIdResponse> {
144144- return __request(OpenAPI, {
145145- errors: {
146146- 400: 'Invalid ID supplied',
147147- 404: 'Pet not found',
148148- },
149149- method: 'GET',
150150- path: {
151151- petId: data.petId,
152152- },
153153- url: '/pet/{petId}',
154154- });
155155- }
156156-157157- /**
158158- * Updates a pet in the store with form data
159159- * @param data The data for the request.
160160- * @param data.petId ID of pet that needs to be updated
161161- * @param data.name Name of pet that needs to be updated
162162- * @param data.status Status of pet that needs to be updated
163163- * @throws ApiError
164164- */
165165- public static updatePetWithForm(
166166- data: UpdatePetWithFormData,
167167- ): CancelablePromise<void> {
168168- return __request(OpenAPI, {
169169- errors: {
170170- 405: 'Invalid input',
171171- },
172172- method: 'POST',
173173- path: {
174174- petId: data.petId,
175175- },
176176- query: {
177177- name: data.name,
178178- status: data.status,
179179- },
180180- url: '/pet/{petId}',
181181- });
182182- }
183183-184184- /**
185185- * Deletes a pet
186186- * @param data The data for the request.
187187- * @param data.petId Pet id to delete
188188- * @param data.apiKey
189189- * @throws ApiError
190190- */
191191- public static deletePet(data: DeletePetData): CancelablePromise<void> {
192192- return __request(OpenAPI, {
193193- errors: {
194194- 400: 'Invalid pet value',
195195- },
196196- headers: {
197197- api_key: data.apiKey,
198198- },
199199- method: 'DELETE',
200200- path: {
201201- petId: data.petId,
202202- },
203203- url: '/pet/{petId}',
204204- });
205205- }
206206-207207- /**
208208- * uploads an image
209209- * @param data The data for the request.
210210- * @param data.petId ID of pet to update
211211- * @param data.additionalMetadata Additional Metadata
212212- * @param data.requestBody
213213- * @returns ApiResponse successful operation
214214- * @throws ApiError
215215- */
216216- public static uploadFile(
217217- data: UploadFileData,
218218- ): CancelablePromise<UploadFileResponse> {
219219- return __request(OpenAPI, {
220220- body: data.requestBody,
221221- mediaType: 'application/octet-stream',
222222- method: 'POST',
223223- path: {
224224- petId: data.petId,
225225- },
226226- query: {
227227- additionalMetadata: data.additionalMetadata,
228228- },
229229- url: '/pet/{petId}/uploadImage',
230230- });
231231- }
232232-}
233233-234234-export class StoreService {
235235- /**
236236- * Returns pet inventories by status
237237- * Returns a map of status codes to quantities
238238- * @returns number successful operation
239239- * @throws ApiError
240240- */
241241- public static getInventory(): CancelablePromise<GetInventoryResponse> {
242242- return __request(OpenAPI, {
243243- method: 'GET',
244244- url: '/store/inventory',
245245- });
246246- }
247247-248248- /**
249249- * Place an order for a pet
250250- * Place a new order in the store
251251- * @param data The data for the request.
252252- * @param data.requestBody
253253- * @returns Order successful operation
254254- * @throws ApiError
255255- */
256256- public static placeOrder(
257257- data: PlaceOrderData = {},
258258- ): CancelablePromise<PlaceOrderResponse> {
259259- return __request(OpenAPI, {
260260- body: data.requestBody,
261261- errors: {
262262- 405: 'Invalid input',
263263- },
264264- mediaType: 'application/json',
265265- method: 'POST',
266266- url: '/store/order',
267267- });
268268- }
269269-270270- /**
271271- * Find purchase order by ID
272272- * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
273273- * @param data The data for the request.
274274- * @param data.orderId ID of order that needs to be fetched
275275- * @returns Order successful operation
276276- * @throws ApiError
277277- */
278278- public static getOrderById(
279279- data: GetOrderByIdData,
280280- ): CancelablePromise<GetOrderByIdResponse> {
281281- return __request(OpenAPI, {
282282- errors: {
283283- 400: 'Invalid ID supplied',
284284- 404: 'Order not found',
285285- },
286286- method: 'GET',
287287- path: {
288288- orderId: data.orderId,
289289- },
290290- url: '/store/order/{orderId}',
291291- });
292292- }
293293-294294- /**
295295- * Delete purchase order by ID
296296- * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
297297- * @param data The data for the request.
298298- * @param data.orderId ID of the order that needs to be deleted
299299- * @throws ApiError
300300- */
301301- public static deleteOrder(data: DeleteOrderData): CancelablePromise<void> {
302302- return __request(OpenAPI, {
303303- errors: {
304304- 400: 'Invalid ID supplied',
305305- 404: 'Order not found',
306306- },
307307- method: 'DELETE',
308308- path: {
309309- orderId: data.orderId,
310310- },
311311- url: '/store/order/{orderId}',
312312- });
313313- }
314314-}
315315-316316-export class UserService {
317317- /**
318318- * Create user
319319- * This can only be done by the logged in user.
320320- * @param data The data for the request.
321321- * @param data.requestBody Created user object
322322- * @returns User successful operation
323323- * @throws ApiError
324324- */
325325- public static createUser(
326326- data: CreateUserData = {},
327327- ): CancelablePromise<CreateUserResponse> {
328328- return __request(OpenAPI, {
329329- body: data.requestBody,
330330- mediaType: 'application/json',
331331- method: 'POST',
332332- url: '/user',
333333- });
334334- }
335335-336336- /**
337337- * Creates list of users with given input array
338338- * Creates list of users with given input array
339339- * @param data The data for the request.
340340- * @param data.requestBody
341341- * @returns User Successful operation
342342- * @returns unknown successful operation
343343- * @throws ApiError
344344- */
345345- public static createUsersWithListInput(
346346- data: CreateUsersWithListInputData = {},
347347- ): CancelablePromise<CreateUsersWithListInputResponse> {
348348- return __request(OpenAPI, {
349349- body: data.requestBody,
350350- mediaType: 'application/json',
351351- method: 'POST',
352352- url: '/user/createWithList',
353353- });
354354- }
355355-356356- /**
357357- * Logs user into the system
358358- * @param data The data for the request.
359359- * @param data.username The user name for login
360360- * @param data.password The password for login in clear text
361361- * @returns string successful operation
362362- * @throws ApiError
363363- */
364364- public static loginUser(
365365- data: LoginUserData = {},
366366- ): CancelablePromise<LoginUserResponse> {
367367- return __request(OpenAPI, {
368368- errors: {
369369- 400: 'Invalid username/password supplied',
370370- },
371371- method: 'GET',
372372- query: {
373373- password: data.password,
374374- username: data.username,
375375- },
376376- url: '/user/login',
377377- });
378378- }
379379-380380- /**
381381- * Logs out current logged in user session
382382- * @returns unknown successful operation
383383- * @throws ApiError
384384- */
385385- public static logoutUser(): CancelablePromise<LogoutUserResponse> {
386386- return __request(OpenAPI, {
387387- method: 'GET',
388388- url: '/user/logout',
389389- });
390390- }
391391-392392- /**
393393- * Get user by user name
394394- * @param data The data for the request.
395395- * @param data.username The name that needs to be fetched. Use user1 for testing.
396396- * @returns User successful operation
397397- * @throws ApiError
398398- */
399399- public static getUserByName(
400400- data: GetUserByNameData,
401401- ): CancelablePromise<GetUserByNameResponse> {
402402- return __request(OpenAPI, {
403403- errors: {
404404- 400: 'Invalid username supplied',
405405- 404: 'User not found',
406406- },
407407- method: 'GET',
408408- path: {
409409- username: data.username,
410410- },
411411- url: '/user/{username}',
412412- });
413413- }
414414-415415- /**
416416- * Update user
417417- * This can only be done by the logged in user.
418418- * @param data The data for the request.
419419- * @param data.username name that needs to be updated
420420- * @param data.requestBody Update an existent user in the store
421421- * @returns unknown successful operation
422422- * @throws ApiError
423423- */
424424- public static updateUser(
425425- data: UpdateUserData,
426426- ): CancelablePromise<UpdateUserResponse> {
427427- return __request(OpenAPI, {
428428- body: data.requestBody,
429429- mediaType: 'application/json',
430430- method: 'PUT',
431431- path: {
432432- username: data.username,
433433- },
434434- url: '/user/{username}',
435435- });
436436- }
437437-438438- /**
439439- * Delete user
440440- * This can only be done by the logged in user.
441441- * @param data The data for the request.
442442- * @param data.username The name that needs to be deleted
443443- * @throws ApiError
444444- */
445445- public static deleteUser(data: DeleteUserData): CancelablePromise<void> {
446446- return __request(OpenAPI, {
447447- errors: {
448448- 400: 'Invalid username supplied',
449449- 404: 'User not found',
450450- },
451451- method: 'DELETE',
452452- path: {
453453- username: data.username,
454454- },
455455- url: '/user/{username}',
456456- });
457457- }
458458-}