Add emote models

This commit is contained in:
Tommy Chow 2021-08-18 13:23:13 -04:00
parent 7cec28d839
commit c4eb59f3a5
4 changed files with 514 additions and 0 deletions

118
lib/models/emotes.dart Normal file
View file

@ -0,0 +1,118 @@
// Twitch Emotes
import 'package:json_annotation/json_annotation.dart';
part 'emotes.g.dart';
// Twitch Emotes
@JsonSerializable(createToJson: false, fieldRename: FieldRename.snake)
class ImagesTwitch {
final String url1x;
final String url2x;
final String url4x;
ImagesTwitch(this.url1x, this.url2x, this.url4x);
factory ImagesTwitch.fromJson(Map<String, dynamic> json) => _$ImagesTwitchFromJson(json);
}
@JsonSerializable(createToJson: false)
class EmoteTwitch {
final String id;
final String name;
final ImagesTwitch images;
final String? tier;
final String? emoteType;
final String? emoteSetId;
EmoteTwitch(this.id, this.name, this.images, this.tier, this.emoteType, this.emoteSetId);
factory EmoteTwitch.fromJson(Map<String, dynamic> json) => _$EmoteTwitchFromJson(json);
}
// BTTV Emotes
@JsonSerializable(createToJson: false)
class EmoteBTTVGlobal {
final String id;
final String code;
final String imageType;
final String userId;
EmoteBTTVGlobal(this.id, this.code, this.imageType, this.userId);
factory EmoteBTTVGlobal.fromJson(Map<String, dynamic> json) => _$EmoteBTTVGlobalFromJson(json);
}
@JsonSerializable(createToJson: false)
class UserBTTV {
final String id;
final String name;
final String displayName;
final String providerId;
UserBTTV(this.id, this.name, this.displayName, this.providerId);
factory UserBTTV.fromJson(Map<String, dynamic> json) => _$UserBTTVFromJson(json);
}
@JsonSerializable(createToJson: false)
class EmoteBTTVShared {
final String id;
final String code;
final String imageType;
final UserBTTV user;
EmoteBTTVShared(this.id, this.code, this.imageType, this.user);
factory EmoteBTTVShared.fromJson(Map<String, dynamic> json) => _$EmoteBTTVSharedFromJson(json);
}
@JsonSerializable(createToJson: false)
class EmoteBTTVChannel {
final String id;
final List<String> bots;
final List<EmoteBTTVGlobal> channelEmotes;
final List<EmoteBTTVShared> sharedEmotes;
EmoteBTTVChannel(this.id, this.bots, this.channelEmotes, this.sharedEmotes);
factory EmoteBTTVChannel.fromJson(Map<String, dynamic> json) => _$EmoteBTTVChannelFromJson(json);
}
// FFZ Emotes
@JsonSerializable(createToJson: false)
class UserFFZ {
final int id;
final String name;
final String displayName;
UserFFZ(this.id, this.name, this.displayName);
factory UserFFZ.fromJson(Map<String, dynamic> json) => _$UserFFZFromJson(json);
}
@JsonSerializable(createToJson: false)
class ImagesFFZ {
@JsonKey(name: '1x')
final String url1x;
@JsonKey(name: '2x')
final String? url2x;
@JsonKey(name: '4x')
final String? url4x;
ImagesFFZ(this.url1x, this.url2x, this.url4x);
factory ImagesFFZ.fromJson(Map<String, dynamic> json) => _$ImagesFFZFromJson(json);
}
@JsonSerializable(createToJson: false)
class EmoteFFZ {
final int id;
final UserFFZ user;
final String code;
final ImagesFFZ images;
final String imageType;
EmoteFFZ(this.id, this.user, this.code, this.images, this.imageType);
factory EmoteFFZ.fromJson(Map<String, dynamic> json) => _$EmoteFFZFromJson(json);
}

92
lib/models/emotes.g.dart Normal file
View file

@ -0,0 +1,92 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'emotes.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
ImagesTwitch _$ImagesTwitchFromJson(Map<String, dynamic> json) {
return ImagesTwitch(
json['url1x'] as String,
json['url2x'] as String,
json['url4x'] as String,
);
}
EmoteTwitch _$EmoteTwitchFromJson(Map<String, dynamic> json) {
return EmoteTwitch(
json['id'] as String,
json['name'] as String,
ImagesTwitch.fromJson(json['images'] as Map<String, dynamic>),
json['tier'] as String?,
json['emoteType'] as String?,
json['emoteSetId'] as String?,
);
}
EmoteBTTVGlobal _$EmoteBTTVGlobalFromJson(Map<String, dynamic> json) {
return EmoteBTTVGlobal(
json['id'] as String,
json['code'] as String,
json['imageType'] as String,
json['userId'] as String,
);
}
UserBTTV _$UserBTTVFromJson(Map<String, dynamic> json) {
return UserBTTV(
json['id'] as String,
json['name'] as String,
json['displayName'] as String,
json['providerId'] as String,
);
}
EmoteBTTVShared _$EmoteBTTVSharedFromJson(Map<String, dynamic> json) {
return EmoteBTTVShared(
json['id'] as String,
json['code'] as String,
json['imageType'] as String,
UserBTTV.fromJson(json['user'] as Map<String, dynamic>),
);
}
EmoteBTTVChannel _$EmoteBTTVChannelFromJson(Map<String, dynamic> json) {
return EmoteBTTVChannel(
json['id'] as String,
(json['bots'] as List<dynamic>).map((e) => e as String).toList(),
(json['channelEmotes'] as List<dynamic>)
.map((e) => EmoteBTTVGlobal.fromJson(e as Map<String, dynamic>))
.toList(),
(json['sharedEmotes'] as List<dynamic>)
.map((e) => EmoteBTTVShared.fromJson(e as Map<String, dynamic>))
.toList(),
);
}
UserFFZ _$UserFFZFromJson(Map<String, dynamic> json) {
return UserFFZ(
json['id'] as int,
json['name'] as String,
json['displayName'] as String,
);
}
ImagesFFZ _$ImagesFFZFromJson(Map<String, dynamic> json) {
return ImagesFFZ(
json['1x'] as String,
json['2x'] as String?,
json['4x'] as String?,
);
}
EmoteFFZ _$EmoteFFZFromJson(Map<String, dynamic> json) {
return EmoteFFZ(
json['id'] as int,
UserFFZ.fromJson(json['user'] as Map<String, dynamic>),
json['code'] as String,
ImagesFFZ.fromJson(json['images'] as Map<String, dynamic>),
json['imageType'] as String,
);
}

View file

@ -1,6 +1,27 @@
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
_fe_analyzer_shared:
dependency: transitive
description:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "22.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.1"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
async: async:
dependency: transitive dependency: transitive
description: description:
@ -15,6 +36,62 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
build:
dependency: transitive
description:
name: build
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
build_config:
dependency: transitive
description:
name: build_config
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
build_daemon:
dependency: transitive
description:
name: build_daemon
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
build_resolvers:
dependency: transitive
description:
name: build_resolvers
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
build_runner:
dependency: "direct dev"
description:
name: build_runner
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
url: "https://pub.dartlang.org"
source: hosted
version: "7.1.0"
built_collection:
dependency: transitive
description:
name: built_collection
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.0"
built_value:
dependency: transitive
description:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
version: "8.1.2"
characters: characters:
dependency: transitive dependency: transitive
description: description:
@ -29,6 +106,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
checked_yaml:
dependency: transitive
description:
name: checked_yaml
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
cli_util:
dependency: transitive
description:
name: cli_util
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.3"
clock: clock:
dependency: transitive dependency: transitive
description: description:
@ -36,6 +127,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
code_builder:
dependency: transitive
description:
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
collection: collection:
dependency: transitive dependency: transitive
description: description:
@ -43,6 +141,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.15.0" version: "1.15.0"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
@ -50,6 +162,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.3" version: "1.0.3"
dart_style:
dependency: transitive
description:
name: dart_style
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
@ -57,6 +176,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.2"
fixnum:
dependency: transitive
description:
name: fixnum
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -67,6 +200,76 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
frontend_server_client:
dependency: transitive
description:
name: frontend_server_client
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
graphs:
dependency: transitive
description:
name: graphs
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
io:
dependency: transitive
description:
name: io
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
json_annotation:
dependency: "direct main"
description:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.1"
json_serializable:
dependency: "direct dev"
description:
name: json_serializable
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.4"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@ -81,6 +284,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0" version: "1.3.0"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
path: path:
dependency: transitive dependency: transitive
description: description:
@ -88,11 +305,60 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.8.0"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.1"
pool:
dependency: transitive
description:
name: pool
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
pubspec_parse:
dependency: transitive
description:
name: pubspec_parse
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.99" version: "0.0.99"
source_gen:
dependency: transitive
description:
name: source_gen
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
source_span: source_span:
dependency: transitive dependency: transitive
description: description:
@ -114,6 +380,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
stream_transform:
dependency: transitive
description:
name: stream_transform
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
@ -135,6 +408,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.0" version: "0.3.0"
timing:
dependency: transitive
description:
name: timing
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -149,5 +429,26 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
sdks: sdks:
dart: ">=2.12.0 <3.0.0" dart: ">=2.12.0 <3.0.0"

View file

@ -23,6 +23,7 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
json_annotation: ^4.0.1
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
@ -32,6 +33,8 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
build_runner: ^2.1.1
json_serializable: ^4.1.4
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec