Skip to content

[client] add inbox refresh options#49

Merged
capcom6 merged 1 commit intomasterfrom
client/inbox/refresh-options
May 6, 2026
Merged

[client] add inbox refresh options#49
capcom6 merged 1 commit intomasterfrom
client/inbox/refresh-options

Conversation

@capcom6
Copy link
Copy Markdown
Member

@capcom6 capcom6 commented Apr 21, 2026

Summary by CodeRabbit

  • New Features

    • Message export supports optional filtering by message type.
    • Message export can optionally trigger webhooks.
    • Exports enforce a valid date range (Since ≤ Until) and require a device identifier.
  • Deprecations

    • The previous message export request type is deprecated; a new request type is preferred but the old name remains available for compatibility.

@coderabbitai coderabbitai Bot added the ready label Apr 21, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 742ab031-9c59-4f3b-8a5d-2031dd09f83a

📥 Commits

Reviewing files that changed from the base of the PR and between 9e821d0 and 11fa2b9.

📒 Files selected for processing (2)
  • smsgateway/requests.go
  • smsgateway/requests_inbox.go
💤 Files with no reviewable changes (1)
  • smsgateway/requests.go

📝 Walkthrough

Walkthrough

Removed the old exported MessagesExportRequest from requests.go, added a new exported InboxRefreshRequest in requests_inbox.go with deviceId, since, until, messageTypes, and triggerWebhooks fields and validations, and reintroduced MessagesExportRequest as a deprecated type alias to InboxRefreshRequest.

Changes

Cohort / File(s) Summary
Struct Removal
smsgateway/requests.go
Deleted exported MessagesExportRequest and removed the time import.
Struct Addition & Deprecation
smsgateway/requests_inbox.go
Added exported InboxRefreshRequest (DeviceID, Since, Until, MessageTypes, TriggerWebhooks) with validation tags and time fields; added deprecated alias type MessagesExportRequest = InboxRefreshRequest for compatibility.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 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 '[client] add inbox refresh options' accurately describes the main change: introducing new InboxRefreshRequest with options for controlling message export behavior, while the old MessagesExportRequest is retained as a deprecated alias for backward compatibility.
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.


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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
smsgateway/requests_inbox.go (1)

10-10: Add element-level validation for MessageTypes enum values.

The current validation omitempty,min=1 only checks slice length. Add dive,oneof=SMS DATA_SMS MMS MMS_DOWNLOADED to validate that each element is a supported IncomingMessageType:

Proposed validation tag update
-	MessageTypes    []IncomingMessageType `json:"messageTypes,omitempty"    validate:"omitempty,min=1"`                                         // MessageTypes is the list of message types to export. By default, SMS messages are exported.
+	MessageTypes    []IncomingMessageType `json:"messageTypes,omitempty"    validate:"omitempty,min=1,dive,oneof=SMS DATA_SMS MMS MMS_DOWNLOADED"` // MessageTypes is the list of message types to export. By default, SMS messages are exported.

This pattern matches the validation conventions used elsewhere in the codebase (e.g., domain_settings.go, domain_messages.go).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@smsgateway/requests_inbox.go` at line 10, Update the validation tag for the
MessageTypes field to validate each enum value: change the current
`validate:"omitempty,min=1"` on `MessageTypes []IncomingMessageType` to include
`dive,oneof=SMS DATA_SMS MMS MMS_DOWNLOADED` so each element is validated
against allowed IncomingMessageType values (preserving omitempty and min=1
semantics).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@smsgateway/requests_inbox.go`:
- Line 17: The type declaration "type MessagesExportRequest InboxRefreshRequest"
creates a new distinct type instead of an alias, breaking compatibility when
passing an InboxRefreshRequest to ExportInbox (referenced by ExportInbox and
InboxRefreshRequest); change the declaration to a type alias so both names refer
to the same type (use the Go alias syntax: "type MessagesExportRequest =
InboxRefreshRequest") so existing calls that pass InboxRefreshRequest to
functions expecting MessagesExportRequest compile and behave identically.

---

Nitpick comments:
In `@smsgateway/requests_inbox.go`:
- Line 10: Update the validation tag for the MessageTypes field to validate each
enum value: change the current `validate:"omitempty,min=1"` on `MessageTypes
[]IncomingMessageType` to include `dive,oneof=SMS DATA_SMS MMS MMS_DOWNLOADED`
so each element is validated against allowed IncomingMessageType values
(preserving omitempty and min=1 semantics).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c15d04d4-2c78-41a2-91c5-6cf7d51a0ec7

📥 Commits

Reviewing files that changed from the base of the PR and between 4691ceb and 9e821d0.

📒 Files selected for processing (2)
  • smsgateway/requests.go
  • smsgateway/requests_inbox.go
💤 Files with no reviewable changes (1)
  • smsgateway/requests.go

Comment thread smsgateway/requests_inbox.go Outdated
@capcom6 capcom6 force-pushed the client/inbox/refresh-options branch from 3393ace to f49a9ec Compare April 22, 2026 12:03
@capcom6 capcom6 force-pushed the client/inbox/refresh-options branch from f49a9ec to 11fa2b9 Compare April 24, 2026 02:16
@capcom6 capcom6 merged commit 964d39f into master May 6, 2026
8 checks passed
@capcom6 capcom6 deleted the client/inbox/refresh-options branch May 6, 2026 00:39
@coderabbitai coderabbitai Bot mentioned this pull request May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant