Skip to content

feat: add personalization API (run/runAll) to Flutter SDK - #4

Merged
vmarchaud merged 2 commits into
mainfrom
devin/1781269268-add-personalization-api
Jun 12, 2026
Merged

vmarchaud merged 2 commits into
mainfrom
devin/1781269268-add-personalization-api

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Adds run() and runAll() to the existing ReelevantAnalytics class so the same SDK instance handles both analytics tracking and personalization — with shared identity.

Key design: Identity auto-resolves from setUser() → stored tmpId → fallback, so callers don't pass userId manually (but can override via RunOptions.userId).

New API surface

ReelevantAnalytics(
    companyId: '...',
    datasourceId: '...',
    runnerUrl: 'https://reelevant.run',      // default
    runnerTimeout: Duration(seconds: 5),      // default
    fallback: FallbackStrategy.empty,         // default
)

Future<RunResult> run(RunOptions options)
Future<List<RunResult>> runAll(List<RunOptions> optionsList)

RunResult.body uses subclasses: JsonRunContent, HtmlRunContent, ImageRunContent, EmptyRunContent.

Files

  • New: lib/reelevant_client.dart — types (RunOptions, RunResult, RunContent subclasses, FallbackStrategy, error classes) + internal runner HTTP logic using the existing http.Client
  • Modified: lib/reelevant_analytics.dart — added run()/runAll()/_resolveUserId()/_handleRunError() methods + new constructor params with defaults + re-exports reelevant_client.dart
  • Updated: README.md — full personalization docs with usage examples

Link to Devin session: https://app.devin.ai/sessions/cb78c8f2e2ba4d348b6f9a8c274c69bb
Requested by: @vmarchaud

Add run() and runAll() methods to ReelevantAnalytics for fetching
personalised content from the Reelevant runner. Identity is auto-resolved
from stored userId/tmpId. Includes typed RunResult with discriminated
RunContent body (JsonRunContent/HtmlRunContent/ImageRunContent/EmptyRunContent),
click tracking, and configurable fallback strategies.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author
Original prompt from vmarchaud

i want to provide the same DX as the web sdk but for mobile SDKs, check mobile personalization part in the docs to understand better

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Devin Review found 3 potential issues.

Open in Devin Review

Comment thread lib/reelevant_client.dart Outdated
Comment thread lib/reelevant_analytics.dart
Comment thread lib/reelevant_client.dart
Strip rlvt-u from user-supplied params before merging into runner URL
query parameters to prevent silent identity override.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@vmarchaud
vmarchaud marked this pull request as ready for review June 12, 2026 13:23
@vmarchaud
vmarchaud merged commit d2d17dc into main Jun 12, 2026
1 check passed
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