hevy-shared 1.0.962 → 1.0.964
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -2
- package/built/API/APIClient.d.ts +157 -0
- package/built/API/APIClient.js +381 -0
- package/built/API/index.d.ts +2 -0
- package/built/API/index.js +18 -0
- package/built/API/types.d.ts +38 -0
- package/built/API/types.js +18 -0
- package/built/adjustEventTokens.d.ts +16 -0
- package/built/adjustEventTokens.js +18 -0
- package/built/adminPermissions.d.ts +4 -0
- package/built/adminPermissions.js +22 -0
- package/built/async.d.ts +50 -0
- package/built/async.js +170 -0
- package/built/chat.d.ts +25 -23
- package/built/coachPlans.d.ts +2 -1
- package/built/coachPlans.js +2 -2
- package/built/cue.d.ts +12 -0
- package/built/cue.js +22 -0
- package/built/exerciseLocaleUtils.d.ts +17 -0
- package/built/exerciseLocaleUtils.js +62 -0
- package/built/filterExercises.d.ts +19 -3
- package/built/filterExercises.js +72 -60
- package/built/hevyTrainer.d.ts +250 -0
- package/built/hevyTrainer.js +676 -0
- package/built/index.d.ts +1217 -304
- package/built/index.js +268 -75
- package/built/muscleHeatmaps.d.ts +31 -0
- package/built/muscleHeatmaps.js +68 -0
- package/built/muscleSplits.d.ts +36 -0
- package/built/muscleSplits.js +100 -0
- package/built/normalizedWorkoutUtils.d.ts +88 -0
- package/built/normalizedWorkoutUtils.js +112 -0
- package/built/notifications.d.ts +215 -0
- package/built/notifications.js +9 -0
- package/built/routineUtils.d.ts +14 -0
- package/built/routineUtils.js +186 -0
- package/built/setIndicatorUtils.d.ts +4 -3
- package/built/setIndicatorUtils.js +15 -1
- package/built/tests/async.test.d.ts +1 -0
- package/built/tests/async.test.js +49 -0
- package/built/tests/hevyTrainer.test.d.ts +1 -0
- package/built/tests/hevyTrainer.test.js +1199 -0
- package/built/tests/muscleSplit.test.d.ts +1 -0
- package/built/tests/muscleSplit.test.js +153 -0
- package/built/tests/routineUtils.test.d.ts +1 -0
- package/built/tests/routineUtils.test.js +745 -0
- package/built/tests/testUtils.d.ts +85 -0
- package/built/tests/testUtils.js +319 -0
- package/built/tests/utils.test.js +748 -0
- package/built/tests/workoutVolume.test.js +165 -49
- package/built/translations/index.d.ts +2 -0
- package/built/translations/index.js +18 -0
- package/built/translations/translationUtils.d.ts +2 -0
- package/built/translations/translationUtils.js +61 -0
- package/built/translations/types.d.ts +8 -0
- package/built/translations/types.js +20 -0
- package/built/typeUtils.d.ts +70 -0
- package/built/typeUtils.js +55 -0
- package/built/units.d.ts +14 -7
- package/built/units.js +24 -14
- package/built/utils.d.ts +192 -5
- package/built/utils.js +598 -85
- package/built/websocket.d.ts +14 -2
- package/built/workoutVolume.d.ts +24 -5
- package/built/workoutVolume.js +25 -34
- package/package.json +30 -9
- package/.eslintignore +0 -2
- package/.eslintrc +0 -21
- package/.github/workflows/ci.yml +0 -15
- package/.github/workflows/npm-publish.yml +0 -59
- package/.github/workflows/pr-auto-assign.yml +0 -15
- package/.prettierrc.js +0 -5
- package/jest.config.js +0 -4
- package/src/chat.ts +0 -130
- package/src/coachPlans.ts +0 -57
- package/src/constants.ts +0 -14
- package/src/filterExercises.ts +0 -222
- package/src/index.ts +0 -1576
- package/src/setIndicatorUtils.ts +0 -137
- package/src/tests/utils.test.ts +0 -156
- package/src/tests/workoutVolume.test.ts +0 -93
- package/src/units.ts +0 -41
- package/src/utils.ts +0 -516
- package/src/websocket.ts +0 -36
- package/src/workoutVolume.ts +0 -175
- package/tsconfig.json +0 -70
package/src/index.ts
DELETED
|
@@ -1,1576 +0,0 @@
|
|
|
1
|
-
import { HevyChatUpdatePush } from './chat';
|
|
2
|
-
|
|
3
|
-
export * from './constants';
|
|
4
|
-
export * from './utils';
|
|
5
|
-
export * from './units';
|
|
6
|
-
export * from './filterExercises';
|
|
7
|
-
export * from './setIndicatorUtils';
|
|
8
|
-
export * from './workoutVolume';
|
|
9
|
-
export * from './coachPlans';
|
|
10
|
-
export * from './chat';
|
|
11
|
-
export * from './websocket';
|
|
12
|
-
|
|
13
|
-
export type Language =
|
|
14
|
-
| 'en'
|
|
15
|
-
| 'es'
|
|
16
|
-
| 'de'
|
|
17
|
-
| 'fr'
|
|
18
|
-
| 'it'
|
|
19
|
-
| 'pt'
|
|
20
|
-
| 'tr'
|
|
21
|
-
| 'zh_CN'
|
|
22
|
-
| 'zh_TW'
|
|
23
|
-
| 'ru'
|
|
24
|
-
| 'ja'
|
|
25
|
-
| 'ko';
|
|
26
|
-
|
|
27
|
-
export const isLanguage = (x: string): x is Language => {
|
|
28
|
-
return [
|
|
29
|
-
'en',
|
|
30
|
-
'es',
|
|
31
|
-
'de',
|
|
32
|
-
'fr',
|
|
33
|
-
'it',
|
|
34
|
-
'pt',
|
|
35
|
-
'tr',
|
|
36
|
-
'zh_CN',
|
|
37
|
-
'zh_TW',
|
|
38
|
-
'ru',
|
|
39
|
-
'ja',
|
|
40
|
-
'ko',
|
|
41
|
-
].includes(x);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export type WeightUnit = 'kg' | 'lbs';
|
|
45
|
-
export const isWeightUnit = (x: string): x is WeightUnit => {
|
|
46
|
-
return x === 'kg' || x === 'lbs';
|
|
47
|
-
};
|
|
48
|
-
export type DistanceUnit = 'kilometers' | 'miles';
|
|
49
|
-
export const isDistanceUnit = (x: string): x is DistanceUnit => {
|
|
50
|
-
return x === 'kilometers' || x === 'miles';
|
|
51
|
-
};
|
|
52
|
-
export type DistanceUnitShort = 'km' | 'mi';
|
|
53
|
-
export const isDistanceUnitShort = (x: string): x is DistanceUnit => {
|
|
54
|
-
return x === 'km' || x === 'mi';
|
|
55
|
-
};
|
|
56
|
-
export type BodyMeasurementUnit = 'cm' | 'in';
|
|
57
|
-
export const isBodyMeasurementUnit = (x: string): x is BodyMeasurementUnit => {
|
|
58
|
-
return x === 'cm' || x === 'in';
|
|
59
|
-
};
|
|
60
|
-
export type Weekday =
|
|
61
|
-
| 'monday'
|
|
62
|
-
| 'tuesday'
|
|
63
|
-
| 'wednesday'
|
|
64
|
-
| 'thursday'
|
|
65
|
-
| 'friday'
|
|
66
|
-
| 'saturday'
|
|
67
|
-
| 'sunday';
|
|
68
|
-
|
|
69
|
-
export const isWeekday = (x: string): x is Weekday => {
|
|
70
|
-
return (
|
|
71
|
-
x === 'monday' ||
|
|
72
|
-
x === 'tuesday' ||
|
|
73
|
-
x === 'wednesday' ||
|
|
74
|
-
x === 'thursday' ||
|
|
75
|
-
x === 'friday' ||
|
|
76
|
-
x === 'saturday' ||
|
|
77
|
-
x === 'sunday'
|
|
78
|
-
);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export type TimerVolumeOption = 'off' | 'low' | 'normal' | 'high';
|
|
82
|
-
export const isTimerVolumeOption = (x: string): x is TimerVolumeOption => {
|
|
83
|
-
return x === 'off' || x === 'low' || x === 'normal' || x === 'high';
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export interface ErrorResponse {
|
|
87
|
-
error: string;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export const isErrorResponse = (x?: any): x is ErrorResponse => {
|
|
91
|
-
return typeof x?.error === 'string';
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* @deprecated 1.30.4
|
|
96
|
-
*/
|
|
97
|
-
export interface AccountResponse {
|
|
98
|
-
id: string;
|
|
99
|
-
username: string;
|
|
100
|
-
email: string;
|
|
101
|
-
full_name?: string;
|
|
102
|
-
description?: string;
|
|
103
|
-
website_link?: string;
|
|
104
|
-
profile_pic?: string;
|
|
105
|
-
gift_pro_expiry?: string;
|
|
106
|
-
gympass_user_id?: string;
|
|
107
|
-
is_gympass_plan_active?: boolean;
|
|
108
|
-
follows_push_enabled: boolean;
|
|
109
|
-
likes_push_enabled: boolean;
|
|
110
|
-
comments_push_enabled: boolean;
|
|
111
|
-
comment_mention_push_enabled: boolean;
|
|
112
|
-
comment_discussion_push_enabled: boolean;
|
|
113
|
-
/** @deprecated 1.26.15 */
|
|
114
|
-
comment_replies_push_enabled?: boolean;
|
|
115
|
-
private_profile: boolean;
|
|
116
|
-
follower_count: number;
|
|
117
|
-
following_count: number;
|
|
118
|
-
created_at: string;
|
|
119
|
-
last_workout_at: string;
|
|
120
|
-
accepted_terms_and_conditions: boolean;
|
|
121
|
-
is_coached: boolean;
|
|
122
|
-
birthday?: string;
|
|
123
|
-
sex?: Sex;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export interface UserAccountResponse {
|
|
127
|
-
id: string;
|
|
128
|
-
username: string;
|
|
129
|
-
email: string;
|
|
130
|
-
full_name?: string;
|
|
131
|
-
description?: string;
|
|
132
|
-
website_link?: string;
|
|
133
|
-
profile_pic?: string;
|
|
134
|
-
gift_pro_expiry?: string;
|
|
135
|
-
gympass_user_id?: string;
|
|
136
|
-
is_gympass_plan_active?: boolean;
|
|
137
|
-
follows_push_enabled: boolean;
|
|
138
|
-
likes_push_enabled: boolean;
|
|
139
|
-
comments_push_enabled: boolean;
|
|
140
|
-
comment_mention_push_enabled: boolean;
|
|
141
|
-
comment_discussion_push_enabled: boolean;
|
|
142
|
-
private_profile: boolean;
|
|
143
|
-
created_at: string;
|
|
144
|
-
last_workout_at: string;
|
|
145
|
-
accepted_terms_and_conditions: boolean;
|
|
146
|
-
is_coached: boolean;
|
|
147
|
-
is_a_coach: boolean;
|
|
148
|
-
became_coach_at?: string;
|
|
149
|
-
birthday?: string;
|
|
150
|
-
sex?: Sex;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export interface FollowCountsResponse {
|
|
154
|
-
follower_count: number;
|
|
155
|
-
following_count: number;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export interface AccountUpdate {
|
|
159
|
-
/** `null` = delete the value; `undefined` = do nothing */
|
|
160
|
-
full_name?: string | null;
|
|
161
|
-
description?: string | null;
|
|
162
|
-
website_link?: string | null;
|
|
163
|
-
profile_pic_url?: string | null;
|
|
164
|
-
follows_push_enabled?: boolean;
|
|
165
|
-
likes_push_enabled?: boolean;
|
|
166
|
-
comments_push_enabled?: boolean;
|
|
167
|
-
comment_mention_push_enabled?: boolean;
|
|
168
|
-
comment_discussion_push_enabled?: boolean;
|
|
169
|
-
/** @deprecated 1.26.15 */
|
|
170
|
-
comment_replies_push_enabled?: boolean;
|
|
171
|
-
email_consent?: boolean;
|
|
172
|
-
private_profile?: boolean;
|
|
173
|
-
accepted_terms_and_conditions?: boolean;
|
|
174
|
-
sex?: Sex;
|
|
175
|
-
birthday?: string;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export interface AppleSignInRequest {
|
|
179
|
-
email?: string;
|
|
180
|
-
user: string;
|
|
181
|
-
identityToken: string;
|
|
182
|
-
/**
|
|
183
|
-
* When generateUsername=true. The backend will generate
|
|
184
|
-
* a placeholder username when the account gets created.
|
|
185
|
-
*/
|
|
186
|
-
generateUsername: boolean;
|
|
187
|
-
gympassUserId?: string;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export interface AppleSignInWebRequest {
|
|
191
|
-
email?: string;
|
|
192
|
-
identityToken: string;
|
|
193
|
-
gympassUserId?: string;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export interface GoogleSignInRequest {
|
|
197
|
-
email: string;
|
|
198
|
-
userId: string;
|
|
199
|
-
idToken: string;
|
|
200
|
-
source?: 'web';
|
|
201
|
-
/**
|
|
202
|
-
* When generateUsername=true. The backend will generate
|
|
203
|
-
* a placeholder username when the account gets created.
|
|
204
|
-
*/
|
|
205
|
-
generateUsername: boolean;
|
|
206
|
-
gympassUserId?: string;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export interface FacebookSignInRequest {
|
|
210
|
-
userId: string;
|
|
211
|
-
accessToken: string;
|
|
212
|
-
/**
|
|
213
|
-
* When generateUsername=true. The backend will generate
|
|
214
|
-
* a placeholder username when the account gets created.
|
|
215
|
-
*/
|
|
216
|
-
generateUsername: boolean;
|
|
217
|
-
gympassUserId?: string;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
export interface SocialLoginResult {
|
|
221
|
-
auth_token: string;
|
|
222
|
-
is_new_user: boolean;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
export interface UsernameAvailabilityResponse {
|
|
226
|
-
isAvailable: boolean;
|
|
227
|
-
suggestions: string[];
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
export interface CoachLoginResult {
|
|
231
|
-
auth_token: string;
|
|
232
|
-
is_first_login_to_coach_platform: boolean;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
export interface CoachSocialLoginResult extends SocialLoginResult {
|
|
236
|
-
is_first_login_to_coach_platform: boolean;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
export interface User {
|
|
240
|
-
id: string;
|
|
241
|
-
email: string;
|
|
242
|
-
auth_token: string;
|
|
243
|
-
username: string;
|
|
244
|
-
verified: boolean;
|
|
245
|
-
profile_pic?: string;
|
|
246
|
-
full_name?: string;
|
|
247
|
-
private_profile: boolean;
|
|
248
|
-
description?: string;
|
|
249
|
-
website_link?: string;
|
|
250
|
-
created_at: string;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
export interface BackofficeUserData {
|
|
254
|
-
id: string;
|
|
255
|
-
is_banned: boolean;
|
|
256
|
-
flagged_metadata: UserFlagMetadata;
|
|
257
|
-
gympass_email: string | null;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
export type BackofficeUserResponse = UserAccountResponse & BackofficeUserData;
|
|
261
|
-
|
|
262
|
-
export type BackofficeFeaturedUser = Pick<
|
|
263
|
-
BackofficeUserResponse,
|
|
264
|
-
'id' | 'username' | 'profile_pic' | 'private_profile' | 'last_workout_at'
|
|
265
|
-
> & {
|
|
266
|
-
followers_count: number;
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
export type BackofficeFlaggedUser = Pick<
|
|
270
|
-
BackofficeUserResponse,
|
|
271
|
-
'id' | 'username' | 'profile_pic' | 'flagged_metadata'
|
|
272
|
-
>;
|
|
273
|
-
|
|
274
|
-
export interface BackofficeUserComment {
|
|
275
|
-
workout_username: string;
|
|
276
|
-
workout_short_id: string;
|
|
277
|
-
comment_date: string;
|
|
278
|
-
is_archived: boolean;
|
|
279
|
-
comment_text: string;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
export interface BackofficeAccountUpdate {
|
|
283
|
-
email?: string;
|
|
284
|
-
description?: string;
|
|
285
|
-
/** `null` means we're unlinking the user's Gympass account */
|
|
286
|
-
gympass_email?: string | null;
|
|
287
|
-
delete_profile_pic?: boolean;
|
|
288
|
-
delete_link?: boolean;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
export interface CoachsClientData {
|
|
292
|
-
id: string;
|
|
293
|
-
email: string;
|
|
294
|
-
username: string;
|
|
295
|
-
profile_pic: string | null;
|
|
296
|
-
full_name: string | null;
|
|
297
|
-
last_workout_at: string;
|
|
298
|
-
notes: string | null;
|
|
299
|
-
custom_exercises: ExerciseTemplate[];
|
|
300
|
-
user_preferences: UserPreferences | null;
|
|
301
|
-
created_at: string;
|
|
302
|
-
archived_date: string | null;
|
|
303
|
-
is_sample_user: boolean;
|
|
304
|
-
client_configuration: ClientConfiguration;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
export type CoachPlanUpdateType = 'pause' | 'cancel' | 'change' | 'resume';
|
|
308
|
-
export interface CoachPlanUpdateRequest {
|
|
309
|
-
planUpdateType: CoachPlanUpdateType;
|
|
310
|
-
newPlanId?: string;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
export const DefaultClientConfiguration: ClientConfiguration = {
|
|
314
|
-
is_chat_enabled: false,
|
|
315
|
-
};
|
|
316
|
-
export interface ClientConfiguration {
|
|
317
|
-
is_chat_enabled: boolean;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
export interface ClientsCoachData {
|
|
321
|
-
username: string;
|
|
322
|
-
profile_pic: string | null;
|
|
323
|
-
email: string;
|
|
324
|
-
full_name: string | null;
|
|
325
|
-
coaching_since: string;
|
|
326
|
-
coach_id: string;
|
|
327
|
-
coach_conversation_id?: string;
|
|
328
|
-
client_configuration: ClientConfiguration;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
export interface CoachAccountConfiguration {
|
|
332
|
-
enable_chat_for_new_clients: boolean;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
export interface UserFlagMetadata {
|
|
336
|
-
reason: string;
|
|
337
|
-
username?: string | null;
|
|
338
|
-
email?: string | null;
|
|
339
|
-
description?: string | null;
|
|
340
|
-
website_link?: string | null;
|
|
341
|
-
profile_pic_url?: string | null;
|
|
342
|
-
recaptcha_score?: number | null;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
export interface UserHevyProSubcription {
|
|
346
|
-
is_pro: boolean;
|
|
347
|
-
active_subscription?: {
|
|
348
|
-
managing_store:
|
|
349
|
-
| 'app_store'
|
|
350
|
-
| 'play_store'
|
|
351
|
-
| 'stripe'
|
|
352
|
-
| 'hevy-gift'
|
|
353
|
-
| 'gympass';
|
|
354
|
-
type: 'monthly' | 'yearly' | 'lifetime' | 'custom';
|
|
355
|
-
expires_date?: string;
|
|
356
|
-
unsubscribe_detected_at?: string;
|
|
357
|
-
};
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
export interface UserPreferences {
|
|
361
|
-
username: string;
|
|
362
|
-
language?: Language;
|
|
363
|
-
weight_unit?: WeightUnit;
|
|
364
|
-
distance_unit?: DistanceUnit;
|
|
365
|
-
body_measurement_unit?: BodyMeasurementUnit;
|
|
366
|
-
first_weekday?: Weekday;
|
|
367
|
-
default_rest_timer_seconds?: number;
|
|
368
|
-
workout_keep_awake?: boolean;
|
|
369
|
-
disabled_review_request?: boolean;
|
|
370
|
-
superset_scrolling?: boolean;
|
|
371
|
-
plate_calculator_enabled?: boolean;
|
|
372
|
-
previous_workout_values_from_routine?: boolean;
|
|
373
|
-
rpe_enabled?: boolean;
|
|
374
|
-
timer_volume?: string;
|
|
375
|
-
inline_set_timer_enabled?: boolean;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
export type UpdateUserPreferencesRequest = Omit<UserPreferences, 'username'>;
|
|
379
|
-
|
|
380
|
-
export type FollowingStatus = 'not-following' | 'following' | 'requested';
|
|
381
|
-
|
|
382
|
-
export type FollowingStatusMap = { [id: string]: 'following' | 'requested' };
|
|
383
|
-
|
|
384
|
-
export interface FollowRequest {
|
|
385
|
-
id: number;
|
|
386
|
-
username: string;
|
|
387
|
-
profile_pic?: string;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
export interface SearchUser {
|
|
391
|
-
id: string;
|
|
392
|
-
profile_pic?: string;
|
|
393
|
-
username: string;
|
|
394
|
-
full_name: string;
|
|
395
|
-
following_status: FollowingStatus;
|
|
396
|
-
private_profile: boolean;
|
|
397
|
-
verified: boolean;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
export interface RoutineLibraryRoutine {
|
|
401
|
-
id: string;
|
|
402
|
-
title: string;
|
|
403
|
-
username: string;
|
|
404
|
-
profile_pic: string;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
export type RoutineLibrarySubsectionKey =
|
|
408
|
-
| 'classic-split'
|
|
409
|
-
| 'suspension-band'
|
|
410
|
-
| 'full-body-split'
|
|
411
|
-
| 'five-by-five'
|
|
412
|
-
| 'push-pull'
|
|
413
|
-
| 'no-equipment'
|
|
414
|
-
| 'only-dumbbells'
|
|
415
|
-
| 'five-day-split'
|
|
416
|
-
| 'upper-lower';
|
|
417
|
-
|
|
418
|
-
export interface RoutineLibrarySubsection {
|
|
419
|
-
key: RoutineLibrarySubsectionKey;
|
|
420
|
-
title: string;
|
|
421
|
-
routines: RoutineLibraryRoutine[];
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
export interface RoutineLibrarySection {
|
|
425
|
-
title: string;
|
|
426
|
-
subsections: RoutineLibrarySubsection[];
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
export interface RoutineLibrary {
|
|
430
|
-
sections: RoutineLibrarySection[];
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
export interface WeeklyWorkoutDuration {
|
|
434
|
-
week_start_date: string;
|
|
435
|
-
week_end_date: string;
|
|
436
|
-
total_seconds: number;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
export interface RoutineMetadata {
|
|
440
|
-
id: string;
|
|
441
|
-
short_id: string;
|
|
442
|
-
title: string;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
export interface UserProfile {
|
|
446
|
-
username: string;
|
|
447
|
-
verified: boolean;
|
|
448
|
-
subscribed: boolean;
|
|
449
|
-
profile_pic?: string;
|
|
450
|
-
full_name?: string;
|
|
451
|
-
description?: string;
|
|
452
|
-
website_link?: string;
|
|
453
|
-
workout_count: number;
|
|
454
|
-
following_status: FollowingStatus;
|
|
455
|
-
private_profile: boolean;
|
|
456
|
-
is_blocked: boolean;
|
|
457
|
-
follower_count: number;
|
|
458
|
-
following_count: number;
|
|
459
|
-
routines: RoutineMetadata[];
|
|
460
|
-
weekly_workout_durations: WeeklyWorkoutDuration[];
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
export interface PublicUserProfile {
|
|
464
|
-
private_profile: boolean;
|
|
465
|
-
username: string;
|
|
466
|
-
verified: boolean;
|
|
467
|
-
profile_pic?: string;
|
|
468
|
-
full_name?: string;
|
|
469
|
-
description?: string;
|
|
470
|
-
website_link?: string;
|
|
471
|
-
workout_count: number;
|
|
472
|
-
follower_count: number;
|
|
473
|
-
following_count: number;
|
|
474
|
-
routines: RoutineMetadata[];
|
|
475
|
-
weekly_workout_durations: WeeklyWorkoutDuration[];
|
|
476
|
-
last_workout?: Workout;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
export type MuscleGroup =
|
|
480
|
-
| 'abdominals'
|
|
481
|
-
| 'cardio'
|
|
482
|
-
| 'shoulders'
|
|
483
|
-
| 'chest'
|
|
484
|
-
| 'lower_back'
|
|
485
|
-
| 'full_body'
|
|
486
|
-
| 'biceps'
|
|
487
|
-
| 'triceps'
|
|
488
|
-
| 'upper_back'
|
|
489
|
-
| 'quadriceps'
|
|
490
|
-
| 'calves'
|
|
491
|
-
| 'lats'
|
|
492
|
-
| 'hamstrings'
|
|
493
|
-
| 'glutes'
|
|
494
|
-
| 'abductors'
|
|
495
|
-
| 'adductors'
|
|
496
|
-
| 'traps'
|
|
497
|
-
| 'forearms'
|
|
498
|
-
| 'neck'
|
|
499
|
-
| 'other';
|
|
500
|
-
|
|
501
|
-
export const muscleGroups: MuscleGroup[] = [
|
|
502
|
-
'abdominals',
|
|
503
|
-
'abductors',
|
|
504
|
-
'adductors',
|
|
505
|
-
'biceps',
|
|
506
|
-
'lower_back',
|
|
507
|
-
'upper_back',
|
|
508
|
-
'cardio',
|
|
509
|
-
'chest',
|
|
510
|
-
'calves',
|
|
511
|
-
'forearms',
|
|
512
|
-
'glutes',
|
|
513
|
-
'hamstrings',
|
|
514
|
-
'lats',
|
|
515
|
-
'quadriceps',
|
|
516
|
-
'shoulders',
|
|
517
|
-
'triceps',
|
|
518
|
-
'traps',
|
|
519
|
-
'neck',
|
|
520
|
-
'full_body',
|
|
521
|
-
'other',
|
|
522
|
-
];
|
|
523
|
-
|
|
524
|
-
export const isMuscleGroup = (x: string): x is MuscleGroup => {
|
|
525
|
-
return (muscleGroups as string[]).includes(x);
|
|
526
|
-
};
|
|
527
|
-
|
|
528
|
-
export const muscleGroupFilters: MuscleGroupFilter[] = [
|
|
529
|
-
'all_muscles',
|
|
530
|
-
...muscleGroups,
|
|
531
|
-
];
|
|
532
|
-
|
|
533
|
-
export const isMuscleGroupFilter = (x: string): x is MuscleGroupFilter => {
|
|
534
|
-
return (muscleGroupFilters as string[]).includes(x);
|
|
535
|
-
};
|
|
536
|
-
|
|
537
|
-
export type MuscleGroupFilter = MuscleGroup | 'all_muscles';
|
|
538
|
-
|
|
539
|
-
/**
|
|
540
|
-
* Equipment
|
|
541
|
-
*/
|
|
542
|
-
|
|
543
|
-
export type Equipment =
|
|
544
|
-
| 'none'
|
|
545
|
-
| 'machine'
|
|
546
|
-
| 'kettlebell'
|
|
547
|
-
| 'barbell'
|
|
548
|
-
| 'dumbbell'
|
|
549
|
-
| 'resistance_band'
|
|
550
|
-
| 'suspension'
|
|
551
|
-
| 'plate'
|
|
552
|
-
| 'other';
|
|
553
|
-
|
|
554
|
-
export const equipments: Equipment[] = [
|
|
555
|
-
'none',
|
|
556
|
-
'barbell',
|
|
557
|
-
'dumbbell',
|
|
558
|
-
'kettlebell',
|
|
559
|
-
'machine',
|
|
560
|
-
'plate',
|
|
561
|
-
'resistance_band',
|
|
562
|
-
'suspension',
|
|
563
|
-
'other',
|
|
564
|
-
];
|
|
565
|
-
|
|
566
|
-
export type EquipmentFilter = Equipment | 'all_equipment';
|
|
567
|
-
|
|
568
|
-
export const equipmentFilters: EquipmentFilter[] = [
|
|
569
|
-
'all_equipment',
|
|
570
|
-
...equipments,
|
|
571
|
-
];
|
|
572
|
-
|
|
573
|
-
export const isEquipment = (x: string): x is Equipment => {
|
|
574
|
-
return (equipments as string[]).includes(x);
|
|
575
|
-
};
|
|
576
|
-
|
|
577
|
-
export const isEquipmentFilter = (x: string): x is EquipmentFilter => {
|
|
578
|
-
return (equipmentFilters as string[]).includes(x);
|
|
579
|
-
};
|
|
580
|
-
|
|
581
|
-
/**
|
|
582
|
-
* ExerciseType
|
|
583
|
-
*
|
|
584
|
-
* weight_reps = Bench Press
|
|
585
|
-
* bodyweight_reps = Pull ups (Weighted)
|
|
586
|
-
* bodyweight_assisted_reps = Pull Ups (Assisted)
|
|
587
|
-
* reps_only = Pull ups
|
|
588
|
-
*/
|
|
589
|
-
|
|
590
|
-
export type ExerciseRepType =
|
|
591
|
-
| 'weight_reps'
|
|
592
|
-
| 'bodyweight_reps' // This is actually used for weighted bodyweight exercises (eg weighted pull ups)
|
|
593
|
-
| 'bodyweight_assisted_reps'
|
|
594
|
-
| 'reps_only';
|
|
595
|
-
|
|
596
|
-
export type ExerciseType =
|
|
597
|
-
| 'distance_duration'
|
|
598
|
-
| 'duration'
|
|
599
|
-
| 'short_distance_weight'
|
|
600
|
-
| ExerciseRepType;
|
|
601
|
-
|
|
602
|
-
export const exerciseTypes: ExerciseType[] = [
|
|
603
|
-
'weight_reps',
|
|
604
|
-
'reps_only',
|
|
605
|
-
'bodyweight_reps',
|
|
606
|
-
'bodyweight_assisted_reps',
|
|
607
|
-
'duration',
|
|
608
|
-
'distance_duration',
|
|
609
|
-
/**
|
|
610
|
-
* Note on short_distance_weight exercises. The UI makes it look like we support yards and meters
|
|
611
|
-
* inputs, but in reality all inputs are considered to be meters. For example, if an imperial user inputs
|
|
612
|
-
* 10 yards it'll be stored as 10 meters. It's mostly to account for the weird volume calculations that
|
|
613
|
-
* would happen if we stored exact values in yards. The volume of a weight_reps set is weight*reps,
|
|
614
|
-
* the volume of a short_distance_weight is weight*distance_meters if we converted yards to meters
|
|
615
|
-
* imperial users would get a different volume value than metric users. To keep it simple and since
|
|
616
|
-
* a meter is basically the same as a yard, we're not storing the value in yards and we convert 1-1
|
|
617
|
-
* from yards<->meters.
|
|
618
|
-
*/
|
|
619
|
-
'short_distance_weight',
|
|
620
|
-
];
|
|
621
|
-
|
|
622
|
-
export const isExerciseType = (x: any): x is ExerciseType => {
|
|
623
|
-
return typeof x === 'string' && (exerciseTypes as string[]).includes(x);
|
|
624
|
-
};
|
|
625
|
-
|
|
626
|
-
export interface ExerciseTemplate {
|
|
627
|
-
id: string;
|
|
628
|
-
title: string;
|
|
629
|
-
es_title?: string;
|
|
630
|
-
de_title?: string;
|
|
631
|
-
fr_title?: string;
|
|
632
|
-
it_title?: string;
|
|
633
|
-
pt_title?: string;
|
|
634
|
-
ko_title?: string;
|
|
635
|
-
ja_title?: string;
|
|
636
|
-
tr_title?: string;
|
|
637
|
-
ru_title?: string;
|
|
638
|
-
zh_cn_title?: string;
|
|
639
|
-
zh_tw_title?: string;
|
|
640
|
-
priority: number;
|
|
641
|
-
muscle_group: MuscleGroup;
|
|
642
|
-
other_muscles: MuscleGroup[];
|
|
643
|
-
exercise_type: ExerciseType;
|
|
644
|
-
equipment_category: Equipment;
|
|
645
|
-
url?: string;
|
|
646
|
-
media_type?: string;
|
|
647
|
-
custom_exercise_image_url?: string;
|
|
648
|
-
/** @deprecated 1.22.5 */
|
|
649
|
-
custom_exercise_image_thumbnail_url?: string;
|
|
650
|
-
thumbnail_url?: string;
|
|
651
|
-
thumbnail?: number;
|
|
652
|
-
manual_tag?: string;
|
|
653
|
-
aka?: string;
|
|
654
|
-
instructions?: string;
|
|
655
|
-
is_custom: boolean;
|
|
656
|
-
is_archived: boolean;
|
|
657
|
-
/** Used for Hevy Coach: in Hevy Coach, changes to a parent template propagate to children, and clients can't edit the children */
|
|
658
|
-
parent_exercise_template_id?: string;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
/** Workouts */
|
|
662
|
-
|
|
663
|
-
export type SetPersonalRecordType =
|
|
664
|
-
| 'best_weight'
|
|
665
|
-
| 'best_reps'
|
|
666
|
-
| 'best_volume'
|
|
667
|
-
| 'best_1rm'
|
|
668
|
-
| 'best_duration'
|
|
669
|
-
| 'best_distance';
|
|
670
|
-
|
|
671
|
-
export interface SetPersonalRecord {
|
|
672
|
-
exercise_template_id: string;
|
|
673
|
-
type: SetPersonalRecordType;
|
|
674
|
-
record: number;
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
export type RPE = 6 | 7 | 7.5 | 8 | 8.5 | 9 | 9.5 | 10;
|
|
678
|
-
export const isRPE = (x: number): x is RPE => {
|
|
679
|
-
return validRpeValues.includes(x as any);
|
|
680
|
-
};
|
|
681
|
-
export const validRpeValues: RPE[] = [6, 7, 7.5, 8, 8.5, 9, 9.5, 10];
|
|
682
|
-
|
|
683
|
-
export type SetType = 'warmup' | 'normal' | 'failure' | 'dropset';
|
|
684
|
-
|
|
685
|
-
export interface WorkoutExerciseSet {
|
|
686
|
-
/**
|
|
687
|
-
* id can be a string or a number because we used
|
|
688
|
-
* to store it as int4 and now we store it as int8
|
|
689
|
-
* which is too big to store (accurately) in a JS
|
|
690
|
-
* number.
|
|
691
|
-
*/
|
|
692
|
-
id: number | string;
|
|
693
|
-
index: number;
|
|
694
|
-
indicator: SetType;
|
|
695
|
-
weight_kg?: number | null;
|
|
696
|
-
reps?: number | null;
|
|
697
|
-
distance_meters?: number | null;
|
|
698
|
-
duration_seconds?: number | null;
|
|
699
|
-
rpe?: RPE | null;
|
|
700
|
-
/**
|
|
701
|
-
* @deprecated 1.29.17 -
|
|
702
|
-
* we can only set this to `best_weight`, `best_reps`, `best_duration` or
|
|
703
|
-
* `best_distance`. sending anything else would cause older clients to crash.
|
|
704
|
-
* newer clients will ignore this field and use the `prs` field instead.
|
|
705
|
-
*/
|
|
706
|
-
personalRecords?: Array<{
|
|
707
|
-
type: 'best_weight' | 'best_reps' | 'best_duration' | 'best_distance';
|
|
708
|
-
value: number;
|
|
709
|
-
}>;
|
|
710
|
-
prs: { type: SetPersonalRecordType; value: number }[];
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
export interface WorkoutExercise {
|
|
714
|
-
id: string;
|
|
715
|
-
exercise_template_id: string;
|
|
716
|
-
title: string;
|
|
717
|
-
es_title?: string | null;
|
|
718
|
-
de_title?: string | null;
|
|
719
|
-
fr_title?: string | null;
|
|
720
|
-
it_title?: string | null;
|
|
721
|
-
pt_title?: string | null;
|
|
722
|
-
ko_title?: string | null;
|
|
723
|
-
ja_title?: string | null;
|
|
724
|
-
tr_title?: string | null;
|
|
725
|
-
ru_title?: string | null;
|
|
726
|
-
zh_cn_title?: string | null;
|
|
727
|
-
zh_tw_title?: string | null;
|
|
728
|
-
superset_id: number | null;
|
|
729
|
-
rest_seconds: number | null;
|
|
730
|
-
notes: string;
|
|
731
|
-
priority: number;
|
|
732
|
-
muscle_group: MuscleGroup;
|
|
733
|
-
other_muscles: MuscleGroup[];
|
|
734
|
-
exercise_type: ExerciseType;
|
|
735
|
-
equipment_category: Equipment;
|
|
736
|
-
url?: string;
|
|
737
|
-
media_type?: string;
|
|
738
|
-
custom_exercise_image_url?: string | null;
|
|
739
|
-
/** @deprecated 1.22.5 */
|
|
740
|
-
custom_exercise_image_thumbnail_url?: string | null;
|
|
741
|
-
thumbnail_url?: string | null;
|
|
742
|
-
manual_tag?: string;
|
|
743
|
-
aka?: string;
|
|
744
|
-
sets: WorkoutExerciseSet[];
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
export interface WorkoutComment {
|
|
748
|
-
id: number;
|
|
749
|
-
username: string;
|
|
750
|
-
verified: boolean;
|
|
751
|
-
profile_pic?: string;
|
|
752
|
-
comment: string;
|
|
753
|
-
created_at: string;
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
export interface WorkoutImage {
|
|
757
|
-
type: 'image';
|
|
758
|
-
url: string;
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
export interface WorkoutVideo {
|
|
762
|
-
type: 'video';
|
|
763
|
-
url: string;
|
|
764
|
-
thumbnail_url: string;
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
export type WorkoutMedia = WorkoutImage | WorkoutVideo;
|
|
768
|
-
|
|
769
|
-
export interface Workout {
|
|
770
|
-
id: string;
|
|
771
|
-
short_id: string | null;
|
|
772
|
-
index: number;
|
|
773
|
-
name: string;
|
|
774
|
-
description?: string;
|
|
775
|
-
like_count: number;
|
|
776
|
-
like_images: string[];
|
|
777
|
-
comment_count: number;
|
|
778
|
-
comments: WorkoutComment[];
|
|
779
|
-
/** @deprecated 1.28.13 */
|
|
780
|
-
image_urls?: string[];
|
|
781
|
-
media: WorkoutMedia[];
|
|
782
|
-
is_liked_by_user: boolean;
|
|
783
|
-
start_time: number;
|
|
784
|
-
end_time: number;
|
|
785
|
-
user_id: string;
|
|
786
|
-
username: string;
|
|
787
|
-
profile_image: string;
|
|
788
|
-
exercises: WorkoutExercise[];
|
|
789
|
-
routine_id?: string;
|
|
790
|
-
apple_watch: boolean;
|
|
791
|
-
verified: boolean;
|
|
792
|
-
created_at: string;
|
|
793
|
-
updated_at: string;
|
|
794
|
-
nth_workout: number;
|
|
795
|
-
/**
|
|
796
|
-
* See https://github.com/hevyapp/hevy-backend/pull/193 to understand
|
|
797
|
-
* why we added estimated_volume_kg
|
|
798
|
-
*/
|
|
799
|
-
estimated_volume_kg: number;
|
|
800
|
-
is_private: boolean;
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
export const isPublicWorkout = (x: any): x is PublicWorkout => {
|
|
804
|
-
return x.type === 'public';
|
|
805
|
-
};
|
|
806
|
-
|
|
807
|
-
export interface PublicWorkout {
|
|
808
|
-
type: 'public';
|
|
809
|
-
id: string;
|
|
810
|
-
short_id: string | null;
|
|
811
|
-
name: string;
|
|
812
|
-
create_at: string;
|
|
813
|
-
start_time: number;
|
|
814
|
-
end_time: number;
|
|
815
|
-
username: string;
|
|
816
|
-
profile_image: string | null;
|
|
817
|
-
preview_image: string | null;
|
|
818
|
-
is_private: boolean;
|
|
819
|
-
exercises: WorkoutExercise[];
|
|
820
|
-
/**
|
|
821
|
-
* weight_unit and distance_unit are the current unit
|
|
822
|
-
* preferences of the owner of the workout.
|
|
823
|
-
*/
|
|
824
|
-
weight_unit: WeightUnit;
|
|
825
|
-
distance_unit: DistanceUnit;
|
|
826
|
-
estimated_volume_kg: number;
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
export interface WorkoutSync {
|
|
830
|
-
updated: Workout[];
|
|
831
|
-
deleted: string[];
|
|
832
|
-
isMore: boolean;
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
export interface PostWorkoutRequest {
|
|
836
|
-
workout: PostWorkoutRequestWorkout;
|
|
837
|
-
source?: string;
|
|
838
|
-
isEventLoggedByAppleWatch?: boolean;
|
|
839
|
-
emptyResponse: boolean;
|
|
840
|
-
updateRoutineValues: boolean;
|
|
841
|
-
/** @deprecated 1.22.6 */
|
|
842
|
-
updateRoutineOptions?: { updateValuesDumb: boolean };
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
/**
|
|
846
|
-
* PostWorkoutRequestWorkout describes the final state of a completed workout.
|
|
847
|
-
* It's used when sending a workout to the server.
|
|
848
|
-
*/
|
|
849
|
-
export interface PostWorkoutRequestWorkout {
|
|
850
|
-
name: string;
|
|
851
|
-
description: string;
|
|
852
|
-
/** @deprecated 1.28.13 */
|
|
853
|
-
imageUrls?: string[];
|
|
854
|
-
media: WorkoutMedia[];
|
|
855
|
-
startTime: number;
|
|
856
|
-
endTime: number;
|
|
857
|
-
exercises: PostWorkoutRequestExercise[];
|
|
858
|
-
routineId?: string;
|
|
859
|
-
trackWorkoutAsRoutine: boolean;
|
|
860
|
-
updateRoutineFromWorkout?: boolean;
|
|
861
|
-
appleWatch: boolean;
|
|
862
|
-
clientId: string;
|
|
863
|
-
isPrivate?: boolean;
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
export interface PostWorkoutRequestSet {
|
|
867
|
-
index: number;
|
|
868
|
-
indicator: SetType;
|
|
869
|
-
weight?: number | null;
|
|
870
|
-
reps?: number | null;
|
|
871
|
-
distance?: number | null;
|
|
872
|
-
duration?: number | null;
|
|
873
|
-
rpe?: RPE | null;
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
export interface PostWorkoutRequestExercise {
|
|
877
|
-
title: string;
|
|
878
|
-
/** poorly named exercise template id */
|
|
879
|
-
id: string;
|
|
880
|
-
supersetId?: number;
|
|
881
|
-
autoRestTimerSeconds?: number;
|
|
882
|
-
notes: string;
|
|
883
|
-
sets: PostWorkoutRequestSet[];
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
/** Routines */
|
|
887
|
-
|
|
888
|
-
export interface RoutineSet {
|
|
889
|
-
id: number;
|
|
890
|
-
index: number;
|
|
891
|
-
indicator: SetType;
|
|
892
|
-
weight_kg?: number | null;
|
|
893
|
-
reps?: number | null;
|
|
894
|
-
distance_meters?: number | null;
|
|
895
|
-
duration_seconds?: number | null;
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
export interface RoutineExercise {
|
|
899
|
-
id: string;
|
|
900
|
-
username: string;
|
|
901
|
-
exercise_template_id: string;
|
|
902
|
-
warmup_set_count: number;
|
|
903
|
-
normal_set_count: number;
|
|
904
|
-
title: string;
|
|
905
|
-
es_title?: string | null;
|
|
906
|
-
de_title?: string | null;
|
|
907
|
-
fr_title?: string | null;
|
|
908
|
-
it_title?: string | null;
|
|
909
|
-
pt_title?: string | null;
|
|
910
|
-
ko_title?: string | null;
|
|
911
|
-
ja_title?: string | null;
|
|
912
|
-
tr_title?: string | null;
|
|
913
|
-
ru_title?: string | null;
|
|
914
|
-
zh_cn_title?: string | null;
|
|
915
|
-
zh_tw_title?: string | null;
|
|
916
|
-
muscle_group: MuscleGroup;
|
|
917
|
-
other_muscles: MuscleGroup[];
|
|
918
|
-
exercise_type: ExerciseType;
|
|
919
|
-
equipment_category: Equipment;
|
|
920
|
-
sets: RoutineSet[];
|
|
921
|
-
notes?: string | null;
|
|
922
|
-
url?: string | null;
|
|
923
|
-
custom_exercise_image_url?: string | null;
|
|
924
|
-
parent_exercise_template_id?: string | null;
|
|
925
|
-
/** @deprecated 1.22.5 */
|
|
926
|
-
custom_exercise_image_thumbnail_url?: string | null;
|
|
927
|
-
thumbnail_url?: string | null;
|
|
928
|
-
media_type?: string;
|
|
929
|
-
superset_id: number | null;
|
|
930
|
-
rest_seconds: number | null;
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
export type ShallowRoutineExercise = Omit<RoutineExercise, 'sets'>;
|
|
934
|
-
|
|
935
|
-
export interface BaseRoutine {
|
|
936
|
-
id: string;
|
|
937
|
-
short_id: string;
|
|
938
|
-
parent_routine_id: string | null;
|
|
939
|
-
title: string;
|
|
940
|
-
username: string | null;
|
|
941
|
-
profile_pic: string | null | undefined;
|
|
942
|
-
exercises: RoutineExercise[];
|
|
943
|
-
updated_at: string;
|
|
944
|
-
index: number | null;
|
|
945
|
-
folder_id: number | null;
|
|
946
|
-
program_id: string | null;
|
|
947
|
-
coach_id: string | null;
|
|
948
|
-
notes: string | null;
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
export interface Routine extends BaseRoutine {
|
|
952
|
-
username: string;
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
export interface RoutineWithShallowExercises
|
|
956
|
-
extends Omit<BaseRoutine, 'exercises'> {
|
|
957
|
-
exercises: ShallowRoutineExercise[];
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
export interface CoachesRoutine extends BaseRoutine {
|
|
961
|
-
coach_id: string;
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
export interface CoachAndCoachsClientsRoutineSyncResponse {
|
|
965
|
-
updated: BaseRoutine[];
|
|
966
|
-
deleted: string[];
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
export interface CreateSampleClientResponse {
|
|
970
|
-
auth_token: string;
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
export interface RoutineSync {
|
|
974
|
-
updated: Routine[];
|
|
975
|
-
deleted: string[];
|
|
976
|
-
isMore: boolean;
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
export interface RoutineUpdate {
|
|
980
|
-
title: string;
|
|
981
|
-
exercises: RoutineUpdateExercise[];
|
|
982
|
-
parent_routine_id?: string;
|
|
983
|
-
folder_id: number | null;
|
|
984
|
-
index: number;
|
|
985
|
-
program_id: string | null;
|
|
986
|
-
notes: string | null;
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
export interface PostRoutineRequest extends RoutineUpdate {
|
|
990
|
-
clientId: string;
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
export interface RoutineUpdateExercise {
|
|
994
|
-
exercise_template_id: string;
|
|
995
|
-
superset_id?: number | null;
|
|
996
|
-
rest_seconds?: number | null;
|
|
997
|
-
sets: RoutineUpdateSet[];
|
|
998
|
-
notes?: string | null;
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
export interface RoutineUpdateSet {
|
|
1002
|
-
index: number;
|
|
1003
|
-
indicator: SetType;
|
|
1004
|
-
weight_kg?: number | null;
|
|
1005
|
-
reps?: number | null;
|
|
1006
|
-
distance_meters?: number | null;
|
|
1007
|
-
duration_seconds?: number | null;
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
export interface RoutineFolderLocationUpdate {
|
|
1011
|
-
folderId: number;
|
|
1012
|
-
index: number;
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
export interface RoutineLocationUpdate {
|
|
1016
|
-
routineId: string;
|
|
1017
|
-
folderId: number | null;
|
|
1018
|
-
index: number;
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
export interface RoutineFolder {
|
|
1022
|
-
id: number;
|
|
1023
|
-
title: string;
|
|
1024
|
-
index: number;
|
|
1025
|
-
created_at: string;
|
|
1026
|
-
updated_at: string;
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
export interface Program {
|
|
1030
|
-
id: string;
|
|
1031
|
-
title: string;
|
|
1032
|
-
created_at: string;
|
|
1033
|
-
coach_id: string;
|
|
1034
|
-
client_id: string | null;
|
|
1035
|
-
template_program_id: string | null;
|
|
1036
|
-
folder_id: number | null;
|
|
1037
|
-
index: number | null;
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
export interface ProgramUpdate {
|
|
1041
|
-
title: string;
|
|
1042
|
-
template_program_id: string | null;
|
|
1043
|
-
client_id: string | null;
|
|
1044
|
-
folder_id: number | null;
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
export interface ProgramLocationUpdate {
|
|
1048
|
-
index: number;
|
|
1049
|
-
program_id: string;
|
|
1050
|
-
folder_id: number | null;
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
export interface ProgramFolder {
|
|
1054
|
-
created_at: string;
|
|
1055
|
-
id: number;
|
|
1056
|
-
index: number;
|
|
1057
|
-
title: string;
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
export interface ProgramFolderLocationUpdate {
|
|
1061
|
-
index: number;
|
|
1062
|
-
folder_id: number;
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
export interface ClientInvite {
|
|
1066
|
-
coach_name: string | null;
|
|
1067
|
-
coach_profile_pic: string | null;
|
|
1068
|
-
coach_username: string;
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
export interface GetInviteResponse {
|
|
1072
|
-
coach_name?: string;
|
|
1073
|
-
coach_username: string;
|
|
1074
|
-
coach_profile_pic?: string;
|
|
1075
|
-
invitee_email: string;
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
export interface CoachClientInvite {
|
|
1079
|
-
client_id: string | null;
|
|
1080
|
-
coach_id: string;
|
|
1081
|
-
created_at: Date;
|
|
1082
|
-
invitee_email: string;
|
|
1083
|
-
short_id: string;
|
|
1084
|
-
declined_at: Date | null;
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
export interface OutstandingInvitesForCoachResponse {
|
|
1088
|
-
invites: CoachClientInvite[];
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
export interface BodyMeasurement {
|
|
1092
|
-
id: number;
|
|
1093
|
-
date: string; // YYYY-MM-DD
|
|
1094
|
-
weight_kg?: number;
|
|
1095
|
-
fat_percent?: number;
|
|
1096
|
-
neck_cm?: number;
|
|
1097
|
-
shoulder_cm?: number;
|
|
1098
|
-
chest_cm?: number;
|
|
1099
|
-
left_bicep_cm?: number;
|
|
1100
|
-
right_bicep_cm?: number;
|
|
1101
|
-
left_forearm_cm?: number;
|
|
1102
|
-
right_forearm_cm?: number;
|
|
1103
|
-
abdomen?: number;
|
|
1104
|
-
waist?: number;
|
|
1105
|
-
hips?: number;
|
|
1106
|
-
left_thigh?: number;
|
|
1107
|
-
right_thigh?: number;
|
|
1108
|
-
left_calf?: number;
|
|
1109
|
-
right_calf?: number;
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
export interface CustomExercise {
|
|
1113
|
-
id: string;
|
|
1114
|
-
title: string;
|
|
1115
|
-
muscle_group: MuscleGroup;
|
|
1116
|
-
other_muscles?: MuscleGroup[];
|
|
1117
|
-
exercise_type: ExerciseType;
|
|
1118
|
-
equipment_category: Equipment;
|
|
1119
|
-
custom_exercise_image_url?: string;
|
|
1120
|
-
/** @deprecated 1.22.5 */
|
|
1121
|
-
custom_exercise_image_thumbnail_url?: string;
|
|
1122
|
-
thumbnail_url?: string;
|
|
1123
|
-
created_at: string;
|
|
1124
|
-
is_archived: boolean;
|
|
1125
|
-
/** Used for Hevy Coach: in Hevy Coach, changes to a parent template propagate to children, and clients can't edit the children */
|
|
1126
|
-
parent_exercise_template_id?: string;
|
|
1127
|
-
coach_id?: string;
|
|
1128
|
-
}
|
|
1129
|
-
export interface CreateCustomExerciseRequest {
|
|
1130
|
-
title: string;
|
|
1131
|
-
muscle_group: MuscleGroup;
|
|
1132
|
-
other_muscles: MuscleGroup[];
|
|
1133
|
-
exercise_type: ExerciseType;
|
|
1134
|
-
equipment_category: Equipment;
|
|
1135
|
-
custom_exercise_image_url?: string;
|
|
1136
|
-
/** @deprecated 1.22.5 */
|
|
1137
|
-
custom_exercise_image_thumbnail_url?: string;
|
|
1138
|
-
thumbnail_url?: string;
|
|
1139
|
-
/** if set, the template will be related to the coach, not via username */
|
|
1140
|
-
coach_id?: string;
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
export interface UpdateCustomExerciseRequest {
|
|
1144
|
-
id: string;
|
|
1145
|
-
title: string;
|
|
1146
|
-
muscle_group: MuscleGroup;
|
|
1147
|
-
other_muscles: MuscleGroup[];
|
|
1148
|
-
equipment_category: Equipment;
|
|
1149
|
-
custom_exercise_image_url?: string;
|
|
1150
|
-
/** @deprecated 1.22.5 */
|
|
1151
|
-
custom_exercise_image_thumbnail_url?: string;
|
|
1152
|
-
thumbnail_url?: string;
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
export type ExerciseTemplateCustomizationAttachmentUrlType =
|
|
1156
|
-
| 'mp4_video'
|
|
1157
|
-
| 'youtube';
|
|
1158
|
-
|
|
1159
|
-
export interface ExerciseTemplateCustomization {
|
|
1160
|
-
exercise_template_id: string;
|
|
1161
|
-
instructions?: string;
|
|
1162
|
-
video_url?: string;
|
|
1163
|
-
video_url_type?: ExerciseTemplateCustomizationAttachmentUrlType;
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
export interface CreateOrUpdateExerciseTemplateCustomizationRequest {
|
|
1167
|
-
exercise_template_id: string;
|
|
1168
|
-
instructions?: string;
|
|
1169
|
-
video_url?: string;
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
|
-
export interface ClientRecentExerciseData {
|
|
1173
|
-
exercise_template_id: string;
|
|
1174
|
-
date_used: number;
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
/**
|
|
1178
|
-
* Notifications
|
|
1179
|
-
*/
|
|
1180
|
-
|
|
1181
|
-
export type Notification =
|
|
1182
|
-
| WorkoutCompleteNotification
|
|
1183
|
-
| WorkoutMentionNotification
|
|
1184
|
-
| WorkoutCommentNotification
|
|
1185
|
-
| WorkoutCommentReplyNotification
|
|
1186
|
-
| WorkoutCommentMentionNotification
|
|
1187
|
-
| WorkoutLikeNotification
|
|
1188
|
-
| FollowNotification
|
|
1189
|
-
| FollowRequestNotification
|
|
1190
|
-
| AcceptFollowRequestNotification
|
|
1191
|
-
| CoachClientInviteNotification
|
|
1192
|
-
| ContactOnHevyNotification;
|
|
1193
|
-
|
|
1194
|
-
export type NotificationType =
|
|
1195
|
-
| 'workout-complete'
|
|
1196
|
-
| 'workout-mention'
|
|
1197
|
-
| 'workout-comment'
|
|
1198
|
-
| 'workout-comment-reply'
|
|
1199
|
-
| 'workout-comment-mention'
|
|
1200
|
-
| 'workout-like'
|
|
1201
|
-
| 'follow'
|
|
1202
|
-
| 'follow-request'
|
|
1203
|
-
| 'accept-follow-request'
|
|
1204
|
-
| 'coach-client-invite'
|
|
1205
|
-
| 'contact-on-hevy';
|
|
1206
|
-
|
|
1207
|
-
export interface BaseNotification {
|
|
1208
|
-
id: number;
|
|
1209
|
-
type: NotificationType;
|
|
1210
|
-
from_username: string;
|
|
1211
|
-
profile_pic?: string;
|
|
1212
|
-
date: string;
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
export interface WorkoutCompleteNotification extends BaseNotification {
|
|
1216
|
-
type: 'workout-complete';
|
|
1217
|
-
workout_id: string;
|
|
1218
|
-
workout_title: string;
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
export interface WorkoutMentionNotification extends BaseNotification {
|
|
1222
|
-
type: 'workout-mention';
|
|
1223
|
-
workout_id: string;
|
|
1224
|
-
workout_title: string;
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
export interface WorkoutCommentNotification extends BaseNotification {
|
|
1228
|
-
type: 'workout-comment';
|
|
1229
|
-
workout_id: string;
|
|
1230
|
-
workout_title: string;
|
|
1231
|
-
comment: string;
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
export interface WorkoutCommentReplyNotification extends BaseNotification {
|
|
1235
|
-
type: 'workout-comment-reply';
|
|
1236
|
-
workout_id: string;
|
|
1237
|
-
workout_title: string;
|
|
1238
|
-
comment: string;
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
|
-
export interface WorkoutCommentMentionNotification extends BaseNotification {
|
|
1242
|
-
type: 'workout-comment-mention';
|
|
1243
|
-
workout_id: string;
|
|
1244
|
-
workout_title: string;
|
|
1245
|
-
comment: string;
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1248
|
-
export interface WorkoutLikeNotification extends BaseNotification {
|
|
1249
|
-
type: 'workout-like';
|
|
1250
|
-
workout_id: string;
|
|
1251
|
-
workout_title: string;
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
export interface FollowNotification extends BaseNotification {
|
|
1255
|
-
type: 'follow';
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
|
-
export interface FollowRequestNotification extends BaseNotification {
|
|
1259
|
-
type: 'follow-request';
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
export interface AcceptFollowRequestNotification extends BaseNotification {
|
|
1263
|
-
type: 'accept-follow-request';
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
export interface CoachClientInviteNotification extends BaseNotification {
|
|
1267
|
-
type: 'coach-client-invite';
|
|
1268
|
-
from_full_name?: string;
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
export interface ContactOnHevyNotification extends BaseNotification {
|
|
1272
|
-
type: 'contact-on-hevy';
|
|
1273
|
-
contact_name: string;
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
/**
|
|
1277
|
-
* "Pushes": a push is basically a remote notification, NOT to be confused with a "notification", which is
|
|
1278
|
-
* a data type in the Hevy database
|
|
1279
|
-
*/
|
|
1280
|
-
export type PushType = NotificationPushType | DataOnlyPushType;
|
|
1281
|
-
|
|
1282
|
-
/**
|
|
1283
|
-
* These types will have an alert/title, and will only be delivered if the user has given the notification
|
|
1284
|
-
* permission to the App
|
|
1285
|
-
*/
|
|
1286
|
-
export type NotificationPushType = NotificationType | 'chat-update';
|
|
1287
|
-
|
|
1288
|
-
/**
|
|
1289
|
-
* These types CAN NOT have an alert/title, but may be delivered even if the user has not given the notification
|
|
1290
|
-
* permission and even if Hevy isn't running, although these should be treated as best effort
|
|
1291
|
-
* For iOS/Apple see https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app
|
|
1292
|
-
* For Android see https://firebase.google.com/docs/cloud-messaging/concept-options#data_messages
|
|
1293
|
-
*/
|
|
1294
|
-
export type DataOnlyPushType =
|
|
1295
|
-
| 'coach-data-changed'
|
|
1296
|
-
| 'coach-program-changed'
|
|
1297
|
-
| 'sync-routines'
|
|
1298
|
-
| 'sync-routine-folders'
|
|
1299
|
-
| 'sync-exercise-templates-and-customizations';
|
|
1300
|
-
|
|
1301
|
-
export type WeightRepComparisonMetric =
|
|
1302
|
-
| 'one_rep_max'
|
|
1303
|
-
| 'best_weight'
|
|
1304
|
-
| 'best_set_volume';
|
|
1305
|
-
|
|
1306
|
-
export type RepsOnlyComparisonMetric = 'best_set_reps' | 'best_session_reps';
|
|
1307
|
-
|
|
1308
|
-
export type ComparisonMetric =
|
|
1309
|
-
| WeightRepComparisonMetric
|
|
1310
|
-
| RepsOnlyComparisonMetric;
|
|
1311
|
-
|
|
1312
|
-
export type ExerciseMetricComparison =
|
|
1313
|
-
| WeightRepExerciseMetricComparison
|
|
1314
|
-
| RepsOnlyExerciseMetricComparison;
|
|
1315
|
-
|
|
1316
|
-
export interface WeightRepExerciseMetricComparison {
|
|
1317
|
-
type: 'weight_rep';
|
|
1318
|
-
metric_id: WeightRepComparisonMetric;
|
|
1319
|
-
current_user_value_kg: number;
|
|
1320
|
-
other_user_value_kg: number;
|
|
1321
|
-
}
|
|
1322
|
-
|
|
1323
|
-
export interface RepsOnlyExerciseMetricComparison {
|
|
1324
|
-
type: 'reps_only';
|
|
1325
|
-
metric_id: RepsOnlyComparisonMetric;
|
|
1326
|
-
current_user_value_reps: number;
|
|
1327
|
-
other_user_value_reps: number;
|
|
1328
|
-
}
|
|
1329
|
-
|
|
1330
|
-
export interface UserWeeklyWorkoutDuration {
|
|
1331
|
-
week_start_date: string;
|
|
1332
|
-
week_end_date: string;
|
|
1333
|
-
total_seconds: number;
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
|
-
export interface GeneratePasswordRecoveryTokenResult {
|
|
1337
|
-
result: 'success' | 'unknown-email';
|
|
1338
|
-
}
|
|
1339
|
-
|
|
1340
|
-
export interface PromoResponse {
|
|
1341
|
-
endDate: string;
|
|
1342
|
-
feedCellTitle: {
|
|
1343
|
-
en: string;
|
|
1344
|
-
es: string;
|
|
1345
|
-
de: string;
|
|
1346
|
-
fr: string;
|
|
1347
|
-
it: string;
|
|
1348
|
-
pt: string;
|
|
1349
|
-
tr: string;
|
|
1350
|
-
ru: string;
|
|
1351
|
-
ja: string;
|
|
1352
|
-
ko: string;
|
|
1353
|
-
zh_CN: string;
|
|
1354
|
-
zh_TW: string;
|
|
1355
|
-
};
|
|
1356
|
-
}
|
|
1357
|
-
|
|
1358
|
-
export interface UserExerciseSet {
|
|
1359
|
-
workout_id: string;
|
|
1360
|
-
workout_short_id: string;
|
|
1361
|
-
workout_title: string;
|
|
1362
|
-
exercise_template_id: string;
|
|
1363
|
-
created_at: string;
|
|
1364
|
-
start_time: number;
|
|
1365
|
-
end_time: number;
|
|
1366
|
-
weight_kg: number | null;
|
|
1367
|
-
reps: number | null;
|
|
1368
|
-
duration_seconds: number | null;
|
|
1369
|
-
distance_meters: number | null;
|
|
1370
|
-
rpe: RPE | null;
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
|
-
export type SetCountMuscleSplitResponse = { [key in MuscleGroup]: number };
|
|
1374
|
-
|
|
1375
|
-
export type ComparableExerciseTemplatesResponse = Array<{
|
|
1376
|
-
exercise_template_id: string;
|
|
1377
|
-
}>;
|
|
1378
|
-
|
|
1379
|
-
export interface UserProfileCompareResponse {
|
|
1380
|
-
current_user: {
|
|
1381
|
-
workout_count: number;
|
|
1382
|
-
volume_kg: number;
|
|
1383
|
-
duration_seconds: number;
|
|
1384
|
-
};
|
|
1385
|
-
other_user: {
|
|
1386
|
-
workout_count: number;
|
|
1387
|
-
volume_kg: number;
|
|
1388
|
-
duration_seconds: number;
|
|
1389
|
-
};
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
|
-
export interface ServerYearInReview {
|
|
1393
|
-
supporters: Array<{
|
|
1394
|
-
username: string;
|
|
1395
|
-
like_count: number;
|
|
1396
|
-
profile_pic?: string;
|
|
1397
|
-
}>;
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1400
|
-
export type PlateCalculatorBar = {
|
|
1401
|
-
id: number;
|
|
1402
|
-
title: string;
|
|
1403
|
-
weight: number;
|
|
1404
|
-
unit: WeightUnit;
|
|
1405
|
-
};
|
|
1406
|
-
|
|
1407
|
-
export type PlateCalculatorPlate = {
|
|
1408
|
-
id: number;
|
|
1409
|
-
weight: number;
|
|
1410
|
-
unit: WeightUnit;
|
|
1411
|
-
};
|
|
1412
|
-
|
|
1413
|
-
export interface PushData {
|
|
1414
|
-
deeplink?: string;
|
|
1415
|
-
profilePic?: string;
|
|
1416
|
-
cue_campaign_id?: string;
|
|
1417
|
-
type: PushType;
|
|
1418
|
-
additionalHevyData?: any;
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
|
-
export interface CoachDataChangedPushData extends PushData {
|
|
1422
|
-
type: 'coach-data-changed';
|
|
1423
|
-
additionalHevyData: ClientsCoachData;
|
|
1424
|
-
}
|
|
1425
|
-
export interface CoachProgramChangedPushData extends PushData {
|
|
1426
|
-
type: 'coach-program-changed';
|
|
1427
|
-
additionalHevyData: {
|
|
1428
|
-
program: Program | undefined;
|
|
1429
|
-
};
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
export interface SyncRoutinesPushData extends PushData {
|
|
1433
|
-
type: 'sync-routines';
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
|
-
export interface SyncRoutineFoldersPushData extends PushData {
|
|
1437
|
-
type: 'sync-routine-folders';
|
|
1438
|
-
}
|
|
1439
|
-
export interface SyncCustomExercisesAndCoachCustomizationsPushData
|
|
1440
|
-
extends PushData {
|
|
1441
|
-
type: 'sync-exercise-templates-and-customizations';
|
|
1442
|
-
}
|
|
1443
|
-
|
|
1444
|
-
export interface ChatUpdatePushData extends PushData {
|
|
1445
|
-
type: 'chat-update';
|
|
1446
|
-
message: HevyChatUpdatePush;
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
|
-
export interface ExerciseTemplateUnit {
|
|
1450
|
-
id: number;
|
|
1451
|
-
exercise_template_id: string;
|
|
1452
|
-
weight_unit: WeightUnit;
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
export interface UserMetadataRequest {
|
|
1456
|
-
appLanguage: string;
|
|
1457
|
-
platform: string;
|
|
1458
|
-
platformVersion: string;
|
|
1459
|
-
appVersion: string;
|
|
1460
|
-
}
|
|
1461
|
-
|
|
1462
|
-
export interface UserMetadataResponse {
|
|
1463
|
-
created_at: string;
|
|
1464
|
-
updated_at: string;
|
|
1465
|
-
app_language: string;
|
|
1466
|
-
platform: string;
|
|
1467
|
-
platform_version: string;
|
|
1468
|
-
app_version: string;
|
|
1469
|
-
geoip_country: string | null;
|
|
1470
|
-
geoip_city: string | null;
|
|
1471
|
-
geoip_timezone: string | null;
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
|
-
export interface StripePrice {
|
|
1475
|
-
product_id: string;
|
|
1476
|
-
billing_period: 'month' | 'year' | 'pay-once';
|
|
1477
|
-
price_usd: number;
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
export interface StripePromoCodeDetails {
|
|
1481
|
-
product_id: string;
|
|
1482
|
-
percent_off: number;
|
|
1483
|
-
}
|
|
1484
|
-
|
|
1485
|
-
export interface StripeCheckoutSessionRequest {
|
|
1486
|
-
lookup_key: string;
|
|
1487
|
-
success_url: string;
|
|
1488
|
-
cancel_url: string;
|
|
1489
|
-
promo_code?: string;
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1492
|
-
export interface StripeCheckoutSessionResponse {
|
|
1493
|
-
url: string;
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
|
-
export interface StripeCustomerPortalSessionRequest {
|
|
1497
|
-
return_url: string;
|
|
1498
|
-
}
|
|
1499
|
-
|
|
1500
|
-
export interface StripeCustomerPortalSessionResponse {
|
|
1501
|
-
url: string;
|
|
1502
|
-
}
|
|
1503
|
-
|
|
1504
|
-
export type UserValue = string | number | boolean | null | UserValue[];
|
|
1505
|
-
|
|
1506
|
-
export type UserKeyValues = { [key: string]: UserValue };
|
|
1507
|
-
|
|
1508
|
-
export type Sex = 'male' | 'female' | 'other';
|
|
1509
|
-
|
|
1510
|
-
/**
|
|
1511
|
-
* A slimmed down version of a coach's client's workout that is used by the
|
|
1512
|
-
* coach app to display workout stats, calendar, etc. for a client.
|
|
1513
|
-
*/
|
|
1514
|
-
export interface ClientWorkout extends ClientWorkoutMetadata {
|
|
1515
|
-
estimated_volume_kg: number;
|
|
1516
|
-
set_count: number;
|
|
1517
|
-
prs: SetPersonalRecord[];
|
|
1518
|
-
}
|
|
1519
|
-
|
|
1520
|
-
export interface ClientWorkoutMetadata {
|
|
1521
|
-
id: string;
|
|
1522
|
-
index: number;
|
|
1523
|
-
start_time: number;
|
|
1524
|
-
end_time: number;
|
|
1525
|
-
name: string;
|
|
1526
|
-
description: string | null;
|
|
1527
|
-
routine_id: string | null;
|
|
1528
|
-
short_id: string;
|
|
1529
|
-
apple_watch: boolean;
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
|
-
/**
|
|
1533
|
-
* Used for the chat backend to validate authentication details
|
|
1534
|
-
*/
|
|
1535
|
-
export type UserAuthenticationValidationResponse =
|
|
1536
|
-
| 'unauthorized'
|
|
1537
|
-
| 'authorized_user'
|
|
1538
|
-
| 'admin'
|
|
1539
|
-
| 'banned'
|
|
1540
|
-
| 'flagged';
|
|
1541
|
-
|
|
1542
|
-
/**
|
|
1543
|
-
* Used for hevy-web for fetching profile metrics and calendar data
|
|
1544
|
-
*/
|
|
1545
|
-
export type UserWorkoutMetricsType = 'duration' | 'reps';
|
|
1546
|
-
|
|
1547
|
-
interface WorkoutMetricBase {
|
|
1548
|
-
workout_id: string;
|
|
1549
|
-
start_time: number;
|
|
1550
|
-
type: UserWorkoutMetricsType;
|
|
1551
|
-
}
|
|
1552
|
-
|
|
1553
|
-
export interface RepsWorkoutMetric extends WorkoutMetricBase {
|
|
1554
|
-
type: 'reps';
|
|
1555
|
-
reps: number;
|
|
1556
|
-
}
|
|
1557
|
-
|
|
1558
|
-
export interface DurationWorkoutMetric extends WorkoutMetricBase {
|
|
1559
|
-
type: 'duration';
|
|
1560
|
-
duration_seconds: number;
|
|
1561
|
-
}
|
|
1562
|
-
|
|
1563
|
-
export type WorkoutMetric = RepsWorkoutMetric | DurationWorkoutMetric;
|
|
1564
|
-
|
|
1565
|
-
export const isValidUserWorkoutMetricsType = (
|
|
1566
|
-
x: any,
|
|
1567
|
-
): x is UserWorkoutMetricsType => {
|
|
1568
|
-
return typeof x === 'string' && ['duration', 'reps'].includes(x);
|
|
1569
|
-
};
|
|
1570
|
-
|
|
1571
|
-
export interface UserCalendarWorkout {
|
|
1572
|
-
workout_short_id: string;
|
|
1573
|
-
title: string;
|
|
1574
|
-
start_time: number;
|
|
1575
|
-
duration_seconds: number;
|
|
1576
|
-
}
|