Skip to content

Add set_activity_description() method#367

Open
TomasPinosRedbait wants to merge 1 commit into
cyberjunky:masterfrom
TomasPinosRedbait:feat/set-activity-description
Open

Add set_activity_description() method#367
TomasPinosRedbait wants to merge 1 commit into
cyberjunky:masterfrom
TomasPinosRedbait:feat/set-activity-description

Conversation

@TomasPinosRedbait
Copy link
Copy Markdown

@TomasPinosRedbait TomasPinosRedbait commented May 27, 2026

Summary

Adds a new method set_activity_description(activity_id, description) that lets clients write the activity's description field — the multi-line text shown under "Description" in the Garmin Connect web UI. Today the library reads this field (it appears on the activity detail JSON as top-level description) but offers no way to set it.

Implementation mirrors set_activity_name(): PUT to /activity-service/activity/{id} with {"activityId": id, "description": text}. Verified against live Garmin Connect — the server accepts the payload, returns {}, and the description is visible both via get_activity() and in the web UI after refresh.

from garminconnect import Garmin
api = Garmin(...)
api.login()
api.set_activity_description("12345678", "Tempo run — 5×1k @ 4:00, rest 90s")

Why

The Garmin Connect web UI exposes the Description field on every activity, but the wrapper currently has no setter. Use cases include logging session details that aren't captured by the device (intervals, RPE, equipment used, kettlebell weights, notes), which becomes important when downstream tooling reads activities programmatically and needs richer metadata than the device alone provides.

Test plan

  • Verified locally against my own Garmin account: PUT succeeds, returns {}, and the description persists on subsequent get_activity() calls and in the web UI.
  • ruff check garminconnect/ — clean.
  • ruff format --check garminconnect/ — clean.
  • mypy: no new errors introduced (the two pre-existing unused-ignore warnings in client.py are unaffected).
  • No unit test added — set_activity_name() and set_activity_type() also ship without dedicated tests, so this stays consistent with the existing convention. Happy to add a unit test (mocked client.put) if maintainers prefer.

Summary by CodeRabbit

  • New Features
    • Added ability to update activity descriptions programmatically.

Review Change Stack

Mirrors set_activity_name() — sends a PUT to
/activity-service/activity/{id} with {activityId, description}.
Verified against live Garmin Connect: payload accepted, returns {},
field is exposed on the activity detail at top-level "description"
after refetch.

Closes: feature gap with Garmin Connect web UI which has had the
"Description" field since at least 2024.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 32b6178f-78e7-4be8-8f1f-3ee91e137b10

📥 Commits

Reviewing files that changed from the base of the PR and between d206167 and 04953dc.

📒 Files selected for processing (1)
  • garminconnect/__init__.py

Walkthrough

This PR adds a new set_activity_description() method to the Garmin class that allows updating an activity's description. The method accepts an activity ID and description text, packages them into a request payload, and sends a PUT request to the Garmin activity endpoint.

Changes

Activity description update

Layer / File(s) Summary
Activity description setter
garminconnect/__init__.py
New set_activity_description(activity_id, description) method constructs a payload with activity ID and description, sends it to the activity endpoint via HTTP PUT, and returns the response.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding a new set_activity_description() method to the Garmin class.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant