trainingpeaks-sdk
Version:
TypeScript SDK for TrainingPeaks API integration
47 lines (46 loc) • 1.86 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TokenResponseSchema = exports.TrainingPeaksTokenResponseSchema = exports.RefreshTokenEndpointResponseSchema = exports.RefreshTokenRequestSchema = exports.TokenEndpointResponseSchema = void 0;
const zod_1 = require("zod");
exports.TokenEndpointResponseSchema = zod_1.z.object({
success: zod_1.z.boolean(),
token: zod_1.z.object({
access_token: zod_1.z.string().min(1),
token_type: zod_1.z.string(),
expires_in: zod_1.z.number(),
expires: zod_1.z.string(),
refresh_token: zod_1.z.string().optional(),
scope: zod_1.z.string().optional(),
}),
});
exports.RefreshTokenRequestSchema = zod_1.z.object({
refreshToken: zod_1.z.string().min(1),
});
exports.RefreshTokenEndpointResponseSchema = exports.TokenEndpointResponseSchema;
exports.TrainingPeaksTokenResponseSchema = zod_1.z.object({
success: zod_1.z.boolean(),
token: zod_1.z.object({
access_token: zod_1.z.string().min(1),
token_type: zod_1.z.string(),
expires_in: zod_1.z.number(),
refresh_token: zod_1.z.string(),
scope: zod_1.z.string(),
expires: zod_1.z.string(),
}),
});
exports.TokenResponseSchema = zod_1.z.object({
status: zod_1.z.number(),
statusText: zod_1.z.string(),
data: zod_1.z.object({
token: zod_1.z.object({
access_token: zod_1.z.string().min(1),
token_type: zod_1.z.string().min(1),
expires_in: zod_1.z.number().int().positive(),
refresh_token: zod_1.z.string().min(1).optional(),
scope: zod_1.z.string().optional(),
expires: zod_1.z.string().optional(),
}),
}),
headers: zod_1.z.record(zod_1.z.string(), zod_1.z.string()),
cookies: zod_1.z.array(zod_1.z.string()),
});