bigbuffet-rw/packages/pl-api/lib/entities/token.ts
marcin mikołajczak bc65755862 pl-api: Update docs
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-11-29 16:01:54 +01:00

24 lines
675 B
TypeScript

import * as v from 'valibot';
/**
* @category Schemas
* @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: v.fallback(v.optional(v.number()), undefined),
id: v.fallback(v.optional(v.pipe(v.unknown(), v.transform(String))), undefined),
refresh_token: v.fallback(v.optional(v.string()), undefined),
expires_in: v.fallback(v.optional(v.number()), undefined),
me: v.fallback(v.optional(v.string()), undefined),
});
/**
* @category Entity types
*/
type Token = v.InferOutput<typeof tokenSchema>;
export { tokenSchema, type Token };