import type { SWRConfiguration, SWRResponse } from "swr"; import useSWR from "swr"; import client from "../../client"; import type { GetPurchasesIdPathParams, GetPurchasesIdQueryParams, GetPurchasesIdQueryResponse, } from "../models/GetPurchasesId"; export function getPurchasesIdQueryOptions< TData = GetPurchasesIdQueryResponse, TError = unknown, >( id: GetPurchasesIdPathParams["id"], params?: GetPurchasesIdQueryParams, options: Partial[0]> = {} ): SWRConfiguration { return { fetcher: () => { return client({ method: "get", url: `/purchases/${id}`, params, ...options, }); }, }; } /** * @description Retrieve the details of a purchase by its ID (transaction hash) * @summary Purchase details * @link /purchases/:id */ export function useGetPurchasesId< TData = GetPurchasesIdQueryResponse, TError = unknown, >( id: GetPurchasesIdPathParams["id"], params?: GetPurchasesIdQueryParams, options?: { query?: SWRConfiguration; client?: Partial>[0]>; } ): SWRResponse { const { query: queryOptions, client: clientOptions = {} } = options ?? {}; const query = useSWR(`/purchases/${id}`, { ...getPurchasesIdQueryOptions(id, params, clientOptions), ...queryOptions, }); return query; }