Migrate templates.go to use SDK TemplatesService - #60
Conversation
Replace direct API calls with SDK TemplatesService methods: - List, Get, Create, Update, Delete for templates - CreateProject and GetConstruction for project construction - Use basecamp.Template and related types - Filter templates by status client-side
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a780630606
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| templates, err := app.SDK.Templates().List(cmd.Context()) | ||
| if err != nil { |
There was a problem hiding this comment.
Preserve archived/trashed listing
If the Basecamp templates endpoint defaults to active-only when no status query is provided (which is why the old implementation passed ?status=...), calling Templates().List() without a status will return only active templates. In that case the CLI’s --status archived|trashed paths will silently return zero results because there are no archived/trashed items to filter. This would be a regression for users who rely on listing archived/trashed templates; consider using an SDK call that accepts status or falling back to the raw API when status != "active".
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in PR #73 - now uses raw API with status parameter for archived/trashed templates, since SDK List() only returns active.
Fixes for Codex review comments: 1. webhooks.go: Let server use default webhook types instead of hard-coding (PR #58 feedback) 2. templates.go: Use raw API for archived/trashed status since SDK List() only returns active templates (PR #60 feedback) 3. campfire.go: Validate ParseInt errors before DeleteLine to avoid silent 0 IDs (PR #64 feedback) 4. recordings.go: Add comment clarifying that Unarchive() works for both archived AND trashed recordings via status/active endpoint (PR #68) 5. files.go: Preserve SDK errors in auto-detect mode instead of masking auth/permission errors as "not found" (PR #70 feedback)
Fixes for Codex review comments: 1. webhooks.go: Let server use default webhook types instead of hard-coding (PR #58 feedback) 2. templates.go: Use raw API for archived/trashed status since SDK List() only returns active templates (PR #60 feedback) 3. campfire.go: Validate ParseInt errors before DeleteLine to avoid silent 0 IDs (PR #64 feedback) 4. recordings.go: Add comment clarifying that Unarchive() works for both archived AND trashed recordings via status/active endpoint (PR #68) 5. files.go: Preserve SDK errors in auto-detect mode instead of masking auth/permission errors as "not found" (PR #70 feedback)
Replace direct API calls with SDK TemplatesService methods: - List, Get, Create, Update, Delete for templates - CreateProject and GetConstruction for project construction - Use basecamp.Template and related types - Filter templates by status client-side
Fixes for Codex review comments: 1. webhooks.go: Let server use default webhook types instead of hard-coding (PR #58 feedback) 2. templates.go: Use raw API for archived/trashed status since SDK List() only returns active templates (PR #60 feedback) 3. campfire.go: Validate ParseInt errors before DeleteLine to avoid silent 0 IDs (PR #64 feedback) 4. recordings.go: Add comment clarifying that Unarchive() works for both archived AND trashed recordings via status/active endpoint (PR #68) 5. files.go: Preserve SDK errors in auto-detect mode instead of masking auth/permission errors as "not found" (PR #70 feedback)
Replace direct API calls with SDK TemplatesService methods: