bigbuffet-rw/packages/pl-api/lib/entities/token.ts
marcin mikołajczak a6bc160caa pl-api: Do some blind search and replace
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-10-14 00:25:30 +02:00

18 lines
565 B
TypeScript

import * as v from 'valibot';
/** @see {@link https://docs.joinmastodon.org/entities/Token/} */
const tokenSchema = v.object({
access_token: v.string(),
token_type: v.string(),
scope: v.string(),
created_at: z.number().optional().catch(undefined),
id: z.number().optional().catch(undefined),
refresh_token: v.fallback(v.optional(v.string()), undefined),
expires_in: z.number().optional().catch(undefined),
me: v.fallback(v.optional(v.string()), undefined),
});
type Token = v.InferOutput<typeof tokenSchema>;
export { tokenSchema, type Token };