Models: events, content and the app
Events, content blocks and the app’s public face, from package:crm_sdk/wire.dart.
import 'package:crm_sdk/wire.dart';| Name | What it is |
|---|---|
ContentBlock | One block of content. |
CrmPublicLinkApp | An app’s public face for its links: what the page a link lands on without the app shows. |
CrmPublicRatingBody | Whether a public help article helped a reader of the web’s help center (POST /public/v1/help/articles/{slug}/rating), who has no account. |
EventBody | One thing the guest did in the product. |
EventRejected | One event of a batch PurrCRM refused, by its place in the batch. |
EventsAccepted | The answer to a batch. |
EventsBody | A batch of events, oldest first, with what every event in it shares. |
ExportAttribute | One attribute and its value, in the guest’s export. |
ExportCollected | One thing the help bot kept from a conversation. |
ExportContact | What the PurrCRM service keeps about the guest, in their export. |
ExportEvent | One event recorded about the guest, in their export. |
ExportNote | One note staff wrote about the guest, in their export. |
ExportWorkflowRun | One run of a workflow the guest was in. |
ListItem | One item of a list. |
Span | A run of text with one style. |
crmAppKeyHeader | The header a product’s app key travels in on every request (CrmConfig.appKey): which of PurrCRM’s apps the guest is in. |
crmSdkVersionHeader | The header the package’s version travels in on every request, so that PurrCRM knows which SDK a guest is on. |
crmTestAppKeyPrefix | What a test app’s public key begins with: the key of a live app’s test test app, which a staging build sends and whose data is kept apart from the live app’s. |
crmUserIdHeader | The header a guest’s id travels in instead of a token, for an app that takes unverified guests. |
maxEventAge | How old an event may be when it arrives. |
maxEventBatch | The most events one batch carries. |
maxEventPropRunes | The longest a prop’s value may be. |
maxEventProps | The most props one event carries. |
ContentBlock
Section titled “ContentBlock”class ContentBlockOne block of content. Only the fields its type names are set.
The formatting fields (size to style) are a carousel’s and a post’s
alone: PurrCRM refuses them anywhere else. Each is
optional, and empty (or unknown) is the renderer’s default for where the
block is, which carousel_style.json gives.
Members of ContentBlock
Section titled “Members of ContentBlock”ContentBlock.fromJson()
Section titled “ContentBlock.fromJson()”factory ContentBlock.fromJson(Map<String, Object?> json)ContentBlock()
Section titled “ContentBlock()”const ContentBlock({required BlockType type, int level = 0, List<Span> spans = const <Span>[], List<ListItem> items = const <ListItem>[], String imageUrl = '', String alt = '', String label = '', String link = '', String size = '', String color = '', ContentAlign align = ContentAlign.unknown, TextWeight weight = TextWeight.unknown, CalloutTone tone = CalloutTone.unknown, String emoji = '', ImageAspect aspect = ImageAspect.unknown, ImageFit fit = ImageFit.unknown, ImageShape shape = ImageShape.unknown, ContentButtonStyle style = ContentButtonStyle.unknown})final ContentAlign alignA text block’s or an emoji’s alignment; unknown for the screen’s.
final String altWhat a picture shows, for a guest who cannot see it.
aspect
Section titled “aspect”final ImageAspect aspectA picture’s aspect, fit and shape, as a carousel’s hero’s.
final String colorA text block’s colour, or a callout’s tint: a ColorToken’s word or
a fixed #rrggbb; empty for the screen’s text colour.
final String emojiAn emoji block’s emoji, or the one before a callout’s words.
final ImageFit fitimageUrl
Section titled “imageUrl”final String imageUrlfinal List<ListItem> itemsfinal String labelfinal int levelA heading’s level, 1 to 3.
final String linkWhere a button or a picture goes: a path in the product, opened only when its allow-list names it, or an https URL, opened in the browser.
final ImageShape shapefinal String sizeA word of the block’s own: a TextSize for a paragraph, a heading or
a list (textSize), an ImageSize for a picture (imageSize), a
SpacerSize for a spacer (spacerSize). Empty for the default.
final List<Span> spansfinal ContentButtonStyle styleA button’s style; unknown is primary.
final CalloutTone toneA callout’s tint when it has no color; unknown is info.
final BlockType typeweight
Section titled “weight”final TextWeight weightA paragraph’s or a heading’s weight; unknown for the default.
imageSize
Section titled “imageSize”ImageSize get imageSizesize as a picture’s.
spacerSize
Section titled “spacerSize”SpacerSize get spacerSizesize as a spacer’s.
textSize
Section titled “textSize”TextSize get textSizesize as a text block’s.
CrmPublicLinkApp
Section titled “CrmPublicLinkApp”class CrmPublicLinkAppAn app’s public face for its links: what the page a link lands on without the app shows. The package reads none of it; it is here so that every fixture of the CRM’s contract has its model.
Members of CrmPublicLinkApp
Section titled “Members of CrmPublicLinkApp”CrmPublicLinkApp.fromJson()
Section titled “CrmPublicLinkApp.fromJson()”factory CrmPublicLinkApp.fromJson(Map<String, Object?> json)CrmPublicLinkApp()
Section titled “CrmPublicLinkApp()”const CrmPublicLinkApp({required String key, required String name, required CrmPublicBrand brand, String linkBase = '', String appStoreUrl = '', String playStoreUrl = ''})appStoreUrl
Section titled “appStoreUrl”final String appStoreUrlfinal CrmPublicBrand brandfinal String keylinkBase
Section titled “linkBase”final String linkBaseWhere the app’s links are (CrmPublicApp.linkBase).
final String nameplayStoreUrl
Section titled “playStoreUrl”final String playStoreUrlCrmPublicRatingBody
Section titled “CrmPublicRatingBody”class CrmPublicRatingBodyWhether a public help article helped a reader of the web’s help center
(POST /public/v1/help/articles/{slug}/rating), who has no account. The
web’s, not the package’s: an app’s guest rates with ArticleRatingBody.
Members of CrmPublicRatingBody
Section titled “Members of CrmPublicRatingBody”CrmPublicRatingBody.fromJson()
Section titled “CrmPublicRatingBody.fromJson()”factory CrmPublicRatingBody.fromJson(Map<String, Object?> json)CrmPublicRatingBody()
Section titled “CrmPublicRatingBody()”const CrmPublicRatingBody({required bool helpful, required String visitor})helpful
Section titled “helpful”final bool helpfulvisitor
Section titled “visitor”final String visitorEventBody
Section titled “EventBody”class EventBodyOne thing the guest did in the product.
Members of EventBody
Section titled “Members of EventBody”EventBody.fromJson()
Section titled “EventBody.fromJson()”factory EventBody.fromJson(Map<String, Object?> json)EventBody()
Section titled “EventBody()”const EventBody({required String id, required String name, required DateTime occurredAt, Map<String, String> props = const <String, String>{}})final String idA UUID drawn when it happened, so a batch sent twice is kept once.
final String nameThe event’s name as the word PurrCRM knows it by: a CrmEvent’s, or one
the product declared. PurrCRM refuses a batch that names one it does not
know, so the tracker sends no other.
occurredAt
Section titled “occurredAt”final DateTime occurredAttoJson
Section titled “toJson”Map<String, Object?> toJson()EventRejected
Section titled “EventRejected”class EventRejectedOne event of a batch PurrCRM refused, by its place in the batch.
Members of EventRejected
Section titled “Members of EventRejected”EventRejected.fromJson()
Section titled “EventRejected.fromJson()”factory EventRejected.fromJson(Map<String, Object?> json)EventRejected()
Section titled “EventRejected()”const EventRejected({required int index, required String id, required String reason})final String idfinal int indexreason
Section titled “reason”final String reasontoJson
Section titled “toJson”Map<String, Object?> toJson()EventsAccepted
Section titled “EventsAccepted”class EventsAcceptedThe answer to a batch.
Members of EventsAccepted
Section titled “Members of EventsAccepted”EventsAccepted.fromJson()
Section titled “EventsAccepted.fromJson()”factory EventsAccepted.fromJson(Map<String, Object?> json)EventsAccepted()
Section titled “EventsAccepted()”const EventsAccepted({required int accepted, List<EventRejected> rejected = const []})accepted
Section titled “accepted”final int acceptedHow many were kept: fewer than were sent when some were sent before, were too old, were refused, or the guest has turned product events off.
rejected
Section titled “rejected”final List<EventRejected> rejectedThe events PurrCRM refused, each alone: a name the app does not define (the app defines its own events on PurrCRM’s site). The rest of the batch was kept.
EventsBody
Section titled “EventsBody”class EventsBodyA batch of events, oldest first, with what every event in it shares.
Members of EventsBody
Section titled “Members of EventsBody”EventsBody.fromJson()
Section titled “EventsBody.fromJson()”factory EventsBody.fromJson(Map<String, Object?> json)EventsBody()
Section titled “EventsBody()”const EventsBody({required List<EventBody> events, required String appVersion, required CrmPlatform platform, String timeZone = '', DateTime? sentAt})appVersion
Section titled “appVersion”final String appVersionevents
Section titled “events”final List<EventBody> eventsplatform
Section titled “platform”final CrmPlatform platformsentAt
Section titled “sentAt”final DateTime? sentAtNull leaves it out.
timeZone
Section titled “timeZone”final String timeZoneThe phone’s IANA zone name, for the guest’s quiet hours; empty when the phone does not say.
toJson
Section titled “toJson”Map<String, Object?> toJson()ExportAttribute
Section titled “ExportAttribute”class ExportAttributeOne attribute and its value, in the guest’s export.
Members of ExportAttribute
Section titled “Members of ExportAttribute”ExportAttribute.fromJson()
Section titled “ExportAttribute.fromJson()”factory ExportAttribute.fromJson(Map<String, Object?> json)ExportAttribute()
Section titled “ExportAttribute()”const ExportAttribute({required String name, required String value})final String namefinal String valueExportCollected
Section titled “ExportCollected”class ExportCollectedOne thing the help bot kept from a conversation.
Members of ExportCollected
Section titled “Members of ExportCollected”ExportCollected.fromJson()
Section titled “ExportCollected.fromJson()”factory ExportCollected.fromJson(Map<String, Object?> json)ExportCollected()
Section titled “ExportCollected()”const ExportCollected({required String conversationId, required String key, required String value})conversationId
Section titled “conversationId”final String conversationIdfinal String keyWhat it is: order_ref, email, or the name staff gave it.
final String valueExportContact
Section titled “ExportContact”class ExportContactWhat the PurrCRM service keeps about the guest, in their export.
Members of ExportContact
Section titled “Members of ExportContact”ExportContact.fromJson()
Section titled “ExportContact.fromJson()”factory ExportContact.fromJson(Map<String, Object?> json)ExportContact()
Section titled “ExportContact()”const ExportContact({List<ExportAttribute> attributes = const <ExportAttribute>[], List<String> tags = const <String>[], List<ExportNote> notes = const <ExportNote>[], List<ExportEvent> events = const <ExportEvent>[], bool eventsTruncated = false, List<ExportConversation> conversations = const <ExportConversation>[], List<ExportTicket> tickets = const <ExportTicket>[], List<ExportArticleRating> articleRatings = const <ExportArticleRating>[], List<ExportReceipt> receipts = const <ExportReceipt>[], List<ExportSurveyResponse> surveyResponses = const <ExportSurveyResponse>[], List<ExportWorkflowRun> workflows = const <ExportWorkflowRun>[], List<ExportCollected> collected = const <ExportCollected>[], ExportTestPhone? testPhone, List<ExportTestSend> testSends = const <ExportTestSend>[], List<CrmExportDevice> devices = const <CrmExportDevice>[], List<CrmExportNotice> notices = const <CrmExportNotice>[], List<CrmExportSubscription> subscriptions = const <CrmExportSubscription>[], List<CrmExportConsentChange> consentHistory = const <CrmExportConsentChange>[]})articleRatings
Section titled “articleRatings”final List<ExportArticleRating> articleRatingsattributes
Section titled “attributes”final List<ExportAttribute> attributesThe guest’s attributes by name, each value as a string.
collected
Section titled “collected”final List<ExportCollected> collectedconsentHistory
Section titled “consentHistory”final List<CrmExportConsentChange> consentHistoryconversations
Section titled “conversations”final List<ExportConversation> conversationsThe guest’s conversations in the messenger, their tickets, and what they said about help articles; empty from a PurrCRM older than them.
devices
Section titled “devices”final List<CrmExportDevice> devicesThe devices the guest registered for PurrCRM’s pushes, without their tokens, and the inbox of notices it keeps; empty from a PurrCRM older than them.
events
Section titled “events”final List<ExportEvent> eventsThe events recorded about the guest, newest first.
eventsTruncated
Section titled “eventsTruncated”final bool eventsTruncatedOnly the newest events are here: there were more.
final List<ExportNote> notesWhat staff wrote about the guest.
notices
Section titled “notices”final List<CrmExportNotice> noticesreceipts
Section titled “receipts”final List<ExportReceipt> receiptsThe messages staff sent or showed the guest, and their answers to surveys; empty from a PurrCRM older than them.
subscriptions
Section titled “subscriptions”final List<CrmExportSubscription> subscriptionsThe guest’s choices about the app’s topics, and every change of them and of their channels’ own switches; empty from a PurrCRM older than topics.
surveyResponses
Section titled “surveyResponses”final List<ExportSurveyResponse> surveyResponsesfinal List<String> tagsThe names of the tags staff put on the guest.
testPhone
Section titled “testPhone”final ExportTestPhone? testPhoneThe guest’s account being a test phone, and the tests staff sent it; null and empty when it is not one, or from a PurrCRM older than them.
testSends
Section titled “testSends”final List<ExportTestSend> testSendstickets
Section titled “tickets”final List<ExportTicket> ticketsworkflows
Section titled “workflows”final List<ExportWorkflowRun> workflowsThe runs of workflows the guest was in, and what the help bot kept from their conversations; empty from a PurrCRM older than them.
ExportEvent
Section titled “ExportEvent”class ExportEventOne event recorded about the guest, in their export.
Members of ExportEvent
Section titled “Members of ExportEvent”ExportEvent.fromJson()
Section titled “ExportEvent.fromJson()”factory ExportEvent.fromJson(Map<String, Object?> json)ExportEvent()
Section titled “ExportEvent()”const ExportEvent({required String name, required DateTime occurredAt, Map<String, String> props = const <String, String>{}})final String nameAn app event’s name or a server event’s, kept as the word: the guest reads it, and an event the package does not know is still theirs.
occurredAt
Section titled “occurredAt”final DateTime occurredAtExportNote
Section titled “ExportNote”class ExportNoteOne note staff wrote about the guest, in their export.
Members of ExportNote
Section titled “Members of ExportNote”ExportNote.fromJson()
Section titled “ExportNote.fromJson()”factory ExportNote.fromJson(Map<String, Object?> json)ExportNote()
Section titled “ExportNote()”const ExportNote({required String body, required DateTime createdAt})final String bodycreatedAt
Section titled “createdAt”final DateTime createdAtExportWorkflowRun
Section titled “ExportWorkflowRun”class ExportWorkflowRunOne run of a workflow the guest was in.
Members of ExportWorkflowRun
Section titled “Members of ExportWorkflowRun”ExportWorkflowRun.fromJson()
Section titled “ExportWorkflowRun.fromJson()”factory ExportWorkflowRun.fromJson(Map<String, Object?> json)ExportWorkflowRun()
Section titled “ExportWorkflowRun()”const ExportWorkflowRun({required String workflow, required String state, required DateTime startedAt, String outcome = '', DateTime? endedAt})endedAt
Section titled “endedAt”final DateTime? endedAtoutcome
Section titled “outcome”final String outcomeHow it ended, once it has.
startedAt
Section titled “startedAt”final DateTime startedAtfinal String stateWhere the run is, as PurrCRM says it (active, waiting, parked, ended).
workflow
Section titled “workflow”final String workflowListItem
Section titled “ListItem”class ListItemOne item of a list.
Members of ListItem
Section titled “Members of ListItem”ListItem.fromJson()
Section titled “ListItem.fromJson()”factory ListItem.fromJson(Map<String, Object?> json)ListItem()
Section titled “ListItem()”const ListItem({required List<Span> spans})final List<Span> spansclass SpanA run of text with one style.
Members of Span
Section titled “Members of Span”Span.fromJson()
Section titled “Span.fromJson()”factory Span.fromJson(Map<String, Object?> json)Span()
Section titled “Span()”const Span({required String text, bool bold = false, bool italic = false, String link = '', bool underline = false, bool strike = false, bool highlight = false, String color = ''})final bool boldfinal String colorhighlight
Section titled “highlight”final bool highlightitalic
Section titled “italic”final bool italicfinal String linkMakes the run a link, as ContentBlock.link.
strike
Section titled “strike”final bool strikefinal String textunderline
Section titled “underline”final bool underlineThe formatting marks, a carousel’s and a post’s alone: underlined,
struck through, on a wash of the accent, and the run’s own colour (a
ColorToken’s word or #rrggbb) over the block’s.
crmAppKeyHeader
Section titled “crmAppKeyHeader”const String crmAppKeyHeaderThe header a product’s app key travels in on every request (CrmConfig.appKey): which of PurrCRM’s apps the guest is in.
crmSdkVersionHeader
Section titled “crmSdkVersionHeader”const String crmSdkVersionHeaderThe header the package’s version travels in on every request, so that PurrCRM knows which SDK a guest is on.
crmTestAppKeyPrefix
Section titled “crmTestAppKeyPrefix”const String crmTestAppKeyPrefixWhat a test app’s public key begins with: the key of a live app’s test test app, which a staging build sends and whose data is kept apart from the live app’s. A live app’s key never begins with it, so the key alone says which mode a build is in, before PurrCRM answers (CrmPublicApp.mode).
crmUserIdHeader
Section titled “crmUserIdHeader”const String crmUserIdHeaderThe header a guest’s id travels in instead of a token, for an app that takes unverified guests.
maxEventAge
Section titled “maxEventAge”const Duration maxEventAgeHow old an event may be when it arrives. The Go constant is MaxEventAge: the tracker drops what it has kept for longer than this rather than send it to be dropped.
maxEventBatch
Section titled “maxEventBatch”const int maxEventBatchThe most events one batch carries. The Go constant is MaxEventBatch.
maxEventPropRunes
Section titled “maxEventPropRunes”const int maxEventPropRunesThe longest a prop’s value may be. The Go constant is MaxEventPropRunes.
maxEventProps
Section titled “maxEventProps”const int maxEventPropsThe most props one event carries. The Go constant is MaxEventProps.