The Talk room list crashed for a new account because the server omits
lastMessage for rooms without a visible message and the model required it.
Beyond that single field, a review of the Talk models against the OpenAPI
spec of the installed version (23.0.8) found the same crash class in several
places: closed enums over open server values (inCall bitmask, rich-object
types, actor and message types), a deleted parent sent as {id, deleted},
and the autocomplete status arriving as an object.
- json_serializable `checked: true`: decode errors now name class and field
- lists (rooms, messages, participants, autocomplete) decode per entry;
a malformed entry is skipped and reported via ClientErrorReporter
- unknownEnumValue fallbacks for all response enums of Talk and breakers
- lastMessage nullable; inCall as bitmask; deleted parent placeholder;
autocomplete status object/string; fixed shareWithDisplayNameUnique key
- GetRoomParams no longer sends null query parameters
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HrepDTL4qDe35TuS29sLW3
165 lines
5.9 KiB
Dart
165 lines
5.9 KiB
Dart
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
part of 'get_chat_response.dart';
|
|
|
|
// **************************************************************************
|
|
// JsonSerializableGenerator
|
|
// **************************************************************************
|
|
|
|
GetChatResponse _$GetChatResponseFromJson(Map<String, dynamic> json) =>
|
|
$checkedCreate('GetChatResponse', json, ($checkedConvert) {
|
|
final val = GetChatResponse(
|
|
$checkedConvert('data', (v) => _messagesFromJson(v)),
|
|
);
|
|
$checkedConvert(
|
|
'headers',
|
|
(v) => val.headers = (v as Map<String, dynamic>?)?.map(
|
|
(k, e) => MapEntry(k, e as String),
|
|
),
|
|
);
|
|
return val;
|
|
});
|
|
|
|
Map<String, dynamic> _$GetChatResponseToJson(GetChatResponse instance) =>
|
|
<String, dynamic>{
|
|
'headers': ?instance.headers,
|
|
'data': instance.data.map((e) => e.toJson()).toList(),
|
|
};
|
|
|
|
GetChatResponseObject _$GetChatResponseObjectFromJson(
|
|
Map<String, dynamic> json,
|
|
) => $checkedCreate('GetChatResponseObject', json, ($checkedConvert) {
|
|
final val = GetChatResponseObject(
|
|
$checkedConvert('id', (v) => (v as num).toInt()),
|
|
$checkedConvert('token', (v) => v as String),
|
|
$checkedConvert(
|
|
'actorType',
|
|
(v) => $enumDecode(
|
|
_$GetRoomResponseObjectMessageActorTypeEnumMap,
|
|
v,
|
|
unknownValue: GetRoomResponseObjectMessageActorType.unknown,
|
|
),
|
|
),
|
|
$checkedConvert('actorId', (v) => v as String),
|
|
$checkedConvert('actorDisplayName', (v) => v as String),
|
|
$checkedConvert('timestamp', (v) => (v as num).toInt()),
|
|
$checkedConvert('systemMessage', (v) => v as String),
|
|
$checkedConvert(
|
|
'messageType',
|
|
(v) => $enumDecode(
|
|
_$GetRoomResponseObjectMessageTypeEnumMap,
|
|
v,
|
|
unknownValue: GetRoomResponseObjectMessageType.unknown,
|
|
),
|
|
),
|
|
$checkedConvert('isReplyable', (v) => v as bool),
|
|
$checkedConvert('referenceId', (v) => v as String),
|
|
$checkedConvert('message', (v) => v as String),
|
|
$checkedConvert('messageParameters', (v) => _fromJson(v)),
|
|
$checkedConvert(
|
|
'reactions',
|
|
(v) => (v as Map<String, dynamic>?)?.map(
|
|
(k, e) => MapEntry(k, (e as num).toInt()),
|
|
),
|
|
),
|
|
$checkedConvert(
|
|
'reactionsSelf',
|
|
(v) => (v as List<dynamic>?)?.map((e) => e as String).toList(),
|
|
),
|
|
$checkedConvert('parent', (v) => _parentFromJson(v)),
|
|
$checkedConvert('markdown', (v) => v as bool? ?? false),
|
|
);
|
|
return val;
|
|
});
|
|
|
|
Map<String, dynamic> _$GetChatResponseObjectToJson(
|
|
GetChatResponseObject instance,
|
|
) => <String, dynamic>{
|
|
'id': instance.id,
|
|
'token': instance.token,
|
|
'actorType':
|
|
_$GetRoomResponseObjectMessageActorTypeEnumMap[instance.actorType]!,
|
|
'actorId': instance.actorId,
|
|
'actorDisplayName': instance.actorDisplayName,
|
|
'timestamp': instance.timestamp,
|
|
'systemMessage': instance.systemMessage,
|
|
'messageType':
|
|
_$GetRoomResponseObjectMessageTypeEnumMap[instance.messageType]!,
|
|
'isReplyable': instance.isReplyable,
|
|
'referenceId': instance.referenceId,
|
|
'message': instance.message,
|
|
'reactions': instance.reactions,
|
|
'reactionsSelf': instance.reactionsSelf,
|
|
'messageParameters': instance.messageParameters?.map(
|
|
(k, e) => MapEntry(k, e.toJson()),
|
|
),
|
|
'parent': instance.parent?.toJson(),
|
|
'markdown': instance.markdown,
|
|
};
|
|
|
|
const _$GetRoomResponseObjectMessageActorTypeEnumMap = {
|
|
GetRoomResponseObjectMessageActorType.deletedUsers: 'deleted_users',
|
|
GetRoomResponseObjectMessageActorType.user: 'users',
|
|
GetRoomResponseObjectMessageActorType.guest: 'guests',
|
|
GetRoomResponseObjectMessageActorType.bot: 'bots',
|
|
GetRoomResponseObjectMessageActorType.bridge: 'bridged',
|
|
GetRoomResponseObjectMessageActorType.group: 'groups',
|
|
GetRoomResponseObjectMessageActorType.email: 'emails',
|
|
GetRoomResponseObjectMessageActorType.circle: 'circles',
|
|
GetRoomResponseObjectMessageActorType.federatedUser: 'federated_users',
|
|
GetRoomResponseObjectMessageActorType.phone: 'phones',
|
|
GetRoomResponseObjectMessageActorType.unknown: 'unknown',
|
|
};
|
|
|
|
const _$GetRoomResponseObjectMessageTypeEnumMap = {
|
|
GetRoomResponseObjectMessageType.comment: 'comment',
|
|
GetRoomResponseObjectMessageType.voiceMessage: 'voice-message',
|
|
GetRoomResponseObjectMessageType.deletedComment: 'comment_deleted',
|
|
GetRoomResponseObjectMessageType.system: 'system',
|
|
GetRoomResponseObjectMessageType.command: 'command',
|
|
GetRoomResponseObjectMessageType.unknown: 'unknown',
|
|
};
|
|
|
|
RichObjectString _$RichObjectStringFromJson(Map<String, dynamic> json) =>
|
|
$checkedCreate('RichObjectString', json, ($checkedConvert) {
|
|
final val = RichObjectString(
|
|
$checkedConvert(
|
|
'type',
|
|
(v) => $enumDecode(
|
|
_$RichObjectStringObjectTypeEnumMap,
|
|
v,
|
|
unknownValue: RichObjectStringObjectType.unknown,
|
|
),
|
|
),
|
|
$checkedConvert('id', (v) => v as String),
|
|
$checkedConvert('name', (v) => v as String),
|
|
$checkedConvert('path', (v) => v as String?),
|
|
$checkedConvert('link', (v) => v as String?),
|
|
);
|
|
return val;
|
|
});
|
|
|
|
Map<String, dynamic> _$RichObjectStringToJson(RichObjectString instance) =>
|
|
<String, dynamic>{
|
|
'type': _$RichObjectStringObjectTypeEnumMap[instance.type]!,
|
|
'id': instance.id,
|
|
'name': instance.name,
|
|
'path': instance.path,
|
|
'link': instance.link,
|
|
};
|
|
|
|
const _$RichObjectStringObjectTypeEnumMap = {
|
|
RichObjectStringObjectType.user: 'user',
|
|
RichObjectStringObjectType.group: 'group',
|
|
RichObjectStringObjectType.file: 'file',
|
|
RichObjectStringObjectType.guest: 'guest',
|
|
RichObjectStringObjectType.highlight: 'highlight',
|
|
RichObjectStringObjectType.talkPoll: 'talk-poll',
|
|
RichObjectStringObjectType.geoLocation: 'geo-location',
|
|
RichObjectStringObjectType.call: 'call',
|
|
RichObjectStringObjectType.userGroup: 'user-group',
|
|
RichObjectStringObjectType.circle: 'circle',
|
|
RichObjectStringObjectType.email: 'email',
|
|
RichObjectStringObjectType.unknown: 'unknown',
|
|
};
|