Migrate campfire.go to use SDK CampfiresService - #64
Conversation
698d83e to
2f1b0d7
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b3497d5894
ℹ️ 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".
| bucketID, _ := strconv.ParseInt(resolvedProjectID, 10, 64) | ||
| campfireIDInt, _ := strconv.ParseInt(effectiveCampfireID, 10, 64) | ||
| lineIDInt, _ := strconv.ParseInt(lineID, 10, 64) |
There was a problem hiding this comment.
Validate numeric IDs before DeleteLine call
Here the strconv.ParseInt calls ignore their errors, so a non-numeric --campfire, lineID, or an unexpected non-numeric resolvedProjectID will silently become 0 and the SDK call will target bucket/campfire/line ID 0. That shifts a user input error into a potentially wrong delete (or at least a confusing 404) rather than a clear usage error. It would be safer to check the parse errors and fail fast before calling DeleteLine.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in PR #73 - added proper error checking for ParseInt calls and return usage errors for invalid IDs.
Replace direct API calls with SDK methods: - Use app.SDK.Campfires().List() for account-wide listing - Use app.SDK.Campfires().Get() for single campfire details - Use app.SDK.Campfires().ListLines() for messages - Use app.SDK.Campfires().GetLine() for single message - Use app.SDK.Campfires().CreateLine() for posting messages - Use app.SDK.Campfires().DeleteLine() for deletion Remove local CampfireLine struct in favor of basecamp.CampfireLine from the SDK.
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 methods: - Use app.SDK.Campfires().List() for account-wide listing - Use app.SDK.Campfires().Get() for single campfire details - Use app.SDK.Campfires().ListLines() for messages - Use app.SDK.Campfires().GetLine() for single message - Use app.SDK.Campfires().CreateLine() for posting messages - Use app.SDK.Campfires().DeleteLine() for deletion Remove local CampfireLine struct in favor of basecamp.CampfireLine from the SDK.
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 methods:
Remove local CampfireLine struct in favor of basecamp.CampfireLine
from the SDK.