Skip to content
Source
Sign inSign up
TanStack/schemas
Open History to see the last commit

sdk.gen.ts

306 lines9.3 KB

1// This file is auto-generated by @hey-api/openapi-ts
2​
3import type { Client, Options as Options2, TDataShape } from './client'
4import { client } from './client.gen'
5import type {
6 EstimateCostData,
7 EstimateCostErrors,
8 EstimateCostResponses,
9 ExportCatalogData,
10 ExportCatalogErrors,
11 ExportCatalogResponses,
12 ExtractFalPricingData,
13 ExtractFalPricingErrors,
14 ExtractFalPricingResponses,
15 GetActivitySchemasData,
16 GetActivitySchemasErrors,
17 GetActivitySchemasResponses,
18 GetModelData,
19 GetModelErrors,
20 GetModelResponses,
21 GetProviderOpenApiData,
22 GetProviderOpenApiErrors,
23 GetProviderOpenApiResponses,
24 GetSchemaData,
25 GetSchemaErrors,
26 GetSchemaResponses,
27 GetServiceIndexData,
28 GetServiceIndexResponses,
29 GetStatusData,
30 GetStatusResponses,
31 ListAllSchemasData,
32 ListAllSchemasResponses,
33 ListChangesData,
34 ListChangesResponses,
35 ListModelsData,
36 ListModelsResponses,
37 ListProviderModelsData,
38 ListProviderModelsErrors,
39 ListProviderModelsResponses,
40 ListProviderSchemasData,
41 ListProviderSchemasErrors,
42 ListProviderSchemasResponses,
43 ListProvidersData,
44 ListProvidersResponses,
45 SyncProviderData,
46 SyncProviderErrors,
47 SyncProviderResponses,
48 ValidatePayloadData,
49 ValidatePayloadErrors,
50 ValidatePayloadResponses,
51} from './types.gen'
52​
53export type Options<
54 TData extends TDataShape = TDataShape,
55 ThrowOnError extends boolean = boolean,
56 TResponse = unknown,
57> = Options2<TData, ThrowOnError, TResponse> & {
58 /**
59 * You can provide a client instance returned by `createClient()` instead of
60 * individual options. This might be also useful if you want to implement a
61 * custom client.
62 */
63 client?: Client
64 /**
65 * You can pass arbitrary values through the `meta` object. This can be
66 * used to access values that aren't defined as part of the SDK function.
67 */
68 meta?: Record<string, unknown>
70​
71/**
72 * Service description and endpoint index
73 */
74export const getServiceIndex = <ThrowOnError extends boolean = false>(
75 options?: Options<GetServiceIndexData, ThrowOnError>,
76) =>
77 (options?.client ?? client).get<
78 GetServiceIndexResponses,
79 unknown,
80 ThrowOnError
81 >({ url: '/v1', ...options })
82​
83/**
84 * Per-provider sync status and row counts
85 */
86export const getStatus = <ThrowOnError extends boolean = false>(
87 options?: Options<GetStatusData, ThrowOnError>,
88) =>
89 (options?.client ?? client).get<GetStatusResponses, unknown, ThrowOnError>({
90 url: '/v1/status',
91 ...options,
92 })
93​
94/**
95 * List monitored providers with sync status
96 */
97export const listProviders = <ThrowOnError extends boolean = false>(
98 options?: Options<ListProvidersData, ThrowOnError>,
99) =>
100 (options?.client ?? client).get<
101 ListProvidersResponses,
102 unknown,
103 ThrowOnError
104 >({ url: '/v1/providers', ...options })
105​
106/**
107 * List models for one provider
108 */
109export const listProviderModels = <ThrowOnError extends boolean = false>(
110 options: Options<ListProviderModelsData, ThrowOnError>,
111) =>
112 (options.client ?? client).get<
113 ListProviderModelsResponses,
114 ListProviderModelsErrors,
115 ThrowOnError
116 >({ url: '/v1/providers/{provider}/models', ...options })
117​
118/**
119 * Cross-provider model catalog
120 *
121 * The headline "what can I use right now" endpoint. Filterable.
122 */
123export const listModels = <ThrowOnError extends boolean = false>(
124 options?: Options<ListModelsData, ThrowOnError>,
125) =>
126 (options?.client ?? client).get<ListModelsResponses, unknown, ThrowOnError>({
127 url: '/v1/models',
128 ...options,
129 })
130​
131/**
132 * Full metadata for one model
133 */
134export const getModel = <ThrowOnError extends boolean = false>(
135 options: Options<GetModelData, ThrowOnError>,
136) =>
137 (options.client ?? client).get<
138 GetModelResponses,
139 GetModelErrors,
140 ThrowOnError
141 >({ url: '/v1/models/{provider}/{modelId}', ...options })
142​
143/**
144 * System-wide schema index
145 *
146 * Every provider with extracted schemas, each with its activities and endpoint ids — the discovery entry point for all schemas on the system.
147 */
148export const listAllSchemas = <ThrowOnError extends boolean = false>(
149 options?: Options<ListAllSchemasData, ThrowOnError>,
150) =>
151 (options?.client ?? client).get<
152 ListAllSchemasResponses,
153 unknown,
154 ThrowOnError
155 >({ url: '/v1/schemas', ...options })
156​
157/**
158 * Activities and endpoint ids for a provider
159 */
160export const listProviderSchemas = <ThrowOnError extends boolean = false>(
161 options: Options<ListProviderSchemasData, ThrowOnError>,
162) =>
163 (options.client ?? client).get<
164 ListProviderSchemasResponses,
165 ListProviderSchemasErrors,
166 ThrowOnError
167 >({ url: '/v1/schemas/{provider}', ...options })
168​
169/**
170 * Endpoint-id-keyed schema map for one activity
171 */
172export const getActivitySchemas = <ThrowOnError extends boolean = false>(
173 options: Options<GetActivitySchemasData, ThrowOnError>,
174) =>
175 (options.client ?? client).get<
176 GetActivitySchemasResponses,
177 GetActivitySchemasErrors,
178 ThrowOnError
179 >({ url: '/v1/schemas/{provider}/{activity}', ...options })
180​
181/**
182 * One self-contained JSON Schema
183 */
184export const getSchema = <ThrowOnError extends boolean = false>(
185 options: Options<GetSchemaData, ThrowOnError>,
186) =>
187 (options.client ?? client).get<
188 GetSchemaResponses,
189 GetSchemaErrors,
190 ThrowOnError
191 >({ url: '/v1/schemas/{provider}/{activity}/{endpointId}', ...options })
192​
193/**
194 * Generation-only OpenAPI document for one provider
195 *
196 * Assembled from classified endpoints plus the provider connect profile (servers, auth, required headers). Not a raw upstream-spec mirror. Model-grained providers (today: FAL) require ?model=. Selections over 40 classified endpoints, or a filter that matches none, return 400 spec_requires_selector. An unsynced provider returns 404 no_endpoints. ?model= pins the live model enum on provider-grained specs; it does not drop endpoints.
197 */
198export const getProviderOpenApi = <ThrowOnError extends boolean = false>(
199 options: Options<GetProviderOpenApiData, ThrowOnError>,
200) =>
201 (options.client ?? client).get<
202 GetProviderOpenApiResponses,
203 GetProviderOpenApiErrors,
204 ThrowOnError
205 >({ url: '/v1/openapi/{provider}', ...options })
206​
207/**
208 * Validate a payload against a provider endpoint schema
209 */
210export const validatePayload = <ThrowOnError extends boolean = false>(
211 options: Options<ValidatePayloadData, ThrowOnError>,
212) =>
213 (options.client ?? client).post<
214 ValidatePayloadResponses,
215 ValidatePayloadErrors,
216 ThrowOnError
217 >({
218 url: '/v1/validate',
219 ...options,
220 headers: {
221 'Content-Type': 'application/json',
222 ...options.headers,
223 },
224 })
225​
226/**
227 * Evaluate a stored rate card against request and usage
228 */
229export const estimateCost = <ThrowOnError extends boolean = false>(
230 options: Options<EstimateCostData, ThrowOnError>,
231) =>
232 (options.client ?? client).post<
233 EstimateCostResponses,
234 EstimateCostErrors,
235 ThrowOnError
236 >({
237 url: '/v1/estimate',
238 ...options,
239 headers: {
240 'Content-Type': 'application/json',
241 ...options.headers,
242 },
243 })
244​
245/**
246 * Changelog feed (cursor-paginated)
247 *
248 * The polling-friendly alternative to webhooks.
249 */
250export const listChanges = <ThrowOnError extends boolean = false>(
251 options?: Options<ListChangesData, ThrowOnError>,
252) =>
253 (options?.client ?? client).get<ListChangesResponses, unknown, ThrowOnError>({
254 url: '/v1/changes',
255 ...options,
256 })
257​
258/**
259 * Manually trigger a provider spec sync (admin only)
260 */
261export const syncProvider = <ThrowOnError extends boolean = false>(
262 options: Options<SyncProviderData, ThrowOnError>,
263) =>
264 (options.client ?? client).post<
265 SyncProviderResponses,
266 SyncProviderErrors,
267 ThrowOnError
268 >({
269 security: [{ name: 'X-Admin-Key', type: 'apiKey' }],
270 url: '/v1/admin/sync/{provider}',
271 ...options,
272 })
273​
274/**
275 * Manually trigger the FAL llms.txt rate-card extract (admin only). Spec sync stays on POST /v1/admin/sync/fal.
276 */
277export const extractFalPricing = <ThrowOnError extends boolean = false>(
278 options?: Options<ExtractFalPricingData, ThrowOnError>,
279) =>
280 (options?.client ?? client).post<
281 ExtractFalPricingResponses,
282 ExtractFalPricingErrors,
283 ThrowOnError
284 >({
285 security: [{ name: 'X-Admin-Key', type: 'apiKey' }],
286 url: '/v1/admin/extract/fal',
287 ...options,
288 })
289​
290/**
291 * The whole catalog in one streamed response, for the public git mirror (admin only)
292 *
293 * Returns `latestChange` (the newest change id and createdAt, or null), then `models` (live and deprecated, full rate card), `providers`, and `schemas` (each endpoint with its current input and output versions). Object keys are sorted, and fields that change on every poll (`lastSeenAt`, `lastPolledAt`, `lastSyncedAt`, `_links`) are left out; provenance timestamps such as `factSources.*.fetchedAt` are kept and can move without a value changing. The export is not one snapshot: rows read after `latestChange` may already hold newer changes. To catch up from an earlier export, read every page of GET /v1/changes?since=<its latestChange.createdAt> and skip only its latestChange.id (change ids are random, so do not stop at it). A failure part way breaks the stream, so the body is not valid JSON.
294 */
295export const exportCatalog = <ThrowOnError extends boolean = false>(
296 options?: Options<ExportCatalogData, ThrowOnError>,
297) =>
298 (options?.client ?? client).get<
299 ExportCatalogResponses,
300 ExportCatalogErrors,
301 ThrowOnError
302 >({
303 security: [{ name: 'X-Admin-Key', type: 'apiKey' }],
304 url: '/v1/admin/export',
305 ...options,
306 })