2024-10-13 15:25:30 -07:00
|
|
|
import * as v from 'valibot';
|
2024-08-28 04:43:23 -07:00
|
|
|
|
|
|
|
/** @see {@link https://docs.pleroma.social/backend/development/API/pleroma_api/#get-apioauth_tokens} */
|
|
|
|
const oauthTokenSchema = z.preprocess((token: any) => ({
|
|
|
|
...token,
|
|
|
|
valid_until: token?.valid_until?.padEnd(27, 'Z'),
|
2024-10-13 15:25:30 -07:00
|
|
|
}), v.object({
|
|
|
|
app_name: v.string(),
|
2024-10-14 11:54:44 -07:00
|
|
|
id: v.number(),
|
2024-08-28 04:43:23 -07:00
|
|
|
valid_until: z.string().datetime({ offset: true }),
|
|
|
|
}));
|
|
|
|
|
2024-10-13 15:25:30 -07:00
|
|
|
type OauthToken = v.InferOutput<typeof oauthTokenSchema>;
|
2024-08-28 04:43:23 -07:00
|
|
|
|
|
|
|
export { oauthTokenSchema, type OauthToken };
|