KinesteX

Data Models

Reference for the data structures returned by the Content API.


WorkoutModel:

FieldTypeDescription
idStringUnique identifier
titleStringWorkout name
categoryStringFitness or Rehabilitation
caloriesInt?Estimated calories burned
totalMinutesInt?Total duration in minutes
bodyParts[String]Targeted body parts
difficultyLevelString?Difficulty level
descriptionStringWorkout description
imgURLStringWorkout thumbnail image
sequence[ExerciseModel]List of exercises

ExerciseModel:

FieldTypeDescription
idStringUnique identifier
titleStringExercise name
bodyParts[String]Targeted body parts
videoURLStringDemo video URL
thumbnailURLStringThumbnail image URL
modelIdStringMotion tracking model ID (use in Camera Component)
descriptionStringExercise description
steps[String]Step-by-step instructions
commonMistakesStringCommon mistakes to avoid
tipsStringTips for proper form

PlanModel:

FieldTypeDescription
idStringUnique identifier
titleStringPlan name
imgURLStringPlan thumbnail image
categoryPlanModelCategoryCategory with description and levels
levels[String: PlanLevel]Dictionary of levels (1, 2, 3, etc.)
createdByStringCreator identifier

PlanLevel:

FieldTypeDescription
titleStringLevel title
descriptionStringLevel description
days[String: PlanDay]Dictionary of days

PlanDay:

FieldTypeDescription
titleStringDay title
descriptionStringDay description
workouts[WorkoutSummary]?List of workouts for this day
Working with Models
1// Accessing workout model properties
2Task {
3    let result = await kinestex.fetchWorkout(id: "9zE1kzOzpU5d5dAJrPOY")
4
5    switch result {
6    case .success(let workout):
7        // Basic properties
8        print("Title: \(workout.title)")
9        print("Category: \(workout.category ?? "N/A")")
10        print("Duration: \(workout.totalMinutes ?? 0) minutes")
11        print("Calories: \(workout.totalCalories ?? 0)")
12        print("Difficulty: \(workout.difficultyLevel ?? "N/A")")
13
14        // Body parts
15        print("Targets: \(workout.bodyParts.joined(separator: ", "))")
16
17        // Exercise sequence
18        print("\nExercises (\(workout.sequence.count)):")
19        for (index, exercise) in workout.sequence.enumerated() {
20            print("\(index + 1). \(exercise.title)")
21            print("   Model ID: \(exercise.modelId)")  // Use for Camera Component
22            print("   Reps: \(exercise.workoutReps ?? exercise.averageReps ?? 0)")
23        }
24
25        // Access raw JSON if needed
26        if let rawJSON = workout.rawJSON {
27            print("\nRaw JSON available: \(rawJSON.keys.count) keys")
28        }
29
30    case .failure(let error):
31        print("Error: \(error.localizedDescription)")
32    }
33}
34
35// Working with plan structure
36Task {
37    let result = await kinestex.fetchPlan(id: "22B3qRU2r75hVXHgGiGx")
38
39    switch result {
40    case .success(let plan):
41        print("Plan: \(plan.title)")
42        print("Category: \(plan.category.description)")
43
44        // Iterate through levels
45        for (levelKey, level) in plan.levels {
46            print("\nLevel \(levelKey): \(level.title)")
47
48            // Iterate through days
49            for (dayKey, day) in level.days {
50                print("  Day \(dayKey): \(day.title)")
51
52                // List workouts for this day
53                if let workouts = day.workouts {
54                    for workout in workouts {
55                        print("    - \(workout.title) (\(workout.totalMinutes) min)")
56                    }
57                }
58            }
59        }
60
61    case .failure(let error):
62        print("Error: \(error.localizedDescription)")
63    }
64}