store.vuequery.ts 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* eslint-disable */
  2. // @ts-ignore
  3. import { queryOptions, useMutation } from '@tanstack/vue-query';
  4. import type { DefaultError } from '@tanstack/vue-query';
  5. import request from '@/http/vue-query';
  6. import type { CustomRequestOptions } from '@/http/types';
  7. import * as apis from './store';
  8. import * as API from './types';
  9. /** Returns pet inventories by status Returns a map of status codes to quantities GET /store/inventory */
  10. export function storeInventoryUsingGetQueryOptions(options: {
  11. options?: CustomRequestOptions;
  12. }) {
  13. return queryOptions({
  14. queryFn: async ({ queryKey }) => {
  15. return apis.storeInventoryUsingGet(queryKey[1] as typeof options);
  16. },
  17. queryKey: ['storeInventoryUsingGet', options],
  18. });
  19. }
  20. /** Place an order for a pet POST /store/order */
  21. export function useStoreOrderUsingPostMutation(options?: {
  22. onSuccess?: (value?: API.Order) => void;
  23. onError?: (error?: DefaultError) => void;
  24. }) {
  25. const { onSuccess, onError } = options || {};
  26. const response = useMutation({
  27. mutationFn: apis.storeOrderUsingPost,
  28. onSuccess(data: API.Order) {
  29. onSuccess?.(data);
  30. },
  31. onError(error) {
  32. onError?.(error);
  33. },
  34. });
  35. return response;
  36. }
  37. /** Find purchase order by ID For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions GET /store/order/${param0} */
  38. export function storeOrderOrderIdUsingGetQueryOptions(options: {
  39. // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  40. params: API.storeOrderOrderIdUsingGetParams;
  41. options?: CustomRequestOptions;
  42. }) {
  43. return queryOptions({
  44. queryFn: async ({ queryKey }) => {
  45. return apis.storeOrderOrderIdUsingGet(queryKey[1] as typeof options);
  46. },
  47. queryKey: ['storeOrderOrderIdUsingGet', options],
  48. });
  49. }
  50. /** Delete purchase order by ID For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors DELETE /store/order/${param0} */
  51. export function useStoreOrderOrderIdUsingDeleteMutation(options?: {
  52. onSuccess?: (value?: unknown) => void;
  53. onError?: (error?: DefaultError) => void;
  54. }) {
  55. const { onSuccess, onError } = options || {};
  56. const response = useMutation({
  57. mutationFn: apis.storeOrderOrderIdUsingDelete,
  58. onSuccess(data: unknown) {
  59. onSuccess?.(data);
  60. },
  61. onError(error) {
  62. onError?.(error);
  63. },
  64. });
  65. return response;
  66. }