limenia library
The headless API for apps that integrate Limenia, without widgets. The
widgets are in package:limenia/ui.dart.
The app talks to Limenia only through its own backend, which holds the API key: implement LimeniaTransport for that way. See README.md.
Classes
- AppealExpired
- The complaint waited longer than RetryPolicy.maxPendingAge and was dropped.
- AppealFailed
- Limenia or the client rejected the complaint. It is not kept.
- AppealLimits
-
Limits of a complaint (
CreateAppealRequest). Lengths count characters (Unicode code points). - AppealQueued
- Limenia cannot be reached right now. The complaint is kept and goes out with the next LimeniaReporter.sendPendingAppeals.
- AppealReceipt
-
Answer of
POST /v1/appeals(CreatedAppeal). - AppealRequest
-
A complaint against a decision (Art. 20 DSA) in the format of
POST /v1/appeals(CreateAppealRequest). - AppealResolution
-
A resolved complaint as Limenia sends it in
appeal.resolved(WebhookAppeal). - AppealResolvedEvent
-
A moderator decided on a complaint (
appeal.resolved). Show AppealResolution.statementText to the complaining user. For AppealOutcome.changed the new decision follows asdecision.created. - AppealResult
- Outcome of sending a complaint, like ReportResult.
- AppealSent
- Limenia has the complaint.
- AppealStatusInfo
-
Status and result of a complaint from
GET /v1/appeals/{appealId}(AppealStatusInfo), the fallback ifappeal.resolvedwas missed. - DecisionCreatedEvent
-
A moderator decided (
decision.created). - DeviceCheckLimits
-
Limits of a device check (
DeviceCheckRequest, API version 0.20.0). Lengths count characters (Unicode code points). - DeviceCheckRequest
-
A device check in the format of
POST /v1/devices/check(DeviceCheckRequest, API version 0.20.0). - DeviceCheckResult
-
Answer of
POST /v1/devices/check(DeviceCheckResult). - DeviceIntegrity
-
Summary of the Play Integrity verdicts (
DeviceIntegrity, Android only). - FieldError
-
Invalid field of a request (
FieldError). - InMemoryPendingAppealStore
- Keeps pending complaints in memory only, so they are lost when the app ends.
- InMemoryPendingReportStore
- Keeps pending reports in memory only, so they are lost when the app ends.
- InMemoryPendingReviewStore
- Keeps pending review requests in memory only, so they are lost when the app ends.
- InMemoryPendingSignalsStore
- Keeps pending signals in memory only, so they are lost when the app ends.
- Limenia
- Entry point for apps: reports, complaints, review requests, signals, device checks and the status of users over one LimeniaTransport to the backend of the app.
- LimeniaEvent
-
A webhook event of Limenia (
WebhookEvent). - LimeniaReporter
-
Sends reports, complaints, review requests and signals reliably: checks
them against the limits of Limenia, keeps them in a PendingReportStore,
PendingAppealStore, PendingReviewStore or PendingSignalsStore until
they went through, tries again with the same idempotency key and respects
Retry-After. - LimeniaTransport
- The way from the app to Limenia. The app implements it, usually as a call to its own backend, which passes the request on to the Limenia ingest API.
- ModerationDecision
-
A decision as Limenia sends it in
decision.created(WebhookDecision). - PendingAppeal
- A complaint that has not reached Limenia yet.
- PendingAppealStore
- Storage for complaints that still have to be sent, like PendingReportStore. Complaints contain the text of the user and their ID: delete them as soon as they are sent and do not log them.
- PendingReport
- A report that has not reached Limenia yet.
- PendingReportStore
- Storage for reports that still have to be sent.
- PendingReview
- A review request that has not reached Limenia yet.
- PendingReviewStore
- Storage for review requests that still have to be sent, like PendingReportStore. They contain the content before publication and the ID of its author: delete them as soon as they are sent and do not log them.
- PendingSignals
- Signals that have not reached Limenia yet.
- PendingSignalsStore
- Storage for signals that still have to be sent, like PendingReportStore. They contain IDs of users and what they did: delete them as soon as they are sent and do not log them.
- PolicyRef
- Policy a decision is based on.
- ReasonCategory
- Codes of the default policies Limenia creates for every tenant during onboarding (integration guide of Limenia, https://limenia.eu/docs/integration.md, section 3.3).
- ReportedContent
- Snapshot of the reported content. Limenia keeps the snapshot of the first report on an externalContentId; later reports do not change it.
- ReportedUser
- The reported user, for a content its author.
- ReporterWarning
-
A moderator warned the reporter for frequently submitting manifestly
unfounded notices (Art. 23 DSA), see ReportReceipt.reporterWarning
(
ReporterWarning, API version 0.16.0). - ReportExpired
- The report waited longer than RetryPolicy.maxPendingAge and was dropped.
- ReportFailed
- Limenia or the client rejected the report. It is not kept: sending it again unchanged would fail again.
- ReportLimits
-
Limits of a report, as in
api/openapi.yamland the ingest validation of the Limenia backend. Lengths count characters (Unicode code points). - ReportQueued
- Limenia cannot be reached right now. The report is kept and goes out with the next LimeniaReporter.sendPending.
- ReportReceipt
-
Answer of
POST /v1/reports(CreatedReport). - ReportRequest
-
A report in the format of
POST /v1/reports(CreateReportRequest). - ReportResult
- Outcome of sending a report.
- ReportSent
- Limenia has the report.
- ReportsResolution
-
The decision on a case for the users who reported it (Art. 16 (5) DSA),
as Limenia sends it in
reports.resolved(WebhookReportsResolved). - ReportsResolvedEvent
-
A case with reports of users was decided (
reports.resolved), in addition todecision.created. Tell the reporters the result and the deadline for a complaint (Art. 16 (5) DSA). - ResolvedReport
-
A report of a user on a decided case, from
reports.resolved. - RetryPolicy
- When and how often LimeniaReporter tries a report, a complaint, a review request or signals again.
- ReviewDecidedEvent
-
A moderator decided on a review request (
review.decided). Publish the content only now, depending on ReviewResolution.outcome. For ReviewOutcome.restricted and ReviewOutcome.rejected the decision with the statement of reasons follows asdecision.created. - ReviewExpired
- The review request waited longer than RetryPolicy.maxPendingAge and was dropped.
- ReviewFailed
- Limenia or the client rejected the review request. It is not kept.
- ReviewLimits
-
Limits of a review request (
CreateReviewRequest). Author and content have the limits of a report (ReportLimits). Lengths count characters (Unicode code points). - ReviewQueued
- Limenia cannot be reached right now. The review request is kept and goes out with the next LimeniaReporter.sendPendingReviews.
- ReviewReceipt
-
Answer of
POST /v1/reviews(CreatedReview). - ReviewRequest
-
Content submitted for review before it is published (pre-moderation),
in the format of
POST /v1/reviews(CreateReviewRequest). - ReviewResolution
-
A decided review request as Limenia sends it in
review.decided(WebhookReview). - ReviewResult
- Outcome of sending a review request, like ReportResult.
- ReviewSent
-
Limenia has the review request. Publish the content only after
review.decided(or ReviewStatusInfo.outcome), and follow a laterdecision.createdwith itsreviewIdif a complaint changes the result. - ReviewStatusInfo
-
Status and result of a review request from
GET /v1/reviews/{reviewId}(ReviewStatusInfo), the fallback ifreview.decidedwas missed. - SignalInput
-
An observation of the app about a user, in the format of one entry of
POST /v1/signals(SignalInput, API version 0.18.0), e.g. a jump in the score or an unusual burst of activity. - SignalLimits
-
Limits of a signals request (
CreateSignalsRequest,SignalInput). Lengths count characters (Unicode code points). - SignalsExpired
- The signals waited longer than RetryPolicy.maxPendingAge and were dropped.
- SignalsFailed
- Limenia or the client rejected the signals. They are not kept: sending them again unchanged would fail again. Limenia checks the request as a whole, so none of its signals was stored.
- SignalsQueued
- Limenia cannot be reached right now. The signals are kept and go out with the next LimeniaReporter.sendPendingSignals.
- SignalsReceipt
-
Answer of
POST /v1/signals(CreatedSignals). - SignalsRequest
-
Up to 100 signals in the format of
POST /v1/signals(CreateSignalsRequest). - SignalsResult
- Outcome of sending signals, like ReportResult.
- SignalsSent
- Limenia has the signals. Rules are evaluated afterwards in the background and the answer says nothing about them.
- SorDetails
- Structured statement of reasons, for an own layout or other languages.
- SorGround
- One ground of the statement of reasons.
- StatementOfReasons
- Statement of reasons (Art. 17 DSA) the app shows the affected user.
- SubjectStatus
-
Status of a user (
SubjectStatus), fromGET /v1/subjects/{id}/statusor the eventsubject.status_changed. - SubjectStatusChangedEvent
-
Limenia lifted a suspension that has ended (
subject.status_changed). - SubjectStatusWatcher
- Follows the sanction status of one user, usually the one logged in to the app, e.g. to show a notice when the account is suspended.
- TestPingEvent
-
Test event from the dashboard (
test.ping). - UnknownLimeniaEvent
- An event type this version of the package does not know yet. Acknowledge it and ignore it.
Enums
- AppealOutcome
-
Result of a complaint (
AppealOutcome). - AppealStatus
-
Status of a complaint (
AppealStatus). - AppellantType
-
Who complains against a decision (
AppellantType). - Automation
-
Use of automated means for a decision
(
StatementOfReasonsStructured.automation, API version 0.19.0), see SorDetails.automation. - DeviceAction
-
What Limenia wrote to the device during the check (
DeviceAction). - DeviceCheckEvent
-
What led to a device check (
DeviceCheckEvent). Limenia stores it with the check and passes it on in the context of the system signals. - DeviceCheckStatus
-
Whether Limenia could ask Google or Apple (
DeviceCheckStatus). - DeviceEnvironment
-
DeviceCheck environment of an iOS build (
DeviceCheckRequest.environment). - DeviceFlag
-
Marking of a device by Limenia's bits (
DeviceFlag). - DeviceIntegrityLevel
-
Highest device verdict of Play Integrity (
DeviceIntegrityLevel). - DevicePlatform
-
Platform of a device check (
DevicePlatform). - DeviceRisk
-
A risk of Play Integrity (
DeviceRisk). Later versions of the API add values, see DeviceIntegrity.riskNames. - LegalBasis
- Legal basis of a ground in the statement of reasons.
- ModerationAction
-
Measure of a decision (
ModerationAction). Every decision has exactly one. - NoticeSource
-
What led to a decision (
StatementOfReasonsStructured.noticeSource, API version 0.16.0), see SorDetails.noticeSource. - ReportSource
- Who found the problem. It decides whether the statement of reasons says "following a report" or "based on our own review".
- RestoreScope
-
What a decision ModerationAction.restore lifts (
RestoreScope, API version 0.13.2), see ModerationDecision.restoreScope. - ReviewOutcome
-
Result of a review request (
ReviewOutcome). - ReviewStatus
-
Status of a review request (
ReviewStatus). - SanctionStatus
-
Sanction status of a user in Limenia (
SubjectSanctionStatus).
Functions
-
deviceRequestHash(
String externalUserId, String nonce) → String -
The recommended request hash of a device check:
base64url(SHA-256("limenia:" + externalUserId + ":" + nonce)), without=padding (43 characters), as the spec of the device connector recommends. -
isAllowedMediaUrl(
String raw) → bool -
Whether Limenia accepts
rawas a media URL: at most 2048 characters (Unicode code points, ReportLimits.urlLength), and what the URL check of the backend accepts: https without user info, a public IP address or a host name with a dot that is notlocalhost,*.localor*.internal. In a report or review request a longer URL gets the field codetoo_long, any other rejected oneinvalid. Limenia also checks the address it actually connects to, so a URL can still fail there. -
newDeviceNonce(
) → String - A random nonce for deviceRequestHash: 32 bytes from a secure random generator in base64url without padding (43 characters). Create it in the backend of the app, use it once and keep it only until the check is done.
-
newIdempotencyKey(
[DateTime? now]) → String - A new idempotency key: a ULID (26 characters, sortable by time).
-
parseRetryAfter(
String? value, DateTime now) → Duration? -
Parses
Retry-After(RFC 9110): a delay in seconds or an HTTP date in the preferred format, e.g.Sun, 06 Nov 1994 08:49:37 GMT. A date in the past gives zero. Returns null for a missing or malformed value. -
validateAppeal(
AppealRequest appeal, {String? idempotencyKey}) → List< FieldError> -
Checks
appealagainst the limits of Limenia, like validateReport. An empty list means valid. -
validateDeviceCheck(
DeviceCheckRequest request) → List< FieldError> -
Checks the device check
requestagainst the limits of Limenia, with the field codes the package uses for the other requests. An empty list means valid. -
validateReport(
ReportRequest report, {String? idempotencyKey}) → List< FieldError> -
Checks
reportagainst the limits of Limenia, in the same order and with the same field codes as the backend. An empty list means valid. -
validateReview(
ReviewRequest review, {String? idempotencyKey}) → List< FieldError> -
Checks the review request
reviewagainst the limits of Limenia, with the field codes of the backend. Author and content have the limits of a report. An empty list means valid. -
validateSignals(
SignalsRequest request, {String? idempotencyKey}) → List< FieldError> -
Checks the signals
requestagainst the limits of Limenia, with the field codes the package uses for reports and review requests. An empty list means valid. The fields name the signal by its position, e.g./signals/2/externalUserId.
Exceptions / Errors
- AppealValidationException
- The complaint breaks a limit of Limenia and was not sent.
- DeviceCheckValidationException
- The device check breaks a limit of Limenia and was not sent.
- LimeniaException
- Error answer of Limenia (problem details, RFC 9457), as passed on by the backend of the app.
- ReportValidationException
- The report breaks a limit of Limenia and was not sent.
- ReviewValidationException
- The review request breaks a limit of Limenia and was not sent.
- SignalsValidationException
- The signals break a limit of Limenia and were not sent.