UNPKG

trainingpeaks-sdk

Version:
44 lines (43 loc) 1.38 kB
import { z } from 'zod'; export const TokenEndpointResponseSchema = z.object({ success: z.boolean(), token: z.object({ access_token: z.string().min(1), token_type: z.string(), expires_in: z.number(), expires: z.string(), refresh_token: z.string().optional(), scope: z.string().optional(), }), }); export const RefreshTokenRequestSchema = z.object({ refreshToken: z.string().min(1), }); export const RefreshTokenEndpointResponseSchema = TokenEndpointResponseSchema; export const TrainingPeaksTokenResponseSchema = z.object({ success: z.boolean(), token: z.object({ access_token: z.string().min(1), token_type: z.string(), expires_in: z.number(), refresh_token: z.string(), scope: z.string(), expires: z.string(), }), }); export const TokenResponseSchema = z.object({ status: z.number(), statusText: z.string(), data: z.object({ token: z.object({ access_token: z.string().min(1), token_type: z.string().min(1), expires_in: z.number().int().positive(), refresh_token: z.string().min(1).optional(), scope: z.string().optional(), expires: z.string().optional(), }), }), headers: z.record(z.string(), z.string()), cookies: z.array(z.string()), });