feat: Initial commit of FitTrack_GarminSync project

This commit is contained in:
2025-10-10 12:20:48 -07:00
parent d0e29fbeb4
commit 18f9f6fa18
229 changed files with 21035 additions and 42 deletions

View File

@@ -0,0 +1,85 @@
{
"openapi": "3.0.0",
"info": {
"title": "GarminSync Service API - Garmin Authentication and Linking",
"version": "1.0.0",
"description": "API for initiating and managing Garmin Connect authentication and account linking."
},
"paths": {
"/api/garmin/auth/link": {
"post": {
"summary": "Initiate Garmin Connect Account Linking (Direct Email/Password)",
"operationId": "linkGarminAccountDirect",
"requestBody": {
"description": "Garmin Connect credentials for direct authentication.",
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"email": {
"type": "string",
"format": "email",
"description": "Garmin Connect account email."
},
"password": {
"type": "string",
"format": "password",
"description": "Garmin Connect account password."
}
},
"required": [
"email",
"password"
]
}
}
}
},
"responses": {
"200": {
"description": "Garmin Connect account linked successfully.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "Confirmation message."
},
"user_id": {
"type": "string",
"format": "uuid",
"description": "ID of the user for whom the account was linked."
},
"garmin_connect_account_id": {
"type": "string",
"format": "uuid",
"description": "ID of the newly linked Garmin Connect account."
}
},
"required": [
"message",
"user_id",
"garmin_connect_account_id"
]
}
}
}
},
"400": {
"description": "Invalid credentials or account already linked."
},
"500": {
"description": "Internal server error during linking process."
}
},
"tags": [
"Authentication"
]
}
}
}
}

View File

@@ -0,0 +1,85 @@
{
"openapi": "3.0.0",
"info": {
"title": "GarminSync Service API - Activity Sync",
"version": "1.0.0",
"description": "API for triggering and managing Garmin Connect activity synchronization."
},
"paths": {
"/api/sync/garmin/activities": {
"post": {
"summary": "Trigger Garmin Connect Activity Synchronization",
"operationId": "triggerActivitySync",
"requestBody": {
"description": "Optional parameters to control the synchronization process.",
"required": false,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"force_resync": {
"type": "boolean",
"description": "If true, re-download activities even if they exist. Defaults to false.",
"default": false
},
"start_date": {
"type": "string",
"format": "date",
"description": "Optional start date (YYYY-MM-DD) to sync activities from. If not provided, syncs recent activities."
},
"end_date": {
"type": "string",
"format": "date",
"description": "Optional end date (YYYY-MM-DD) to sync activities up to."
}
}
}
}
}
},
"responses": {
"202": {
"description": "Activity synchronization initiated successfully. Returns a SyncJob ID.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"job_id": {
"type": "string",
"format": "uuid",
"description": "Unique identifier for the initiated synchronization job."
},
"status": {
"type": "string",
"description": "Current status of the job (e.g., 'pending', 'in_progress')."
},
"message": {
"type": "string",
"description": "Confirmation message."
}
},
"required": [
"job_id",
"status",
"message"
]
}
}
}
},
"401": {
"description": "Unauthorized. User not authenticated with Garmin Connect."
},
"500": {
"description": "Internal server error."
}
},
"tags": [
"Synchronization"
]
}
}
}
}

View File

@@ -0,0 +1,87 @@
{
"openapi": "3.0.0",
"info": {
"title": "GarminSync Service API - Health Metrics Sync",
"version": "1.0.0",
"description": "API for triggering and managing Garmin Connect health metrics synchronization."
},
"paths": {
"/api/sync/garmin/health_metrics": {
"post": {
"summary": "Trigger Garmin Connect Health Metrics Synchronization",
"operationId": "triggerHealthMetricsSync",
"requestBody": {
"description": "Optional parameters to control the synchronization process.",
"required": false,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"metric_types": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of specific health metric types to synchronize (e.g., 'heart_rate', 'sleep'). If empty, syncs all available metrics."
},
"start_date": {
"type": "string",
"format": "date",
"description": "Optional start date (YYYY-MM-DD) to sync metrics from."
},
"end_date": {
"type": "string",
"format": "date",
"description": "Optional end date (YYYY-MM-DD) to sync metrics up to."
}
}
}
}
}
},
"responses": {
"202": {
"description": "Health metrics synchronization initiated successfully. Returns a SyncJob ID.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"job_id": {
"type": "string",
"format": "uuid",
"description": "Unique identifier for the initiated synchronization job."
},
"status": {
"type": "string",
"description": "Current status of the job (e.g., 'pending', 'in_progress')."
},
"message": {
"type": "string",
"description": "Confirmation message."
}
},
"required": [
"job_id",
"status",
"message"
]
}
}
}
},
"401": {
"description": "Unauthorized. User not authenticated with Garmin Connect."
},
"500": {
"description": "Internal server error."
}
},
"tags": [
"Synchronization"
]
}
}
}
}

View File

@@ -0,0 +1,102 @@
{
"openapi": "3.0.0",
"info": {
"title": "GarminSync Service API - Workout Upload",
"version": "1.0.0",
"description": "API for uploading workouts to Garmin Connect."
},
"paths": {
"/api/sync/garmin/workouts": {
"post": {
"summary": "Upload Workout to Garmin Connect",
"operationId": "uploadGarminWorkout",
"requestBody": {
"description": "Workout definition to be uploaded.",
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"workout_id": {
"type": "string",
"format": "uuid",
"description": "Unique identifier of the workout within the application."
},
"workout_name": {
"type": "string",
"description": "Name of the workout."
},
"workout_type": {
"type": "string",
"description": "Type of workout (e.g., 'running', 'cycling')."
},
"scheduled_date": {
"type": "string",
"format": "date",
"description": "Date the workout is scheduled for (YYYY-MM-DD)."
},
"workout_data": {
"type": "object",
"description": "Structured data defining the workout steps and targets. (Schema to be defined based on Garmin Connect workout API)."
}
},
"required": [
"workout_id",
"workout_name",
"workout_type",
"scheduled_date",
"workout_data"
]
}
}
}
},
"responses": {
"202": {
"description": "Workout upload initiated successfully. Returns a SyncJob ID.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"job_id": {
"type": "string",
"format": "uuid",
"description": "Unique identifier for the initiated workout upload job."
},
"status": {
"type": "string",
"description": "Current status of the job (e.g., 'pending', 'in_progress')."
},
"message": {
"type": "string",
"description": "Confirmation message."
}
},
"required": [
"job_id",
"status",
"message"
]
}
}
}
},
"400": {
"description": "Invalid workout data provided."
},
"401": {
"description": "Unauthorized. User not authenticated with Garmin Connect."
},
"500": {
"description": "Internal server error."
}
},
"tags": [
"Synchronization"
]
}
}
}
}

View File

@@ -0,0 +1,128 @@
{
"openapi": "3.0.0",
"info": {
"title": "GarminSync Service API - Synchronization Status",
"version": "1.0.0",
"description": "API for checking the status of synchronization processes."
},
"paths": {
"/api/sync/status": {
"get": {
"summary": "Get Synchronization Status",
"operationId": "getSyncStatus",
"parameters": [
{
"name": "job_id",
"in": "query",
"required": false,
"schema": {
"type": "string",
"format": "uuid"
},
"description": "Optional: Filter status by a specific synchronization job ID."
},
{
"name": "job_type",
"in": "query",
"required": false,
"schema": {
"type": "string",
"enum": [
"activity_sync",
"health_metrics_sync",
"workout_upload"
]
},
"description": "Optional: Filter status by job type."
}
],
"responses": {
"200": {
"description": "Returns the current status of synchronization jobs.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"jobs": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SyncJobStatus"
}
}
},
"required": [
"jobs"
]
}
}
}
},
"401": {
"description": "Unauthorized. User not authenticated."
},
"500": {
"description": "Internal server error."
}
},
"tags": [
"Synchronization"
]
}
}
},
"components": {
"schemas": {
"SyncJobStatus": {
"type": "object",
"properties": {
"job_id": {
"type": "string",
"format": "uuid",
"description": "Unique identifier for the synchronization job."
},
"job_type": {
"type": "string",
"description": "Type of synchronization (e.g., 'activity_sync')."
},
"status": {
"type": "string",
"description": "Current status of the job (e.g., 'pending', 'in_progress', 'completed', 'failed')."
},
"progress": {
"type": "number",
"format": "float",
"description": "Percentage completion (0.0 to 1.0)."
},
"start_time": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the job started."
},
"end_time": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the job ended (if completed or failed)."
},
"error_message": {
"type": "string",
"nullable": true,
"description": "Any error message if the job failed."
},
"details": {
"type": "object",
"nullable": true,
"description": "Additional job-specific details (e.g., number of items synced, skipped)."
}
},
"required": [
"job_id",
"job_type",
"status",
"progress",
"start_time"
]
}
}
}
}