|
| 1 | +/** |
| 2 | + * Generated by orval v8.12.3 🍺 |
| 3 | + * Do not edit manually. |
| 4 | + * issue-1775 |
| 5 | + * OpenAPI spec version: 1.0.0 |
| 6 | + */ |
| 7 | +import axios from 'axios'; |
| 8 | +import type { AxiosRequestConfig, AxiosResponse } from 'axios'; |
| 9 | + |
| 10 | +import type { PutApiOrderLimit200Item } from './model'; |
| 11 | + |
| 12 | +import { faker } from '@faker-js/faker'; |
| 13 | + |
| 14 | +import { HttpResponse, http } from 'msw'; |
| 15 | +import type { RequestHandlerOptions } from 'msw'; |
| 16 | + |
| 17 | +export const putApiOrderLimit = ( |
| 18 | + options?: AxiosRequestConfig, |
| 19 | +): Promise<AxiosResponse<PutApiOrderLimit200Item[]>> => { |
| 20 | + return axios.put(`/api/order/limit`, undefined, options); |
| 21 | +}; |
| 22 | + |
| 23 | +export type PutApiOrderLimitResult = AxiosResponse<PutApiOrderLimit200Item[]>; |
| 24 | + |
| 25 | +export const getPutApiOrderLimitResponseMock = (): PutApiOrderLimit200Item[] => |
| 26 | + Array.from( |
| 27 | + { length: faker.number.int({ min: 1, max: 10 }) }, |
| 28 | + (_, i) => i + 1, |
| 29 | + ).map(() => ({ |
| 30 | + ...{ orderId: faker.string.alpha({ length: { min: 10, max: 20 } }) }, |
| 31 | + ...faker.helpers.arrayElement([ |
| 32 | + { success: faker.helpers.arrayElement([true] as const) }, |
| 33 | + { |
| 34 | + success: faker.helpers.arrayElement([false] as const), |
| 35 | + failReason: faker.string.alpha({ length: { min: 10, max: 20 } }), |
| 36 | + }, |
| 37 | + ]), |
| 38 | + })); |
| 39 | + |
| 40 | +export const getPutApiOrderLimitMockHandler = ( |
| 41 | + overrideResponse?: |
| 42 | + | PutApiOrderLimit200Item[] |
| 43 | + | (( |
| 44 | + info: Parameters<Parameters<typeof http.put>[1]>[0], |
| 45 | + ) => Promise<PutApiOrderLimit200Item[]> | PutApiOrderLimit200Item[]), |
| 46 | + options?: RequestHandlerOptions, |
| 47 | +) => { |
| 48 | + return http.put( |
| 49 | + '*/api/order/limit', |
| 50 | + async (info: Parameters<Parameters<typeof http.put>[1]>[0]) => { |
| 51 | + return HttpResponse.json( |
| 52 | + overrideResponse !== undefined |
| 53 | + ? typeof overrideResponse === 'function' |
| 54 | + ? await overrideResponse(info) |
| 55 | + : overrideResponse |
| 56 | + : getPutApiOrderLimitResponseMock(), |
| 57 | + { status: 200 }, |
| 58 | + ); |
| 59 | + }, |
| 60 | + options, |
| 61 | + ); |
| 62 | +}; |
| 63 | +export const getIssue1775Mock = () => [getPutApiOrderLimitMockHandler()]; |
0 commit comments