diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 625dc32..a48b0ec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,63 +8,61 @@ on: jobs: release: runs-on: ubuntu-latest - + steps: - name: Checkout repository uses: actions/checkout@v4 - + - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '18' cache: 'npm' cache-dependency-path: data_models/package-lock.json - + - name: Install TypeSpec dependencies run: | cd data_models npm ci - + - name: Install Redocly CLI - run: npm install -g @redocly/cli - + run: npm install -g @redocly/cli@1.34.2 + - name: Generate TypeSpec schemas run: | cd data_models npx tsp compile . --emit=@typespec/json-schema chmod +x promote.sh ./promote.sh - - - name: Bundle OpenAPI v5 specification + + - name: Bundle OpenAPI specifications run: | redocly bundle v5.yaml -o v5-bundled.yaml - - - name: Bundle OpenAPI v6 specification - run: | - redocly bundle v6.yaml -o v6-bundled.yaml - - - name: Validate bundled specifications + redocly bundle widget.yaml -o widget-bundled.yaml + + - name: Validate specifications run: | - redocly lint v5-bundled.yaml - redocly lint v6-bundled.yaml - + redocly lint + redocly lint v5-bundled.yaml widget-bundled.yaml + - name: Upload bundled specifications uses: actions/upload-artifact@v4 with: name: bundled-specs path: | v5-bundled.yaml - v6-bundled.yaml + widget-bundled.yaml retention-days: 90 - + - name: Upload schemas uses: actions/upload-artifact@v4 with: name: schemas path: schemas/ retention-days: 90 - + - name: Create Release + id: create_release if: startsWith(github.ref, 'refs/tags/') uses: actions/create-release@v1 env: @@ -74,17 +72,17 @@ jobs: release_name: Release ${{ github.ref_name }} body: | ## Changes - + This release includes updated OpenAPI specifications and JSON schemas. - + ### Artifacts - - `v5-bundled.yaml` - Bundled OpenAPI v5 specification - - `v6-bundled.yaml` - Bundled OpenAPI v6 specification + - `v5-bundled.yaml` - Bundled OpenAPI v5/v2 specification + - `widget-bundled.yaml` - Bundled Widget API specification - `schemas.zip` - All generated JSON schemas - + draft: false prerelease: false - + - name: Upload Release Asset - v5 Bundle if: startsWith(github.ref, 'refs/tags/') uses: actions/upload-release-asset@v1 @@ -95,14 +93,14 @@ jobs: asset_path: ./v5-bundled.yaml asset_name: v5-bundled.yaml asset_content_type: application/yaml - - - name: Upload Release Asset - v6 Bundle + + - name: Upload Release Asset - Widget Bundle if: startsWith(github.ref, 'refs/tags/') uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./v6-bundled.yaml - asset_name: v6-bundled.yaml - asset_content_type: application/yaml \ No newline at end of file + asset_path: ./widget-bundled.yaml + asset_name: widget-bundled.yaml + asset_content_type: application/yaml diff --git a/.github/workflows/schema-generation.yml b/.github/workflows/schema-generation.yml index b7e9a05..bee2c95 100644 --- a/.github/workflows/schema-generation.yml +++ b/.github/workflows/schema-generation.yml @@ -9,49 +9,52 @@ on: jobs: generate-schemas: runs-on: ubuntu-latest - + steps: - name: Checkout repository uses: actions/checkout@v4 - + - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '18' cache: 'npm' cache-dependency-path: data_models/package-lock.json - + - name: Install dependencies run: | cd data_models npm ci - + + - name: Install Redocly CLI + run: npm install -g @redocly/cli@1.34.2 + - name: Run linting run: | cd data_models npm run lint - + - name: Run formatting check run: | cd data_models npm run format:check - + - name: Run tests run: | cd data_models npm test - + - name: Generate TypeSpec schemas run: | cd data_models npx tsp compile . --emit=@typespec/json-schema - + - name: Promote schemas run: | cd data_models chmod +x promote.sh ./promote.sh - + - name: Verify schemas were generated run: | if [ ! -d "schemas" ] || [ -z "$(ls -A schemas)" ]; then @@ -59,20 +62,37 @@ jobs: exit 1 fi echo "Generated $(ls schemas | wc -l) schema files" - + + # Drift gate: committed schemas/ must match freshly-generated output. + # Runs on PRs *and* pushes so a direct push to master can't land stale schemas. + - name: Check for schema drift + run: | + git add schemas/ + if ! git diff --cached --quiet; then + echo "::error::Promoted schemas differ from committed schemas/. Run 'cd data_models && npx tsp compile . --emit=@typespec/json-schema && ./promote.sh' and commit the result." + git diff --cached --name-only + exit 1 + fi + + # Validate every OpenAPI spec (errors block merge; see redocly.yaml). + - name: Lint OpenAPI specs + run: redocly lint + + # Bundle drift gate: committed *-bundled.yaml must match a fresh bundle, so + # the published bundles can never go stale relative to their source specs. + - name: Check for bundle drift + run: | + redocly bundle v5.yaml -o v5-bundled.yaml + redocly bundle widget.yaml -o widget-bundled.yaml + if ! git diff --quiet v5-bundled.yaml widget-bundled.yaml; then + echo "::error::Committed bundles are stale. Run 'redocly bundle v5.yaml -o v5-bundled.yaml && redocly bundle widget.yaml -o widget-bundled.yaml' and commit the result." + git diff --name-only v5-bundled.yaml widget-bundled.yaml + exit 1 + fi + - name: Upload generated schemas uses: actions/upload-artifact@v4 with: name: generated-schemas path: schemas/ retention-days: 30 - - - name: Check for schema changes - if: github.event_name == 'pull_request' - run: | - git add schemas/ - if ! git diff --cached --quiet; then - echo "Schema files have changed. Please commit the updated schemas." - git diff --cached --name-only - exit 1 - fi \ No newline at end of file diff --git a/.github/workflows/spec-drift.yml b/.github/workflows/spec-drift.yml new file mode 100644 index 0000000..aef97be --- /dev/null +++ b/.github/workflows/spec-drift.yml @@ -0,0 +1,56 @@ +name: Spec/Router Drift Check + +# Weekly backstop: compares v5.yaml's documented paths against the live v2 route +# inventory committed in terra-v6 (route_inventory.json, produced by that repo's +# route-inventory golden test). Fails — and opens an issue — only when the spec +# documents a path the router no longer serves. See analysis §8.3. + +on: + schedule: + - cron: '0 9 * * 1' # Mondays 09:00 UTC + workflow_dispatch: {} + +jobs: + drift: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install PyYAML + run: pip install pyyaml + + - name: Fetch terra-v6 route inventory + env: + # PAT with read access to the private terra-v6 repo. + GH_TOKEN: ${{ secrets.TERRA_V6_RO_TOKEN }} + run: | + curl -sSfL \ + -H "Authorization: Bearer $GH_TOKEN" \ + -H "Accept: application/vnd.github.raw" \ + "https://api.github.com/repos/tryterra/terra-v6/contents/services/api/internal/endpoints/v2/route_inventory.json?ref=main" \ + -o route_inventory.json + echo "fetched $(python3 -c 'import json;print(len(json.load(open("route_inventory.json"))))') routes" + + - name: Check spec/router drift + run: python3 scripts/check_spec_drift.py --spec v5.yaml --inventory route_inventory.json + + - name: Open issue on drift + if: failure() + uses: actions/github-script@v7 + with: + script: | + const title = 'Spec/router drift detected (v5.yaml vs terra-v6 v2 routes)'; + const issues = await github.rest.issues.listForRepo({ + owner: context.repo.owner, repo: context.repo.repo, + state: 'open', labels: 'spec-drift', + }); + if (issues.data.some(i => i.title === title)) return; + await github.rest.issues.create({ + owner: context.repo.owner, repo: context.repo.repo, + title, labels: ['spec-drift'], + body: 'The weekly drift check failed: v5.yaml documents one or more paths the terra-v6 v2 router no longer serves. See the failed run logs for the list, then update v5.yaml (remove/relocate) or the router.', + }); diff --git a/README.md b/README.md index 49bac89..6da5a27 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,12 @@ This repository contains OpenAPI specifications and JSON schema definitions for - **`data_models/`** - TypeSpec source files and build configuration - **`specs/`** - TypeSpec data model definitions - **`tsp-output/`** - Generated schemas and OpenAPI specs -- **`schemas/`** - Promoted JSON schemas (ready for use) -- **`v5.yaml`** - Main OpenAPI v5 specification -- **`v6.yaml`** - OpenAPI v6 specification -- **`v5-bundled.yaml`** - Bundled version of v5 spec +- **`schemas/`** - Promoted JSON schemas (ready for use), referenced by `v5.yaml` via local relative refs +- **`v5.yaml`** - Main OpenAPI specification (serves the `/api/v2` surface) +- **`widget.yaml`** - Authentication-widget session API +- **`teams.yml`** - Team-based API +- **`rt.yml`** - Real-Time streaming API +- **`v5-bundled.yaml`** / **`widget-bundled.yaml`** - Bundled (self-contained) specs, regenerated by CI ## Building diff --git a/data_models/promote.sh b/data_models/promote.sh index b5c99c0..1d5473f 100755 --- a/data_models/promote.sh +++ b/data_models/promote.sh @@ -1,5 +1,37 @@ #!/bin/bash -# This script promotes the generated JSON schemas to the schemas directory. +# Promotes the generated JSON schemas to the repo-root schemas/ directory. +# +# The @typespec/json-schema emitter requires @jsonSchema() to be a valid +# absolute URL, so main.tsp keeps a github raw base. We rewrite that base out +# here so the promoted schemas use bare relative sibling refs ($ref: Foo.yaml) +# and carry no $id. This keeps the spec hermetic: `redocly bundle` resolves the +# whole graph from local files with no network access, and old checkouts no +# longer resolve against master HEAD. See analysis/openapi-v6-surface-analysis.md §8. +set -euo pipefail -rm -rf ../schemas/* -cp tsp-output/@typespec/json-schema/*.yaml ../schemas \ No newline at end of file +BASE="https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/" +SRC="tsp-output/@typespec/json-schema" +DEST="../schemas" + +rm -rf "$DEST"/* +cp "$SRC"/*.yaml "$DEST"/ + +python3 - "$DEST" "$BASE" <<'PY' +import glob, os, sys +dest, base = sys.argv[1], sys.argv[2] +for f in glob.glob(os.path.join(dest, "*.yaml")): + out = [] + for ln in open(f): + if ln.startswith("$id:"): # drop absolute $id; refs resolve by file path + continue + out.append(ln.replace(base, "")) # remote $ref base -> bare relative sibling + open(f, "w").write("".join(out)) +PY + +# Guard: no promoted schema may carry the remote base anymore. +if grep -rl "raw.githubusercontent.com/tryterra/openapi" "$DEST" >/dev/null 2>&1; then + echo "ERROR: promoted schemas still contain remote refs" >&2 + grep -rl "raw.githubusercontent.com/tryterra/openapi" "$DEST" >&2 + exit 1 +fi +echo "Promoted $(ls "$DEST"/*.yaml | wc -l | tr -d ' ') schemas with local relative refs." diff --git a/data_models/specs/data_models/TerraUser.tsp b/data_models/specs/data_models/TerraUser.tsp index e3c873e..ead8161 100644 --- a/data_models/specs/data_models/TerraUser.tsp +++ b/data_models/specs/data_models/TerraUser.tsp @@ -12,6 +12,10 @@ model TerraUser { @minLength(1) provider: string; // not null + @doc("Time at which the connection was created") + @example("2022-12-12T10:00:00.000000+00:00") + created_at?: string; + @doc("Last time at which a webhook update was sent for the connection") @example("2022-12-12T10:00:00.000000+00:00") last_webhook_update?: string; diff --git a/redocly.yaml b/redocly.yaml new file mode 100644 index 0000000..b7bfcfd --- /dev/null +++ b/redocly.yaml @@ -0,0 +1,31 @@ +# Redocly lint configuration for all Terra OpenAPI specs. +# `redocly lint` (no args) lints every api listed below. +# Philosophy: keep correctness rules as errors (3.1 validity, hermetic refs, +# defined security), and authoring-policy rules as warnings so the gate blocks +# broken specs without nagging on style. See analysis/openapi-v6-surface-analysis.md §8. +apis: + v5: + root: v5.yaml + widget: + root: widget.yaml + teams: + root: teams.yml + rt: + root: rt.yml + +extends: + - recommended + +rules: + # --- errors: block merge --- + struct: error # OpenAPI 3.1 structural validity (e.g. no `nullable`) + no-unresolved-refs: error # every $ref must resolve from local files (hermetic) + security-defined: error # no `security` referencing an undefined scheme + operation-operationId-unique: error + # --- warnings: visible, non-blocking --- + operation-4xx-response: warn # data reads model success as a oneOf; don't hard-fail + operation-operationId: warn # some legacy ops still lack operationIds + no-unused-components: warn + info-license: warn + no-invalid-media-type-examples: warn + no-server-example.com: warn diff --git a/rt.yml b/rt.yml index a0b032e..f3482f1 100644 --- a/rt.yml +++ b/rt.yml @@ -1,7 +1,7 @@ openapi: 3.1.0 info: title: Real Time Streaming API - version: 2.0 + version: "2.0" servers: - url: https://ws.tryterra.co components: @@ -49,10 +49,8 @@ paths: example: cG9RvLY5.yvKm778XMIPm1ig93BJEoRCVGHzlrBNjzWdeXePTaMM examples: Result: - value: | - { - "token": "cG9RvLY5.yvKm778XMIPm1ig93BJEoRCVGHzlrBNjzWdeXePTaMM" - } + value: + token: cG9RvLY5.yvKm778XMIPm1ig93BJEoRCVGHzlrBNjzWdeXePTaMM '403': description: Forbidden content: @@ -96,10 +94,8 @@ paths: example: OTYwNWFi5ZWQMTAxMjg0Y2Qw.gzrPzZcS3Gy8QDOxbiPRwu30PTB3VxW0eE examples: Result: - value: | - { - "token": "OTYwNWFi5ZWQMTAxMjg0Y2Qw.gzrPzZcS3Gy8QDOxbiPRwu30PTB3VxW0eE" - } + value: + token: OTYwNWFi5ZWQMTAxMjg0Y2Qw.gzrPzZcS3Gy8QDOxbiPRwu30PTB3VxW0eE '403': description: Forbidden content: diff --git a/schemas/AFibClassificationSample.yaml b/schemas/AFibClassificationSample.yaml index 5bc7099..e522e91 100644 --- a/schemas/AFibClassificationSample.yaml +++ b/schemas/AFibClassificationSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AFibClassificationSample.yaml type: object properties: timestamp: @@ -8,5 +7,5 @@ properties: - 2022-11-23T09:00:00.000000+02:00 description: Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time. afib_classification: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AFibFlag.yaml + $ref: AFibFlag.yaml description: Flag indicating the atrial fibrillation classification of the individual diff --git a/schemas/AFibFlag.yaml b/schemas/AFibFlag.yaml index 5f27751..8e97709 100644 --- a/schemas/AFibFlag.yaml +++ b/schemas/AFibFlag.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AFibFlag.yaml oneOf: - type: number const: 0 diff --git a/schemas/AccessRevokedEvent.yaml b/schemas/AccessRevokedEvent.yaml index 37d401d..843934c 100644 --- a/schemas/AccessRevokedEvent.yaml +++ b/schemas/AccessRevokedEvent.yaml @@ -1,12 +1,11 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AccessRevokedEvent.yaml type: object properties: type: type: string const: access_revoked user: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml + $ref: TerraUser.yaml description: User who revoked access status: type: string @@ -21,5 +20,5 @@ required: - status - message allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml + - $ref: WebhookEvent.yaml description: Access revoked event when a user revokes access through the provider diff --git a/schemas/ActiveDurationsData.yaml b/schemas/ActiveDurationsData.yaml index 7d016ad..c7e7eac 100644 --- a/schemas/ActiveDurationsData.yaml +++ b/schemas/ActiveDurationsData.yaml @@ -1,11 +1,10 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActiveDurationsData.yaml type: object properties: activity_levels_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityLevelSample.yaml + $ref: ActivityLevelSample.yaml description: Array of detailed samples of the intensity the user was in at various points during the workout. activity_seconds: type: number diff --git a/schemas/Activity.yaml b/schemas/Activity.yaml index 873e497..d070ccf 100644 --- a/schemas/Activity.yaml +++ b/schemas/Activity.yaml @@ -1,12 +1,11 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Activity.yaml type: object properties: active_durations_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActiveDurationsData.yaml + $ref: ActiveDurationsData.yaml description: Number of minutes spent at various intensities during the workout, as reported by the Fitness Data provider. calories_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/CaloriesData.yaml + $ref: CaloriesData.yaml description: Object containing calorie-related information for the user during the specific workout. cheat_detection: type: number @@ -14,52 +13,52 @@ properties: - 0 description: Cheat detection flag. data_enrichment: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DataEnrichment.yaml + $ref: DataEnrichment.yaml description: Object containing Terra Scores. device_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceData.yaml + $ref: DeviceData.yaml description: Object containing information on the device which recorded the specific workout. distance_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceData.yaml + $ref: DistanceData.yaml description: Object containing information related to distance covered during the associated workout. energy_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/EnergyData.yaml + $ref: EnergyData.yaml description: Object containing information on the energy expended by the user during the workout. heart_rate_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateData.yaml + $ref: HeartRateData.yaml description: Object containing heartrate-related information for the workout. lap_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LapData.yaml + $ref: LapData.yaml description: Object containing information on data for each lap performed by the user - mostly relates to track & field running activities, and swimming activities. MET_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/METData.yaml + $ref: METData.yaml description: Object containing information on the Metabolic Equivalent of Task for the workout. metadata: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityMetadata.yaml + $ref: ActivityMetadata.yaml description: Object containing workout metadata. movement_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MovementData.yaml + $ref: MovementData.yaml description: Object containing information on the user's movement throughout the workout. oxygen_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenData.yaml + $ref: OxygenData.yaml description: Object containing information on oxygen-related metrics for the workout. polyline_map_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PolylineMapData.yaml + $ref: PolylineMapData.yaml description: Object containing polyline-representation map data, plotting the user's trajectory throughout the workout. position_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PositionData.yaml + $ref: PositionData.yaml description: Object containing information on the user's position throughout the workout. power_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PowerData.yaml + $ref: PowerData.yaml description: Object containing information on the power generated by the user during the workout. strain_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StrainData.yaml + $ref: StrainData.yaml description: Object containing information on the cardiovascular strain imposed on the user during the workout. TSS_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TSSData.yaml + $ref: TSSData.yaml description: Object containing information on the stress put on the user's body from a workout. work_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WorkData.yaml + $ref: WorkData.yaml description: Object containing information on the work output of the user during the workout. required: - metadata diff --git a/schemas/ActivityEvent.yaml b/schemas/ActivityEvent.yaml index 21a441a..58a64c6 100644 --- a/schemas/ActivityEvent.yaml +++ b/schemas/ActivityEvent.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityEvent.yaml type: object properties: type: @@ -8,10 +7,10 @@ properties: data: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Activity.yaml + $ref: Activity.yaml description: Array of activity data user: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml + $ref: TerraUser.yaml description: User whose data is being provided version: type: string @@ -22,5 +21,5 @@ required: - user - version allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml + - $ref: WebhookEvent.yaml description: Activity data event diff --git a/schemas/ActivityLevel.yaml b/schemas/ActivityLevel.yaml index acffd56..73d4228 100644 --- a/schemas/ActivityLevel.yaml +++ b/schemas/ActivityLevel.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityLevel.yaml oneOf: - type: number const: 0 diff --git a/schemas/ActivityLevelSample.yaml b/schemas/ActivityLevelSample.yaml index 5edc796..ffe611a 100644 --- a/schemas/ActivityLevelSample.yaml +++ b/schemas/ActivityLevelSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityLevelSample.yaml type: object properties: timestamp: @@ -8,4 +7,4 @@ properties: - 2022-11-23T09:00:00.000000+02:00 description: Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time. level: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityLevel.yaml + $ref: ActivityLevel.yaml diff --git a/schemas/ActivityMetadata.yaml b/schemas/ActivityMetadata.yaml index a5c63f6..79e16a7 100644 --- a/schemas/ActivityMetadata.yaml +++ b/schemas/ActivityMetadata.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityMetadata.yaml type: object properties: city: @@ -38,12 +37,12 @@ properties: - 123e4567-e89b-12d3-a456-426614174000 description: A unique identifier for the workout - note that this is unique for the given user, and may not be globally unique. timestamp_localization: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TimestampLocalization.yaml + $ref: TimestampLocalization.yaml type: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityType.yaml + $ref: ActivityType.yaml description: The type of activity performed for the associated workout. upload_type: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/UploadType.yaml + $ref: UploadType.yaml description: The upload type for the associated workout, providing information on whether this was an automatic workout or user-entered. required: - end_time diff --git a/schemas/ActivityType.yaml b/schemas/ActivityType.yaml index 774b805..dc65e48 100644 --- a/schemas/ActivityType.yaml +++ b/schemas/ActivityType.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityType.yaml oneOf: - type: number const: 0 diff --git a/schemas/AsleepDurations.yaml b/schemas/AsleepDurations.yaml index ba9226a..53b5168 100644 --- a/schemas/AsleepDurations.yaml +++ b/schemas/AsleepDurations.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AsleepDurations.yaml type: object properties: duration_asleep_state_seconds: diff --git a/schemas/Athlete.yaml b/schemas/Athlete.yaml index c24de20..68fac87 100644 --- a/schemas/Athlete.yaml +++ b/schemas/Athlete.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Athlete.yaml type: object properties: age: @@ -65,5 +64,5 @@ properties: devices: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceData.yaml + $ref: DeviceData.yaml description: Array of devices associated with the user's account. diff --git a/schemas/AthleteEvent.yaml b/schemas/AthleteEvent.yaml index c006921..5a8a595 100644 --- a/schemas/AthleteEvent.yaml +++ b/schemas/AthleteEvent.yaml @@ -1,15 +1,14 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AthleteEvent.yaml type: object properties: type: type: string const: athlete athlete: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Athlete.yaml + $ref: Athlete.yaml description: Athlete data user: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml + $ref: TerraUser.yaml description: User whose data is being provided version: type: string @@ -20,5 +19,5 @@ required: - user - version allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml + - $ref: WebhookEvent.yaml description: Athlete data event diff --git a/schemas/AuthErrorEvent.yaml b/schemas/AuthErrorEvent.yaml index 770d4ab..6569906 100644 --- a/schemas/AuthErrorEvent.yaml +++ b/schemas/AuthErrorEvent.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AuthErrorEvent.yaml type: object properties: status: @@ -7,7 +6,7 @@ properties: const: error description: Status of authentication user: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml + $ref: TerraUser.yaml description: User who attempted to authenticate provider: type: string @@ -33,5 +32,5 @@ required: - reference_id - widget_session_id allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AuthEvent.yaml + - $ref: AuthEvent.yaml description: Authentication error event diff --git a/schemas/AuthEvent.yaml b/schemas/AuthEvent.yaml index 53c87a1..fd6f99c 100644 --- a/schemas/AuthEvent.yaml +++ b/schemas/AuthEvent.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AuthEvent.yaml type: object properties: type: @@ -12,5 +11,5 @@ required: - type - status allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml + - $ref: WebhookEvent.yaml description: Authentication event diff --git a/schemas/AuthSuccessEvent.yaml b/schemas/AuthSuccessEvent.yaml index b8d917c..004198f 100644 --- a/schemas/AuthSuccessEvent.yaml +++ b/schemas/AuthSuccessEvent.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AuthSuccessEvent.yaml type: object properties: status: @@ -7,7 +6,7 @@ properties: const: success description: Status of authentication user: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml + $ref: TerraUser.yaml description: User who authenticated reference_id: type: string @@ -21,5 +20,5 @@ required: - reference_id - widget_session_id allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AuthEvent.yaml + - $ref: AuthEvent.yaml description: Authentication success event diff --git a/schemas/AwakeDurations.yaml b/schemas/AwakeDurations.yaml index edf2de6..4116bc9 100644 --- a/schemas/AwakeDurations.yaml +++ b/schemas/AwakeDurations.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AwakeDurations.yaml type: object properties: duration_awake_state_seconds: diff --git a/schemas/BloodPressureData.yaml b/schemas/BloodPressureData.yaml index e99543b..97efbbe 100644 --- a/schemas/BloodPressureData.yaml +++ b/schemas/BloodPressureData.yaml @@ -1,9 +1,8 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BloodPressureData.yaml type: object properties: blood_pressure_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BloodPressureSample.yaml + $ref: BloodPressureSample.yaml description: List of Blood Pressure measurements sampled throughout the day. diff --git a/schemas/BloodPressureSample.yaml b/schemas/BloodPressureSample.yaml index 018d8bb..a5a7118 100644 --- a/schemas/BloodPressureSample.yaml +++ b/schemas/BloodPressureSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BloodPressureSample.yaml type: object properties: timestamp: diff --git a/schemas/Body.yaml b/schemas/Body.yaml index 86f6e00..52e6911 100644 --- a/schemas/Body.yaml +++ b/schemas/Body.yaml @@ -1,36 +1,35 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Body.yaml type: object properties: blood_pressure_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BloodPressureData.yaml + $ref: BloodPressureData.yaml description: Object containing information on user's Blood Pressure. device_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceData.yaml + $ref: DeviceData.yaml description: Object containing information on the device which recorded data for the payload. heart_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartData.yaml + $ref: HeartData.yaml description: Object containing information on user's heart metrics. hydration_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HydrationData.yaml + $ref: HydrationData.yaml description: Object containing information on user's hydration (both internal & consumption of water) for the day. ketone_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/KetoneData.yaml + $ref: KetoneData.yaml description: Object containing information on user's ketone data for the day. measurements_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MeasurementsData.yaml + $ref: MeasurementsData.yaml description: Object containing information on body measurements for the day. metadata: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BodyMetadata.yaml + $ref: BodyMetadata.yaml description: Object containing daily summary metadata. oxygen_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenData.yaml + $ref: OxygenData.yaml description: Object containing information on user's oxygen-related data. temperature_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TemperatureData.yaml + $ref: TemperatureData.yaml description: Object containing temperature information (core, skin, ambient) during the day. glucose_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/GlucoseData.yaml + $ref: GlucoseData.yaml description: Object containing information on user's blood glucose for the day. required: - metadata diff --git a/schemas/BodyBatterySample.yaml b/schemas/BodyBatterySample.yaml index 0d09d76..06db111 100644 --- a/schemas/BodyBatterySample.yaml +++ b/schemas/BodyBatterySample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BodyBatterySample.yaml type: object properties: timestamp: diff --git a/schemas/BodyEvent.yaml b/schemas/BodyEvent.yaml index 1d0ec9d..76d0882 100644 --- a/schemas/BodyEvent.yaml +++ b/schemas/BodyEvent.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BodyEvent.yaml type: object properties: type: @@ -8,10 +7,10 @@ properties: data: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Body.yaml + $ref: Body.yaml description: Array of body data user: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml + $ref: TerraUser.yaml description: User whose data is being provided version: type: string @@ -22,5 +21,5 @@ required: - user - version allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml + - $ref: WebhookEvent.yaml description: Body data event diff --git a/schemas/BodyMetadata.yaml b/schemas/BodyMetadata.yaml index 0877609..e346fcf 100644 --- a/schemas/BodyMetadata.yaml +++ b/schemas/BodyMetadata.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BodyMetadata.yaml type: object properties: end_time: @@ -13,7 +12,7 @@ properties: - 1999-11-23T09:00:00.000000+02:00 description: The start time of the associated day, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h before end_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time. timestamp_localization: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TimestampLocalization.yaml + $ref: TimestampLocalization.yaml required: - end_time - start_time diff --git a/schemas/BreathSample.yaml b/schemas/BreathSample.yaml index 9851ad5..5cd42a4 100644 --- a/schemas/BreathSample.yaml +++ b/schemas/BreathSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BreathSample.yaml type: object properties: timestamp: diff --git a/schemas/BreathsData.yaml b/schemas/BreathsData.yaml index b01fd48..0fc9432 100644 --- a/schemas/BreathsData.yaml +++ b/schemas/BreathsData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BreathsData.yaml type: object properties: avg_breaths_per_min: @@ -25,7 +24,7 @@ properties: samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BreathSample.yaml + $ref: BreathSample.yaml description: List of breathing rate information sampled throughout the sleep session. start_time: type: string diff --git a/schemas/CadenceSample.yaml b/schemas/CadenceSample.yaml index bd21b1a..777311e 100644 --- a/schemas/CadenceSample.yaml +++ b/schemas/CadenceSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/CadenceSample.yaml type: object properties: timestamp: diff --git a/schemas/CalorieSample.yaml b/schemas/CalorieSample.yaml index 0b27094..9775028 100644 --- a/schemas/CalorieSample.yaml +++ b/schemas/CalorieSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/CalorieSample.yaml type: object properties: timestamp: diff --git a/schemas/CaloriesData.yaml b/schemas/CaloriesData.yaml index f7f3fe1..1309d77 100644 --- a/schemas/CaloriesData.yaml +++ b/schemas/CaloriesData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/CaloriesData.yaml type: object properties: BMR_calories: @@ -8,7 +7,7 @@ properties: calorie_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/CalorieSample.yaml + $ref: CalorieSample.yaml description: Array of calorie data samples recorded throughout the time period. net_activity_calories: type: number diff --git a/schemas/Connection.yaml b/schemas/Connection.yaml index f158a2e..174477c 100644 --- a/schemas/Connection.yaml +++ b/schemas/Connection.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Connection.yaml type: object properties: id: diff --git a/schemas/ConnectionErrorEvent.yaml b/schemas/ConnectionErrorEvent.yaml index 74614cf..dc637a5 100644 --- a/schemas/ConnectionErrorEvent.yaml +++ b/schemas/ConnectionErrorEvent.yaml @@ -1,12 +1,11 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ConnectionErrorEvent.yaml type: object properties: type: type: string const: connection_error user: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml + $ref: TerraUser.yaml description: User with connection issues status: type: string @@ -21,5 +20,5 @@ required: - status - message allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml + - $ref: WebhookEvent.yaml description: Connection error event diff --git a/schemas/Daily.yaml b/schemas/Daily.yaml index ae5f685..37b92ff 100644 --- a/schemas/Daily.yaml +++ b/schemas/Daily.yaml @@ -1,45 +1,44 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Daily.yaml type: object properties: active_durations_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActiveDurationsData.yaml + $ref: ActiveDurationsData.yaml description: Object containing information related to the time spent in different activity intensities during over the day. calories_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/CaloriesData.yaml + $ref: CaloriesData.yaml description: Object containing calorie-related information for the user during the specific day. data_enrichment: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyDataEnrichment.yaml + $ref: DailyDataEnrichment.yaml description: Object containing additional enrichment data for the day. device_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceData.yaml + $ref: DeviceData.yaml description: Object containing information on the device which recorded data for the day. distance_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyDistanceData.yaml + $ref: DailyDistanceData.yaml description: Object containing information related to distance covered during the associated day. heart_rate_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateData.yaml + $ref: HeartRateData.yaml description: Object containing heartrate-related information for the day. MET_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/METData.yaml + $ref: METData.yaml description: Object containing information on the Metabolic Equivalent of Task for the day. metadata: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyMetadata.yaml + $ref: DailyMetadata.yaml description: Object containing daily summary metadata. oxygen_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenData.yaml + $ref: OxygenData.yaml description: Object containing information on oxygen-related metrics for the day. scores: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ScoresData.yaml + $ref: ScoresData.yaml description: Scores for the user's performance on different metrics for the given day, as calculated by the fitness data provider. strain_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StrainData.yaml + $ref: StrainData.yaml description: Object containing information on the strain put on the user's body over a day. stress_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StressData.yaml + $ref: StressData.yaml description: Object containing information on the stress put on the user over a day. tag_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TagData.yaml + $ref: TagData.yaml description: Object containing all user-entered or automatically tagged events in the day. required: - metadata diff --git a/schemas/DailyDataEnrichment.yaml b/schemas/DailyDataEnrichment.yaml index 001eed6..1cc6ccf 100644 --- a/schemas/DailyDataEnrichment.yaml +++ b/schemas/DailyDataEnrichment.yaml @@ -1,11 +1,10 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyDataEnrichment.yaml type: object properties: cardiovascular_contributors: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DataContributor.yaml + $ref: DataContributor.yaml description: Array of factors contributing to cardiovascular score. cardiovascular_score: type: number @@ -13,7 +12,7 @@ properties: immune_contributors: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DataContributor.yaml + $ref: DataContributor.yaml description: Array of factors contributing to immune index. immune_index: type: number @@ -21,7 +20,7 @@ properties: readiness_contributors: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DataContributor.yaml + $ref: DataContributor.yaml description: Array of factors contributing to readiness score. readiness_score: type: number @@ -29,7 +28,7 @@ properties: respiratory_contributors: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DataContributor.yaml + $ref: DataContributor.yaml description: Array of factors contributing to respiratory score. respiratory_score: type: number @@ -40,7 +39,7 @@ properties: stress_contributors: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DataContributor.yaml + $ref: DataContributor.yaml description: Array of factors contributing to stress score. total_stress_score: type: number diff --git a/schemas/DailyDistanceData.yaml b/schemas/DailyDistanceData.yaml index 2563b58..1935c19 100644 --- a/schemas/DailyDistanceData.yaml +++ b/schemas/DailyDistanceData.yaml @@ -1,9 +1,8 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyDistanceData.yaml type: object properties: detailed: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceDataDetailed.yaml + $ref: DistanceDataDetailed.yaml description: Object containing detailed distance information - this may include second-by-second samples. distance_meters: type: number @@ -11,7 +10,7 @@ properties: - 8500.45 description: Total distance covered by the user throughout the day. elevation: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ElevationData.yaml + $ref: ElevationData.yaml description: Object containing information on the elevation of the user throughout the day. floors_climbed: type: integer @@ -25,5 +24,5 @@ properties: - 12000 description: Total number of steps performed during the day. swimming: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SwimmingData.yaml + $ref: SwimmingData.yaml description: Summary information of the user's swimming statistics for the day, if applicable. diff --git a/schemas/DailyEvent.yaml b/schemas/DailyEvent.yaml index 9676b8b..83e9b9a 100644 --- a/schemas/DailyEvent.yaml +++ b/schemas/DailyEvent.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyEvent.yaml type: object properties: type: @@ -8,10 +7,10 @@ properties: data: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Daily.yaml + $ref: Daily.yaml description: Array of daily data user: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml + $ref: TerraUser.yaml description: User whose data is being provided version: type: string @@ -22,5 +21,5 @@ required: - user - version allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml + - $ref: WebhookEvent.yaml description: Daily data event diff --git a/schemas/DailyMetadata.yaml b/schemas/DailyMetadata.yaml index 95bc7d5..afb5c60 100644 --- a/schemas/DailyMetadata.yaml +++ b/schemas/DailyMetadata.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyMetadata.yaml type: object properties: end_time: @@ -13,9 +12,9 @@ properties: - 1999-11-23T09:00:00.000000+02:00 description: The start time of the associated day, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h before end_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time. timestamp_localization: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TimestampLocalization.yaml + $ref: TimestampLocalization.yaml upload_type: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/UploadType.yaml + $ref: UploadType.yaml description: The upload type for data in the associated day, providing information on whether data was automatically uploaded or user-entered. If any data point in a day is altered, the day should be classed as manual. required: - end_time diff --git a/schemas/DailyPatternSample.yaml b/schemas/DailyPatternSample.yaml index ce015e2..33254a8 100644 --- a/schemas/DailyPatternSample.yaml +++ b/schemas/DailyPatternSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyPatternSample.yaml type: object properties: time_from_midnight: diff --git a/schemas/DataContributor.yaml b/schemas/DataContributor.yaml index 7691621..7e0e4b4 100644 --- a/schemas/DataContributor.yaml +++ b/schemas/DataContributor.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DataContributor.yaml type: object properties: contributor_name: diff --git a/schemas/DataEnrichment.yaml b/schemas/DataEnrichment.yaml index 4639710..9ea0992 100644 --- a/schemas/DataEnrichment.yaml +++ b/schemas/DataEnrichment.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DataEnrichment.yaml type: object properties: stress_score: diff --git a/schemas/DeauthEvent.yaml b/schemas/DeauthEvent.yaml index c7126e8..b52a2bb 100644 --- a/schemas/DeauthEvent.yaml +++ b/schemas/DeauthEvent.yaml @@ -1,12 +1,11 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeauthEvent.yaml type: object properties: type: type: string const: deauth user: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml + $ref: TerraUser.yaml description: User who deauthenticated status: type: string @@ -21,5 +20,5 @@ required: - status - message allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml + - $ref: WebhookEvent.yaml description: User deauthentication event diff --git a/schemas/DeviceData.yaml b/schemas/DeviceData.yaml index 82a22b5..159de14 100644 --- a/schemas/DeviceData.yaml +++ b/schemas/DeviceData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceData.yaml type: object properties: activation_timestamp: @@ -10,7 +9,7 @@ properties: data_provided: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceDataType.yaml + $ref: DeviceDataType.yaml description: Data provided by the device, as enumerated types. hardware_version: type: string @@ -33,7 +32,7 @@ properties: other_devices: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OtherDeviceData.yaml + $ref: OtherDeviceData.yaml description: Data pertaining to other devices which may have contributed data for this workout. sensor_state: type: string diff --git a/schemas/DeviceDataType.yaml b/schemas/DeviceDataType.yaml index 0b8a6a1..a51e963 100644 --- a/schemas/DeviceDataType.yaml +++ b/schemas/DeviceDataType.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceDataType.yaml oneOf: - type: string const: STEPS diff --git a/schemas/DistanceData.yaml b/schemas/DistanceData.yaml index 80dc422..fa3cdbf 100644 --- a/schemas/DistanceData.yaml +++ b/schemas/DistanceData.yaml @@ -1,10 +1,9 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceData.yaml type: object properties: detailed: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceDataDetailed.yaml + $ref: DistanceDataDetailed.yaml description: Object containing detailed distance information - this may included second-by-second samples. summary: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceDataSummary.yaml + $ref: DistanceDataSummary.yaml description: Object containing summary information related to distance covered throughout the workout. diff --git a/schemas/DistanceDataDetailed.yaml b/schemas/DistanceDataDetailed.yaml index 314b6d9..713023e 100644 --- a/schemas/DistanceDataDetailed.yaml +++ b/schemas/DistanceDataDetailed.yaml @@ -1,24 +1,23 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceDataDetailed.yaml type: object properties: distance_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceSample.yaml + $ref: DistanceSample.yaml description: Array of detailed samples of distance covered throughout the workout. elevation_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ElevationSample.yaml + $ref: ElevationSample.yaml description: Array of detailed samples of elevation throughout the workout. floors_climbed_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/FloorsClimbedSample.yaml + $ref: FloorsClimbedSample.yaml description: Array of detailed samples of floors climbed throughout the workout, as determined by the fitness data provider. step_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StepSample.yaml + $ref: StepSample.yaml description: Array of detailed samples of steps performed throughout the workout. diff --git a/schemas/DistanceDataSummary.yaml b/schemas/DistanceDataSummary.yaml index b4a9d4e..c507903 100644 --- a/schemas/DistanceDataSummary.yaml +++ b/schemas/DistanceDataSummary.yaml @@ -1,12 +1,11 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceDataSummary.yaml type: object properties: distance_meters: type: integer description: Total distance covered by the user throughout the workout. elevation: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ElevationData.yaml + $ref: ElevationData.yaml description: Object containing information on the elevation of the user throughout the workout. floors_climbed: type: integer @@ -15,5 +14,5 @@ properties: type: integer description: Total number of steps performed during the workout. swimming: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SwimmingData.yaml + $ref: SwimmingData.yaml description: Summary information of the user's swimming statistics for the workout, if applicable. diff --git a/schemas/DistanceSample.yaml b/schemas/DistanceSample.yaml index 173de22..2580e1a 100644 --- a/schemas/DistanceSample.yaml +++ b/schemas/DistanceSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceSample.yaml type: object properties: timestamp: diff --git a/schemas/DrinkSample.yaml b/schemas/DrinkSample.yaml index 9258faa..306258b 100644 --- a/schemas/DrinkSample.yaml +++ b/schemas/DrinkSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DrinkSample.yaml type: object properties: timestamp: diff --git a/schemas/ECGReading.yaml b/schemas/ECGReading.yaml index 605e8d8..0d9a8f0 100644 --- a/schemas/ECGReading.yaml +++ b/schemas/ECGReading.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ECGReading.yaml type: object properties: start_timestamp: @@ -11,10 +10,10 @@ properties: - 72.5 description: User's average heart rate throughout the day, in beats per minute (bpm). afib_classification: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AFibFlag.yaml + $ref: AFibFlag.yaml description: User's afib classification throught the day. raw_signal: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RawECGSample.yaml + $ref: RawECGSample.yaml description: List of raw ECG readings sampled through the day. diff --git a/schemas/ElevationData.yaml b/schemas/ElevationData.yaml index a3407d1..82c9046 100644 --- a/schemas/ElevationData.yaml +++ b/schemas/ElevationData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ElevationData.yaml type: object properties: avg_meters: diff --git a/schemas/ElevationSample.yaml b/schemas/ElevationSample.yaml index 4ba2efa..de9b5b4 100644 --- a/schemas/ElevationSample.yaml +++ b/schemas/ElevationSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ElevationSample.yaml type: object properties: timestamp: diff --git a/schemas/EnergyData.yaml b/schemas/EnergyData.yaml index 279d947..7b9e0dc 100644 --- a/schemas/EnergyData.yaml +++ b/schemas/EnergyData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/EnergyData.yaml type: object properties: energy_kilojoules: diff --git a/schemas/EventType.yaml b/schemas/EventType.yaml index 312e54b..bbf73cc 100644 --- a/schemas/EventType.yaml +++ b/schemas/EventType.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/EventType.yaml type: string enum: - auth diff --git a/schemas/FloorsClimbedSample.yaml b/schemas/FloorsClimbedSample.yaml index 2cf6e2a..1051c0c 100644 --- a/schemas/FloorsClimbedSample.yaml +++ b/schemas/FloorsClimbedSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/FloorsClimbedSample.yaml type: object properties: timestamp: diff --git a/schemas/GlucoseData.yaml b/schemas/GlucoseData.yaml index bfeb78b..5e65230 100644 --- a/schemas/GlucoseData.yaml +++ b/schemas/GlucoseData.yaml @@ -1,16 +1,15 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/GlucoseData.yaml type: object properties: blood_glucose_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/GlucoseDataSample.yaml + $ref: GlucoseDataSample.yaml description: List of blood glucose readings sampled throughout the day. detailed_blood_glucose_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/GlucoseDataSample.yaml + $ref: GlucoseDataSample.yaml description: List of blood glucose readings sampled throughout the day - this represents additional data points, potentially at higher frequency from the ones in blood_glucose_samples, which may come at a cost of reduced accuracy. day_avg_blood_glucose_mg_per_dL: type: number @@ -29,5 +28,5 @@ properties: daily_patterns: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyPatternSample.yaml + $ref: DailyPatternSample.yaml description: List of glucose percentile samples throughout the day. diff --git a/schemas/GlucoseDataSample.yaml b/schemas/GlucoseDataSample.yaml index 9172867..84d7686 100644 --- a/schemas/GlucoseDataSample.yaml +++ b/schemas/GlucoseDataSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/GlucoseDataSample.yaml type: object properties: timestamp: @@ -13,8 +12,8 @@ properties: - 95 description: User's blood glucose reading glucose_level_flag: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/GlucoseFlag.yaml + $ref: GlucoseFlag.yaml description: Flag indicating state of user's blood glucose level trend_arrow: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TrendArrow.yaml + $ref: TrendArrow.yaml description: Flag indicating the current trend in the user's blood glucose level (e.g. rising, constant, falling) diff --git a/schemas/GlucoseFlag.yaml b/schemas/GlucoseFlag.yaml index c39a6f4..9d36c54 100644 --- a/schemas/GlucoseFlag.yaml +++ b/schemas/GlucoseFlag.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/GlucoseFlag.yaml oneOf: - type: number const: 0 diff --git a/schemas/GoogleNoDatasourceEvent.yaml b/schemas/GoogleNoDatasourceEvent.yaml index 547e684..2983429 100644 --- a/schemas/GoogleNoDatasourceEvent.yaml +++ b/schemas/GoogleNoDatasourceEvent.yaml @@ -1,12 +1,11 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/GoogleNoDatasourceEvent.yaml type: object properties: type: type: string const: google_no_datasource user: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml + $ref: TerraUser.yaml description: Affected user status: type: string @@ -21,5 +20,5 @@ required: - status - message allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml + - $ref: WebhookEvent.yaml description: Google no datasource event diff --git a/schemas/HealthcheckEvent.yaml b/schemas/HealthcheckEvent.yaml index 49909f4..d7517ae 100644 --- a/schemas/HealthcheckEvent.yaml +++ b/schemas/HealthcheckEvent.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HealthcheckEvent.yaml type: object properties: type: @@ -24,5 +23,5 @@ required: - trend_percentage - sent_webhooks_last_hour allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml + - $ref: WebhookEvent.yaml description: Healthcheck event sent periodically to verify your webhook endpoint is functional diff --git a/schemas/HeartData.yaml b/schemas/HeartData.yaml index 6d8e25e..ecdbfa5 100644 --- a/schemas/HeartData.yaml +++ b/schemas/HeartData.yaml @@ -1,27 +1,26 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartData.yaml type: object properties: afib_classification_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AFibClassificationSample.yaml + $ref: AFibClassificationSample.yaml description: List of Atrial Fibrillation classification measurements sampled through the day. ecg_signal: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ECGReading.yaml + $ref: ECGReading.yaml description: List of ECGReadings sampled through the day. heart_rate_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateData.yaml + $ref: HeartRateData.yaml description: Object containing heart rate data. pulse_wave_velocity_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PulseVelocitySample.yaml + $ref: PulseVelocitySample.yaml description: List of Pulse Wave Velocity measurements sampled throughout the day. This represents a measurement of arterial stiffness that is an independent predictor of cardiovascular risk. rr_interval_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RRIntervalSample.yaml + $ref: RRIntervalSample.yaml description: List of RR Interval samples throughout the day. diff --git a/schemas/HeartRateContext.yaml b/schemas/HeartRateContext.yaml index bc53f8d..0daf3d5 100644 --- a/schemas/HeartRateContext.yaml +++ b/schemas/HeartRateContext.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateContext.yaml oneOf: - type: number const: 0 diff --git a/schemas/HeartRateData.yaml b/schemas/HeartRateData.yaml index 92a5147..ff25505 100644 --- a/schemas/HeartRateData.yaml +++ b/schemas/HeartRateData.yaml @@ -1,10 +1,9 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateData.yaml type: object properties: detailed: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataDetailed.yaml + $ref: HeartRateDataDetailed.yaml description: Object containing detailed heart rate information for the associated workout. summary: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataSummary.yaml + $ref: HeartRateDataSummary.yaml description: Object containing summary heart rate information for the associated workout. diff --git a/schemas/HeartRateDataDetailed.yaml b/schemas/HeartRateDataDetailed.yaml index f8af901..eac286a 100644 --- a/schemas/HeartRateDataDetailed.yaml +++ b/schemas/HeartRateDataDetailed.yaml @@ -1,19 +1,18 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataDetailed.yaml type: object properties: hr_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataSample.yaml + $ref: HeartRateDataSample.yaml description: Array of HeartRate data samples recorded for the user during the workout. hrv_samples_rmssd: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateVariabilityDataSampleRMSSD.yaml + $ref: HeartRateVariabilityDataSampleRMSSD.yaml description: Array of HeartRate Variability data samples recorded for the user during the workout, computed using RMSSD. hrv_samples_sdnn: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateVariabilityDataSampleSDNN.yaml + $ref: HeartRateVariabilityDataSampleSDNN.yaml description: Array of HeartRate Variability data samples recorded for the user during the workout, computed using SDNN. diff --git a/schemas/HeartRateDataSample.yaml b/schemas/HeartRateDataSample.yaml index cd5182f..3f58833 100644 --- a/schemas/HeartRateDataSample.yaml +++ b/schemas/HeartRateDataSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataSample.yaml type: object properties: timestamp: @@ -18,5 +17,5 @@ properties: - 600 description: Time elapsed since the start of the workout, subtracting time during which the recording was paused context: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateContext.yaml + $ref: HeartRateContext.yaml description: Represents the context in which heart rate was measured. diff --git a/schemas/HeartRateDataSummary.yaml b/schemas/HeartRateDataSummary.yaml index 6c68cb8..c689af1 100644 --- a/schemas/HeartRateDataSummary.yaml +++ b/schemas/HeartRateDataSummary.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataSummary.yaml type: object properties: avg_hr_bpm: @@ -21,7 +20,7 @@ properties: hr_zone_data: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateZoneData.yaml + $ref: HeartRateZoneData.yaml description: Array of time spent in various HR zones throughout the workout. max_hr_bpm: type: number diff --git a/schemas/HeartRateVariabilityDataSampleRMSSD.yaml b/schemas/HeartRateVariabilityDataSampleRMSSD.yaml index 7852cb9..dbe87a8 100644 --- a/schemas/HeartRateVariabilityDataSampleRMSSD.yaml +++ b/schemas/HeartRateVariabilityDataSampleRMSSD.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateVariabilityDataSampleRMSSD.yaml type: object properties: timestamp: diff --git a/schemas/HeartRateVariabilityDataSampleSDNN.yaml b/schemas/HeartRateVariabilityDataSampleSDNN.yaml index e9aec5b..aa5b316 100644 --- a/schemas/HeartRateVariabilityDataSampleSDNN.yaml +++ b/schemas/HeartRateVariabilityDataSampleSDNN.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateVariabilityDataSampleSDNN.yaml type: object properties: timestamp: diff --git a/schemas/HeartRateZone.yaml b/schemas/HeartRateZone.yaml index d599267..05474a3 100644 --- a/schemas/HeartRateZone.yaml +++ b/schemas/HeartRateZone.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateZone.yaml oneOf: - type: number const: 0 diff --git a/schemas/HeartRateZoneData.yaml b/schemas/HeartRateZoneData.yaml index 8c8d452..fb66b0f 100644 --- a/schemas/HeartRateZoneData.yaml +++ b/schemas/HeartRateZoneData.yaml @@ -1,9 +1,8 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateZoneData.yaml type: object properties: zone: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateZone.yaml + $ref: HeartRateZone.yaml description: Heart rate zone designation start_percentage: type: number diff --git a/schemas/HormoneSample.yaml b/schemas/HormoneSample.yaml index 1cce6c3..d0a1747 100644 --- a/schemas/HormoneSample.yaml +++ b/schemas/HormoneSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HormoneSample.yaml type: object properties: timestamp: diff --git a/schemas/HydrationData.yaml b/schemas/HydrationData.yaml index 2091fe5..7c9a755 100644 --- a/schemas/HydrationData.yaml +++ b/schemas/HydrationData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HydrationData.yaml type: object properties: day_total_water_consumption_ml: @@ -10,5 +9,5 @@ properties: hydration_amount_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HydrationMeasurementSample.yaml + $ref: HydrationMeasurementSample.yaml description: User's hydration level samples throughout the day. diff --git a/schemas/HydrationLevelSample.yaml b/schemas/HydrationLevelSample.yaml index 5e3cf1b..45bf96e 100644 --- a/schemas/HydrationLevelSample.yaml +++ b/schemas/HydrationLevelSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HydrationLevelSample.yaml type: object properties: timestamp: diff --git a/schemas/HydrationMeasurementSample.yaml b/schemas/HydrationMeasurementSample.yaml index d0f4315..738a757 100644 --- a/schemas/HydrationMeasurementSample.yaml +++ b/schemas/HydrationMeasurementSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HydrationMeasurementSample.yaml type: object properties: timestamp: diff --git a/schemas/KetoneData.yaml b/schemas/KetoneData.yaml index 1c0dcae..b67cb56 100644 --- a/schemas/KetoneData.yaml +++ b/schemas/KetoneData.yaml @@ -1,9 +1,8 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/KetoneData.yaml type: object properties: ketone_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/KetoneSample.yaml + $ref: KetoneSample.yaml description: List of ketone data sampled through the day. diff --git a/schemas/KetoneSample.yaml b/schemas/KetoneSample.yaml index 480b720..f41692d 100644 --- a/schemas/KetoneSample.yaml +++ b/schemas/KetoneSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/KetoneSample.yaml type: object properties: timestamp: @@ -13,5 +12,5 @@ properties: - 1.5 description: Ketone in mg per dL sample_type: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/KetoneSampleType.yaml + $ref: KetoneSampleType.yaml description: Flag indicating the ketone sample type (e.g. blood, breath, urine) diff --git a/schemas/KetoneSampleType.yaml b/schemas/KetoneSampleType.yaml index 605a872..650422b 100644 --- a/schemas/KetoneSampleType.yaml +++ b/schemas/KetoneSampleType.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/KetoneSampleType.yaml oneOf: - type: number const: 0 diff --git a/schemas/LapData.yaml b/schemas/LapData.yaml index 608ae25..45786eb 100644 --- a/schemas/LapData.yaml +++ b/schemas/LapData.yaml @@ -1,9 +1,8 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LapData.yaml type: object properties: laps: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LapSample.yaml + $ref: LapSample.yaml description: Array of datapoints for each lap performed by the user during the workout. diff --git a/schemas/LapSample.yaml b/schemas/LapSample.yaml index 1ffb53c..9deeb50 100644 --- a/schemas/LapSample.yaml +++ b/schemas/LapSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LapSample.yaml type: object properties: calories: @@ -38,7 +37,7 @@ properties: - 2022-10-28T10:00:00.000000+01:00 description: The end time of the associated lap, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time stroke_type: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StrokeType.yaml + $ref: StrokeType.yaml examples: - freestyle description: Stroke type - only relevant for swimming activities diff --git a/schemas/LargeRequestProcessingEvent.yaml b/schemas/LargeRequestProcessingEvent.yaml index 9db46f1..213eab6 100644 --- a/schemas/LargeRequestProcessingEvent.yaml +++ b/schemas/LargeRequestProcessingEvent.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LargeRequestProcessingEvent.yaml type: object properties: type: @@ -13,7 +12,7 @@ properties: type: string description: Information about the processing user: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml + $ref: TerraUser.yaml description: User whose data is being processed reference: type: string @@ -25,5 +24,5 @@ required: - user - reference allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml + - $ref: WebhookEvent.yaml description: Large request processing event diff --git a/schemas/LargeRequestSendingEvent.yaml b/schemas/LargeRequestSendingEvent.yaml index 4ad0e69..032c4e0 100644 --- a/schemas/LargeRequestSendingEvent.yaml +++ b/schemas/LargeRequestSendingEvent.yaml @@ -1,12 +1,11 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LargeRequestSendingEvent.yaml type: object properties: type: type: string const: large_request_sending user: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml + $ref: TerraUser.yaml description: User whose data is being sent reference: type: string @@ -24,5 +23,5 @@ required: - message - expected_payloads allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml + - $ref: WebhookEvent.yaml description: Large request sending event diff --git a/schemas/METData.yaml b/schemas/METData.yaml index 5e11d97..de870c9 100644 --- a/schemas/METData.yaml +++ b/schemas/METData.yaml @@ -1,11 +1,10 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/METData.yaml type: object properties: MET_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/METSample.yaml + $ref: METSample.yaml description: An array of Metabolic Equivalent Time samples, as calculated by the user's wearable. avg_level: type: number diff --git a/schemas/METSample.yaml b/schemas/METSample.yaml index ab0c5fe..76ce0ec 100644 --- a/schemas/METSample.yaml +++ b/schemas/METSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/METSample.yaml type: object properties: timestamp: diff --git a/schemas/Meal.yaml b/schemas/Meal.yaml index fb49127..526fe59 100644 --- a/schemas/Meal.yaml +++ b/schemas/Meal.yaml @@ -1,12 +1,11 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Meal.yaml type: object properties: micros: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionMicros.yaml + $ref: NutritionMicros.yaml description: Micronutrient information for associated food. type: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MealType.yaml + $ref: MealType.yaml description: Enum representing the category the consumed food/meal falls under (i.e. Breakfast/Lunch/Dinner etc). id: type: string @@ -19,7 +18,7 @@ properties: - 2022-12-12T08:53:00.000000+02:00 description: Timestamp the food is associated with, in ISO8601 format, with microsecond precision. quantity: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionQuantity.yaml + $ref: NutritionQuantity.yaml description: Quantity of the food that was consumed, containing information on amount & units in which this was recorded. name: type: string @@ -27,7 +26,7 @@ properties: - Oatmeal description: Name of food logged by the user. macros: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionMacros.yaml + $ref: NutritionMacros.yaml description: Macronutrient information for associated food. required: - micros diff --git a/schemas/MealType.yaml b/schemas/MealType.yaml index d5fee5c..c29a43f 100644 --- a/schemas/MealType.yaml +++ b/schemas/MealType.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MealType.yaml oneOf: - type: number const: 0 diff --git a/schemas/MeasurementDataSample.yaml b/schemas/MeasurementDataSample.yaml index cdfb586..40a7b43 100644 --- a/schemas/MeasurementDataSample.yaml +++ b/schemas/MeasurementDataSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MeasurementDataSample.yaml type: object properties: measurement_time: diff --git a/schemas/MeasurementsData.yaml b/schemas/MeasurementsData.yaml index 3738852..6c748ae 100644 --- a/schemas/MeasurementsData.yaml +++ b/schemas/MeasurementsData.yaml @@ -1,9 +1,8 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MeasurementsData.yaml type: object properties: measurements: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MeasurementDataSample.yaml + $ref: MeasurementDataSample.yaml description: List of body metrics & measurements taken throughout the associated day. diff --git a/schemas/MenstrualPhase.yaml b/schemas/MenstrualPhase.yaml index dcb8e26..f19765d 100644 --- a/schemas/MenstrualPhase.yaml +++ b/schemas/MenstrualPhase.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstrualPhase.yaml oneOf: - type: string const: menstrual diff --git a/schemas/Menstruation.yaml b/schemas/Menstruation.yaml index 2673e55..b3387f8 100644 --- a/schemas/Menstruation.yaml +++ b/schemas/Menstruation.yaml @@ -1,12 +1,11 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Menstruation.yaml type: object properties: metadata: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstruationMetadata.yaml + $ref: MenstruationMetadata.yaml description: Object containing daily summary metadata. menstruation_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstruationData.yaml + $ref: MenstruationData.yaml description: Object containing information on user's menstruation for a given day. required: - metadata diff --git a/schemas/MenstruationData.yaml b/schemas/MenstruationData.yaml index bba71c0..47c1bb9 100644 --- a/schemas/MenstruationData.yaml +++ b/schemas/MenstruationData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstruationData.yaml type: object properties: period_length_days: @@ -8,7 +7,7 @@ properties: - 5 description: Total length of period (i.e. menstrual bleeding). current_phase: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstrualPhase.yaml + $ref: MenstrualPhase.yaml description: Phase in associated cycle, (i.e. menstruation, fertile etc). length_of_current_phase_days: type: integer @@ -53,5 +52,5 @@ properties: menstruation_flow: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstruationFlowSample.yaml + $ref: MenstruationFlowSample.yaml description: List of user logs of information related to the strength of user's menstrual flow. diff --git a/schemas/MenstruationEvent.yaml b/schemas/MenstruationEvent.yaml index 32a477e..9a0fca1 100644 --- a/schemas/MenstruationEvent.yaml +++ b/schemas/MenstruationEvent.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstruationEvent.yaml type: object properties: type: @@ -8,10 +7,10 @@ properties: data: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Menstruation.yaml + $ref: Menstruation.yaml description: Array of menstruation data user: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml + $ref: TerraUser.yaml description: User whose data is being provided version: type: string @@ -22,5 +21,5 @@ required: - user - version allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml + - $ref: WebhookEvent.yaml description: Menstruation data event diff --git a/schemas/MenstruationFlow.yaml b/schemas/MenstruationFlow.yaml index 79e6019..49787bb 100644 --- a/schemas/MenstruationFlow.yaml +++ b/schemas/MenstruationFlow.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstruationFlow.yaml oneOf: - type: number const: 0 diff --git a/schemas/MenstruationFlowSample.yaml b/schemas/MenstruationFlowSample.yaml index 8d9758f..1e7f39f 100644 --- a/schemas/MenstruationFlowSample.yaml +++ b/schemas/MenstruationFlowSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstruationFlowSample.yaml type: object properties: timestamp: @@ -8,5 +7,5 @@ properties: - 2022-11-23T09:00:00.000000+02:00 description: Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time. flow: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstruationFlow.yaml + $ref: MenstruationFlow.yaml description: Flag indicating the strength of the user's menstrual flow. diff --git a/schemas/MenstruationMetadata.yaml b/schemas/MenstruationMetadata.yaml index 908e602..e346fcf 100644 --- a/schemas/MenstruationMetadata.yaml +++ b/schemas/MenstruationMetadata.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstruationMetadata.yaml type: object properties: end_time: @@ -13,7 +12,7 @@ properties: - 1999-11-23T09:00:00.000000+02:00 description: The start time of the associated day, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h before end_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time. timestamp_localization: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TimestampLocalization.yaml + $ref: TimestampLocalization.yaml required: - end_time - start_time diff --git a/schemas/MovementData.yaml b/schemas/MovementData.yaml index 0906eee..0908e85 100644 --- a/schemas/MovementData.yaml +++ b/schemas/MovementData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MovementData.yaml type: object properties: adjusted_max_speed_meters_per_second: @@ -35,7 +34,7 @@ properties: cadence_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/CadenceSample.yaml + $ref: CadenceSample.yaml description: Array of cadence values recorded throughout the workout, sampled at intervals determined by the fitness data provider. max_cadence_rpm: type: number @@ -70,10 +69,10 @@ properties: speed_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SpeedSample.yaml + $ref: SpeedSample.yaml description: Array of the datapoints for the user's speed sampled throughout the workout. torque_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TorqueSample.yaml + $ref: TorqueSample.yaml description: Array of the datapoints for the user's torque sampled throughout the workout. diff --git a/schemas/Nutrition.yaml b/schemas/Nutrition.yaml index 2384926..a9bf53b 100644 --- a/schemas/Nutrition.yaml +++ b/schemas/Nutrition.yaml @@ -1,22 +1,21 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Nutrition.yaml type: object properties: drink_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DrinkSample.yaml + $ref: DrinkSample.yaml description: Information on drinks the user consumed throughout the day. meals: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Meal.yaml + $ref: Meal.yaml description: Information on individual foods consumed throughout a given day. metadata: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionMetadata.yaml + $ref: NutritionMetadata.yaml description: Object containing daily summary metadata. summary: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionSummary.yaml + $ref: NutritionSummary.yaml description: Summative nutritional information for a given day. required: - metadata diff --git a/schemas/NutritionEvent.yaml b/schemas/NutritionEvent.yaml index a0d215b..302fef3 100644 --- a/schemas/NutritionEvent.yaml +++ b/schemas/NutritionEvent.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionEvent.yaml type: object properties: type: @@ -8,10 +7,10 @@ properties: data: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Nutrition.yaml + $ref: Nutrition.yaml description: Array of nutrition data user: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml + $ref: TerraUser.yaml description: User whose data is being provided version: type: string @@ -22,5 +21,5 @@ required: - user - version allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml + - $ref: WebhookEvent.yaml description: Nutrition data event diff --git a/schemas/NutritionMacros.yaml b/schemas/NutritionMacros.yaml index 5bc67da..4d9454b 100644 --- a/schemas/NutritionMacros.yaml +++ b/schemas/NutritionMacros.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionMacros.yaml type: object properties: alcohol_g: diff --git a/schemas/NutritionMetadata.yaml b/schemas/NutritionMetadata.yaml index d49eb19..e346fcf 100644 --- a/schemas/NutritionMetadata.yaml +++ b/schemas/NutritionMetadata.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionMetadata.yaml type: object properties: end_time: @@ -13,7 +12,7 @@ properties: - 1999-11-23T09:00:00.000000+02:00 description: The start time of the associated day, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h before end_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time. timestamp_localization: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TimestampLocalization.yaml + $ref: TimestampLocalization.yaml required: - end_time - start_time diff --git a/schemas/NutritionMicros.yaml b/schemas/NutritionMicros.yaml index b0da47f..cbc4a27 100644 --- a/schemas/NutritionMicros.yaml +++ b/schemas/NutritionMicros.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionMicros.yaml type: object properties: biotin_mg: diff --git a/schemas/NutritionQuantity.yaml b/schemas/NutritionQuantity.yaml index 716602a..4757c88 100644 --- a/schemas/NutritionQuantity.yaml +++ b/schemas/NutritionQuantity.yaml @@ -1,9 +1,8 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionQuantity.yaml type: object properties: unit: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionUnits.yaml + $ref: NutritionUnits.yaml amount: type: number required: diff --git a/schemas/NutritionSummary.yaml b/schemas/NutritionSummary.yaml index bd12f69..0e6305c 100644 --- a/schemas/NutritionSummary.yaml +++ b/schemas/NutritionSummary.yaml @@ -1,12 +1,11 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionSummary.yaml type: object properties: macros: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionMacros.yaml + $ref: NutritionMacros.yaml description: Summary of macronutrient information for a given day. micros: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionMicros.yaml + $ref: NutritionMicros.yaml description: Summary of micronutrient information for a given day. water_ml: type: number diff --git a/schemas/NutritionUnits.yaml b/schemas/NutritionUnits.yaml index 5329c08..c95ae8b 100644 --- a/schemas/NutritionUnits.yaml +++ b/schemas/NutritionUnits.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionUnits.yaml oneOf: - type: number const: 0 diff --git a/schemas/OtherDeviceData.yaml b/schemas/OtherDeviceData.yaml index 6ae509a..11b305c 100644 --- a/schemas/OtherDeviceData.yaml +++ b/schemas/OtherDeviceData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OtherDeviceData.yaml type: object properties: manufacturer: @@ -33,7 +32,7 @@ properties: data_provided: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceDataType.yaml + $ref: DeviceDataType.yaml description: Data provided by the device, as enumerated types. last_upload_date: type: string diff --git a/schemas/OtherSleepDurations.yaml b/schemas/OtherSleepDurations.yaml index 57a8234..70273c4 100644 --- a/schemas/OtherSleepDurations.yaml +++ b/schemas/OtherSleepDurations.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OtherSleepDurations.yaml type: object properties: duration_in_bed_seconds: diff --git a/schemas/OxygenData.yaml b/schemas/OxygenData.yaml index 21715ec..ce93bb0 100644 --- a/schemas/OxygenData.yaml +++ b/schemas/OxygenData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenData.yaml type: object properties: avg_saturation_percentage: @@ -10,12 +9,12 @@ properties: saturation_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationSample.yaml + $ref: OxygenSaturationSample.yaml description: Array of Oxygen Saturation percentage datapoints sampled throughout the day. vo2_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Vo2MaxSample.yaml + $ref: Vo2MaxSample.yaml description: Array of VO2 datapoints sampled throughout the day. vo2max_ml_per_min_per_kg: type: number diff --git a/schemas/OxygenSaturationData.yaml b/schemas/OxygenSaturationData.yaml index da092ce..758e726 100644 --- a/schemas/OxygenSaturationData.yaml +++ b/schemas/OxygenSaturationData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationData.yaml type: object properties: avg_saturation_percentage: @@ -15,7 +14,7 @@ properties: samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationSample.yaml + $ref: OxygenSaturationSample.yaml description: Array of Oxygen Saturation percentage datapoints sampled throughout the sleep session. start_time: type: string diff --git a/schemas/OxygenSaturationSample.yaml b/schemas/OxygenSaturationSample.yaml index 63ed5d9..b4b38e6 100644 --- a/schemas/OxygenSaturationSample.yaml +++ b/schemas/OxygenSaturationSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationSample.yaml type: object properties: timestamp: @@ -13,5 +12,5 @@ properties: - 98 description: User's oxygen saturation percentage - referring to either SpO2 or SmO2, based on the `type` field type: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationType.yaml + $ref: OxygenSaturationType.yaml description: Type of oxygen saturation measurement (i.e. blood vs muscle) diff --git a/schemas/OxygenSaturationType.yaml b/schemas/OxygenSaturationType.yaml index ec9383b..8f2db86 100644 --- a/schemas/OxygenSaturationType.yaml +++ b/schemas/OxygenSaturationType.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationType.yaml oneOf: - type: number const: 0 diff --git a/schemas/PermissionChangeEvent.yaml b/schemas/PermissionChangeEvent.yaml index 8a6477b..657f464 100644 --- a/schemas/PermissionChangeEvent.yaml +++ b/schemas/PermissionChangeEvent.yaml @@ -1,12 +1,11 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PermissionChangeEvent.yaml type: object properties: type: type: string const: permission_change user: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml + $ref: TerraUser.yaml description: User who changed permissions status: type: string @@ -33,5 +32,5 @@ required: - scopes_added - scopes_removed allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml + - $ref: WebhookEvent.yaml description: Permission change event diff --git a/schemas/PolylineMapData.yaml b/schemas/PolylineMapData.yaml index 11534a3..0075120 100644 --- a/schemas/PolylineMapData.yaml +++ b/schemas/PolylineMapData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PolylineMapData.yaml type: object properties: summary_polyline: diff --git a/schemas/PositionData.yaml b/schemas/PositionData.yaml index f6d6f50..015858b 100644 --- a/schemas/PositionData.yaml +++ b/schemas/PositionData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PositionData.yaml type: object properties: center_pos_lat_lng_deg: @@ -21,7 +20,7 @@ properties: position_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PositionSample.yaml + $ref: PositionSample.yaml description: Array of datapoints of the position of the user, sampled throughout the workout. start_pos_lat_lng_deg: type: array diff --git a/schemas/PositionSample.yaml b/schemas/PositionSample.yaml index c681b65..498aa52 100644 --- a/schemas/PositionSample.yaml +++ b/schemas/PositionSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PositionSample.yaml type: object properties: timestamp: diff --git a/schemas/PowerData.yaml b/schemas/PowerData.yaml index 950d00c..a266812 100644 --- a/schemas/PowerData.yaml +++ b/schemas/PowerData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PowerData.yaml type: object properties: avg_watts: @@ -15,5 +14,5 @@ properties: power_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PowerSample.yaml + $ref: PowerSample.yaml description: Array containing datapoints of the power output of the user sampled throughout the workout. diff --git a/schemas/PowerSample.yaml b/schemas/PowerSample.yaml index f61c24b..d1fda2d 100644 --- a/schemas/PowerSample.yaml +++ b/schemas/PowerSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PowerSample.yaml type: object properties: timestamp: diff --git a/schemas/ProcessingEvent.yaml b/schemas/ProcessingEvent.yaml index 29f1b2c..6806b47 100644 --- a/schemas/ProcessingEvent.yaml +++ b/schemas/ProcessingEvent.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ProcessingEvent.yaml type: object properties: type: @@ -13,7 +12,7 @@ properties: type: string description: Information about the processing user: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml + $ref: TerraUser.yaml description: User whose data is being processed retry_after_seconds: type: integer @@ -25,5 +24,5 @@ required: - user - retry_after_seconds allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml + - $ref: WebhookEvent.yaml description: Processing event returned when data is being fetched asynchronously diff --git a/schemas/PulseVelocitySample.yaml b/schemas/PulseVelocitySample.yaml index 1d315d5..6dfa249 100644 --- a/schemas/PulseVelocitySample.yaml +++ b/schemas/PulseVelocitySample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PulseVelocitySample.yaml type: object properties: timestamp: diff --git a/schemas/RRIntervalSample.yaml b/schemas/RRIntervalSample.yaml index ccc2204..01f6410 100644 --- a/schemas/RRIntervalSample.yaml +++ b/schemas/RRIntervalSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RRIntervalSample.yaml type: object properties: rr_interval_ms: diff --git a/schemas/RateLimitHitEvent.yaml b/schemas/RateLimitHitEvent.yaml index 9d228c3..5b29253 100644 --- a/schemas/RateLimitHitEvent.yaml +++ b/schemas/RateLimitHitEvent.yaml @@ -1,12 +1,11 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RateLimitHitEvent.yaml type: object properties: type: type: string const: rate_limit_hit user: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml + $ref: TerraUser.yaml description: User whose request hit rate limits start_date: type: string @@ -28,5 +27,5 @@ required: - retrying_at - message allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml + - $ref: WebhookEvent.yaml description: Rate limit hit event diff --git a/schemas/RawECGSample.yaml b/schemas/RawECGSample.yaml index d1a70bf..6fcd826 100644 --- a/schemas/RawECGSample.yaml +++ b/schemas/RawECGSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RawECGSample.yaml type: object properties: potential_uV: diff --git a/schemas/ReadinessData.yaml b/schemas/ReadinessData.yaml index 1805435..08436f0 100644 --- a/schemas/ReadinessData.yaml +++ b/schemas/ReadinessData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ReadinessData.yaml type: object properties: readiness: @@ -10,5 +9,5 @@ properties: maximum: 100 description: User's readiness score for a given day, resulting from the sleep session. recovery_level: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RecoveryLevel.yaml + $ref: RecoveryLevel.yaml description: User's recovery score for a given day, resulting from the sleep session - takes Enum value. diff --git a/schemas/RecoveryLevel.yaml b/schemas/RecoveryLevel.yaml index 06ef27f..bf49f28 100644 --- a/schemas/RecoveryLevel.yaml +++ b/schemas/RecoveryLevel.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RecoveryLevel.yaml oneOf: - type: number const: 0 diff --git a/schemas/RespirationData.yaml b/schemas/RespirationData.yaml index ceb24c8..f1819a7 100644 --- a/schemas/RespirationData.yaml +++ b/schemas/RespirationData.yaml @@ -1,13 +1,12 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RespirationData.yaml type: object properties: breaths_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BreathsData.yaml + $ref: BreathsData.yaml description: Object containing information on breathing rate for the sleep session. oxygen_saturation_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationData.yaml + $ref: OxygenSaturationData.yaml description: Object containing information on saturation metrics for the sleep session. snoring_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SnoringData.yaml + $ref: SnoringData.yaml description: Object containing information on snoring metrics for the sleep session. diff --git a/schemas/S3PayloadEvent.yaml b/schemas/S3PayloadEvent.yaml index 3777342..d7ec0d1 100644 --- a/schemas/S3PayloadEvent.yaml +++ b/schemas/S3PayloadEvent.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/S3PayloadEvent.yaml type: object properties: type: @@ -21,5 +20,5 @@ required: - url - expires_in allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml + - $ref: WebhookEvent.yaml description: S3 Upload event with data download URL diff --git a/schemas/ScoresData.yaml b/schemas/ScoresData.yaml index ec1d0fc..422f5fb 100644 --- a/schemas/ScoresData.yaml +++ b/schemas/ScoresData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ScoresData.yaml type: object properties: activity: diff --git a/schemas/Sleep.yaml b/schemas/Sleep.yaml index 4f7fc55..3382faf 100644 --- a/schemas/Sleep.yaml +++ b/schemas/Sleep.yaml @@ -1,24 +1,23 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Sleep.yaml type: object properties: data_enrichment: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepDataEnrichment.yaml + $ref: SleepDataEnrichment.yaml description: Object containing additional enrichment data for the sleep session. device_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceData.yaml + $ref: DeviceData.yaml description: Object containing information on the device which recorded data for the payload. heart_rate_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateData.yaml + $ref: HeartRateData.yaml description: Object containing information on the user's heart rate during the sleep session. metadata: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepMetadata.yaml + $ref: SleepMetadata.yaml description: Object containing daily summary metadata. readiness_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ReadinessData.yaml + $ref: ReadinessData.yaml description: Object containing information on the user's readiness for the day, based off the quality and duration of their sleep. respiration_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RespirationData.yaml + $ref: RespirationData.yaml description: Object containing information on the user's respiration throughout the sleep session. scores: type: object @@ -28,10 +27,10 @@ properties: description: User's sleep score. description: User's sleep score sleep_durations_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepDurationsData.yaml + $ref: SleepDurationsData.yaml description: Object containing information on the user's duration spent in various sleep stages. temperature_data: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepTemperatureData.yaml + $ref: SleepTemperatureData.yaml description: Object containing body temperature information of the user during the sleep recording session. required: - metadata diff --git a/schemas/SleepDataEnrichment.yaml b/schemas/SleepDataEnrichment.yaml index aedd3e2..c39b24c 100644 --- a/schemas/SleepDataEnrichment.yaml +++ b/schemas/SleepDataEnrichment.yaml @@ -1,10 +1,9 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepDataEnrichment.yaml type: object properties: sleep_contributors: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DataContributor.yaml + $ref: DataContributor.yaml sleep_score: type: number diff --git a/schemas/SleepDurationsData.yaml b/schemas/SleepDurationsData.yaml index cf4807d..b49b601 100644 --- a/schemas/SleepDurationsData.yaml +++ b/schemas/SleepDurationsData.yaml @@ -1,20 +1,19 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepDurationsData.yaml type: object properties: asleep: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AsleepDurations.yaml + $ref: AsleepDurations.yaml description: Object containing information on the duration the user spent asleep during the sleep recording session. awake: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AwakeDurations.yaml + $ref: AwakeDurations.yaml description: Object containing information on the duration the user spent awake during the sleep recording session. hypnogram_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepHypnogramSample.yaml + $ref: SleepHypnogramSample.yaml description: List of sleep stage (Hypnogram) samples recorded during the user's sleep session. other: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OtherSleepDurations.yaml + $ref: OtherSleepDurations.yaml description: Object containing information on the miscellaneous duration data for the sleep recording session. sleep_efficiency: type: number diff --git a/schemas/SleepEvent.yaml b/schemas/SleepEvent.yaml index 8f67f7b..87d820d 100644 --- a/schemas/SleepEvent.yaml +++ b/schemas/SleepEvent.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepEvent.yaml type: object properties: type: @@ -8,10 +7,10 @@ properties: data: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Sleep.yaml + $ref: Sleep.yaml description: Array of sleep data user: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml + $ref: TerraUser.yaml description: User whose data is being provided version: type: string @@ -22,5 +21,5 @@ required: - user - version allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml + - $ref: WebhookEvent.yaml description: Sleep data event diff --git a/schemas/SleepHypnogramSample.yaml b/schemas/SleepHypnogramSample.yaml index fa9dc15..6dbcdeb 100644 --- a/schemas/SleepHypnogramSample.yaml +++ b/schemas/SleepHypnogramSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepHypnogramSample.yaml type: object properties: timestamp: @@ -8,4 +7,4 @@ properties: - 2022-11-23T09:00:00.000000+02:00 description: Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time. level: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepLevel.yaml + $ref: SleepLevel.yaml diff --git a/schemas/SleepLevel.yaml b/schemas/SleepLevel.yaml index 539f484..04f2fd0 100644 --- a/schemas/SleepLevel.yaml +++ b/schemas/SleepLevel.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepLevel.yaml oneOf: - type: number const: 0 diff --git a/schemas/SleepMetadata.yaml b/schemas/SleepMetadata.yaml index f57596b..8fd25e3 100644 --- a/schemas/SleepMetadata.yaml +++ b/schemas/SleepMetadata.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepMetadata.yaml type: object properties: end_time: @@ -21,9 +20,9 @@ properties: type: string description: A unique identifier for the sleep session. timestamp_localization: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TimestampLocalization.yaml + $ref: TimestampLocalization.yaml upload_type: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepUploadType.yaml + $ref: SleepUploadType.yaml description: The upload type for the associated sleep session, providing information on whether this was an automatic sleep or user-entered. required: - end_time diff --git a/schemas/SleepTemperatureData.yaml b/schemas/SleepTemperatureData.yaml index 95b473d..51b82d2 100644 --- a/schemas/SleepTemperatureData.yaml +++ b/schemas/SleepTemperatureData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepTemperatureData.yaml type: object properties: delta: diff --git a/schemas/SleepUploadType.yaml b/schemas/SleepUploadType.yaml index 054fc6b..a11fe24 100644 --- a/schemas/SleepUploadType.yaml +++ b/schemas/SleepUploadType.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepUploadType.yaml oneOf: - type: number const: 0 diff --git a/schemas/SnoringData.yaml b/schemas/SnoringData.yaml index 2a3804c..6ab41b6 100644 --- a/schemas/SnoringData.yaml +++ b/schemas/SnoringData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SnoringData.yaml type: object properties: start_time: @@ -20,7 +19,7 @@ properties: samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SnoringSample.yaml + $ref: SnoringSample.yaml description: List of snoring information data points sampled throughout the sleep session. total_snoring_duration_seconds: type: number diff --git a/schemas/SnoringSample.yaml b/schemas/SnoringSample.yaml index 17aef4d..197068f 100644 --- a/schemas/SnoringSample.yaml +++ b/schemas/SnoringSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SnoringSample.yaml type: object properties: timestamp: diff --git a/schemas/SpeedSample.yaml b/schemas/SpeedSample.yaml index 82e054a..2c37981 100644 --- a/schemas/SpeedSample.yaml +++ b/schemas/SpeedSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SpeedSample.yaml type: object properties: timestamp: diff --git a/schemas/StepSample.yaml b/schemas/StepSample.yaml index d4df65b..ae13672 100644 --- a/schemas/StepSample.yaml +++ b/schemas/StepSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StepSample.yaml type: object properties: timestamp: diff --git a/schemas/StrainData.yaml b/schemas/StrainData.yaml index 83a76db..f4baa7d 100644 --- a/schemas/StrainData.yaml +++ b/schemas/StrainData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StrainData.yaml type: object properties: strain_level: diff --git a/schemas/StressData.yaml b/schemas/StressData.yaml index 533bc32..00ad6e0 100644 --- a/schemas/StressData.yaml +++ b/schemas/StressData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StressData.yaml type: object properties: avg_stress_level: @@ -33,7 +32,7 @@ properties: samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StressSample.yaml + $ref: StressSample.yaml description: Array of stress level data points sampled throughout the day. rest_stress_duration_seconds: type: number @@ -54,10 +53,10 @@ properties: minimum: 0 description: Total number of seconds spent in any stressed state during the day. stress_rating: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StressLevel.yaml + $ref: StressLevel.yaml description: Stress rating for the day. body_battery_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BodyBatterySample.yaml + $ref: BodyBatterySample.yaml description: Array of Body Battery data points sampled throughout the day. diff --git a/schemas/StressLevel.yaml b/schemas/StressLevel.yaml index e19dce7..f1a6398 100644 --- a/schemas/StressLevel.yaml +++ b/schemas/StressLevel.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StressLevel.yaml oneOf: - type: number const: 0 diff --git a/schemas/StressSample.yaml b/schemas/StressSample.yaml index 6095bd6..f86ad1b 100644 --- a/schemas/StressSample.yaml +++ b/schemas/StressSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StressSample.yaml type: object properties: timestamp: diff --git a/schemas/StrokeType.yaml b/schemas/StrokeType.yaml index d0ca8bb..7dbabfc 100644 --- a/schemas/StrokeType.yaml +++ b/schemas/StrokeType.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StrokeType.yaml oneOf: - type: string const: other diff --git a/schemas/SwimmingData.yaml b/schemas/SwimmingData.yaml index 9f7c651..d8b48d0 100644 --- a/schemas/SwimmingData.yaml +++ b/schemas/SwimmingData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SwimmingData.yaml type: object properties: num_laps: diff --git a/schemas/TSSData.yaml b/schemas/TSSData.yaml index 9f2d954..0fb7798 100644 --- a/schemas/TSSData.yaml +++ b/schemas/TSSData.yaml @@ -1,9 +1,8 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TSSData.yaml type: object properties: TSS_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TSSSample.yaml + $ref: TSSSample.yaml description: Array of TSS information sampled throughout the workout diff --git a/schemas/TSSSample.yaml b/schemas/TSSSample.yaml index 9c8f1d2..be5f5dc 100644 --- a/schemas/TSSSample.yaml +++ b/schemas/TSSSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TSSSample.yaml type: object properties: planned: diff --git a/schemas/TagData.yaml b/schemas/TagData.yaml index 7d87b09..d28ef0c 100644 --- a/schemas/TagData.yaml +++ b/schemas/TagData.yaml @@ -1,9 +1,8 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TagData.yaml type: object properties: tags: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TagEntry.yaml + $ref: TagEntry.yaml description: Array of user-entered tags for the day. diff --git a/schemas/TagEntry.yaml b/schemas/TagEntry.yaml index c56422b..ee1af33 100644 --- a/schemas/TagEntry.yaml +++ b/schemas/TagEntry.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TagEntry.yaml type: object properties: timestamp: diff --git a/schemas/TemperatureData.yaml b/schemas/TemperatureData.yaml index e6d5b9d..58f89ee 100644 --- a/schemas/TemperatureData.yaml +++ b/schemas/TemperatureData.yaml @@ -1,19 +1,18 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TemperatureData.yaml type: object properties: ambient_temperature_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TemperatureSample.yaml + $ref: TemperatureSample.yaml description: List of ambient temperature measurements sampled throughout the day. body_temperature_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TemperatureSample.yaml + $ref: TemperatureSample.yaml description: List of body temperature measurements sampled throughout the day. skin_temperature_samples: type: array items: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TemperatureSample.yaml + $ref: TemperatureSample.yaml description: List of skin temperature measurements sampled throughout the day. diff --git a/schemas/TemperatureSample.yaml b/schemas/TemperatureSample.yaml index d6ea88d..d988ad7 100644 --- a/schemas/TemperatureSample.yaml +++ b/schemas/TemperatureSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TemperatureSample.yaml type: object properties: timestamp: diff --git a/schemas/TerraUser.yaml b/schemas/TerraUser.yaml index 9c4ae16..6094bf8 100644 --- a/schemas/TerraUser.yaml +++ b/schemas/TerraUser.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml type: object properties: user_id: @@ -14,6 +13,11 @@ properties: - FITBIT minLength: 1 description: Connection data source + created_at: + type: string + examples: + - 2022-12-12T10:00:00.000000+00:00 + description: Time at which the connection was created last_webhook_update: type: string examples: diff --git a/schemas/TimestampLocalization.yaml b/schemas/TimestampLocalization.yaml index 485aedb..87a0cf8 100644 --- a/schemas/TimestampLocalization.yaml +++ b/schemas/TimestampLocalization.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TimestampLocalization.yaml type: number enum: - 0 diff --git a/schemas/TorqueSample.yaml b/schemas/TorqueSample.yaml index 7e65c2f..6b6adff 100644 --- a/schemas/TorqueSample.yaml +++ b/schemas/TorqueSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TorqueSample.yaml type: object properties: timestamp: diff --git a/schemas/TrendArrow.yaml b/schemas/TrendArrow.yaml index 2900625..5132ab8 100644 --- a/schemas/TrendArrow.yaml +++ b/schemas/TrendArrow.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TrendArrow.yaml oneOf: - type: number const: 0 diff --git a/schemas/UploadType.yaml b/schemas/UploadType.yaml index d564249..d1b1a52 100644 --- a/schemas/UploadType.yaml +++ b/schemas/UploadType.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/UploadType.yaml oneOf: - type: number const: 0 diff --git a/schemas/UserReauthEvent.yaml b/schemas/UserReauthEvent.yaml index ff16fa0..cecee7c 100644 --- a/schemas/UserReauthEvent.yaml +++ b/schemas/UserReauthEvent.yaml @@ -1,15 +1,14 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/UserReauthEvent.yaml type: object properties: type: type: string const: user_reauth new_user: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml + $ref: TerraUser.yaml description: The new user record old_user: - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml + $ref: TerraUser.yaml description: The old user record that will be deleted status: type: string @@ -25,5 +24,5 @@ required: - status - message allOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml + - $ref: WebhookEvent.yaml description: User re-authentication event diff --git a/schemas/Vo2MaxSample.yaml b/schemas/Vo2MaxSample.yaml index 4f73e6d..5477d20 100644 --- a/schemas/Vo2MaxSample.yaml +++ b/schemas/Vo2MaxSample.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Vo2MaxSample.yaml type: object properties: timestamp: diff --git a/schemas/WebhookEvent.yaml b/schemas/WebhookEvent.yaml index 957e754..9eca5f7 100644 --- a/schemas/WebhookEvent.yaml +++ b/schemas/WebhookEvent.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml type: object properties: type: diff --git a/schemas/WebhookEventType.yaml b/schemas/WebhookEventType.yaml index fff8982..7942ee8 100644 --- a/schemas/WebhookEventType.yaml +++ b/schemas/WebhookEventType.yaml @@ -1,25 +1,24 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEventType.yaml oneOf: - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HealthcheckEvent.yaml - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AuthSuccessEvent.yaml - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AuthErrorEvent.yaml - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeauthEvent.yaml - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/UserReauthEvent.yaml - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AccessRevokedEvent.yaml - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ConnectionErrorEvent.yaml - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/GoogleNoDatasourceEvent.yaml - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PermissionChangeEvent.yaml - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ProcessingEvent.yaml - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LargeRequestProcessingEvent.yaml - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LargeRequestSendingEvent.yaml - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RateLimitHitEvent.yaml - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityEvent.yaml - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AthleteEvent.yaml - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BodyEvent.yaml - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyEvent.yaml - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstruationEvent.yaml - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionEvent.yaml - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepEvent.yaml - - $ref: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/S3PayloadEvent.yaml + - $ref: HealthcheckEvent.yaml + - $ref: AuthSuccessEvent.yaml + - $ref: AuthErrorEvent.yaml + - $ref: DeauthEvent.yaml + - $ref: UserReauthEvent.yaml + - $ref: AccessRevokedEvent.yaml + - $ref: ConnectionErrorEvent.yaml + - $ref: GoogleNoDatasourceEvent.yaml + - $ref: PermissionChangeEvent.yaml + - $ref: ProcessingEvent.yaml + - $ref: LargeRequestProcessingEvent.yaml + - $ref: LargeRequestSendingEvent.yaml + - $ref: RateLimitHitEvent.yaml + - $ref: ActivityEvent.yaml + - $ref: AthleteEvent.yaml + - $ref: BodyEvent.yaml + - $ref: DailyEvent.yaml + - $ref: MenstruationEvent.yaml + - $ref: NutritionEvent.yaml + - $ref: SleepEvent.yaml + - $ref: S3PayloadEvent.yaml description: Union of all possible webhook event types diff --git a/schemas/WorkData.yaml b/schemas/WorkData.yaml index 88e31cb..3f0dc81 100644 --- a/schemas/WorkData.yaml +++ b/schemas/WorkData.yaml @@ -1,5 +1,4 @@ $schema: https://json-schema.org/draft/2020-12/schema -$id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WorkData.yaml type: object properties: work_kilojoules: diff --git a/scripts/check_spec_drift.py b/scripts/check_spec_drift.py new file mode 100644 index 0000000..c18643d --- /dev/null +++ b/scripts/check_spec_drift.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python3 +"""Compare v5.yaml's documented paths against the live v2 route inventory. + +The inventory is produced by the terra-v6 route-inventory golden test +(services/api/internal/endpoints/v2/route_inventory.json). In CI a scheduled +job fetches that file from terra-v6 and runs this script; locally, pass --inventory. + +Exit non-zero (a real drift signal) only when the spec documents a path that the +router does not serve — a spec that lies to customers. Undocumented public-looking +routes are reported for triage but do not fail, since adding an endpoint to the +spec is a deliberate compatibility decision. + +See support-agent analysis/openapi-v6-surface-analysis.md §8.3. +""" +import argparse +import json +import re +import sys + +import yaml + +# Router path prefixes that are internal/admin/proxy/beta and are intentionally +# NOT part of the published v2 spec. A route under one of these is never reported +# as an "undocumented public" candidate. +INTERNAL_PREFIXES = ( + "/dashboard", "/agents", "/partners", "/synthetic", "/migrate", + "/oauth/callback", "/mcp", "/teams", "/normalize", "/hooks", + "/workouts", "/plannedWorkouts", "/routes", "/pushedRoutes", + "/lab-reports", "/data-links", "/ai-context", "/chat", + "/sdk", "/coverage", "/preflight", "/backfills", + "/auth/zepp", "/auth/initSDK", "/auth/authenticateSDKUser", + "/auth/subscribe", "/providers", +) + + +def spec_paths(spec_file): + doc = yaml.safe_load(open(spec_file)) + # normalise {param} placeholders to a canonical token for comparison + out = set() + for p in doc.get("paths", {}): + out.add(re.sub(r"\{[^}]+\}", "{}", p)) + return out + + +def router_paths(inventory_file): + routes = json.load(open(inventory_file)) + out = set() + for r in routes: + _, path = r.split(" ", 1) + out.add((path, re.sub(r"\{[^}]+\}", "{}", path))) + return out + + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument("--spec", default="v5.yaml") + ap.add_argument("--inventory", required=True, + help="path to terra-v6 route_inventory.json") + args = ap.parse_args() + + spec = spec_paths(args.spec) + routes = router_paths(args.inventory) + route_norm = {n for _, n in routes} + + # (A) documented but not served — the failing condition + lies = sorted(p for p in spec if p not in route_norm) + + # (B) public-looking router paths not in the spec — informational + undocumented = sorted( + raw for raw, norm in routes + if norm not in spec and not raw.startswith(INTERNAL_PREFIXES) + ) + + if undocumented: + print("Undocumented public-looking v2 routes (triage — not a failure):") + for p in undocumented: + print(f" ? {p}") + print() + + if lies: + print("ERROR: spec documents paths the v2 router does not serve:") + for p in lies: + print(f" - {p}") + print("\nFix the spec (remove/relocate) or the router.") + return 1 + + print(f"OK: all {len(spec)} documented paths are served by the v2 router.") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/teams.yml b/teams.yml index c5d7c66..c7d06e4 100644 --- a/teams.yml +++ b/teams.yml @@ -683,42 +683,36 @@ components: type: object properties: name: - type: string - nullable: true + type: [string, "null"] description: "Name of the metric" value: oneOf: - type: number - type: string - nullable: true + - type: "null" description: "Value of the metric" unit: - type: string - nullable: true + type: [string, "null"] description: "Unit of the metric" AthleteMetrics: type: object properties: athlete_id: - type: string - nullable: true + type: [string, "null"] description: "ID of the athlete" metrics: - type: array + type: [array, "null"] items: $ref: '#/components/schemas/Metric' - nullable: true description: "List of metrics associated with the athlete" DetailedParticipationStatus: type: object properties: athlete_id: - type: string - nullable: true + type: [string, "null"] description: "ID of the athlete" external_athlete_id: - type: string - nullable: true + type: [string, "null"] description: "External ID of the athlete" is_home_team: $ref: '#/components/schemas/IsHomeFlag' @@ -727,8 +721,7 @@ components: $ref: '#/components/schemas/ParticipationType' description: "Type of participation in an activity" function: - type: string - nullable: true + type: [string, "null"] description: "Function of the athlete in the activity" ParticipationStatus: type: object @@ -755,16 +748,15 @@ components: type: object properties: period_id: - type: string - nullable: true + type: [string, "null"] description: "ID of the period" name: - type: string - nullable: true + type: [string, "null"] description: "Name of the period" athlete_participation: - $ref: '#/components/schemas/ParticipationStatus' - nullable: true + anyOf: + - $ref: '#/components/schemas/ParticipationStatus' + - type: "null" description: "Participation status of athletes in the period" detailed_athlete_participation: type: array @@ -773,12 +765,10 @@ components: description: "Detailed participation status of athletes" default: [] start_timestamp_us: - type: integer - nullable: true + type: [integer, "null"] description: "Start timestamp of the period in microseconds" end_timestamp_us: - type: integer - nullable: true + type: [integer, "null"] description: "End timestamp of the period in microseconds" athlete_metrics: type: array @@ -788,8 +778,7 @@ components: type: object properties: name: - type: string - nullable: true + type: [string, "null"] description: "Name of the team" is_home: $ref: '#/components/schemas/IsHomeFlag' @@ -799,91 +788,76 @@ components: type: object properties: activity_id: - type: string - nullable: true + type: [string, "null"] description: "Unique identifier for the activity" start_timestamp_us: - type: integer - nullable: true + type: [integer, "null"] description: "Start timestamp of the activity in microseconds" end_timestamp_us: - type: integer - nullable: true + type: [integer, "null"] description: "End timestamp of the activity in microseconds" description: - type: string - nullable: true + type: [string, "null"] description: "Description of the activity" teams: - type: array + type: [array, "null"] items: $ref: '#/components/schemas/TeamInfo' - nullable: true description: "List of teams involved in the activity" athletes: - type: array + type: [array, "null"] items: $ref: '#/components/schemas/Athlete' - nullable: true description: "List of athletes involved in the activity" athlete_participation: - $ref: '#/components/schemas/ParticipationStatus' - nullable: true + anyOf: + - $ref: '#/components/schemas/ParticipationStatus' + - type: "null" description: "Overall participation status of athletes" tz_offset_seconds: - type: integer - nullable: true + type: [integer, "null"] description: "Timezone offset in seconds" default: 0 periods: - type: array + type: [array, "null"] items: $ref: '#/components/schemas/Period' - nullable: true description: "List of periods in the activity" default: [] activity_metrics: - type: array + type: [array, "null"] items: $ref: '#/components/schemas/Metric' - nullable: true description: "List of metrics associated with the activity" default: [] athlete_metrics: - type: object + type: [object, "null"] additionalProperties: type: array items: $ref: '#/components/schemas/Metric' - nullable: true description: "Dictionary mapping athlete IDs to their metrics" default: {} events: - type: array + type: [array, "null"] items: type: string - nullable: true description: "List of events related to the activity" - components: MetricStats: type: object properties: min: - type: number - nullable: true + type: [number, "null"] description: "Minimum value of the metric" max: - type: number - nullable: true + type: [number, "null"] description: "Maximum value of the metric" avg: - type: number - nullable: true + type: [number, "null"] description: "Average value of the metric" value: - type: number - nullable: true + type: [number, "null"] description: "Specific value of the metric" TestResultMetric: type: object @@ -903,8 +877,7 @@ components: $ref: '#/components/schemas/ContractionType' description: "Type of muscle contraction" value: - type: number - nullable: true + type: [number, "null"] description: "Value of the metric" Rep: type: object @@ -928,12 +901,10 @@ components: items: $ref: '#/components/schemas/TestResultMetric' timestamp_us: - type: integer - nullable: true + type: [integer, "null"] description: "Timestamp of the set in microseconds" duration_us: - type: integer - nullable: true + type: [integer, "null"] description: "Duration of the set in microseconds" side: $ref: '#/components/schemas/Side' @@ -946,12 +917,10 @@ components: items: $ref: '#/components/schemas/Rep' weight: - type: number - nullable: true + type: [number, "null"] description: "Weight used for the exercise" exercise_name: - type: string - nullable: true + type: [string, "null"] description: "Name of the exercise" variations: type: array @@ -965,53 +934,49 @@ components: type: object properties: test_id: - type: string - nullable: true + type: [string, "null"] description: "Unique identifier for the test" display_name: - type: string - nullable: true + type: [string, "null"] description: "Human-readable name of the test performed" timestamp_us: - type: integer - nullable: true + type: [integer, "null"] description: "Timestamp of the test in microseconds" test_type: $ref: '#/components/schemas/TestType' exercise_type: $ref: '#/components/schemas/ExerciseType' athlete_weight: - type: number - nullable: true + type: [number, "null"] description: "Weight of the athlete during the test" movement: - $ref: '#/components/schemas/BiomechanicalMovement' - nullable: true + anyOf: + - $ref: '#/components/schemas/BiomechanicalMovement' + - type: "null" tz_offset_seconds: - type: integer - nullable: true + type: [integer, "null"] description: "Timezone offset in seconds" default: 0 category: - $ref: '#/components/schemas/TestCategory' - nullable: true + anyOf: + - $ref: '#/components/schemas/TestCategory' + - type: "null" duration_us: - type: number - nullable: true + type: [number, "null"] description: "Duration of the test in microseconds" body_region: - $ref: '#/components/schemas/BodyRegion' - nullable: true + anyOf: + - $ref: '#/components/schemas/BodyRegion' + - type: "null" position: - $ref: '#/components/schemas/Position' - nullable: true + anyOf: + - $ref: '#/components/schemas/Position' + - type: "null" notes: - type: string - nullable: true + type: [string, "null"] description: "Any notes related to the test" device: - type: string - nullable: true + type: [string, "null"] description: "The device used for the test" test_result_metrics: type: array @@ -1079,43 +1044,13 @@ components: examples: - "The coach with the provided ID does not exist." instance: - type: string + type: [string, "null"] format: uri - nullable: true required: - type - title - status - detail - examples: - ErrorCoachNotFound: - summary: Resource Not Found - value: - type: "https://api.tryterra.co/probs/not-found" - title: "Resource Not Found" - status: 404 - detail: "The coach with the provided ID does not exist." - ErrorInvalidRequest: - summary: Invalid Request - value: - type: "https://api.tryterra.co/probs/invalid-request" - title: "Invalid Request" - status: 400 - detail: "Missing required query parameter: start_date." - ErrorUnauthorized: - summary: Unauthorized - value: - type: "https://api.tryterra.co/probs/unauthorized" - title: "Unauthorized" - status: 401 - detail: "Authentication credentials are missing or invalid." - ErrorForbidden: - summary: Forbidden - value: - type: "https://api.tryterra.co/probs/forbidden" - title: "Forbidden" - status: 403 - detail: "You do not have permission to access this resource." CoachesReturned: type: object properties: @@ -1150,16 +1085,13 @@ components: type: string description: "Unique key for the metric." display_name: - type: string - nullable: true + type: [string, "null"] description: "Human-readable name of the metric." unit: - type: string - nullable: true + type: [string, "null"] description: "Unit of measurement for the metric." type: - type: string - nullable: true + type: [string, "null"] description: "Data type of the metric (e.g., integer, float)." sport: $ref: '#/components/schemas/Sport' @@ -1212,10 +1144,9 @@ components: type: boolean description: "Indicates if the field is required." options: - type: array + type: [array, "null"] items: type: string - nullable: true description: "Options for select-type fields." IsHomeFlag: type: integer @@ -2671,6 +2602,35 @@ components: error: type: string description: Error message. + examples: + ErrorCoachNotFound: + summary: Resource Not Found + value: + type: "https://api.tryterra.co/probs/not-found" + title: "Resource Not Found" + status: 404 + detail: "The coach with the provided ID does not exist." + ErrorInvalidRequest: + summary: Invalid Request + value: + type: "https://api.tryterra.co/probs/invalid-request" + title: "Invalid Request" + status: 400 + detail: "Missing required query parameter: start_date." + ErrorUnauthorized: + summary: Unauthorized + value: + type: "https://api.tryterra.co/probs/unauthorized" + title: "Unauthorized" + status: 401 + detail: "Authentication credentials are missing or invalid." + ErrorForbidden: + summary: Forbidden + value: + type: "https://api.tryterra.co/probs/forbidden" + title: "Forbidden" + status: 403 + detail: "You do not have permission to access this resource." webhooks: coachRegistered: post: diff --git a/v5-bundled.yaml b/v5-bundled.yaml index b299337..e5c8bb5 100644 --- a/v5-bundled.yaml +++ b/v5-bundled.yaml @@ -1,8 +1,8 @@ openapi: 3.1.0 info: - description: The Terra API + description: The Terra API (v2 surface, served at access.tryterra.co/api/v2). title: TerraAPI - version: 2022.03.16 + version: 2026.06.11 license: name: Apache-2.0 url: https://github.com/tryterra/openapi/blob/master/LICENSE @@ -15,7 +15,7 @@ servers: - url: https://access.tryterra.co/api/v2 security: - ApiKeyAuth: [] - - DevID: [] + DevID: [] paths: /auth/authenticateUser: post: @@ -78,36 +78,9 @@ paths: description: authentication URL the user must be redirected to in order to link their account example: https://www.fitbit.com/oauth2/authorize?response_type=code&client_id=23BBG9&scope=settings+nutrition+sleep+heartrate+electrocardiogram+weight+respiratory_rate+oxygen_saturation+profile+temperature+cardio_fitness+activity+location&state=bLqqjPie9ptwoWm6VBxHCu6JkkoWJp '400': - description: Returned when one or more parameters is malformed - an appropriate error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/BadRequest' '404': - description: Returned when a parameter does not exist on Terra's end (e.g. resource) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - success - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/NotFound' /auth/generateWidgetSession: post: summary: Generate an authentication link, using the Terra Authentication Widget @@ -149,20 +122,7 @@ paths: description: a number in seconds depicting how long the url is valid for example: 900 '400': - description: Returned when one or more parameters is malformed - an appropriate error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/BadRequest' /users/{user_id}: patch: summary: Modify user @@ -209,21 +169,7 @@ paths: description: Indicates that the request was successful example: success '400': - description: Returned if the parameters are malformed or no user is found - content: - application/json: - schema: - type: object - properties: - message: - description: A detailed message describing the error - type: string - status: - type: string - enum: - - success - - error - description: Indicates an error happened + $ref: '#/components/responses/BadRequest' /auth/deauthenticateUser: delete: summary: Deauthenticates a user and deletes any cached data for them @@ -253,21 +199,7 @@ paths: description: indicates that the deauthentication was successful (value is success) type: string '404': - description: Returned when the user_id is not existent - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - success - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/NotFound' /auth/generateAuthToken: post: tags: @@ -300,23 +232,7 @@ paths: example: 180 default: 0 '404': - description: '404' - content: - application/json: - examples: - Result: - value: - status: error - message: Invalid dev-id was provided - schema: - type: object - properties: - status: - type: string - example: error - message: - type: string - example: Invalid dev-id was provided + $ref: '#/components/responses/NotFound' deprecated: false /activity: get: @@ -383,120 +299,14 @@ paths: type: - string - 'null' - - $ref: '#/components/schemas/NoDataReturned' - $ref: '#/components/schemas/DataSentToWebhook' - - $ref: '#/components/schemas/RequestProcessing' - - $ref: '#/components/schemas/RateLimitRequestProcessing' - - $ref: '#/components/schemas/LargeRequestProcessingEvent' + - $ref: '#/components/schemas/NoDestinationsAvailable' '400': - description: Returned when one or more parameters is malformed - an appropriate error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/BadRequest' '401': - description: Returned when credentials (dev ID and API key) are invalid - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized - '404': - description: Returned when a parameter does not exist on Terra's end (e.g. user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) - post: - tags: - - Activity - operationId: Activity_Write - description: Used to post activity data to a provider. This endpoint only works for users connected via Wahoo. Returns error for other providers. - summary: Post activity data to a provider - requestBody: - content: - application/json: - schema: - type: object - properties: - data: - description: List of user-tracked workouts to post to data provider - type: array - items: - $ref: '#/components/schemas/Activity' - required: - - data - required: true - responses: - '201': - description: Returned when activity was successfully created on the provider - content: - application/json: - schema: - type: object - properties: - user: - $ref: '#/components/schemas/TerraUser' - log_ids: - description: List of identifiers for the objects created, returned in the same order they were posted. I.e. Posting [ObjectA, ObjectB] will return [IdentifierA, IdentifierB] - type: array - items: - type: string - message: - type: string - default: Activity successfully logged - '400': - description: Returned when one or more parameters is malformed - an appropriate error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/Unauthorized' '404': - description: Returned when a parameter does not exist on Terra's end (e.g. user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/NotFound' /athlete: get: summary: Retrieve user profile info for a given user ID @@ -526,49 +336,14 @@ paths: schema: oneOf: - $ref: '#/components/schemas/AthleteCollection' - - $ref: '#/components/schemas/NoDataReturned' - $ref: '#/components/schemas/DataSentToWebhook' + - $ref: '#/components/schemas/NoDestinationsAvailable' '400': - description: Returned when one or more parameters is malformed - an appropriate error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/BadRequest' '401': - description: Returned when credentials (dev ID and API key) are invalid - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized + $ref: '#/components/responses/Unauthorized' '404': - description: Returned when a parameter does not exist on Terra's end (e.g. user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/NotFound' /body: get: summary: Retrieve body metrics for a given user ID @@ -634,278 +409,63 @@ paths: type: - string - 'null' - - $ref: '#/components/schemas/NoDataReturned' - $ref: '#/components/schemas/DataSentToWebhook' - - $ref: '#/components/schemas/RequestProcessing' - - $ref: '#/components/schemas/RateLimitRequestProcessing' - - $ref: '#/components/schemas/LargeRequestProcessingEvent' + - $ref: '#/components/schemas/NoDestinationsAvailable' '400': - description: Returned when one or more parameters is malformed - an appropriate error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/BadRequest' '401': - description: Returned when credentials (dev ID and API key) are invalid - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized + $ref: '#/components/responses/Unauthorized' '404': - description: Returned when a parameter does not exist on Terra's end (e.g. user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) - post: - tags: - - Body - operationId: Body_Write - description: Used to post body data to a provider. This endpoint only works for users connected via Google Fit. Returns error for other providers. - summary: Post body data to a provider - requestBody: - content: - application/json: - schema: - type: object - properties: - data: - description: Body measurement metrics to post to data provider - type: array - items: - $ref: '#/components/schemas/Body' - required: - - data - required: true - responses: - '201': - description: Returned when activity was successfully created on the provider - content: - application/json: - schema: - type: object - properties: - user: - $ref: '#/components/schemas/TerraUser' - log_ids: - description: List of identifiers for the objects created, returned in the same order they were posted. I.e. Posting [ObjectA, ObjectB] will return [IdentifierA, IdentifierB] - type: array - items: - type: string - message: - type: string - default: Body data successfully logged - '400': - description: Returned when one or more parameters is malformed - an appropriate error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) - '404': - description: Returned when a parameter does not exist on Terra's end (e.g. user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) - delete: - tags: - - Body - operationId: Body_Delete - description: Used to delete Body metrics the user has registered on their account - summary: Delete body metrics for a given user ID - parameters: - - name: user_id - in: query - description: Terra user ID (UUID format) to retrieve data for - schema: - type: string - required: true - requestBody: - content: - application/json: - schema: - type: object - properties: - log_ids: - type: array - description: List of identifiers for body metrics entries to be deleted - items: - type: string - required: - - data - required: true - responses: - '200': - description: Returned when all records were deleted successfully - content: - application/json: - schema: - type: object - properties: - user: - $ref: '#/components/schemas/TerraUser' - processed_data: - type: array - items: - type: object - properties: - id: - type: string - description: Identifier of the body metric entries whose deletion was attempted - response_code: - type: integer - description: Response code from the provider when attempting to delete the body metric entries - '207': - description: Returned when multiple status codes were obtained from attempting to delete the requested records - content: - application/json: - schema: - type: object - properties: - user: - $ref: '#/components/schemas/TerraUser' - processed_data: - type: array - items: - type: object - properties: - id: - type: string - description: Identifier of the body metric entry whose deletion was attempted - response_code: - type: integer - description: Response code from the provider when attempting to delete the body metric entry - '400': - description: Returned when one or more parameters is malformed - an appropriate error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) - '401': - description: Returned when credentials (dev ID and API key) are invalid - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized - '404': - description: Returned when a parameter does not exist on Terra's end (e.g. user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) - /daily: - get: - summary: Retrieve daily activity summaries for a given user ID - description: Fetches daily summaries of activity metrics such as steps, distance, calories burned etc. for a given user ID - tags: - - Daily - operationId: Daily_Fetch - parameters: - - name: user_id - in: query - description: Terra user ID (UUID format) to retrieve data for - schema: - type: string - required: true - - name: start_date - in: query - description: Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit) - schema: - oneOf: - - type: integer - - type: string - format: date - required: true - - name: end_date - in: query - description: End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit) - schema: - oneOf: - - type: integer - - type: string - format: date - required: false - - name: to_webhook - in: query - description: | - Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided) - schema: - type: boolean - required: false - - name: with_samples - in: query - description: | - Boolean flag specifying whether to include detailed samples in the returned payload (default: false) - schema: - type: boolean - required: false - responses: - '200': - description: Returned upon successful data request + $ref: '#/components/responses/NotFound' + /daily: + get: + summary: Retrieve daily activity summaries for a given user ID + description: Fetches daily summaries of activity metrics such as steps, distance, calories burned etc. for a given user ID + tags: + - Daily + operationId: Daily_Fetch + parameters: + - name: user_id + in: query + description: Terra user ID (UUID format) to retrieve data for + schema: + type: string + required: true + - name: start_date + in: query + description: Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit) + schema: + oneOf: + - type: integer + - type: string + format: date + required: true + - name: end_date + in: query + description: End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit) + schema: + oneOf: + - type: integer + - type: string + format: date + required: false + - name: to_webhook + in: query + description: | + Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided) + schema: + type: boolean + required: false + - name: with_samples + in: query + description: | + Boolean flag specifying whether to include detailed samples in the returned payload (default: false) + schema: + type: boolean + required: false + responses: + '200': + description: Returned upon successful data request content: application/json: schema: @@ -922,52 +482,14 @@ paths: type: - string - 'null' - - $ref: '#/components/schemas/NoDataReturned' - $ref: '#/components/schemas/DataSentToWebhook' - - $ref: '#/components/schemas/RequestProcessing' - - $ref: '#/components/schemas/RateLimitRequestProcessing' - - $ref: '#/components/schemas/LargeRequestProcessingEvent' + - $ref: '#/components/schemas/NoDestinationsAvailable' '400': - description: Returned when one or more parameters is malformed - an appropriate error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/BadRequest' '401': - description: Returned when credentials (dev ID and API key) are invalid - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized + $ref: '#/components/responses/Unauthorized' '404': - description: Returned when a parameter does not exist on Terra's end (e.g. user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/NotFound' /menstruation: get: summary: Retrieve menstruation data for a given user ID @@ -1033,329 +555,21 @@ paths: type: - string - 'null' - - $ref: '#/components/schemas/NoDataReturned' - - $ref: '#/components/schemas/DataSentToWebhook' - - $ref: '#/components/schemas/RequestProcessing' - - $ref: '#/components/schemas/RateLimitRequestProcessing' - - $ref: '#/components/schemas/LargeRequestProcessingEvent' - '400': - description: Returned when one or more parameters is malformed - an appropriate error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) - '401': - description: Returned when credentials (dev ID and API key) are invalid - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized - '404': - description: Returned when a parameter does not exist on Terra's end (e.g. user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) - /connections/{connection_id}/hormone: - get: - summary: Retrieve hormone data for a given connection ID - description: Fetches hormone test events (LH, E3G, PDG, HCG, FSH) for a given connection. Each entry is one test event; hormones not measured at that event appear as null. Uses x-terra-client-id and x-terra-client-secret headers for authentication. - tags: - - Hormone - operationId: Hormone_Fetch - security: - - TerraClientId: [] - TerraClientSecret: [] - parameters: - - name: connection_id - in: path - description: Terra connection ID - schema: - type: string - required: true - - name: start_date - in: query - description: Start date for data query (ISO-8601 date, YYYY-MM-DD) - schema: - type: string - format: date - required: true - - name: end_date - in: query - description: End date for data query (ISO-8601 date, YYYY-MM-DD) - schema: - type: string - format: date - required: false - responses: - '200': - description: Returned upon successful data request - content: - application/json: - schema: - oneOf: - - type: object - properties: - connection: - $ref: '#/components/schemas/Connection' - data: - type: array - items: - $ref: '#/components/schemas/HormoneSample' - type: - type: string - enum: - - hormone - - $ref: '#/components/schemas/NoDataReturned' - '400': - description: Returned when one or more parameters is malformed - an appropriate error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) - '401': - description: Returned when v3 credentials (x-terra-client-id and x-terra-client-secret) are invalid or missing - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized - '404': - description: Returned when the connection ID does not exist - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) - /nutrition: - get: - summary: Retrieve nutrition log data for a given user ID - description: Fetches nutrition log data such as meal type, calories, macronutrients etc. for a given user ID - tags: - - Nutrition - operationId: Nutrition_Fetch - parameters: - - name: user_id - in: query - description: Terra user ID (UUID format) to retrieve data for - schema: - type: string - required: true - - name: start_date - in: query - description: Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit) - schema: - oneOf: - - type: integer - - type: string - format: date - required: true - - name: end_date - in: query - description: End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit) - schema: - oneOf: - - type: integer - - type: string - format: date - required: false - - name: to_webhook - in: query - description: | - Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided) - schema: - type: boolean - required: false - - name: with_samples - in: query - description: | - Boolean flag specifying whether to include detailed samples in the returned payload (default: false) - schema: - type: boolean - required: false - responses: - '200': - description: Returned upon successful data request - content: - application/json: - schema: - oneOf: - - type: object - properties: - user: - $ref: '#/components/schemas/TerraUser' - data: - type: array - items: - $ref: '#/components/schemas/Nutrition' - type: - type: - - string - - 'null' - - $ref: '#/components/schemas/NoDataReturned' - - $ref: '#/components/schemas/DataSentToWebhook' - - $ref: '#/components/schemas/RequestProcessing' - - $ref: '#/components/schemas/RateLimitRequestProcessing' - - $ref: '#/components/schemas/LargeRequestProcessingEvent' - '400': - description: Returned when one or more parameters is malformed - an appropriate error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) - '401': - description: Returned when credentials (dev ID and API key) are invalid - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized - '404': - description: Returned when a parameter does not exist on Terra's end (e.g. user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) - post: - tags: - - Nutrition - operationId: Nutrition_Write - description: Used to post nutrition logs to a provider. This endpoint only works for users connected via Fitbit. Returns error for other providers. - summary: Post nutrition logs to a provider - requestBody: - content: - application/json: - schema: - type: object - properties: - data: - description: Nutrition entry to post to data provider - type: array - items: - $ref: '#/components/schemas/Nutrition' - required: - - data - required: true - responses: - '201': - description: Returned when activity was successfully created on the provider - content: - application/json: - schema: - type: object - properties: - user: - $ref: '#/components/schemas/TerraUser' - log_ids: - description: List of identifiers for the objects created, returned in the same order they were posted. I.e. Posting [ObjectA, ObjectB] will return [IdentifierA, IdentifierB] - type: array - items: - type: string - message: - type: string - default: Nutrition successfully logged - '400': - description: Returned when one or more parameters is malformed - an appropriate error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) - '404': - description: Returned when a parameter does not exist on Terra's end (e.g. user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) - delete: + - $ref: '#/components/schemas/DataSentToWebhook' + - $ref: '#/components/schemas/NoDestinationsAvailable' + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' + /nutrition: + get: + summary: Retrieve nutrition log data for a given user ID + description: Fetches nutrition log data such as meal type, calories, macronutrients etc. for a given user ID tags: - Nutrition - operationId: Nutrition_Delete - description: Used to delete nutrition logs the user has registered on their account - summary: Delete nutrition logs for a given user ID + operationId: Nutrition_Fetch parameters: - name: user_id in: query @@ -1363,103 +577,65 @@ paths: schema: type: string required: true - requestBody: - content: - application/json: - schema: - type: object - properties: - data: - type: array - description: List of identifiers for nutrition entries to be deleted - items: - type: string - required: - - data - required: true + - name: start_date + in: query + description: Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit) + schema: + oneOf: + - type: integer + - type: string + format: date + required: true + - name: end_date + in: query + description: End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit) + schema: + oneOf: + - type: integer + - type: string + format: date + required: false + - name: to_webhook + in: query + description: | + Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided) + schema: + type: boolean + required: false + - name: with_samples + in: query + description: | + Boolean flag specifying whether to include detailed samples in the returned payload (default: false) + schema: + type: boolean + required: false responses: '200': - description: Returned when all records were deleted successfully - content: - application/json: - schema: - type: object - properties: - user: - $ref: '#/components/schemas/TerraUser' - processed_data: - type: array - items: - type: object - properties: - id: - type: string - description: Identifier of the nutrition log whose deletion was attempted - response_code: - type: integer - description: Response code from the provider when attempting to delete the nutrition log - '207': - description: Returned when multiple status codes were obtained from attempting to delete the requested records + description: Returned upon successful data request content: application/json: schema: - type: object - properties: - user: - $ref: '#/components/schemas/TerraUser' - processed_data: - type: array - items: - type: object - properties: - id: - type: string - description: Identifier of the nutrition log whose deletion was attempted - response_code: - type: integer - description: Response code from the provider when attempting to delete the nutrition log + oneOf: + - type: object + properties: + user: + $ref: '#/components/schemas/TerraUser' + data: + type: array + items: + $ref: '#/components/schemas/Nutrition' + type: + type: + - string + - 'null' + - $ref: '#/components/schemas/DataSentToWebhook' + - $ref: '#/components/schemas/NoDestinationsAvailable' '400': - description: Returned when one or more parameters is malformed - an appropriate error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/BadRequest' '401': - description: Returned when credentials (dev ID and API key) are invalid - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized + $ref: '#/components/responses/Unauthorized' '404': - description: Returned when a parameter does not exist on Terra's end (e.g. user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - enum: - - success - - error - type: string - description: indicates that an error happened (value is error) + $ref: '#/components/responses/NotFound' /sleep: get: summary: Retrieve sleep sessions for a given user ID @@ -1525,52 +701,14 @@ paths: type: - string - 'null' - - $ref: '#/components/schemas/NoDataReturned' - $ref: '#/components/schemas/DataSentToWebhook' - - $ref: '#/components/schemas/RequestProcessing' - - $ref: '#/components/schemas/RateLimitRequestProcessing' - - $ref: '#/components/schemas/LargeRequestProcessingEvent' + - $ref: '#/components/schemas/NoDestinationsAvailable' '400': - description: Returned when one or more parameters is malformed - an appropriate error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/BadRequest' '401': - description: Returned when credentials (dev ID and API key) are invalid - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized + $ref: '#/components/responses/Unauthorized' '404': - description: Returned when a parameter does not exist on Terra's end (e.g. user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/NotFound' /plannedWorkout: post: tags: @@ -1618,35 +756,9 @@ paths: type: string default: Planned workout successfully created '400': - description: Returned when one or more parameters is malformed - an appropriate error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/BadRequest' '404': - description: Returned when a parameter does not exist on Terra's end (e.g. user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/NotFound' get: summary: Retrieve workout plans for a given user ID description: Used to get workout plans the user has registered on their account. This can be strength workouts (sets, reps, weight lifted) or cardio workouts (warmup, intervals of different intensities, cooldown etc) @@ -1704,49 +816,14 @@ paths: type: - string - 'null' - - $ref: '#/components/schemas/NoDataReturned' - $ref: '#/components/schemas/DataSentToWebhook' + - $ref: '#/components/schemas/NoDestinationsAvailable' '400': - description: Returned when one or more parameters is malformed - an appropriate error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/BadRequest' '401': - description: Returned when credentials (dev ID and API key) are invalid - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized + $ref: '#/components/responses/Unauthorized' '404': - description: Returned when a parameter does not exist on Terra's end (e.g. user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/NotFound' delete: tags: - PlannedWorkout @@ -1794,71 +871,31 @@ paths: description: Identifier of the planned workout whose deletion was attempted response_code: type: integer - description: Response code from the provider when attempting to delete the planned workout - '207': - description: Returned when multiple status codes were obtained from attempting to delete the requested records - content: - application/json: - schema: - type: object - properties: - user: - $ref: '#/components/schemas/TerraUser' - processed_data: - type: object - properties: - id: - type: string - description: Identifier of the planned workout whose deletion was attempted - response_code: - type: integer - description: Response code from the provider when attempting to delete the planned workout - '400': - description: Returned when one or more parameters is malformed - an appropriate error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) - '401': - description: Returned when authorization with a data provider has failed - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - enum: - - success - - error - type: string - description: indicates that an error happened (value is error) - '404': - description: Returned when a parameter does not exist on Terra's end (e.g. user_id) + description: Response code from the provider when attempting to delete the planned workout + '207': + description: Returned when multiple status codes were obtained from attempting to delete the requested records content: application/json: schema: type: object properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + user: + $ref: '#/components/schemas/TerraUser' + processed_data: + type: object + properties: + id: + type: string + description: Identifier of the planned workout whose deletion was attempted + response_code: + type: integer + description: Response code from the provider when attempting to delete the planned workout + '400': + $ref: '#/components/responses/BadRequest' + '401': + $ref: '#/components/responses/Unauthorized' + '404': + $ref: '#/components/responses/NotFound' /userInfo: get: tags: @@ -1890,7 +927,26 @@ paths: type: object properties: user: - $ref: '#/components/schemas/TerraUser' + description: | + The connection. In addition to the base User fields, this endpoint also returns polling metadata. + allOf: + - $ref: '#/components/schemas/TerraUser' + - type: object + properties: + last_polled_at: + type: + - string + - 'null' + format: date-time + description: Last time Terra polled the provider for this connection. + example: '2024-01-20T11:00:00Z' + most_recent_data_at: + type: + - string + - 'null' + format: date-time + description: Timestamp of the most recent data point Terra holds for this connection. + example: '2024-01-19T23:00:00Z' status: type: string enum: @@ -1904,35 +960,9 @@ paths: items: $ref: '#/components/schemas/TerraUser' '400': - description: Returned when one or more parameters is malformed - an appropriate error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/BadRequest' '404': - description: Returned when a parameter does not exist on Terra's end (e.g. user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/NotFound' /subscriptions: get: tags: @@ -1986,20 +1016,7 @@ paths: items: $ref: '#/components/schemas/TerraUser' '400': - description: Returned when one or more parameters are malformed - content: - application/json: - schema: - type: object - properties: - message: - description: A detailed message describing the error - type: string - status: - type: string - enum: - - error - description: Indicates that an error occurred (value is `error`) + $ref: '#/components/responses/BadRequest' /bulkUserInfo: post: tags: @@ -2027,35 +1044,9 @@ paths: items: $ref: '#/components/schemas/TerraUser' '400': - description: Returned when one or more parameters is malformed - an appropriate error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/BadRequest' '404': - description: Returned when a parameter does not exist on Terra's end (e.g. user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: - - error - description: indicates that an error happened (value is error) + $ref: '#/components/responses/NotFound' /integrations: get: summary: Get list of available integrations @@ -2382,7 +1373,66 @@ components: in: header name: x-terra-client-secret description: Your Terra client secret, used to authenticate v3 endpoints alongside x-terra-client-id + responses: + BadRequest: + description: One or more parameters is malformed. The `detail` field describes the specific problem. + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + example: + type: about:blank + title: bad request + instance: /activity + detail: invalid start_date + Unauthorized: + description: Authentication credentials (dev ID and API key) are missing or invalid. + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + example: + type: about:blank + title: unauthorized + instance: /activity + detail: dev-id or x-api-key headers are missing + NotFound: + description: A referenced resource does not exist on Terra's end (e.g. the user_id). + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + example: + type: about:blank + title: not found + instance: /activity + detail: user not found schemas: + Problem: + type: object + description: | + An error response, following RFC 7807. Returned with `Content-Type: application/problem+json` on every 4xx/5xx response. The HTTP status line carries the status code; it is intentionally not repeated in the body. `type`, `title` and `instance` are always present; `detail` is included when a specific explanation is available. + properties: + type: + type: string + description: A URI reference identifying the problem type. Defaults to `about:blank`. + example: about:blank + title: + type: string + description: A short, human-readable summary of the problem type (the lowercased HTTP status text). + example: unauthorized + instance: + type: string + description: The request path, including any query string, that produced this problem. + example: /api/v2/activity?user_id=d4aba475-f714-4663-88fe-28f18b8599b0&to_webhook=false + detail: + type: string + description: A human-readable explanation specific to this occurrence of the problem. + example: dev-id or x-api-key headers are missing + required: + - type + - title + - instance WidgetSessionParams: type: object properties: @@ -2408,88 +1458,87 @@ components: example: https://myapp.com/failure User: $ref: '#/components/schemas/TerraUser' - NoDataReturned: + NoDestinationsAvailable: type: object + description: | + Returned with HTTP 200 when `to_webhook` is true but the connection has no destination configured, so there is nowhere to deliver the requested data. The body uses the problem shape but is not an error. properties: - status: - type: string - enum: - - success - - error - example: error - message: - type: string - example: No data available for specified time range type: - type: - - string - - 'null' - example: no_data - user: - description: Terra User object - type: object - allOf: - - $ref: '#/components/schemas/TerraUser' - RequestProcessing: - type: object - properties: - retry_after_seconds: - type: number - description: Recommended time after which the request may be retried - nullable: true - example: 30 - message: type: string - nullable: false - example: Request is being processed - type: + example: about:blank + title: type: string - nullable: false - example: processing - user: - description: Terra User object - type: object - allOf: - - $ref: '#/components/schemas/TerraUser' - RateLimitRequestProcessing: - type: object - properties: - message: + example: ok + instance: type: string - nullable: false - example: Rate limit exceeded - type: + example: /activity + detail: type: string - nullable: false - example: rate_limit - user: - $ref: '#/components/schemas/TerraUser' + example: no destinations available for this connection required: - - user + - type + - title + - instance DataSentToWebhook: type: object + description: | + Acknowledgement returned when `to_webhook` is true (the default): the requested data is fetched asynchronously and delivered to your configured destination, and this body confirms the request was accepted. properties: + status: + type: string + enum: + - success + example: success + type: + type: string + description: The data type that was requested (e.g. `activity`, `sleep`). + example: activity reference: type: string - description: Payload reference, tying the request to the webhook payload which will be received - nullable: true - example: webhook_ref_123 - message: + description: Payload reference, tying this request to the webhook payload you will receive. + example: 5a3c2540-7139-44c6-8158-f81196e2cf2e + trace_id: type: string - nullable: false - example: Data will be sent to webhook - type: + description: Trace identifier for this request (equal to `reference`). + example: 5a3c2540-7139-44c6-8158-f81196e2cf2e + message: type: string - nullable: false - example: webhook + description: Present only for large requests (date range over one month), which are delivered in chunks. + example: Large request submitted. The data is being processed and will be sent to your destination in chunks user: - description: Terra User object type: object - allOf: - - $ref: '#/components/schemas/TerraUser' + description: Summary of the connection the data was requested for. + properties: + user_id: + type: string + example: 5a3c2540-7139-44c6-8158-f81196e2cf2e + provider: + type: string + example: GARMIN + reference_id: + type: + - string + - 'null' + example: user123@email.com + created_at: + type: string + format: date-time + example: '2024-01-15T09:30:00Z' + active: + type: boolean + example: true + scopes: + type: string + description: Comma-separated list of granted scopes. + example: activity,sleep,daily + last_webhook_update: + type: + - string + - 'null' + format: date-time + example: '2024-01-20T11:00:00Z' Activity: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Activity.yaml type: object properties: active_durations_data: @@ -2555,7 +1604,6 @@ components: - metadata Athlete: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Athlete.yaml type: object properties: age: @@ -2632,8 +1680,9 @@ components: allOf: - $ref: '#/components/schemas/Athlete' type: - type: string - nullable: true + type: + - string + - 'null' example: athlete user: description: Terra User object @@ -2642,7 +1691,6 @@ components: - $ref: '#/components/schemas/TerraUser' Body: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Body.yaml type: object properties: blood_pressure_data: @@ -2679,7 +1727,6 @@ components: - metadata Daily: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Daily.yaml type: object properties: active_durations_data: @@ -2725,7 +1772,6 @@ components: - metadata Menstruation: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Menstruation.yaml type: object properties: metadata: @@ -2738,7 +1784,6 @@ components: - metadata HormoneSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HormoneSample.yaml type: object properties: timestamp: @@ -2775,7 +1820,6 @@ components: - timestamp Connection: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Connection.yaml type: object properties: id: @@ -2819,7 +1863,6 @@ components: - scopes Nutrition: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Nutrition.yaml type: object properties: drink_samples: @@ -2842,7 +1885,6 @@ components: - metadata Sleep: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Sleep.yaml type: object properties: data_enrichment: @@ -2883,7 +1925,6 @@ components: properties: target_type: description: Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed - nullable: false type: string enum: - SPEED @@ -2910,13 +1951,13 @@ components: type: object properties: cadence: - type: integer + type: + - integer + - 'null' description: Ideal cadence value to be maintained for the workout step - nullable: true example: 90 target_type: description: Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed - nullable: false type: string enum: - SPEED @@ -2940,26 +1981,28 @@ components: - IF example: CADENCE cadence_low: - type: integer + type: + - integer + - 'null' description: Minimum cadence threshold for the workout step - i.e. the user is to stay above this value during the workout - nullable: true example: 85 cadence_high: - type: integer + type: + - integer + - 'null' description: Maximum cadence threshold for the workout step - i.e. the user is to stay under this value during the workout step - nullable: true example: 95 HRPlannedWorkoutStepTarget: type: object properties: hr_percentage_low: - type: number + type: + - number + - 'null' description: Maximum max heart rate percentage threshold for the workout step - i.e. the user is to stay under this value during the workout step - nullable: true example: 65.5 target_type: description: Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed - nullable: false type: string enum: - SPEED @@ -2983,31 +2026,34 @@ components: - IF example: HEART_RATE hr_percentage_high: - type: number + type: + - number + - 'null' description: Minimum heart rate percentage threshold for the workout step - i.e. the user is to stay above this value during the workout - nullable: true example: 85.5 hr_percentage: - type: number + type: + - number + - 'null' description: Ideal percentage of user's maximum HR to be maintained workout step - nullable: true example: 75.5 hr_bpm_high: - type: integer + type: + - integer + - 'null' description: Maximum heart rate threshold for the workout step - i.e. the user is to stay under this value during the workout step - nullable: true example: 175 hr_bpm_low: - type: integer + type: + - integer + - 'null' description: Minimum heart rate threshold for the workout step - i.e. the user is to stay above this value during the workout - nullable: true example: 130 PowerPlannedWorkoutStepTarget: type: object properties: target_type: description: Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed - nullable: false type: string enum: - SPEED @@ -3031,41 +2077,46 @@ components: - IF example: POWER power_percentage_low: - type: number + type: + - number + - 'null' description: Maximum percentage of Functional Threshold Power for the workout step - i.e. the user is to stay under this value during the workout step - nullable: true example: 65.5 power_percentage_high: - type: number + type: + - number + - 'null' description: Minimum percentage of Functional Threshold Power for the workout step - i.e. the user is to stay above this value during the workout - nullable: true example: 85.5 power_watt_high: - type: integer + type: + - integer + - 'null' description: Maximum power threshold for the workout step - i.e. the user is to stay under this value during the workout step - nullable: true example: 300 power_watt_low: - type: integer + type: + - integer + - 'null' description: Minimum power threshold for the workout step - i.e. the user is to stay above this value during the workout - nullable: true example: 200 power_watt: - type: integer + type: + - integer + - 'null' default: null - nullable: true example: 250 power_percentage: - type: number + type: + - number + - 'null' description: Ideal percentage of user's Functional Threshold Power to be maintained workout step - nullable: true example: 75.5 SpeedPlannedWorkoutStepTarget: type: object properties: target_type: description: Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed - nullable: false type: string enum: - SPEED @@ -3089,31 +2140,34 @@ components: - IF example: SPEED speed_percentage_high: - type: number + type: + - number + - 'null' description: Maximum speed threshold for the workout step - i.e. the user is to stay under this value during the workout step - nullable: true example: 85.5 speed_percentage_low: - type: number + type: + - number + - 'null' description: Minimum speed threshold for the workout step - i.e. the user is to stay above this value during the workout step - nullable: true example: 65.5 speed_percentage: - type: number + type: + - number + - 'null' description: Ideal percentage of user's Threshold Speed, based off their Threshold Pace, to be maintained workout step. Usually, the Threshold Pace is defined as the pace one could race at for 50 to 60 minutes - nullable: true example: 75.5 speed_meters_per_second: - type: number + type: + - number + - 'null' description: Ideal speed value to be maintained for the workout step - nullable: true example: 4.2 PacePlannedWorkoutStepTarget: type: object properties: target_type: description: Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed - nullable: false type: string enum: - SPEED @@ -3137,16 +2191,16 @@ components: - IF example: PACE pace_minutes_per_kilometer: - type: number + type: + - number + - 'null' description: Ideal pace value to be maintained for the workout step - nullable: true example: 5.5 TSSPlannedWorkoutStepTarget: type: object properties: target_type: description: Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed - nullable: false type: string enum: - SPEED @@ -3170,21 +2224,22 @@ components: - IF example: TSS tss: - type: number + type: + - number + - 'null' description: Planned Training Stress Score to be achieved for the workout step - nullable: true example: 100.5 IFPlannedWorkoutStepTarget: type: object properties: if_high: - type: number + type: + - number + - 'null' description: Maximum Intensity Factor to be achieved for the workout step - nullable: true example: 1.2 target_type: description: Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed - nullable: false type: string enum: - SPEED @@ -3208,16 +2263,16 @@ components: - IF example: IF if_low: - type: number + type: + - number + - 'null' description: Minimum Intensity Factor to be achieved for the workout step - nullable: true example: 0.8 RepetitionPlannedWorkoutStepTarget: type: object properties: target_type: description: Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed - nullable: false type: string enum: - SPEED @@ -3241,16 +2296,16 @@ components: - IF example: REPETITION repetitions: - type: number + type: + - number + - 'null' description: Number of repetitions of the workout step to be performed - nullable: true example: 10 SwimStrokePlannedWorkoutStepTarget: type: object properties: target_type: description: Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed - nullable: false type: string enum: - SPEED @@ -3274,9 +2329,10 @@ components: - IF example: SWIM_STROKE swim_strokes: - type: integer + type: + - integer + - 'null' description: Number of swim strokes to be performed during the workout step - nullable: true example: 50 PlannedWorkoutStepTargets: type: object @@ -3310,7 +2366,6 @@ components: properties: duration_type: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -3330,12 +2385,12 @@ components: type: object properties: seconds: - type: integer + type: + - integer + - 'null' description: Time duration to be elapsed for the workout step - nullable: true duration_type: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -3355,12 +2410,12 @@ components: type: object properties: power_above_watts: - type: integer + type: + - integer + - 'null' description: Threshold power goal to complete the workout step - once the user reaches above this power level, the step will be completed - nullable: true duration_type: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -3380,12 +2435,12 @@ components: type: object properties: power_below_watts: - type: integer + type: + - integer + - 'null' description: Threshold power goal to complete the workout step - once the user reaches below this power level, the step will be completed - nullable: true duration_type: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -3406,7 +2461,6 @@ components: properties: duration_type: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -3423,19 +2477,20 @@ components: - TIME_AT_VALID_CDA - STEPS rest_seconds: - type: integer + type: + - integer + - 'null' description: Time duration to be elapsed for the rest period - nullable: true CaloriesPlannedWorkoutStepDuration: type: object properties: calories: - type: integer + type: + - integer + - 'null' description: Calorie burn target for the workout step - once the user reaches the target, the step will be completed - nullable: true duration_type: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -3456,7 +2511,6 @@ components: properties: duration_type: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -3473,19 +2527,20 @@ components: - TIME_AT_VALID_CDA - STEPS hr_above_bpm: - type: integer + type: + - integer + - 'null' description: Threshold heart rate goal to complete the workout step - once the user's heart rate reaches above below this value, the step will be completed - nullable: true HRBelowPlannedWorkoutStepDuration: type: object properties: hr_below_bpm: - type: integer + type: + - integer + - 'null' description: Threshold heart rate goal to complete the workout step - once the user's heart rate reaches below this value, the step will be completed - nullable: true duration_type: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -3505,12 +2560,12 @@ components: type: object properties: reps: - type: integer + type: + - integer + - 'null' description: Target number of reps for the workout step - once the user completes this rep target, the step will be completed - nullable: true duration_type: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -3531,7 +2586,6 @@ components: properties: duration_type: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -3548,19 +2602,20 @@ components: - TIME_AT_VALID_CDA - STEPS distance_meters: - type: integer + type: + - integer + - 'null' description: Target distance for the workout step - once the user covers this distance, the step will be completed - nullable: true StepsPlannedWorkoutStepDuration: type: object properties: steps: - type: integer + type: + - integer + - 'null' description: Target number of steps for the workout step - once the user performs this number of steps, the step will be completed - nullable: true duration_type: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -3653,7 +2708,6 @@ components: $ref: '#/components/schemas/PlannedWorkoutStepTarget' type: description: Type of workout step - either repeat or one-off - nullable: false type: string enum: - STEP @@ -3664,26 +2718,30 @@ components: items: $ref: '#/components/schemas/PlannedWorkoutStep' intensity: - type: integer + type: + - integer + - 'null' description: Planned intensity for the workout step - nullable: true order: - type: integer + type: + - integer + - 'null' description: Position of the workout step in the overall workout - nullable: true description: - type: string + type: + - string + - 'null' description: Description of workout step - nullable: true durations: type: array description: List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed items: $ref: '#/components/schemas/PlannedWorkoutStepDuration' name: - type: string + type: + - string + - 'null' description: Name of workout step - nullable: true SwimmingPlannedWorkoutStep: type: object properties: @@ -3694,22 +2752,22 @@ components: $ref: '#/components/schemas/PlannedWorkoutStepTarget' type: description: Type of workout step - either repeat or one-off - nullable: false type: string enum: - STEP - REPEAT_STEP intensity: - type: integer + type: + - integer + - 'null' description: Planned intensity for the workout step - nullable: true order: - type: integer + type: + - integer + - 'null' description: Position of the workout step in the overall workout - nullable: true equipment_type: description: Workout equipment to be used during the workout step - nullable: false type: string enum: - NONE @@ -3719,21 +2777,22 @@ components: - SWIM_PULL_BUOY - SWIM_SNORKEL description: - type: string + type: + - string + - 'null' description: Description of workout step - nullable: true durations: type: array description: List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed items: $ref: '#/components/schemas/PlannedWorkoutStepDuration' name: - type: string + type: + - string + - 'null' description: Name of workout step - nullable: true stroke_type: description: Stroke type used for the workout step (e.g. breaststroke) - nullable: false type: string enum: - OTHER @@ -3752,27 +2811,30 @@ components: $ref: '#/components/schemas/PlannedWorkoutStepTarget' type: description: Type of workout step - either repeat or one-off - nullable: false type: string enum: - STEP - REPEAT_STEP intensity: - type: integer + type: + - integer + - 'null' description: Planned intensity for the workout step - nullable: true order: - type: integer + type: + - integer + - 'null' description: Position of the workout step in the overall workout - nullable: true exercise_name: - type: string + type: + - string + - 'null' description: Name of exercise to be performed for the workout step - nullable: true description: - type: string + type: + - string + - 'null' description: Description of workout step - nullable: true durations: type: array description: List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed @@ -3780,7 +2842,6 @@ components: $ref: '#/components/schemas/PlannedWorkoutStepDuration' exercise_category: description: Type of exercise to be performed for the workout step - nullable: false type: string enum: - UNKNOWN @@ -3820,16 +2881,18 @@ components: - BIKE - CARDIO_SENSORS name: - type: string + type: + - string + - 'null' description: Name of workout step - nullable: true StrengthPlannedWorkoutStep: type: object properties: weight_kg: - type: number + type: + - number + - 'null' description: Weight to be lifted for the exercise - nullable: true targets: type: array description: List of targets for the workout @@ -3837,27 +2900,30 @@ components: $ref: '#/components/schemas/PlannedWorkoutStepTarget' type: description: Type of workout step - either repeat or one-off - nullable: false type: string enum: - STEP - REPEAT_STEP intensity: - type: integer + type: + - integer + - 'null' description: Planned intensity for the workout step - nullable: true order: - type: integer + type: + - integer + - 'null' description: Position of the workout step in the overall workout - nullable: true exercise_name: - type: string + type: + - string + - 'null' description: Name of strength exercise to be performed for the workout step - nullable: true description: - type: string + type: + - string + - 'null' description: Description of workout step - nullable: true durations: type: array description: List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed @@ -3865,7 +2931,6 @@ components: $ref: '#/components/schemas/PlannedWorkoutStepDuration' exercise_category: description: Type of strength exercise to be performed for the workout step - nullable: false type: string enum: - UNKNOWN @@ -3905,9 +2970,10 @@ components: - BIKE - CARDIO_SENSORS name: - type: string + type: + - string + - 'null' description: Name of workout step - nullable: true YogaPlannedWorkoutStep: type: object properties: @@ -3918,32 +2984,35 @@ components: $ref: '#/components/schemas/PlannedWorkoutStepTarget' type: description: Type of workout step - either repeat or one-off - nullable: false type: string enum: - STEP - REPEAT_STEP intensity: - type: integer + type: + - integer + - 'null' description: Planned intensity for the workout step - nullable: true order: - type: integer + type: + - integer + - 'null' description: Position of the workout step in the overall workout - nullable: true description: - type: string + type: + - string + - 'null' description: Description of workout step - nullable: true durations: type: array description: List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed items: $ref: '#/components/schemas/PlannedWorkoutStepDuration' name: - type: string + type: + - string + - 'null' description: Name of workout step - nullable: true PilatesPlannedWorkoutStep: type: object properties: @@ -3954,32 +3023,35 @@ components: $ref: '#/components/schemas/PlannedWorkoutStepTarget' type: description: Type of workout step - either repeat or one-off - nullable: false type: string enum: - STEP - REPEAT_STEP intensity: - type: integer + type: + - integer + - 'null' description: Planned intensity for the workout step - nullable: true order: - type: integer + type: + - integer + - 'null' description: Position of the workout step in the overall workout - nullable: true description: - type: string + type: + - string + - 'null' description: Description of workout step - nullable: true durations: type: array description: List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed items: $ref: '#/components/schemas/PlannedWorkoutStepDuration' name: - type: string + type: + - string + - 'null' description: Name of workout step - nullable: true RunningPlannedWorkoutStep: type: object properties: @@ -3990,32 +3062,35 @@ components: $ref: '#/components/schemas/PlannedWorkoutStepTarget' type: description: Type of workout step - either repeat or one-off - nullable: false type: string enum: - STEP - REPEAT_STEP intensity: - type: integer + type: + - integer + - 'null' description: Planned intensity for the workout step - nullable: true order: - type: integer + type: + - integer + - 'null' description: Position of the workout step in the overall workout - nullable: true description: - type: string + type: + - string + - 'null' description: Description of workout step - nullable: true durations: type: array description: List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed items: $ref: '#/components/schemas/PlannedWorkoutStepDuration' name: - type: string + type: + - string + - 'null' description: Name of workout step - nullable: true CyclingPlannedWorkoutStep: type: object properties: @@ -4026,32 +3101,35 @@ components: $ref: '#/components/schemas/PlannedWorkoutStepTarget' type: description: Type of workout step - either repeat or one-off - nullable: false type: string enum: - STEP - REPEAT_STEP intensity: - type: integer + type: + - integer + - 'null' description: Planned intensity for the workout step - nullable: true order: - type: integer + type: + - integer + - 'null' description: Position of the workout step in the overall workout - nullable: true description: - type: string + type: + - string + - 'null' description: Description of workout step - nullable: true durations: type: array description: List of conditions to be fulfilled for the workout step to be completed - all of the conditions must be completed items: $ref: '#/components/schemas/PlannedWorkoutStepDuration' name: - type: string + type: + - string + - 'null' description: Name of workout step - nullable: true PlannedWorkoutSteps: type: object properties: {} @@ -4113,14 +3191,14 @@ components: example: '2022-11-23T09:00:00.000000+02:00' format: date-time planned_date: - type: string + type: + - string + - 'null' description: The planned start datetime, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time example: '2022-11-24T09:00:00.000000+02:00' format: date-time - nullable: true type: description: The name - either user-entered or given by the fitness data provider - of the associated workout plan - nullable: false type: string enum: - IN_VEHICLE @@ -4414,7 +3492,6 @@ components: $ref: '#/components/schemas/WebhookEventType' TerraUser: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml type: object properties: user_id: @@ -4429,6 +3506,11 @@ components: - FITBIT minLength: 1 description: Connection data source + created_at: + type: string + examples: + - '2022-12-12T10:00:00.000000+00:00' + description: Time at which the connection was created last_webhook_update: type: string examples: @@ -4454,7 +3536,6 @@ components: - provider ActivityLevel: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityLevel.yaml oneOf: - type: number const: 0 @@ -4485,7 +3566,6 @@ components: description: Intensity of the user's activity at an instant in time ActivityLevelSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityLevelSample.yaml type: object properties: timestamp: @@ -4497,7 +3577,6 @@ components: $ref: '#/components/schemas/ActivityLevel' ActiveDurationsData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActiveDurationsData.yaml type: object properties: activity_levels_samples: @@ -4553,7 +3632,6 @@ components: type: number CalorieSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/CalorieSample.yaml type: object properties: timestamp: @@ -4569,7 +3647,6 @@ components: description: Time elapsed since the start of the workout, subtracting time during which the recording was paused CaloriesData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/CaloriesData.yaml type: object properties: BMR_calories: @@ -4591,7 +3668,6 @@ components: description: Total calories burned including BMR and activity. DataEnrichment: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DataEnrichment.yaml type: object properties: stress_score: @@ -4599,7 +3675,6 @@ components: description: User's stress score. DeviceDataType: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceDataType.yaml oneOf: - type: string const: STEPS @@ -4646,7 +3721,6 @@ components: description: Represents data types that a certain device contributed to. OtherDeviceData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OtherDeviceData.yaml type: object properties: manufacturer: @@ -4687,7 +3761,6 @@ components: description: Last upload date from the device. DeviceData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeviceData.yaml type: object properties: activation_timestamp: @@ -4738,7 +3811,6 @@ components: description: Device Software Version. DistanceSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceSample.yaml type: object properties: timestamp: @@ -4758,7 +3830,6 @@ components: description: Time elapsed since the start of the workout, subtracting time during which the recording was paused ElevationSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ElevationSample.yaml type: object properties: timestamp: @@ -4778,7 +3849,6 @@ components: description: Time elapsed since the start of the workout, subtracting time during which the recording was paused FloorsClimbedSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/FloorsClimbedSample.yaml type: object properties: timestamp: @@ -4798,7 +3868,6 @@ components: description: Time elapsed since the start of the workout, subtracting time during which the recording was paused StepSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StepSample.yaml type: object properties: timestamp: @@ -4814,7 +3883,6 @@ components: description: Time elapsed since the start of the workout, subtracting time during which the recording was paused DistanceDataDetailed: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceDataDetailed.yaml type: object properties: distance_samples: @@ -4839,7 +3907,6 @@ components: description: Array of detailed samples of steps performed throughout the workout. ElevationData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ElevationData.yaml type: object properties: avg_meters: @@ -4877,7 +3944,6 @@ components: description: Minimum elevation of the user during the workout. SwimmingData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SwimmingData.yaml type: object properties: num_laps: @@ -4900,7 +3966,6 @@ components: description: Pool length for associated with the day. DistanceDataSummary: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceDataSummary.yaml type: object properties: distance_meters: @@ -4920,7 +3985,6 @@ components: description: Summary information of the user's swimming statistics for the workout, if applicable. DistanceData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DistanceData.yaml type: object properties: detailed: @@ -4931,7 +3995,6 @@ components: description: Object containing summary information related to distance covered throughout the workout. EnergyData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/EnergyData.yaml type: object properties: energy_kilojoules: @@ -4946,7 +4009,6 @@ components: description: Total number of kiloJoules planned to be expended during the workout - represents the user's predefined goal for the workout HeartRateContext: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateContext.yaml oneOf: - type: number const: 0 @@ -4965,7 +4027,6 @@ components: description: Represents the context in which heart rate was measured. HeartRateDataSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataSample.yaml type: object properties: timestamp: @@ -4988,7 +4049,6 @@ components: description: Represents the context in which heart rate was measured. HeartRateVariabilityDataSampleRMSSD: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateVariabilityDataSampleRMSSD.yaml type: object properties: timestamp: @@ -5003,7 +4063,6 @@ components: description: User's Heart Rate Variability, computed using RMSSD HeartRateVariabilityDataSampleSDNN: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateVariabilityDataSampleSDNN.yaml type: object properties: timestamp: @@ -5018,7 +4077,6 @@ components: description: User's Heart Rate Variability, computed using SDNN HeartRateDataDetailed: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataDetailed.yaml type: object properties: hr_samples: @@ -5038,7 +4096,6 @@ components: description: Array of HeartRate Variability data samples recorded for the user during the workout, computed using SDNN. HeartRateZone: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateZone.yaml oneOf: - type: number const: 0 @@ -5073,7 +4130,6 @@ components: description: Represents the heart rate zone the user is currently in during a workout or activity HeartRateZoneData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateZoneData.yaml type: object properties: zone: @@ -5105,7 +4161,6 @@ components: description: Duration spent in the heart rate zone HeartRateDataSummary: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateDataSummary.yaml type: object properties: avg_hr_bpm: @@ -5154,7 +4209,6 @@ components: description: User's maximum HeartRate based on their age, and other factors as determined by the fitness data provider. HeartRateData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartRateData.yaml type: object properties: detailed: @@ -5165,7 +4219,6 @@ components: description: Object containing summary heart rate information for the associated workout. StrokeType: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StrokeType.yaml oneOf: - type: string const: other @@ -5192,7 +4245,6 @@ components: description: Stroke type used for the workout step (e.g. breaststroke) LapSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LapSample.yaml type: object properties: calories: @@ -5237,7 +4289,6 @@ components: description: Stroke type - only relevant for swimming activities LapData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LapData.yaml type: object properties: laps: @@ -5247,7 +4298,6 @@ components: description: Array of datapoints for each lap performed by the user during the workout. METSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/METSample.yaml type: object properties: timestamp: @@ -5260,7 +4310,6 @@ components: description: Metabolic Equivalent of Task (MET) level at the given timestamp METData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/METData.yaml type: object properties: MET_samples: @@ -5299,7 +4348,6 @@ components: description: Number of minutes spent in Moderate Intensity during the workout - based off MET scale. TimestampLocalization: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TimestampLocalization.yaml type: number enum: - 0 @@ -5309,7 +4357,6 @@ components: description: Indicates whether the timestamps in this payload are localized (LOCAL) or in UTC. ActivityType: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityType.yaml oneOf: - type: number const: 0 @@ -5876,7 +4923,6 @@ components: description: The type of activity performed for the associated workout. UploadType: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/UploadType.yaml oneOf: - type: number const: 0 @@ -5909,7 +4955,6 @@ components: description: The type of upload for the associated workout, providing information on how the workout data was recorded or entered ActivityMetadata: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityMetadata.yaml type: object properties: city: @@ -5963,7 +5008,6 @@ components: - upload_type CadenceSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/CadenceSample.yaml type: object properties: timestamp: @@ -5979,7 +5023,6 @@ components: description: Time elapsed since the start of the workout, subtracting time during which the recording was paused SpeedSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SpeedSample.yaml type: object properties: timestamp: @@ -5995,7 +5038,6 @@ components: description: Time elapsed since the start of the workout, subtracting time during which the recording was paused TorqueSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TorqueSample.yaml type: object properties: timestamp: @@ -6015,7 +5057,6 @@ components: description: Torque generated at a given instant in time, in Newton-meters MovementData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MovementData.yaml type: object properties: adjusted_max_speed_meters_per_second: @@ -6095,7 +5136,6 @@ components: description: Array of the datapoints for the user's torque sampled throughout the workout. OxygenSaturationType: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationType.yaml oneOf: - type: number const: 0 @@ -6110,7 +5150,6 @@ components: description: Type of oxygen saturation measurement (i.e. blood vs muscle) OxygenSaturationSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationSample.yaml type: object properties: timestamp: @@ -6128,7 +5167,6 @@ components: description: Type of oxygen saturation measurement (i.e. blood vs muscle) Vo2MaxSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Vo2MaxSample.yaml type: object properties: timestamp: @@ -6143,7 +5181,6 @@ components: description: User's VO2Max - maximum amount of oxygen the user's body can utilize during exercise OxygenData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenData.yaml type: object properties: avg_saturation_percentage: @@ -6168,7 +5205,6 @@ components: description: VO2Max for the given user. PolylineMapData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PolylineMapData.yaml type: object properties: summary_polyline: @@ -6178,7 +5214,6 @@ components: description: The polyline representation of the user's trajectory throughout the workout PositionSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PositionSample.yaml type: object properties: timestamp: @@ -6202,7 +5237,6 @@ components: description: Time elapsed since the start of the workout, subtracting time during which the recording was paused PositionData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PositionData.yaml type: object properties: center_pos_lat_lng_deg: @@ -6236,7 +5270,6 @@ components: description: Position of the user at the start of the workout, represented by a 2-value array of latitude, longitude, wherein each of the two numbers can be nullable. PowerSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PowerSample.yaml type: object properties: timestamp: @@ -6256,7 +5289,6 @@ components: description: Time elapsed since the start of the workout, subtracting time during which the recording was paused PowerData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PowerData.yaml type: object properties: avg_watts: @@ -6276,7 +5308,6 @@ components: description: Array containing datapoints of the power output of the user sampled throughout the workout. StrainData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StrainData.yaml type: object properties: strain_level: @@ -6286,7 +5317,6 @@ components: description: Level of cardiovascular strain imposed on the user during the day. TSSSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TSSSample.yaml type: object properties: planned: @@ -6309,7 +5339,6 @@ components: description: Normalized power output in watts TSSData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TSSData.yaml type: object properties: TSS_samples: @@ -6319,7 +5348,6 @@ components: description: Array of TSS information sampled throughout the workout WorkData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WorkData.yaml type: object properties: work_kilojoules: @@ -6327,53 +5355,8 @@ components: examples: - 450.5 description: Total work output of the user for the workout, in kilojoules. - WebhookEvent: - $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEvent.yaml - type: object - properties: - type: - type: string - description: The type of event - status: - type: string - description: Status of the event - required: - - type - description: Base webhook event structure that all events extend from - LargeRequestProcessingEvent: - $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LargeRequestProcessingEvent.yaml - type: object - properties: - type: - type: string - const: large_request_processing - status: - type: string - const: processing - description: Status of the processing - message: - type: string - description: Information about the processing - user: - $ref: '#/components/schemas/TerraUser' - description: User whose data is being processed - reference: - type: string - description: Reference ID for tracking this request - required: - - type - - status - - message - - user - - reference - allOf: - - $ref: '#/components/schemas/WebhookEvent' - description: Large request processing event BloodPressureSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BloodPressureSample.yaml type: object properties: timestamp: @@ -6393,7 +5376,6 @@ components: description: User's systolic blood pressure, in mmHg BloodPressureData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BloodPressureData.yaml type: object properties: blood_pressure_samples: @@ -6403,7 +5385,6 @@ components: description: List of Blood Pressure measurements sampled throughout the day. AFibFlag: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AFibFlag.yaml oneOf: - type: number const: 0 @@ -6422,7 +5403,6 @@ components: description: Flag indicating the atrial fibrillation classification of the individual AFibClassificationSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AFibClassificationSample.yaml type: object properties: timestamp: @@ -6435,7 +5415,6 @@ components: description: Flag indicating the atrial fibrillation classification of the individual RawECGSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RawECGSample.yaml type: object properties: potential_uV: @@ -6450,7 +5429,6 @@ components: description: Time with which the record is associated, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time. ECGReading: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ECGReading.yaml type: object properties: start_timestamp: @@ -6471,7 +5449,6 @@ components: description: List of raw ECG readings sampled through the day. PulseVelocitySample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PulseVelocitySample.yaml type: object properties: timestamp: @@ -6486,7 +5463,6 @@ components: description: User's Pulse Wave Velocity measurement - velocity at which the blood pressure pulse propagates through the circulatory system RRIntervalSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RRIntervalSample.yaml type: object properties: rr_interval_ms: @@ -6506,7 +5482,6 @@ components: description: The heart beat value at that specific instance. HeartData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HeartData.yaml type: object properties: afib_classification_samples: @@ -6534,7 +5509,6 @@ components: description: List of RR Interval samples throughout the day. HydrationMeasurementSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HydrationMeasurementSample.yaml type: object properties: timestamp: @@ -6549,7 +5523,6 @@ components: description: Total body water composition of the user, in kilograms. HydrationData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HydrationData.yaml type: object properties: day_total_water_consumption_ml: @@ -6564,7 +5537,6 @@ components: description: User's hydration level samples throughout the day. KetoneSampleType: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/KetoneSampleType.yaml oneOf: - type: number const: 0 @@ -6587,7 +5559,6 @@ components: description: Flag indicating the ketone sample type (e.g. blood, breath, urine) KetoneSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/KetoneSample.yaml type: object properties: timestamp: @@ -6605,7 +5576,6 @@ components: description: Flag indicating the ketone sample type (e.g. blood, breath, urine) KetoneData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/KetoneData.yaml type: object properties: ketone_samples: @@ -6615,7 +5585,6 @@ components: description: List of ketone data sampled through the day. MeasurementDataSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MeasurementDataSample.yaml type: object properties: measurement_time: @@ -6707,7 +5676,6 @@ components: description: User notes associated with the measurement. MeasurementsData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MeasurementsData.yaml type: object properties: measurements: @@ -6717,7 +5685,6 @@ components: description: List of body metrics & measurements taken throughout the associated day. BodyMetadata: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BodyMetadata.yaml type: object properties: end_time: @@ -6737,7 +5704,6 @@ components: - start_time TemperatureSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TemperatureSample.yaml type: object properties: timestamp: @@ -6752,7 +5718,6 @@ components: description: Temperature value in degrees Celsius. TemperatureData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TemperatureData.yaml type: object properties: ambient_temperature_samples: @@ -6772,7 +5737,6 @@ components: description: List of skin temperature measurements sampled throughout the day. GlucoseFlag: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/GlucoseFlag.yaml oneOf: - type: number const: 0 @@ -6791,7 +5755,6 @@ components: description: Flag indicating state of user's blood glucose level TrendArrow: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TrendArrow.yaml oneOf: - type: number const: 0 @@ -6822,7 +5785,6 @@ components: description: Flag indicating the current trend in the user's blood glucose level (e.g. rising, constant, falling) GlucoseDataSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/GlucoseDataSample.yaml type: object properties: timestamp: @@ -6843,7 +5805,6 @@ components: description: Flag indicating the current trend in the user's blood glucose level (e.g. rising, constant, falling) DailyPatternSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyPatternSample.yaml type: object properties: time_from_midnight: @@ -6870,7 +5831,6 @@ components: description: Percentile 95 of the glucose level at the given time of day. GlucoseData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/GlucoseData.yaml type: object properties: blood_glucose_samples: @@ -6904,7 +5864,6 @@ components: description: List of glucose percentile samples throughout the day. DataContributor: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DataContributor.yaml type: object properties: contributor_name: @@ -6918,7 +5877,6 @@ components: - contributor_score DailyDataEnrichment: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyDataEnrichment.yaml type: object properties: cardiovascular_contributors: @@ -6966,7 +5924,6 @@ components: description: Total stress score for the day. DailyDistanceData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyDistanceData.yaml type: object properties: detailed: @@ -6996,7 +5953,6 @@ components: description: Summary information of the user's swimming statistics for the day, if applicable. DailyMetadata: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyMetadata.yaml type: object properties: end_time: @@ -7020,7 +5976,6 @@ components: - upload_type ScoresData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ScoresData.yaml type: object properties: activity: @@ -7053,7 +6008,6 @@ components: description: Biological age computed for the given day. StressSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StressSample.yaml type: object properties: timestamp: @@ -7066,7 +6020,6 @@ components: description: Stress level measurement at the given timestamp StressLevel: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StressLevel.yaml oneOf: - type: number const: 0 @@ -7093,7 +6046,6 @@ components: description: Represents stress level ranges. BodyBatterySample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BodyBatterySample.yaml type: object properties: timestamp: @@ -7106,7 +6058,6 @@ components: description: Body battery energy level at the given timestamp StressData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/StressData.yaml type: object properties: avg_stress_level: @@ -7170,7 +6121,6 @@ components: description: Array of Body Battery data points sampled throughout the day. TagEntry: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TagEntry.yaml type: object properties: timestamp: @@ -7194,7 +6144,6 @@ components: - notes TagData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TagData.yaml type: object properties: tags: @@ -7204,7 +6153,6 @@ components: description: Array of user-entered tags for the day. MenstruationMetadata: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstruationMetadata.yaml type: object properties: end_time: @@ -7224,7 +6172,6 @@ components: - start_time MenstrualPhase: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstrualPhase.yaml oneOf: - type: string const: menstrual @@ -7271,7 +6218,6 @@ components: description: Represents menstrual cycle phases. MenstruationFlow: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstruationFlow.yaml oneOf: - type: number const: 0 @@ -7302,7 +6248,6 @@ components: description: Flag indicating the strength of the user's menstrual flow MenstruationFlowSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstruationFlowSample.yaml type: object properties: timestamp: @@ -7315,7 +6260,6 @@ components: description: Flag indicating the strength of the user's menstrual flow. MenstruationData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstruationData.yaml type: object properties: period_length_days: @@ -7373,7 +6317,6 @@ components: description: List of user logs of information related to the strength of user's menstrual flow. DrinkSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DrinkSample.yaml type: object properties: timestamp: @@ -7398,7 +6341,6 @@ components: description: Name of drink consumed. NutritionMicros: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionMicros.yaml type: object properties: biotin_mg: @@ -7633,7 +6575,6 @@ components: description: Starch content of the associated food(s). MealType: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MealType.yaml oneOf: - type: number const: 0 @@ -7668,7 +6609,6 @@ components: description: Enum representing the category the consumed food/meal falls under (i.e. Breakfast/Lunch/Dinner etc) NutritionUnits: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionUnits.yaml oneOf: - type: number const: 0 @@ -7727,7 +6667,6 @@ components: description: Represents units used for nutrition measurements NutritionQuantity: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionQuantity.yaml type: object properties: unit: @@ -7739,7 +6678,6 @@ components: - amount NutritionMacros: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionMacros.yaml type: object properties: alcohol_g: @@ -7804,7 +6742,6 @@ components: description: Trans fat content of the associated food(s). Meal: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Meal.yaml type: object properties: micros: @@ -7844,7 +6781,6 @@ components: - macros NutritionMetadata: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionMetadata.yaml type: object properties: end_time: @@ -7864,7 +6800,6 @@ components: - start_time NutritionSummary: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionSummary.yaml type: object properties: macros: @@ -7885,7 +6820,6 @@ components: description: Non-water drink consumption of the user for a given day. SleepDataEnrichment: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepDataEnrichment.yaml type: object properties: sleep_contributors: @@ -7896,7 +6830,6 @@ components: type: number SleepUploadType: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepUploadType.yaml oneOf: - type: number const: 0 @@ -7923,7 +6856,6 @@ components: description: The upload type for the associated workout, providing information on whether this was an automatic workout or user-entered SleepMetadata: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepMetadata.yaml type: object properties: end_time: @@ -7955,7 +6887,6 @@ components: - upload_type RecoveryLevel: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RecoveryLevel.yaml oneOf: - type: number const: 0 @@ -7990,7 +6921,6 @@ components: description: User's recovery score for a given day, resulting from the sleep session ReadinessData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ReadinessData.yaml type: object properties: readiness: @@ -8005,7 +6935,6 @@ components: description: User's recovery score for a given day, resulting from the sleep session - takes Enum value. BreathSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BreathSample.yaml type: object properties: timestamp: @@ -8020,7 +6949,6 @@ components: description: User's respiration rate BreathsData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BreathsData.yaml type: object properties: avg_breaths_per_min: @@ -8060,7 +6988,6 @@ components: description: The end time of the recording of breathing rate data, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time. OxygenSaturationData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OxygenSaturationData.yaml type: object properties: avg_saturation_percentage: @@ -8085,7 +7012,6 @@ components: description: The start time of the recording of oxygen saturation, in ISO8601 format with microsecond precision. Will always fall on midnight of any given day, and will always be equal to 24h before end_time. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time. SnoringSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SnoringSample.yaml type: object properties: timestamp: @@ -8100,7 +7026,6 @@ components: description: Duration of snoring episode, in seconds SnoringData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SnoringData.yaml type: object properties: start_time: @@ -8130,7 +7055,6 @@ components: description: Total duration for which the user was snoring. RespirationData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RespirationData.yaml type: object properties: breaths_data: @@ -8144,7 +7068,6 @@ components: description: Object containing information on snoring metrics for the sleep session. AsleepDurations: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AsleepDurations.yaml type: object properties: duration_asleep_state_seconds: @@ -8174,7 +7097,6 @@ components: description: Number of periods of REM sleep captured during the sleep session. AwakeDurations: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AwakeDurations.yaml type: object properties: duration_awake_state_seconds: @@ -8214,7 +7136,6 @@ components: description: Wake up latency, defined as time between the moment the user wakes up and the moment they get out of bed. SleepLevel: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepLevel.yaml oneOf: - type: number const: 0 @@ -8249,7 +7170,6 @@ components: description: Represents the sleep level of the user during a sleep session, indicating the depth and quality of sleep SleepHypnogramSample: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepHypnogramSample.yaml type: object properties: timestamp: @@ -8261,7 +7181,6 @@ components: $ref: '#/components/schemas/SleepLevel' OtherSleepDurations: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/OtherSleepDurations.yaml type: object properties: duration_in_bed_seconds: @@ -8276,7 +7195,6 @@ components: description: Total duration during which the user's state (awake, asleep, REM, etc) was unmeasurable during the sleep session. SleepDurationsData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepDurationsData.yaml type: object properties: asleep: @@ -8302,7 +7220,6 @@ components: description: Sleep efficiency of the user given as a percentage, measured as time spent asleep divided by time spent in bed. SleepTemperatureData: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepTemperatureData.yaml type: object properties: delta: @@ -8310,9 +7227,21 @@ components: examples: - 0.5 description: Variation in user's skin temperature from their baseline. + WebhookEvent: + $schema: https://json-schema.org/draft/2020-12/schema + type: object + properties: + type: + type: string + description: The type of event + status: + type: string + description: Status of the event + required: + - type + description: Base webhook event structure that all events extend from HealthcheckEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HealthcheckEvent.yaml type: object properties: type: @@ -8341,7 +7270,6 @@ components: description: Healthcheck event sent periodically to verify your webhook endpoint is functional AuthEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AuthEvent.yaml type: object properties: type: @@ -8358,7 +7286,6 @@ components: description: Authentication event AuthSuccessEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AuthSuccessEvent.yaml type: object properties: status: @@ -8384,7 +7311,6 @@ components: description: Authentication success event AuthErrorEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AuthErrorEvent.yaml type: object properties: status: @@ -8422,7 +7348,6 @@ components: description: Authentication error event DeauthEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeauthEvent.yaml type: object properties: type: @@ -8448,7 +7373,6 @@ components: description: User deauthentication event UserReauthEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/UserReauthEvent.yaml type: object properties: type: @@ -8478,7 +7402,6 @@ components: description: User re-authentication event AccessRevokedEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AccessRevokedEvent.yaml type: object properties: type: @@ -8504,7 +7427,6 @@ components: description: Access revoked event when a user revokes access through the provider ConnectionErrorEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ConnectionErrorEvent.yaml type: object properties: type: @@ -8530,7 +7452,6 @@ components: description: Connection error event GoogleNoDatasourceEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/GoogleNoDatasourceEvent.yaml type: object properties: type: @@ -8556,7 +7477,6 @@ components: description: Google no datasource event ProcessingEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ProcessingEvent.yaml type: object properties: type: @@ -8586,7 +7506,6 @@ components: description: Processing event returned when data is being fetched asynchronously LargeRequestSendingEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LargeRequestSendingEvent.yaml type: object properties: type: @@ -8613,9 +7532,37 @@ components: allOf: - $ref: '#/components/schemas/WebhookEvent' description: Large request sending event + LargeRequestProcessingEvent: + $schema: https://json-schema.org/draft/2020-12/schema + type: object + properties: + type: + type: string + const: large_request_processing + status: + type: string + const: processing + description: Status of the processing + message: + type: string + description: Information about the processing + user: + $ref: '#/components/schemas/TerraUser' + description: User whose data is being processed + reference: + type: string + description: Reference ID for tracking this request + required: + - type + - status + - message + - user + - reference + allOf: + - $ref: '#/components/schemas/WebhookEvent' + description: Large request processing event RateLimitHitEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RateLimitHitEvent.yaml type: object properties: type: @@ -8648,7 +7595,6 @@ components: description: Rate limit hit event S3PayloadEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/S3PayloadEvent.yaml type: object properties: type: @@ -8674,7 +7620,6 @@ components: description: S3 Upload event with data download URL ActivityEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityEvent.yaml type: object properties: type: @@ -8701,7 +7646,6 @@ components: description: Activity data event AthleteEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AthleteEvent.yaml type: object properties: type: @@ -8726,7 +7670,6 @@ components: description: Athlete data event NutritionEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionEvent.yaml type: object properties: type: @@ -8753,7 +7696,6 @@ components: description: Nutrition data event DailyEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyEvent.yaml type: object properties: type: @@ -8780,7 +7722,6 @@ components: description: Daily data event SleepEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepEvent.yaml type: object properties: type: @@ -8807,7 +7748,6 @@ components: description: Sleep data event MenstruationEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstruationEvent.yaml type: object properties: type: @@ -8834,7 +7774,6 @@ components: description: Menstruation data event BodyEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BodyEvent.yaml type: object properties: type: @@ -8861,7 +7800,6 @@ components: description: Body data event PermissionChangeEvent: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PermissionChangeEvent.yaml type: object properties: type: @@ -8899,7 +7837,6 @@ components: description: Permission change event WebhookEventType: $schema: https://json-schema.org/draft/2020-12/schema - $id: https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEventType.yaml oneOf: - $ref: '#/components/schemas/HealthcheckEvent' - $ref: '#/components/schemas/AuthSuccessEvent' diff --git a/v5.yaml b/v5.yaml index adcabbf..4feb423 100644 --- a/v5.yaml +++ b/v5.yaml @@ -1,8 +1,8 @@ openapi: 3.1.0 info: - description: The Terra API + description: The Terra API (v2 surface, served at access.tryterra.co/api/v2). title: TerraAPI - version: 2022.03.16 + version: 2026.06.11 license: name: "Apache-2.0" url: https://github.com/tryterra/openapi/blob/master/LICENSE @@ -16,7 +16,7 @@ servers: - url: https://access.tryterra.co/api/v2 security: - ApiKeyAuth: [] - - DevID: [] + DevID: [] paths: /auth/authenticateUser: post: @@ -79,38 +79,9 @@ paths: in order to link their account example: https://www.fitbit.com/oauth2/authorize?response_type=code&client_id=23BBG9&scope=settings+nutrition+sleep+heartrate+electrocardiogram+weight+respiratory_rate+oxygen_saturation+profile+temperature+cardio_fitness+activity+location&state=bLqqjPie9ptwoWm6VBxHCu6JkkoWJp "400": - description: - Returned when one or more parameters is malformed - an appropriate - error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) - + $ref: "#/components/responses/BadRequest" "404": - description: - Returned when a parameter does not exist on Terra's end (e.g. - resource) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [success, error] - description: indicates that an error happened (value is error) + $ref: "#/components/responses/NotFound" /auth/generateWidgetSession: post: summary: Generate an authentication link, using the Terra Authentication Widget @@ -151,22 +122,7 @@ paths: description: a number in seconds depicting how long the url is valid for example: 900 "400": - description: - Returned when one or more parameters is malformed - an appropriate - error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) - + $ref: "#/components/responses/BadRequest" /users/{user_id}: patch: summary: Modify user @@ -211,19 +167,7 @@ paths: description: Indicates that the request was successful example: success "400": - description: Returned if the parameters are malformed or no user is found - content: - application/json: - schema: - type: object - properties: - message: - description: A detailed message describing the error - type: string - status: - type: string - enum: [success, error] - description: Indicates an error happened + $ref: "#/components/responses/BadRequest" /auth/deauthenticateUser: delete: summary: Deauthenticates a user and deletes any cached data for them @@ -252,19 +196,7 @@ paths: type: string "404": - description: Returned when the user_id is not existent - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [success, error] - description: indicates that an error happened (value is error) + $ref: "#/components/responses/NotFound" /auth/generateAuthToken: post: tags: @@ -297,23 +229,7 @@ paths: example: 180 default: 0 "404": - description: "404" - content: - application/json: - examples: - Result: - value: - status: "error" - message: "Invalid dev-id was provided" - schema: - type: object - properties: - status: - type: string - example: error - message: - type: string - example: Invalid dev-id was provided + $ref: "#/components/responses/NotFound" deprecated: false /activity: get: @@ -378,128 +294,14 @@ paths: $ref: "#/components/schemas/Activity" type: type: [string, "null"] - - $ref: "#/components/schemas/NoDataReturned" - $ref: "#/components/schemas/DataSentToWebhook" - - $ref: "#/components/schemas/RequestProcessing" - - $ref: "#/components/schemas/RateLimitRequestProcessing" - - $ref: "#/components/schemas/LargeRequestProcessingResponse" + - $ref: "#/components/schemas/NoDestinationsAvailable" "400": - description: - Returned when one or more parameters is malformed - an appropriate - error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) + $ref: "#/components/responses/BadRequest" "401": - description: Returned when credentials (dev ID and API key) are invalid - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized - "404": - description: - Returned when a parameter does not exist on Terra's end (e.g. - user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) - post: - tags: - - Activity - operationId: Activity_Write - description: Used to post activity data to a provider. This endpoint only works for users connected via Wahoo. Returns error for other providers. - summary: Post activity data to a provider - requestBody: - content: - application/json: - schema: - type: object - properties: - data: - description: List of user-tracked workouts to post to data provider - type: array - items: - $ref: "#/components/schemas/Activity" - required: - - data - required: true - responses: - "201": - description: Returned when activity was successfully created on the provider - content: - application/json: - schema: - type: object - properties: - user: - $ref: "#/components/schemas/User" - log_ids: - description: - List of identifiers for the objects created, returned - in the same order they were posted. I.e. Posting [ObjectA, ObjectB] - will return [IdentifierA, IdentifierB] - type: array - items: - type: string - message: - type: string - default: Activity successfully logged - "400": - description: - Returned when one or more parameters is malformed - an appropriate - error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) - + $ref: "#/components/responses/Unauthorized" "404": - description: - Returned when a parameter does not exist on Terra's end (e.g. - user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) + $ref: "#/components/responses/NotFound" /athlete: get: summary: Retrieve user profile info for a given user ID @@ -529,52 +331,14 @@ paths: schema: oneOf: - $ref: "#/components/schemas/AthleteCollection" - - $ref: "#/components/schemas/NoDataReturned" - $ref: "#/components/schemas/DataSentToWebhook" + - $ref: "#/components/schemas/NoDestinationsAvailable" "400": - description: - Returned when one or more parameters is malformed - an appropriate - error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) + $ref: "#/components/responses/BadRequest" "401": - description: Returned when credentials (dev ID and API key) are invalid - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized - + $ref: "#/components/responses/Unauthorized" "404": - description: - Returned when a parameter does not exist on Terra's end (e.g. - user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) + $ref: "#/components/responses/NotFound" /body: get: summary: Retrieve body metrics for a given user ID @@ -638,302 +402,63 @@ paths: $ref: "#/components/schemas/Body" type: type: [string, "null"] - - $ref: "#/components/schemas/NoDataReturned" - $ref: "#/components/schemas/DataSentToWebhook" - - $ref: "#/components/schemas/RequestProcessing" - - $ref: "#/components/schemas/RateLimitRequestProcessing" - - $ref: "#/components/schemas/LargeRequestProcessingResponse" + - $ref: "#/components/schemas/NoDestinationsAvailable" "400": - description: - Returned when one or more parameters is malformed - an appropriate - error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) + $ref: "#/components/responses/BadRequest" "401": - description: Returned when credentials (dev ID and API key) are invalid - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized - + $ref: "#/components/responses/Unauthorized" "404": - description: - Returned when a parameter does not exist on Terra's end (e.g. - user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) - post: - tags: - - Body - operationId: Body_Write - description: Used to post body data to a provider. This endpoint only works for users connected via Google Fit. Returns error for other providers. - summary: Post body data to a provider - requestBody: - content: - application/json: - schema: - type: object - properties: - data: - description: Body measurement metrics to post to data provider - type: array - items: - $ref: "#/components/schemas/Body" - required: - - data - required: true - responses: - "201": - description: Returned when activity was successfully created on the provider - content: - application/json: - schema: - type: object - properties: - user: - $ref: "#/components/schemas/User" - log_ids: - description: - List of identifiers for the objects created, returned - in the same order they were posted. I.e. Posting [ObjectA, ObjectB] - will return [IdentifierA, IdentifierB] - type: array - items: - type: string - message: - type: string - default: Body data successfully logged - "400": - description: - Returned when one or more parameters is malformed - an appropriate - error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) - - "404": - description: - Returned when a parameter does not exist on Terra's end (e.g. - user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) - delete: - tags: - - Body - operationId: Body_Delete - description: Used to delete Body metrics the user has registered on their account - summary: Delete body metrics for a given user ID - parameters: - - name: user_id - in: query - description: Terra user ID (UUID format) to retrieve data for - schema: - type: string - required: true - requestBody: - content: - application/json: - schema: - type: object - properties: - log_ids: - type: array - description: - List of identifiers for body metrics entries to be - deleted - items: - type: string - required: - - data - required: true - responses: - "200": - description: Returned when all records were deleted successfully - content: - application/json: - schema: - type: object - properties: - user: - $ref: "#/components/schemas/User" - processed_data: - type: array - items: - type: object - properties: - id: - type: string - description: - Identifier of the body metric entries whose - deletion was attempted - response_code: - type: integer - description: - Response code from the provider when attempting - to delete the body metric entries - "207": - description: - Returned when multiple status codes were obtained from attempting - to delete the requested records - content: - application/json: - schema: - type: object - properties: - user: - $ref: "#/components/schemas/User" - processed_data: - type: array - items: - type: object - properties: - id: - type: string - description: - Identifier of the body metric entry whose deletion - was attempted - response_code: - type: integer - description: - Response code from the provider when attempting - to delete the body metric entry - "400": - description: - Returned when one or more parameters is malformed - an appropriate - error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) - "401": - description: Returned when credentials (dev ID and API key) are invalid - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized - - "404": - description: - Returned when a parameter does not exist on Terra's end (e.g. - user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) - /daily: - get: - summary: Retrieve daily activity summaries for a given user ID - description: Fetches daily summaries of activity metrics such as steps, distance, calories burned etc. for a given user ID - tags: - - Daily - operationId: Daily_Fetch - parameters: - - name: user_id - in: query - description: Terra user ID (UUID format) to retrieve data for - schema: - type: string - required: true - - name: start_date - in: query - description: Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit) - schema: - oneOf: - - type: integer - - type: string - format: date - required: true - - name: end_date - in: query - description: End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit) - schema: - oneOf: - - type: integer - - type: string - format: date - required: false - - name: to_webhook - in: query - description: | - Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided) - schema: - type: boolean - required: false - - name: with_samples - in: query - description: | - Boolean flag specifying whether to include detailed samples in the returned payload (default: false) - schema: - type: boolean - required: false - responses: - "200": - description: Returned upon successful data request + $ref: "#/components/responses/NotFound" + /daily: + get: + summary: Retrieve daily activity summaries for a given user ID + description: Fetches daily summaries of activity metrics such as steps, distance, calories burned etc. for a given user ID + tags: + - Daily + operationId: Daily_Fetch + parameters: + - name: user_id + in: query + description: Terra user ID (UUID format) to retrieve data for + schema: + type: string + required: true + - name: start_date + in: query + description: Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit) + schema: + oneOf: + - type: integer + - type: string + format: date + required: true + - name: end_date + in: query + description: End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit) + schema: + oneOf: + - type: integer + - type: string + format: date + required: false + - name: to_webhook + in: query + description: | + Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided) + schema: + type: boolean + required: false + - name: with_samples + in: query + description: | + Boolean flag specifying whether to include detailed samples in the returned payload (default: false) + schema: + type: boolean + required: false + responses: + "200": + description: Returned upon successful data request content: application/json: schema: @@ -948,55 +473,14 @@ paths: $ref: "#/components/schemas/Daily" type: type: [string, "null"] - - $ref: "#/components/schemas/NoDataReturned" - $ref: "#/components/schemas/DataSentToWebhook" - - $ref: "#/components/schemas/RequestProcessing" - - $ref: "#/components/schemas/RateLimitRequestProcessing" - - $ref: "#/components/schemas/LargeRequestProcessingResponse" + - $ref: "#/components/schemas/NoDestinationsAvailable" "400": - description: - Returned when one or more parameters is malformed - an appropriate - error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) + $ref: "#/components/responses/BadRequest" "401": - description: Returned when credentials (dev ID and API key) are invalid - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized - + $ref: "#/components/responses/Unauthorized" "404": - description: - Returned when a parameter does not exist on Terra's end (e.g. - user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) + $ref: "#/components/responses/NotFound" /menstruation: get: summary: Retrieve menstruation data for a given user ID @@ -1062,153 +546,14 @@ paths: $ref: "#/components/schemas/Menstruation" type: type: [string, "null"] - - $ref: "#/components/schemas/NoDataReturned" - $ref: "#/components/schemas/DataSentToWebhook" - - $ref: "#/components/schemas/RequestProcessing" - - $ref: "#/components/schemas/RateLimitRequestProcessing" - - $ref: "#/components/schemas/LargeRequestProcessingResponse" + - $ref: "#/components/schemas/NoDestinationsAvailable" "400": - description: - Returned when one or more parameters is malformed - an appropriate - error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) + $ref: "#/components/responses/BadRequest" "401": - description: Returned when credentials (dev ID and API key) are invalid - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized - + $ref: "#/components/responses/Unauthorized" "404": - description: - Returned when a parameter does not exist on Terra's end (e.g. - user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) - /connections/{connection_id}/hormone: - get: - summary: Retrieve hormone data for a given connection ID - description: - Fetches hormone test events (LH, E3G, PDG, HCG, FSH) for a given - connection. Each entry is one test event; hormones not measured at - that event appear as null. Uses x-terra-client-id and - x-terra-client-secret headers for authentication. - tags: - - Hormone - operationId: Hormone_Fetch - security: - - TerraClientId: [] - TerraClientSecret: [] - parameters: - - name: connection_id - in: path - description: Terra connection ID - schema: - type: string - required: true - - name: start_date - in: query - description: Start date for data query (ISO-8601 date, YYYY-MM-DD) - schema: - type: string - format: date - required: true - - name: end_date - in: query - description: End date for data query (ISO-8601 date, YYYY-MM-DD) - schema: - type: string - format: date - required: false - responses: - "200": - description: Returned upon successful data request - content: - application/json: - schema: - oneOf: - - type: object - properties: - connection: - $ref: "#/components/schemas/Connection" - data: - type: array - items: - $ref: "#/components/schemas/HormoneSample" - type: - type: string - enum: [hormone] - - $ref: "#/components/schemas/NoDataReturned" - "400": - description: - Returned when one or more parameters is malformed - an appropriate - error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) - "401": - description: - Returned when v3 credentials (x-terra-client-id and - x-terra-client-secret) are invalid or missing - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized - "404": - description: - Returned when the connection ID does not exist - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) + $ref: "#/components/responses/NotFound" /nutrition: get: summary: Retrieve nutrition log data for a given user ID @@ -1227,300 +572,61 @@ paths: required: true - name: start_date in: query - description: Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit) - schema: - oneOf: - - type: integer - - type: string - format: date - required: true - - name: end_date - in: query - description: End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit) - schema: - oneOf: - - type: integer - - type: string - format: date - required: false - - name: to_webhook - in: query - description: | - Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided) - schema: - type: boolean - required: false - - name: with_samples - in: query - description: | - Boolean flag specifying whether to include detailed samples in the returned payload (default: false) - schema: - type: boolean - required: false - responses: - "200": - description: Returned upon successful data request - content: - application/json: - schema: - oneOf: - - type: object - properties: - user: - $ref: "#/components/schemas/User" - data: - type: array - items: - $ref: "#/components/schemas/Nutrition" - type: - type: [string, "null"] - - $ref: "#/components/schemas/NoDataReturned" - - $ref: "#/components/schemas/DataSentToWebhook" - - $ref: "#/components/schemas/RequestProcessing" - - $ref: "#/components/schemas/RateLimitRequestProcessing" - - $ref: "#/components/schemas/LargeRequestProcessingResponse" - "400": - description: - Returned when one or more parameters is malformed - an appropriate - error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) - "401": - description: Returned when credentials (dev ID and API key) are invalid - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized - - "404": - description: - Returned when a parameter does not exist on Terra's end (e.g. - user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) - post: - tags: - - Nutrition - operationId: Nutrition_Write - description: Used to post nutrition logs to a provider. This endpoint only works for users connected via Fitbit. Returns error for other providers. - summary: Post nutrition logs to a provider - requestBody: - content: - application/json: - schema: - type: object - properties: - data: - description: Nutrition entry to post to data provider - type: array - items: - $ref: "#/components/schemas/Nutrition" - required: - - data - required: true - responses: - "201": - description: Returned when activity was successfully created on the provider - content: - application/json: - schema: - type: object - properties: - user: - $ref: "#/components/schemas/User" - log_ids: - description: - List of identifiers for the objects created, returned - in the same order they were posted. I.e. Posting [ObjectA, ObjectB] - will return [IdentifierA, IdentifierB] - type: array - items: - type: string - message: - type: string - default: Nutrition successfully logged - "400": - description: - Returned when one or more parameters is malformed - an appropriate - error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) - - "404": - description: - Returned when a parameter does not exist on Terra's end (e.g. - user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) - delete: - tags: - - Nutrition - operationId: Nutrition_Delete - description: - Used to delete nutrition logs the user has registered on their - account - summary: Delete nutrition logs for a given user ID - parameters: - - name: user_id - in: query - description: Terra user ID (UUID format) to retrieve data for + description: Start date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit) schema: - type: string + oneOf: + - type: integer + - type: string + format: date required: true - requestBody: - content: - application/json: - schema: - type: object - properties: - data: - type: array - description: List of identifiers for nutrition entries to be deleted - items: - type: string - required: - - data - required: true + - name: end_date + in: query + description: End date for data query - either ISO8601 date (YYYY-MM-DD) or unix timestamp in seconds (10-digit) + schema: + oneOf: + - type: integer + - type: string + format: date + required: false + - name: to_webhook + in: query + description: | + Boolean flag specifying whether to send the data retrieved to the webhook instead of in the response (default: true if not provided) + schema: + type: boolean + required: false + - name: with_samples + in: query + description: | + Boolean flag specifying whether to include detailed samples in the returned payload (default: false) + schema: + type: boolean + required: false responses: "200": - description: Returned when all records were deleted successfully - content: - application/json: - schema: - type: object - properties: - user: - $ref: "#/components/schemas/User" - processed_data: - type: array - items: - type: object - properties: - id: - type: string - description: - Identifier of the nutrition log whose deletion - was attempted - response_code: - type: integer - description: - Response code from the provider when attempting - to delete the nutrition log - "207": - description: - Returned when multiple status codes were obtained from attempting - to delete the requested records + description: Returned upon successful data request content: application/json: schema: - type: object - properties: - user: - $ref: "#/components/schemas/User" - processed_data: - type: array - items: - type: object - properties: - id: - type: string - description: - Identifier of the nutrition log whose deletion - was attempted - response_code: - type: integer - description: - Response code from the provider when attempting - to delete the nutrition log + oneOf: + - type: object + properties: + user: + $ref: "#/components/schemas/User" + data: + type: array + items: + $ref: "#/components/schemas/Nutrition" + type: + type: [string, "null"] + - $ref: "#/components/schemas/DataSentToWebhook" + - $ref: "#/components/schemas/NoDestinationsAvailable" "400": - description: - Returned when one or more parameters is malformed - an appropriate - error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) + $ref: "#/components/responses/BadRequest" "401": - description: Returned when credentials (dev ID and API key) are invalid - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized - + $ref: "#/components/responses/Unauthorized" "404": - description: - Returned when a parameter does not exist on Terra's end (e.g. - user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - enum: [success, error] - type: string - description: indicates that an error happened (value is error) + $ref: "#/components/responses/NotFound" /sleep: get: summary: Retrieve sleep sessions for a given user ID @@ -1586,55 +692,14 @@ paths: $ref: "#/components/schemas/Sleep" type: type: [string, "null"] - - $ref: "#/components/schemas/NoDataReturned" - $ref: "#/components/schemas/DataSentToWebhook" - - $ref: "#/components/schemas/RequestProcessing" - - $ref: "#/components/schemas/RateLimitRequestProcessing" - - $ref: "#/components/schemas/LargeRequestProcessingResponse" + - $ref: "#/components/schemas/NoDestinationsAvailable" "400": - description: - Returned when one or more parameters is malformed - an appropriate - error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) + $ref: "#/components/responses/BadRequest" "401": - description: Returned when credentials (dev ID and API key) are invalid - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized - + $ref: "#/components/responses/Unauthorized" "404": - description: - Returned when a parameter does not exist on Terra's end (e.g. - user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) + $ref: "#/components/responses/NotFound" /plannedWorkout: post: tags: @@ -1687,38 +752,9 @@ paths: type: string default: Planned workout successfully created "400": - description: - Returned when one or more parameters is malformed - an appropriate - error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) - + $ref: "#/components/responses/BadRequest" "404": - description: - Returned when a parameter does not exist on Terra's end (e.g. - user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) + $ref: "#/components/responses/NotFound" get: summary: Retrieve workout plans for a given user ID description: @@ -1777,52 +813,14 @@ paths: $ref: "#/components/schemas/PlannedWorkout" type: type: [string, "null"] - - $ref: "#/components/schemas/NoDataReturned" - $ref: "#/components/schemas/DataSentToWebhook" + - $ref: "#/components/schemas/NoDestinationsAvailable" "400": - description: - Returned when one or more parameters is malformed - an appropriate - error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) + $ref: "#/components/responses/BadRequest" "401": - description: Returned when credentials (dev ID and API key) are invalid - content: - application/json: - schema: - type: object - properties: - message: - description: An error message - type: string - example: unauthorized - + $ref: "#/components/responses/Unauthorized" "404": - description: - Returned when a parameter does not exist on Terra's end (e.g. - user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) + $ref: "#/components/responses/NotFound" delete: tags: - PlannedWorkout @@ -1876,81 +874,40 @@ paths: Identifier of the planned workout whose deletion was attempted response_code: - type: integer - description: - Response code from the provider when attempting - to delete the planned workout - "207": - description: - Returned when multiple status codes were obtained from attempting - to delete the requested records - content: - application/json: - schema: - type: object - properties: - user: - $ref: "#/components/schemas/User" - processed_data: - type: object - properties: - id: - type: string - description: - Identifier of the planned workout whose deletion - was attempted - response_code: - type: integer - description: - Response code from the provider when attempting - to delete the planned workout - "400": - description: - Returned when one or more parameters is malformed - an appropriate - error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) - "401": - description: Returned when authorization with a data provider has failed - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - enum: [success, error] - type: string - description: indicates that an error happened (value is error) - - "404": + type: integer + description: + Response code from the provider when attempting + to delete the planned workout + "207": description: - Returned when a parameter does not exist on Terra's end (e.g. - user_id) + Returned when multiple status codes were obtained from attempting + to delete the requested records content: application/json: schema: type: object properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) + user: + $ref: "#/components/schemas/User" + processed_data: + type: object + properties: + id: + type: string + description: + Identifier of the planned workout whose deletion + was attempted + response_code: + type: integer + description: + Response code from the provider when attempting + to delete the planned workout + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "404": + $ref: "#/components/responses/NotFound" /userInfo: get: tags: @@ -1984,7 +941,23 @@ paths: type: object properties: user: - $ref: "#/components/schemas/User" + description: > + The connection. In addition to the base User fields, + this endpoint also returns polling metadata. + allOf: + - $ref: "#/components/schemas/User" + - type: object + properties: + last_polled_at: + type: [string, "null"] + format: date-time + description: Last time Terra polled the provider for this connection. + example: "2024-01-20T11:00:00Z" + most_recent_data_at: + type: [string, "null"] + format: date-time + description: Timestamp of the most recent data point Terra holds for this connection. + example: "2024-01-19T23:00:00Z" status: type: string enum: [success, error] @@ -1998,38 +971,9 @@ paths: items: $ref: "#/components/schemas/User" "400": - description: - Returned when one or more parameters is malformed - an appropriate - error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) - + $ref: "#/components/responses/BadRequest" "404": - description: - Returned when a parameter does not exist on Terra's end (e.g. - user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) + $ref: "#/components/responses/NotFound" /subscriptions: get: tags: @@ -2084,19 +1028,7 @@ paths: items: $ref: "#/components/schemas/User" "400": - description: Returned when one or more parameters are malformed - content: - application/json: - schema: - type: object - properties: - message: - description: A detailed message describing the error - type: string - status: - type: string - enum: [error] - description: Indicates that an error occurred (value is `error`) + $ref: "#/components/responses/BadRequest" /bulkUserInfo: post: tags: @@ -2124,38 +1056,9 @@ paths: items: $ref: "#/components/schemas/User" "400": - description: - Returned when one or more parameters is malformed - an appropriate - error message will be returned - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) - + $ref: "#/components/responses/BadRequest" "404": - description: - Returned when a parameter does not exist on Terra's end (e.g. - user_id) - content: - application/json: - schema: - type: object - properties: - message: - description: a detailed message describing the error - type: string - status: - type: string - enum: [error] - description: indicates that an error happened (value is error) + $ref: "#/components/responses/NotFound" /integrations: get: summary: Get list of available integrations @@ -2230,7 +1133,70 @@ components: in: header name: x-terra-client-secret description: Your Terra client secret, used to authenticate v3 endpoints alongside x-terra-client-id + responses: + BadRequest: + description: One or more parameters is malformed. The `detail` field describes the specific problem. + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + example: + type: about:blank + title: bad request + instance: /activity + detail: invalid start_date + Unauthorized: + description: Authentication credentials (dev ID and API key) are missing or invalid. + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + example: + type: about:blank + title: unauthorized + instance: /activity + detail: dev-id or x-api-key headers are missing + NotFound: + description: A referenced resource does not exist on Terra's end (e.g. the user_id). + content: + application/problem+json: + schema: + $ref: "#/components/schemas/Problem" + example: + type: about:blank + title: not found + instance: /activity + detail: user not found schemas: + Problem: + type: object + description: > + An error response, following RFC 7807. Returned with + `Content-Type: application/problem+json` on every 4xx/5xx response. + The HTTP status line carries the status code; it is intentionally not + repeated in the body. `type`, `title` and `instance` are always present; + `detail` is included when a specific explanation is available. + properties: + type: + type: string + description: A URI reference identifying the problem type. Defaults to `about:blank`. + example: about:blank + title: + type: string + description: A short, human-readable summary of the problem type (the lowercased HTTP status text). + example: unauthorized + instance: + type: string + description: The request path, including any query string, that produced this problem. + example: /api/v2/activity?user_id=d4aba475-f714-4663-88fe-28f18b8599b0&to_webhook=false + detail: + type: string + description: A human-readable explanation specific to this occurrence of the problem. + example: dev-id or x-api-key headers are missing + required: + - type + - title + - instance WidgetSessionParams: type: object properties: @@ -2255,88 +1221,89 @@ components: description: "URL the user is redirected to upon unsuccessful authentication" example: "https://myapp.com/failure" User: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/TerraUser.yaml" - NoDataReturned: + $ref: "./schemas/TerraUser.yaml" + NoDestinationsAvailable: type: object + description: > + Returned with HTTP 200 when `to_webhook` is true but the connection has + no destination configured, so there is nowhere to deliver the requested + data. The body uses the problem shape but is not an error. properties: - status: - type: string - enum: [success, error] - example: "error" - message: - type: string - example: "No data available for specified time range" type: - type: [string, "null"] - example: "no_data" - user: - description: Terra User object - type: object - allOf: - - $ref: "#/components/schemas/User" - RequestProcessing: - type: object - properties: - retry_after_seconds: - type: number - description: Recommended time after which the request may be retried - nullable: true - example: 30 - message: type: string - nullable: false - example: "Request is being processed" - type: + example: about:blank + title: type: string - nullable: false - example: "processing" - user: - description: Terra User object - type: object - allOf: - - $ref: "#/components/schemas/User" - RateLimitRequestProcessing: - type: object - properties: - message: + example: ok + instance: type: string - nullable: false - example: "Rate limit exceeded" - type: + example: /activity + detail: type: string - nullable: false - example: "rate_limit" - user: - $ref: "#/components/schemas/User" + example: no destinations available for this connection required: - - user + - type + - title + - instance DataSentToWebhook: type: object + description: > + Acknowledgement returned when `to_webhook` is true (the default): the + requested data is fetched asynchronously and delivered to your configured + destination, and this body confirms the request was accepted. properties: + status: + type: string + enum: [success] + example: success + type: + type: string + description: The data type that was requested (e.g. `activity`, `sleep`). + example: activity reference: type: string - description: - Payload reference, tying the request to the webhook payload - which will be received - nullable: true - example: "webhook_ref_123" - message: + description: Payload reference, tying this request to the webhook payload you will receive. + example: 5a3c2540-7139-44c6-8158-f81196e2cf2e + trace_id: type: string - nullable: false - example: "Data will be sent to webhook" - type: + description: Trace identifier for this request (equal to `reference`). + example: 5a3c2540-7139-44c6-8158-f81196e2cf2e + message: type: string - nullable: false - example: "webhook" + description: Present only for large requests (date range over one month), which are delivered in chunks. + example: Large request submitted. The data is being processed and will be sent to your destination in chunks user: - description: Terra User object type: object - allOf: - - $ref: "#/components/schemas/User" + description: Summary of the connection the data was requested for. + properties: + user_id: + type: string + example: 5a3c2540-7139-44c6-8158-f81196e2cf2e + provider: + type: string + example: GARMIN + reference_id: + type: [string, "null"] + example: user123@email.com + created_at: + type: string + format: date-time + example: "2024-01-15T09:30:00Z" + active: + type: boolean + example: true + scopes: + type: string + description: Comma-separated list of granted scopes. + example: "activity,sleep,daily" + last_webhook_update: + type: [string, "null"] + format: date-time + example: "2024-01-20T11:00:00Z" Activity: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Activity.yaml" + $ref: "./schemas/Activity.yaml" Athlete: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Athlete.yaml" + $ref: "./schemas/Athlete.yaml" AthleteCollection: type: object properties: @@ -2346,8 +1313,7 @@ components: allOf: - $ref: "#/components/schemas/Athlete" type: - type: string - nullable: true + type: [string, "null"] example: "athlete" user: description: Terra User object @@ -2355,19 +1321,19 @@ components: allOf: - $ref: "#/components/schemas/User" Body: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Body.yaml" + $ref: "./schemas/Body.yaml" Daily: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Daily.yaml" + $ref: "./schemas/Daily.yaml" Menstruation: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Menstruation.yaml" + $ref: "./schemas/Menstruation.yaml" HormoneSample: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HormoneSample.yaml" + $ref: "./schemas/HormoneSample.yaml" Connection: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Connection.yaml" + $ref: "./schemas/Connection.yaml" Nutrition: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Nutrition.yaml" + $ref: "./schemas/Nutrition.yaml" Sleep: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/Sleep.yaml" + $ref: "./schemas/Sleep.yaml" PlannedWorkoutStepTarget: type: object properties: @@ -2375,7 +1341,6 @@ components: description: Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed - nullable: false type: string enum: - SPEED @@ -2402,15 +1367,13 @@ components: type: object properties: cadence: - type: integer + type: [integer, "null"] description: Ideal cadence value to be maintained for the workout step - nullable: true example: 90 target_type: description: Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed - nullable: false type: string enum: - SPEED @@ -2434,34 +1397,30 @@ components: - IF example: "CADENCE" cadence_low: - type: integer + type: [integer, "null"] description: Minimum cadence threshold for the workout step - i.e. the user is to stay above this value during the workout - nullable: true example: 85 cadence_high: - type: integer + type: [integer, "null"] description: Maximum cadence threshold for the workout step - i.e. the user is to stay under this value during the workout step - nullable: true example: 95 HRPlannedWorkoutStepTarget: type: object properties: hr_percentage_low: - type: number + type: [number, "null"] description: Maximum max heart rate percentage threshold for the workout step - i.e. the user is to stay under this value during the workout step - nullable: true example: 65.5 target_type: description: Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed - nullable: false type: string enum: - SPEED @@ -2485,32 +1444,28 @@ components: - IF example: "HEART_RATE" hr_percentage_high: - type: number + type: [number, "null"] description: Minimum heart rate percentage threshold for the workout step - i.e. the user is to stay above this value during the workout - nullable: true example: 85.5 hr_percentage: - type: number + type: [number, "null"] description: Ideal percentage of user's maximum HR to be maintained workout step - nullable: true example: 75.5 hr_bpm_high: - type: integer + type: [integer, "null"] description: Maximum heart rate threshold for the workout step - i.e. the user is to stay under this value during the workout step - nullable: true example: 175 hr_bpm_low: - type: integer + type: [integer, "null"] description: Minimum heart rate threshold for the workout step - i.e. the user is to stay above this value during the workout - nullable: true example: 130 PowerPlannedWorkoutStepTarget: type: object @@ -2519,7 +1474,6 @@ components: description: Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed - nullable: false type: string enum: - SPEED @@ -2543,44 +1497,38 @@ components: - IF example: "POWER" power_percentage_low: - type: number + type: [number, "null"] description: Maximum percentage of Functional Threshold Power for the workout step - i.e. the user is to stay under this value during the workout step - nullable: true example: 65.5 power_percentage_high: - type: number + type: [number, "null"] description: Minimum percentage of Functional Threshold Power for the workout step - i.e. the user is to stay above this value during the workout - nullable: true example: 85.5 power_watt_high: - type: integer + type: [integer, "null"] description: Maximum power threshold for the workout step - i.e. the user is to stay under this value during the workout step - nullable: true example: 300 power_watt_low: - type: integer + type: [integer, "null"] description: Minimum power threshold for the workout step - i.e. the user is to stay above this value during the workout - nullable: true example: 200 power_watt: - type: integer + type: [integer, "null"] default: null - nullable: true example: 250 power_percentage: - type: number + type: [number, "null"] description: Ideal percentage of user's Functional Threshold Power to be maintained workout step - nullable: true example: 75.5 SpeedPlannedWorkoutStepTarget: type: object @@ -2589,7 +1537,6 @@ components: description: Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed - nullable: false type: string enum: - SPEED @@ -2613,31 +1560,27 @@ components: - IF example: "SPEED" speed_percentage_high: - type: number + type: [number, "null"] description: Maximum speed threshold for the workout step - i.e. the user is to stay under this value during the workout step - nullable: true example: 85.5 speed_percentage_low: - type: number + type: [number, "null"] description: Minimum speed threshold for the workout step - i.e. the user is to stay above this value during the workout step - nullable: true example: 65.5 speed_percentage: - type: number + type: [number, "null"] description: Ideal percentage of user's Threshold Speed, based off their Threshold Pace, to be maintained workout step. Usually, the Threshold Pace is defined as the pace one could race at for 50 to 60 minutes - nullable: true example: 75.5 speed_meters_per_second: - type: number + type: [number, "null"] description: Ideal speed value to be maintained for the workout step - nullable: true example: 4.2 PacePlannedWorkoutStepTarget: type: object @@ -2646,7 +1589,6 @@ components: description: Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed - nullable: false type: string enum: - SPEED @@ -2670,9 +1612,8 @@ components: - IF example: "PACE" pace_minutes_per_kilometer: - type: number + type: [number, "null"] description: Ideal pace value to be maintained for the workout step - nullable: true example: 5.5 TSSPlannedWorkoutStepTarget: type: object @@ -2681,7 +1622,6 @@ components: description: Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed - nullable: false type: string enum: - SPEED @@ -2705,25 +1645,22 @@ components: - IF example: "TSS" tss: - type: number + type: [number, "null"] description: Planned Training Stress Score to be achieved for the workout step - nullable: true example: 100.5 IFPlannedWorkoutStepTarget: type: object properties: if_high: - type: number + type: [number, "null"] description: Maximum Intensity Factor to be achieved for the workout step - nullable: true example: 1.2 target_type: description: Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed - nullable: false type: string enum: - SPEED @@ -2747,9 +1684,8 @@ components: - IF example: "IF" if_low: - type: number + type: [number, "null"] description: Minimum Intensity Factor to be achieved for the workout step - nullable: true example: 0.8 RepetitionPlannedWorkoutStepTarget: type: object @@ -2758,7 +1694,6 @@ components: description: Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed - nullable: false type: string enum: - SPEED @@ -2782,9 +1717,8 @@ components: - IF example: "REPETITION" repetitions: - type: number + type: [number, "null"] description: Number of repetitions of the workout step to be performed - nullable: true example: 10 SwimStrokePlannedWorkoutStepTarget: type: object @@ -2793,7 +1727,6 @@ components: description: Type of target for the workout - i.e. metric type for which a criterion must be met for the workout to be completed - nullable: false type: string enum: - SPEED @@ -2817,9 +1750,8 @@ components: - IF example: "SWIM_STROKE" swim_strokes: - type: integer + type: [integer, "null"] description: Number of swim strokes to be performed during the workout step - nullable: true example: 50 PlannedWorkoutStepTargets: type: object @@ -2855,7 +1787,6 @@ components: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -2875,14 +1806,12 @@ components: type: object properties: seconds: - type: integer + type: [integer, "null"] description: Time duration to be elapsed for the workout step - nullable: true duration_type: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -2902,16 +1831,14 @@ components: type: object properties: power_above_watts: - type: integer + type: [integer, "null"] description: Threshold power goal to complete the workout step - once the user reaches above this power level, the step will be completed - nullable: true duration_type: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -2931,16 +1858,14 @@ components: type: object properties: power_below_watts: - type: integer + type: [integer, "null"] description: Threshold power goal to complete the workout step - once the user reaches below this power level, the step will be completed - nullable: true duration_type: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -2963,7 +1888,6 @@ components: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -2980,23 +1904,20 @@ components: - TIME_AT_VALID_CDA - STEPS rest_seconds: - type: integer + type: [integer, "null"] description: Time duration to be elapsed for the rest period - nullable: true CaloriesPlannedWorkoutStepDuration: type: object properties: calories: - type: integer + type: [integer, "null"] description: Calorie burn target for the workout step - once the user reaches the target, the step will be completed - nullable: true duration_type: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -3019,7 +1940,6 @@ components: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -3036,26 +1956,23 @@ components: - TIME_AT_VALID_CDA - STEPS hr_above_bpm: - type: integer + type: [integer, "null"] description: Threshold heart rate goal to complete the workout step - once the user's heart rate reaches above below this value, the step will be completed - nullable: true HRBelowPlannedWorkoutStepDuration: type: object properties: hr_below_bpm: - type: integer + type: [integer, "null"] description: Threshold heart rate goal to complete the workout step - once the user's heart rate reaches below this value, the step will be completed - nullable: true duration_type: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -3075,16 +1992,14 @@ components: type: object properties: reps: - type: integer + type: [integer, "null"] description: Target number of reps for the workout step - once the user completes this rep target, the step will be completed - nullable: true duration_type: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -3107,7 +2022,6 @@ components: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -3124,25 +2038,22 @@ components: - TIME_AT_VALID_CDA - STEPS distance_meters: - type: integer + type: [integer, "null"] description: Target distance for the workout step - once the user covers this distance, the step will be completed - nullable: true StepsPlannedWorkoutStepDuration: type: object properties: steps: - type: integer + type: [integer, "null"] description: Target number of steps for the workout step - once the user performs this number of steps, the step will be completed - nullable: true duration_type: description: Type of condition that must be fulfilled to consider the workout step complete - nullable: false type: string enum: - TIME @@ -3237,7 +2148,6 @@ components: $ref: "#/components/schemas/PlannedWorkoutStepTarget" type: description: Type of workout step - either repeat or one-off - nullable: false type: string enum: - STEP @@ -3251,17 +2161,14 @@ components: items: $ref: "#/components/schemas/PlannedWorkoutStep" intensity: - type: integer + type: [integer, "null"] description: Planned intensity for the workout step - nullable: true order: - type: integer + type: [integer, "null"] description: Position of the workout step in the overall workout - nullable: true description: - type: string + type: [string, "null"] description: Description of workout step - nullable: true durations: type: array description: @@ -3270,9 +2177,8 @@ components: items: $ref: "#/components/schemas/PlannedWorkoutStepDuration" name: - type: string + type: [string, "null"] description: Name of workout step - nullable: true SwimmingPlannedWorkoutStep: type: object properties: @@ -3283,22 +2189,18 @@ components: $ref: "#/components/schemas/PlannedWorkoutStepTarget" type: description: Type of workout step - either repeat or one-off - nullable: false type: string enum: - STEP - REPEAT_STEP intensity: - type: integer + type: [integer, "null"] description: Planned intensity for the workout step - nullable: true order: - type: integer + type: [integer, "null"] description: Position of the workout step in the overall workout - nullable: true equipment_type: description: Workout equipment to be used during the workout step - nullable: false type: string enum: - NONE @@ -3308,9 +2210,8 @@ components: - SWIM_PULL_BUOY - SWIM_SNORKEL description: - type: string + type: [string, "null"] description: Description of workout step - nullable: true durations: type: array description: @@ -3319,12 +2220,10 @@ components: items: $ref: "#/components/schemas/PlannedWorkoutStepDuration" name: - type: string + type: [string, "null"] description: Name of workout step - nullable: true stroke_type: description: Stroke type used for the workout step (e.g. breaststroke) - nullable: false type: string enum: - OTHER @@ -3343,27 +2242,22 @@ components: $ref: "#/components/schemas/PlannedWorkoutStepTarget" type: description: Type of workout step - either repeat or one-off - nullable: false type: string enum: - STEP - REPEAT_STEP intensity: - type: integer + type: [integer, "null"] description: Planned intensity for the workout step - nullable: true order: - type: integer + type: [integer, "null"] description: Position of the workout step in the overall workout - nullable: true exercise_name: - type: string + type: [string, "null"] description: Name of exercise to be performed for the workout step - nullable: true description: - type: string + type: [string, "null"] description: Description of workout step - nullable: true durations: type: array description: @@ -3373,7 +2267,6 @@ components: $ref: "#/components/schemas/PlannedWorkoutStepDuration" exercise_category: description: Type of exercise to be performed for the workout step - nullable: false type: string enum: - UNKNOWN @@ -3413,16 +2306,14 @@ components: - BIKE - CARDIO_SENSORS name: - type: string + type: [string, "null"] description: Name of workout step - nullable: true StrengthPlannedWorkoutStep: type: object properties: weight_kg: - type: number + type: [number, "null"] description: Weight to be lifted for the exercise - nullable: true targets: type: array description: List of targets for the workout @@ -3430,27 +2321,22 @@ components: $ref: "#/components/schemas/PlannedWorkoutStepTarget" type: description: Type of workout step - either repeat or one-off - nullable: false type: string enum: - STEP - REPEAT_STEP intensity: - type: integer + type: [integer, "null"] description: Planned intensity for the workout step - nullable: true order: - type: integer + type: [integer, "null"] description: Position of the workout step in the overall workout - nullable: true exercise_name: - type: string + type: [string, "null"] description: Name of strength exercise to be performed for the workout step - nullable: true description: - type: string + type: [string, "null"] description: Description of workout step - nullable: true durations: type: array description: @@ -3460,7 +2346,6 @@ components: $ref: "#/components/schemas/PlannedWorkoutStepDuration" exercise_category: description: Type of strength exercise to be performed for the workout step - nullable: false type: string enum: - UNKNOWN @@ -3500,9 +2385,8 @@ components: - BIKE - CARDIO_SENSORS name: - type: string + type: [string, "null"] description: Name of workout step - nullable: true YogaPlannedWorkoutStep: type: object properties: @@ -3513,23 +2397,19 @@ components: $ref: "#/components/schemas/PlannedWorkoutStepTarget" type: description: Type of workout step - either repeat or one-off - nullable: false type: string enum: - STEP - REPEAT_STEP intensity: - type: integer + type: [integer, "null"] description: Planned intensity for the workout step - nullable: true order: - type: integer + type: [integer, "null"] description: Position of the workout step in the overall workout - nullable: true description: - type: string + type: [string, "null"] description: Description of workout step - nullable: true durations: type: array description: @@ -3538,9 +2418,8 @@ components: items: $ref: "#/components/schemas/PlannedWorkoutStepDuration" name: - type: string + type: [string, "null"] description: Name of workout step - nullable: true PilatesPlannedWorkoutStep: type: object properties: @@ -3551,23 +2430,19 @@ components: $ref: "#/components/schemas/PlannedWorkoutStepTarget" type: description: Type of workout step - either repeat or one-off - nullable: false type: string enum: - STEP - REPEAT_STEP intensity: - type: integer + type: [integer, "null"] description: Planned intensity for the workout step - nullable: true order: - type: integer + type: [integer, "null"] description: Position of the workout step in the overall workout - nullable: true description: - type: string + type: [string, "null"] description: Description of workout step - nullable: true durations: type: array description: @@ -3576,9 +2451,8 @@ components: items: $ref: "#/components/schemas/PlannedWorkoutStepDuration" name: - type: string + type: [string, "null"] description: Name of workout step - nullable: true RunningPlannedWorkoutStep: type: object properties: @@ -3589,23 +2463,19 @@ components: $ref: "#/components/schemas/PlannedWorkoutStepTarget" type: description: Type of workout step - either repeat or one-off - nullable: false type: string enum: - STEP - REPEAT_STEP intensity: - type: integer + type: [integer, "null"] description: Planned intensity for the workout step - nullable: true order: - type: integer + type: [integer, "null"] description: Position of the workout step in the overall workout - nullable: true description: - type: string + type: [string, "null"] description: Description of workout step - nullable: true durations: type: array description: @@ -3614,9 +2484,8 @@ components: items: $ref: "#/components/schemas/PlannedWorkoutStepDuration" name: - type: string + type: [string, "null"] description: Name of workout step - nullable: true CyclingPlannedWorkoutStep: type: object properties: @@ -3627,23 +2496,19 @@ components: $ref: "#/components/schemas/PlannedWorkoutStepTarget" type: description: Type of workout step - either repeat or one-off - nullable: false type: string enum: - STEP - REPEAT_STEP intensity: - type: integer + type: [integer, "null"] description: Planned intensity for the workout step - nullable: true order: - type: integer + type: [integer, "null"] description: Position of the workout step in the overall workout - nullable: true description: - type: string + type: [string, "null"] description: Description of workout step - nullable: true durations: type: array description: @@ -3652,9 +2517,8 @@ components: items: $ref: "#/components/schemas/PlannedWorkoutStepDuration" name: - type: string + type: [string, "null"] description: Name of workout step - nullable: true PlannedWorkoutSteps: type: object properties: {} @@ -3707,19 +2571,17 @@ components: example: "2022-11-23T09:00:00.000000+02:00" format: date-time planned_date: - type: string + type: [string, "null"] description: The planned start datetime, in ISO8601 format with microsecond precision. TimeZone info will be provided whenever possible. If absent, the time corresponds to the user's local time example: "2022-11-24T09:00:00.000000+02:00" format: date-time - nullable: true type: description: The name - either user-entered or given by the fitness data provider - of the associated workout plan - nullable: false type: string enum: - IN_VEHICLE @@ -3893,49 +2755,49 @@ components: allOf: - $ref: "#/components/schemas/PlannedWorkoutMetadata" DataProcessingWebhook: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ProcessingEvent.yaml" + $ref: "./schemas/ProcessingEvent.yaml" UserAuthWebhook: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AuthSuccessEvent.yaml" + $ref: "./schemas/AuthSuccessEvent.yaml" UserAuthWebhookError: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AuthErrorEvent.yaml" + $ref: "./schemas/AuthErrorEvent.yaml" PermissionChangeWebhook: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/PermissionChangeEvent.yaml" + $ref: "./schemas/PermissionChangeEvent.yaml" UserReauthWebhook: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/UserReauthEvent.yaml" + $ref: "./schemas/UserReauthEvent.yaml" UserDeauthWebhook: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DeauthEvent.yaml" + $ref: "./schemas/DeauthEvent.yaml" AccessRevokedWebhook: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AccessRevokedEvent.yaml" + $ref: "./schemas/AccessRevokedEvent.yaml" GoogleNoDataSourceWebhook: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/GoogleNoDatasourceEvent.yaml" + $ref: "./schemas/GoogleNoDatasourceEvent.yaml" ConnectionErrorWebhook: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ConnectionErrorEvent.yaml" + $ref: "./schemas/ConnectionErrorEvent.yaml" LargeRequestSendingWebhook: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LargeRequestSendingEvent.yaml" + $ref: "./schemas/LargeRequestSendingEvent.yaml" LargeRequestProcessingResponse: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/LargeRequestProcessingEvent.yaml" + $ref: "./schemas/LargeRequestProcessingEvent.yaml" AuthenticationFailedWebhook: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AuthErrorEvent.yaml" + $ref: "./schemas/AuthErrorEvent.yaml" HealthCheckWebhook: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/HealthcheckEvent.yaml" + $ref: "./schemas/HealthcheckEvent.yaml" RateLimitHitWebhook: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/RateLimitHitEvent.yaml" + $ref: "./schemas/RateLimitHitEvent.yaml" S3UploadWebhook: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/S3PayloadEvent.yaml" + $ref: "./schemas/S3PayloadEvent.yaml" ActivityWebhook: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/ActivityEvent.yaml" + $ref: "./schemas/ActivityEvent.yaml" DailyWebhook: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/DailyEvent.yaml" + $ref: "./schemas/DailyEvent.yaml" NutritionWebhook: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/NutritionEvent.yaml" + $ref: "./schemas/NutritionEvent.yaml" AthleteWebhook: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/AthleteEvent.yaml" + $ref: "./schemas/AthleteEvent.yaml" SleepWebhook: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/SleepEvent.yaml" + $ref: "./schemas/SleepEvent.yaml" MenstruationWebhook: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/MenstruationEvent.yaml" + $ref: "./schemas/MenstruationEvent.yaml" BodyWebhook: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/BodyEvent.yaml" + $ref: "./schemas/BodyEvent.yaml" IntegrationsResponse: type: object properties: @@ -3994,7 +2856,7 @@ components: type: boolean example: false WebhookEvents: - $ref: "https://raw.githubusercontent.com/tryterra/openapi/refs/heads/master/schemas/WebhookEventType.yaml" + $ref: "./schemas/WebhookEventType.yaml" webhooks: healthcheck: diff --git a/v6-bundled.yaml b/widget-bundled.yaml similarity index 91% rename from v6-bundled.yaml rename to widget-bundled.yaml index ab103d9..d806390 100644 --- a/v6-bundled.yaml +++ b/widget-bundled.yaml @@ -1,11 +1,13 @@ openapi: 3.1.0 info: - title: Terra API Team-Based API - description: API to manage and retrieve data from team-based fitness tracking devices used in sports training and monitoring. + title: Terra Widget API + description: Endpoint for generating an authentication-widget session, used to redirect an end user into the Terra Authentication Widget so they can connect a data provider. version: 1.0.0 + license: + name: Proprietary servers: - url: https://access.tryterra.co - description: Main teams API base URL + description: Main API base URL security: - apiKeyAuth: [] devIdAuth: [] @@ -98,6 +100,15 @@ paths: - error description: indicates that an error happened (value is error) components: + securitySchemes: + apiKeyAuth: + type: apiKey + in: header + name: x-api-key + devIdAuth: + type: apiKey + in: header + name: dev-id schemas: WidgetSessionParams: type: object diff --git a/v6.yaml b/widget.yaml similarity index 90% rename from v6.yaml rename to widget.yaml index 5771148..a602453 100644 --- a/v6.yaml +++ b/widget.yaml @@ -1,14 +1,16 @@ openapi: 3.1.0 info: - title: Terra API Team-Based API - description: API to manage and retrieve data from team-based fitness tracking devices used in sports training and monitoring. + title: Terra Widget API + description: Endpoint for generating an authentication-widget session, used to redirect an end user into the Terra Authentication Widget so they can connect a data provider. version: 1.0.0 + license: + name: Proprietary security: - apiKeyAuth: [] devIdAuth: [] servers: - url: 'https://access.tryterra.co' - description: Main teams API base URL + description: Main API base URL paths: /widget/api/session: post: @@ -94,6 +96,15 @@ paths: enum: [success, error] description: indicates that an error happened (value is error) components: + securitySchemes: + apiKeyAuth: + type: apiKey + in: header + name: x-api-key + devIdAuth: + type: apiKey + in: header + name: dev-id schemas: WidgetSessionParams: type: object