BootstrapResponse.fromJson constructor
- Json j
Parses the wire shape.
Implementation
factory BootstrapResponse.fromJson(Json j) {
final app = mapOf(j, 'app');
return BootstrapResponse(
visitorToken: strOr(j, 'visitor_token'),
visitor: VisitorDto.fromJson(mapOf(j, 'visitor') ?? const {}),
config: SiteConfig.fromJson(mapOf(j, 'config') ?? const {}),
availability: Availability.fromJson(mapOf(j, 'availability') ?? const {}),
conversation: mapOf(j, 'conversation') == null ? null : ConversationSummary.fromJson(mapOf(j, 'conversation')!),
timeline: [for (final i in mapListOf(j, 'timeline')) TimelineItem.fromJson(i)],
timelineHasMore: j['timeline_has_more'] is bool ? j['timeline_has_more']! as bool : null,
wsUrl: strOr(j, 'ws_url'),
protocolVersion: intOr(j, 'protocol_version', 1),
appId: app == null ? null : str(app, 'id'),
appPlatform: app == null ? null : str(app, 'platform'),
);
}