diff --git a/lib/models/emotes.dart b/lib/models/emotes.dart new file mode 100644 index 00000000..f63a40ca --- /dev/null +++ b/lib/models/emotes.dart @@ -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 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 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 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 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 json) => _$EmoteBTTVSharedFromJson(json); +} + +@JsonSerializable(createToJson: false) +class EmoteBTTVChannel { + final String id; + final List bots; + final List channelEmotes; + final List sharedEmotes; + + EmoteBTTVChannel(this.id, this.bots, this.channelEmotes, this.sharedEmotes); + + factory EmoteBTTVChannel.fromJson(Map 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 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 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 json) => _$EmoteFFZFromJson(json); +} diff --git a/lib/models/emotes.g.dart b/lib/models/emotes.g.dart new file mode 100644 index 00000000..554db7a4 --- /dev/null +++ b/lib/models/emotes.g.dart @@ -0,0 +1,92 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'emotes.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +ImagesTwitch _$ImagesTwitchFromJson(Map json) { + return ImagesTwitch( + json['url1x'] as String, + json['url2x'] as String, + json['url4x'] as String, + ); +} + +EmoteTwitch _$EmoteTwitchFromJson(Map json) { + return EmoteTwitch( + json['id'] as String, + json['name'] as String, + ImagesTwitch.fromJson(json['images'] as Map), + json['tier'] as String?, + json['emoteType'] as String?, + json['emoteSetId'] as String?, + ); +} + +EmoteBTTVGlobal _$EmoteBTTVGlobalFromJson(Map json) { + return EmoteBTTVGlobal( + json['id'] as String, + json['code'] as String, + json['imageType'] as String, + json['userId'] as String, + ); +} + +UserBTTV _$UserBTTVFromJson(Map json) { + return UserBTTV( + json['id'] as String, + json['name'] as String, + json['displayName'] as String, + json['providerId'] as String, + ); +} + +EmoteBTTVShared _$EmoteBTTVSharedFromJson(Map json) { + return EmoteBTTVShared( + json['id'] as String, + json['code'] as String, + json['imageType'] as String, + UserBTTV.fromJson(json['user'] as Map), + ); +} + +EmoteBTTVChannel _$EmoteBTTVChannelFromJson(Map json) { + return EmoteBTTVChannel( + json['id'] as String, + (json['bots'] as List).map((e) => e as String).toList(), + (json['channelEmotes'] as List) + .map((e) => EmoteBTTVGlobal.fromJson(e as Map)) + .toList(), + (json['sharedEmotes'] as List) + .map((e) => EmoteBTTVShared.fromJson(e as Map)) + .toList(), + ); +} + +UserFFZ _$UserFFZFromJson(Map json) { + return UserFFZ( + json['id'] as int, + json['name'] as String, + json['displayName'] as String, + ); +} + +ImagesFFZ _$ImagesFFZFromJson(Map json) { + return ImagesFFZ( + json['1x'] as String, + json['2x'] as String?, + json['4x'] as String?, + ); +} + +EmoteFFZ _$EmoteFFZFromJson(Map json) { + return EmoteFFZ( + json['id'] as int, + UserFFZ.fromJson(json['user'] as Map), + json['code'] as String, + ImagesFFZ.fromJson(json['images'] as Map), + json['imageType'] as String, + ); +} diff --git a/pubspec.lock b/pubspec.lock index 7ffced4e..489d7a65 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,27 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile 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: dependency: transitive description: @@ -15,6 +36,62 @@ packages: url: "https://pub.dartlang.org" source: hosted 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: dependency: transitive description: @@ -29,6 +106,20 @@ packages: url: "https://pub.dartlang.org" source: hosted 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: dependency: transitive description: @@ -36,6 +127,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" + code_builder: + dependency: transitive + description: + name: code_builder + url: "https://pub.dartlang.org" + source: hosted + version: "4.1.0" collection: dependency: transitive description: @@ -43,6 +141,20 @@ packages: url: "https://pub.dartlang.org" source: hosted 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: dependency: "direct main" description: @@ -50,6 +162,13 @@ packages: url: "https://pub.dartlang.org" source: hosted 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: dependency: transitive description: @@ -57,6 +176,20 @@ packages: url: "https://pub.dartlang.org" source: hosted 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: dependency: "direct main" description: flutter @@ -67,6 +200,76 @@ packages: description: flutter source: sdk 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: dependency: transitive description: @@ -81,6 +284,20 @@ packages: url: "https://pub.dartlang.org" source: hosted 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: dependency: transitive description: @@ -88,11 +305,60 @@ packages: url: "https://pub.dartlang.org" source: hosted 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: dependency: transitive description: flutter source: sdk 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: dependency: transitive description: @@ -114,6 +380,13 @@ packages: url: "https://pub.dartlang.org" source: hosted 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: dependency: transitive description: @@ -135,6 +408,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.3.0" + timing: + dependency: transitive + description: + name: timing + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" typed_data: dependency: transitive description: @@ -149,5 +429,26 @@ packages: url: "https://pub.dartlang.org" source: hosted 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: dart: ">=2.12.0 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 2dba501b..ac24a2a4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -23,6 +23,7 @@ environment: dependencies: flutter: sdk: flutter + json_annotation: ^4.0.1 # The following adds the Cupertino Icons font to your application. @@ -32,6 +33,8 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter + build_runner: ^2.1.1 + json_serializable: ^4.1.4 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec