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

sdk.gen.ts

285 lines8.0 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 ExtractFalPricingData,
10 ExtractFalPricingErrors,
11 ExtractFalPricingResponses,
12 GetActivitySchemasData,
13 GetActivitySchemasErrors,
14 GetActivitySchemasResponses,
15 GetModelData,
16 GetModelErrors,
17 GetModelResponses,
18 GetProviderOpenApiData,
19 GetProviderOpenApiErrors,
20 GetProviderOpenApiResponses,
21 GetSchemaData,
22 GetSchemaErrors,
23 GetSchemaResponses,
24 GetServiceIndexData,
25 GetServiceIndexResponses,
26 GetStatusData,
27 GetStatusResponses,
28 ListAllSchemasData,
29 ListAllSchemasResponses,
30 ListChangesData,
31 ListChangesResponses,
32 ListModelsData,
33 ListModelsResponses,
34 ListProviderModelsData,
35 ListProviderModelsErrors,
36 ListProviderModelsResponses,
37 ListProviderSchemasData,
38 ListProviderSchemasErrors,
39 ListProviderSchemasResponses,
40 ListProvidersData,
41 ListProvidersResponses,
42 SyncProviderData,
43 SyncProviderErrors,
44 SyncProviderResponses,
45 ValidatePayloadData,
46 ValidatePayloadErrors,
47 ValidatePayloadResponses,
48} from './types.gen'
49​
50export type Options<
51 TData extends TDataShape = TDataShape,
52 ThrowOnError extends boolean = boolean,
53 TResponse = unknown,
54> = Options2<TData, ThrowOnError, TResponse> & {
55 /**
56 * You can provide a client instance returned by `createClient()` instead of
57 * individual options. This might be also useful if you want to implement a
58 * custom client.
59 */
60 client?: Client
61 /**
62 * You can pass arbitrary values through the `meta` object. This can be
63 * used to access values that aren't defined as part of the SDK function.
64 */
65 meta?: Record<string, unknown>
67​
68/**
69 * Service description and endpoint index
70 */
71export const getServiceIndex = <ThrowOnError extends boolean = false>(
72 options?: Options<GetServiceIndexData, ThrowOnError>,
73) =>
74 (options?.client ?? client).get<
75 GetServiceIndexResponses,
76 unknown,
77 ThrowOnError
78 >({ url: '/v1', ...options })
79​
80/**
81 * Per-provider sync status and row counts
82 */
83export const getStatus = <ThrowOnError extends boolean = false>(
84 options?: Options<GetStatusData, ThrowOnError>,
85) =>
86 (options?.client ?? client).get<GetStatusResponses, unknown, ThrowOnError>({
87 url: '/v1/status',
88 ...options,
89 })
90​
91/**
92 * List monitored providers with sync status
93 */
94export const listProviders = <ThrowOnError extends boolean = false>(
95 options?: Options<ListProvidersData, ThrowOnError>,
96) =>
97 (options?.client ?? client).get<
98 ListProvidersResponses,
99 unknown,
100 ThrowOnError
101 >({ url: '/v1/providers', ...options })
102​
103/**
104 * List models for one provider
105 */
106export const listProviderModels = <ThrowOnError extends boolean = false>(
107 options: Options<ListProviderModelsData, ThrowOnError>,
108) =>
109 (options.client ?? client).get<
110 ListProviderModelsResponses,
111 ListProviderModelsErrors,
112 ThrowOnError
113 >({ url: '/v1/providers/{provider}/models', ...options })
114​
115/**
116 * Cross-provider model catalog
117 *
118 * The headline "what can I use right now" endpoint. Filterable.
119 */
120export const listModels = <ThrowOnError extends boolean = false>(
121 options?: Options<ListModelsData, ThrowOnError>,
122) =>
123 (options?.client ?? client).get<ListModelsResponses, unknown, ThrowOnError>({
124 url: '/v1/models',
125 ...options,
126 })
127​
128/**
129 * Full metadata for one model
130 */
131export const getModel = <ThrowOnError extends boolean = false>(
132 options: Options<GetModelData, ThrowOnError>,
133) =>
134 (options.client ?? client).get<
135 GetModelResponses,
136 GetModelErrors,
137 ThrowOnError
138 >({ url: '/v1/models/{provider}/{modelId}', ...options })
139​
140/**
141 * System-wide schema index
142 *
143 * Every provider with extracted schemas, each with its activities and endpoint ids — the discovery entry point for all schemas on the system.
144 */
145export const listAllSchemas = <ThrowOnError extends boolean = false>(
146 options?: Options<ListAllSchemasData, ThrowOnError>,
147) =>
148 (options?.client ?? client).get<
149 ListAllSchemasResponses,
150 unknown,
151 ThrowOnError
152 >({ url: '/v1/schemas', ...options })
153​
154/**
155 * Activities and endpoint ids for a provider
156 */
157export const listProviderSchemas = <ThrowOnError extends boolean = false>(
158 options: Options<ListProviderSchemasData, ThrowOnError>,
159) =>
160 (options.client ?? client).get<
161 ListProviderSchemasResponses,
162 ListProviderSchemasErrors,
163 ThrowOnError
164 >({ url: '/v1/schemas/{provider}', ...options })
165​
166/**
167 * Endpoint-id-keyed schema map for one activity
168 */
169export const getActivitySchemas = <ThrowOnError extends boolean = false>(
170 options: Options<GetActivitySchemasData, ThrowOnError>,
171) =>
172 (options.client ?? client).get<
173 GetActivitySchemasResponses,
174 GetActivitySchemasErrors,
175 ThrowOnError
176 >({ url: '/v1/schemas/{provider}/{activity}', ...options })
177​
178/**
179 * One self-contained JSON Schema
180 */
181export const getSchema = <ThrowOnError extends boolean = false>(
182 options: Options<GetSchemaData, ThrowOnError>,
183) =>
184 (options.client ?? client).get<
185 GetSchemaResponses,
186 GetSchemaErrors,
187 ThrowOnError
188 >({ url: '/v1/schemas/{provider}/{activity}/{endpointId}', ...options })
189​
190/**
191 * Generation-only OpenAPI document for one provider
192 *
193 * 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.
194 */
195export const getProviderOpenApi = <ThrowOnError extends boolean = false>(
196 options: Options<GetProviderOpenApiData, ThrowOnError>,
197) =>
198 (options.client ?? client).get<
199 GetProviderOpenApiResponses,
200 GetProviderOpenApiErrors,
201 ThrowOnError
202 >({ url: '/v1/openapi/{provider}', ...options })
203​
204/**
205 * Validate a payload against a provider endpoint schema
206 */
207export const validatePayload = <ThrowOnError extends boolean = false>(
208 options: Options<ValidatePayloadData, ThrowOnError>,
209) =>
210 (options.client ?? client).post<
211 ValidatePayloadResponses,
212 ValidatePayloadErrors,
213 ThrowOnError
214 >({
215 url: '/v1/validate',
216 ...options,
217 headers: {
218 'Content-Type': 'application/json',
219 ...options.headers,
220 },
221 })
222​
223/**
224 * Evaluate a stored rate card against request and usage
225 */
226export const estimateCost = <ThrowOnError extends boolean = false>(
227 options: Options<EstimateCostData, ThrowOnError>,
228) =>
229 (options.client ?? client).post<
230 EstimateCostResponses,
231 EstimateCostErrors,
232 ThrowOnError
233 >({
234 url: '/v1/estimate',
235 ...options,
236 headers: {
237 'Content-Type': 'application/json',
238 ...options.headers,
239 },
240 })
241​
242/**
243 * Changelog feed (cursor-paginated)
244 *
245 * The polling-friendly alternative to webhooks.
246 */
247export const listChanges = <ThrowOnError extends boolean = false>(
248 options?: Options<ListChangesData, ThrowOnError>,
249) =>
250 (options?.client ?? client).get<ListChangesResponses, unknown, ThrowOnError>({
251 url: '/v1/changes',
252 ...options,
253 })
254​
255/**
256 * Manually trigger a provider spec sync (admin only)
257 */
258export const syncProvider = <ThrowOnError extends boolean = false>(
259 options: Options<SyncProviderData, ThrowOnError>,
260) =>
261 (options.client ?? client).post<
262 SyncProviderResponses,
263 SyncProviderErrors,
264 ThrowOnError
265 >({
266 security: [{ name: 'X-Admin-Key', type: 'apiKey' }],
267 url: '/v1/admin/sync/{provider}',
268 ...options,
269 })
270​
271/**
272 * Manually trigger the FAL llms.txt rate-card extract (admin only). Spec sync stays on POST /v1/admin/sync/fal.
273 */
274export const extractFalPricing = <ThrowOnError extends boolean = false>(
275 options?: Options<ExtractFalPricingData, ThrowOnError>,
276) =>
277 (options?.client ?? client).post<
278 ExtractFalPricingResponses,
279 ExtractFalPricingErrors,
280 ThrowOnError
281 >({
282 security: [{ name: 'X-Admin-Key', type: 'apiKey' }],
283 url: '/v1/admin/extract/fal',
284 ...options,
285 })