Skip to content

Models: push and notices

Devices, pushes and the inbox of notices, from package:crm_sdk/wire.dart.

import 'package:crm_sdk/wire.dart';
NameWhat it is
CrmConsentWhat PurrCRM keeps of the guest’s choices about its pushes.
CrmConsentBodyWhat the guest chose in the host’s own screens about PurrCRM’s pushes.
CrmDeviceBodyThe device the host’s Firebase gave a registration token for, which the package registers on every start and whenever the token changes.
CrmExportDeviceOne device the guest registered for pushes, in their export, without its token.
CrmExportNoticeOne notice in the guest’s inbox, in their export.
CrmForgetDeviceBodyThe token the package registered, forgotten as the guest signs out so that the next guest on the phone is not pushed the last one’s.
CrmNoticePageA page of the guest’s inbox, newest first.
CrmNoticesReadBodyThe notices the guest has seen, or all of them.
crmDefaultNoticePageA page of the inbox by default, and the most one page may be.
crmMaxNoticePage
crmMaxNoticesReadThe most notices one read may name.
crmMaxPushTokenBytesThe longest registration token PurrCRM keeps.
class CrmConsent

What PurrCRM keeps of the guest’s choices about its pushes.

factory CrmConsent.fromJson(Map<String, Object?> json)
const CrmConsent({bool offersByPush = false})
final bool offersByPush

A marketing push goes only to a guest who agreed.

class CrmConsentBody

What the guest chose in the host’s own screens about PurrCRM’s pushes. Only what is sent changes.

factory CrmConsentBody.fromJson(Map<String, Object?> json)
const CrmConsentBody({bool? offersByPush})
final bool? offersByPush

The guest agreeing to offers by push, or null to leave it.

Map<String, Object?> toJson()
class CrmDeviceBody

The device the host’s Firebase gave a registration token for, which the package registers on every start and whenever the token changes.

factory CrmDeviceBody.fromJson(Map<String, Object?> json)
const CrmDeviceBody({required String token, required CrmPushPlatform platform, String appVersion = '', String locale = ''})
final String appVersion

What the app is and speaks, for staff to tell devices apart.

final String locale
final CrmPushPlatform platform
final String token
Map<String, Object?> toJson()
class CrmExportDevice

One device the guest registered for pushes, in their export, without its token.

factory CrmExportDevice.fromJson(Map<String, Object?> json)
const CrmExportDevice({required CrmPushPlatform platform, required DateTime createdAt, required DateTime lastSeenAt, String appVersion = '', String locale = ''})
final String appVersion
final DateTime createdAt
final DateTime lastSeenAt
final String locale
final CrmPushPlatform platform
class CrmExportNotice

One notice in the guest’s inbox, in their export.

factory CrmExportNotice.fromJson(Map<String, Object?> json)
const CrmExportNotice({required String type, required String title, required String body, required DateTime createdAt, String link = '', DateTime? readAt})
final String body
final DateTime createdAt
final String link
final DateTime? readAt
final String title
final String type
class CrmForgetDeviceBody

The token the package registered, forgotten as the guest signs out so that the next guest on the phone is not pushed the last one’s.

factory CrmForgetDeviceBody.fromJson(Map<String, Object?> json)
const CrmForgetDeviceBody({required String token})
final String token
Map<String, Object?> toJson()
class CrmNoticePage

A page of the guest’s inbox, newest first.

factory CrmNoticePage.fromJson(Map<String, Object?> json)
const CrmNoticePage({List<CrmNotice> notices = const <CrmNotice>[], int unread = 0, String nextBefore = ''})
final String nextBefore

The notice to ask for older ones before; empty on the last page.

final List<CrmNotice> notices
final int unread

The whole inbox’s unread count, not this page’s: the bell’s number.

class CrmNoticesReadBody

The notices the guest has seen, or all of them.

factory CrmNoticesReadBody.fromJson(Map<String, Object?> json)
const CrmNoticesReadBody({List<String> ids = const <String>[], bool all = false})
final bool all
final List<String> ids
Map<String, Object?> toJson()
const int crmDefaultNoticePage

A page of the inbox by default, and the most one page may be. The Go constants are DefaultNoticePage and MaxNoticePage.

const int crmMaxNoticePage

No description.

const int crmMaxNoticesRead

The most notices one read may name. The Go constant is MaxNoticesRead.

const int crmMaxPushTokenBytes

The longest registration token PurrCRM keeps. The Go constant is MaxPushTokenBytes.