trainingpeaks-sdk
Version:
TypeScript SDK for TrainingPeaks API integration
119 lines (118 loc) • 5.17 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserInfoResponseSchema = exports.TrainingPeaksUserResponseSchema = exports.UpdateUserPreferencesEndpointResponseSchema = exports.UserPreferencesEndpointResponseSchema = exports.UpdateUserProfileEndpointResponseSchema = exports.UserProfileEndpointResponseSchema = void 0;
const zod_1 = require("zod");
const entities_schema_1 = require("../../../../../../domain/schemas/entities.schema.js");
const value_objects_schema_1 = require("../../../../../../domain/schemas/value-objects.schema.js");
exports.UserProfileEndpointResponseSchema = zod_1.z.object({
user: zod_1.z.object({
userId: zod_1.z.number(),
firstName: zod_1.z.string(),
lastName: zod_1.z.string(),
fullName: zod_1.z.string().optional(),
email: zod_1.z.string().min(1),
userName: zod_1.z.string(),
personPhotoUrl: zod_1.z.string().nullable().optional(),
timeZone: zod_1.z.string().optional(),
language: zod_1.z.string().optional(),
units: zod_1.z.number().optional(),
dateFormat: zod_1.z.string().optional(),
temperatureUnit: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
settings: zod_1.z.unknown().optional(),
athletes: zod_1.z.array(zod_1.z.unknown()).optional(),
}),
});
exports.UpdateUserProfileEndpointResponseSchema = zod_1.z.object({
success: zod_1.z.boolean(),
message: zod_1.z.string().optional(),
});
exports.UserPreferencesEndpointResponseSchema = zod_1.z.object({
timeZone: zod_1.z.string().optional(),
language: zod_1.z.string().optional(),
units: zod_1.z.number().optional(),
dateFormat: zod_1.z.string().optional(),
temperatureUnit: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).optional(),
});
exports.UpdateUserPreferencesEndpointResponseSchema = zod_1.z.object({
success: zod_1.z.boolean(),
message: zod_1.z.string().optional(),
});
exports.TrainingPeaksUserResponseSchema = zod_1.z.object({
user: zod_1.z.object({
userId: zod_1.z.number(),
settings: value_objects_schema_1.TrainingPeaksSettingsSchema,
athletes: zod_1.z.array(entities_schema_1.TrainingPeaksAthleteSchema),
personId: zod_1.z.number(),
accountSettingsId: zod_1.z.number(),
userName: zod_1.z.string(),
email: zod_1.z.string().min(1),
isEmailVerified: zod_1.z.boolean(),
firstName: zod_1.z.string(),
lastName: zod_1.z.string(),
userType: zod_1.z.number(),
userIdentifierHash: zod_1.z.string(),
expireDate: zod_1.z.string(),
premiumTrial: zod_1.z.boolean(),
premiumTrialDaysRemaining: zod_1.z.number(),
lastLogon: zod_1.z.string(),
numberOfVisits: zod_1.z.number(),
created: zod_1.z.string(),
age: zod_1.z.number(),
birthday: zod_1.z.string(),
gender: zod_1.z.string(),
dateFormat: zod_1.z.string(),
timeZone: zod_1.z.string(),
units: zod_1.z.number(),
temperatureUnit: zod_1.z.number(),
windSpeedUnit: zod_1.z.number(),
allowMarketingEmails: zod_1.z.boolean(),
address: zod_1.z.string().nullable(),
address2: zod_1.z.string().nullable(),
city: zod_1.z.string().nullable(),
state: zod_1.z.string().nullable(),
zipCode: zod_1.z.string().nullable(),
country: zod_1.z.string().nullable(),
phone: zod_1.z.string().nullable(),
cellPhone: zod_1.z.string().nullable(),
language: zod_1.z.string(),
latitude: zod_1.z.number().nullable(),
longitude: zod_1.z.number().nullable(),
personPhotoUrl: zod_1.z.string().nullable(),
affiliateId: zod_1.z.number(),
isAthlete: zod_1.z.boolean(),
fullName: zod_1.z.string(),
}),
accountStatus: zod_1.z.object({
status: zod_1.z.number(),
lockedOut: zod_1.z.boolean(),
demoExpired: zod_1.z.boolean(),
pastDue: zod_1.z.boolean(),
pastDueAccountSetup: zod_1.z.boolean(),
tooManyBasicAthletes: zod_1.z.boolean(),
isAthlete: zod_1.z.boolean(),
isCoachedAthlete: zod_1.z.boolean(),
isCoach: zod_1.z.boolean(),
isCoachingGroupOwner: zod_1.z.boolean(),
athleteInZuoraSystem: zod_1.z.boolean(),
lockedOutOfMobile: zod_1.z.boolean(),
coachingGroupId: zod_1.z.number().nullable(),
coachingGroupOwnerId: zod_1.z.number().nullable(),
billingTier: zod_1.z.number(),
maximumBasicAthletes: zod_1.z.number(),
paymentRequired: zod_1.z.boolean(),
}),
});
exports.UserInfoResponseSchema = zod_1.z.object({
status: zod_1.z.number(),
statusText: zod_1.z.string(),
data: zod_1.z.object({
user: zod_1.z.object({
userId: zod_1.z.string().min(1),
username: zod_1.z.string().min(1),
name: zod_1.z.string().min(1),
preferences: value_objects_schema_1.UserPreferencesSchema,
}),
}),
headers: zod_1.z.record(zod_1.z.string(), zod_1.z.string()),
cookies: zod_1.z.array(zod_1.z.string()),
});