Add channel (stream) model
This commit is contained in:
parent
d957cab877
commit
a9053430ba
2 changed files with 53 additions and 0 deletions
27
lib/models/channel.dart
Normal file
27
lib/models/channel.dart
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
|
|
||||||
|
part 'channel.g.dart';
|
||||||
|
|
||||||
|
// Twitch Channels (Streams)
|
||||||
|
@JsonSerializable(createToJson: false, fieldRename: FieldRename.snake)
|
||||||
|
class Channel {
|
||||||
|
final String id;
|
||||||
|
final String userId;
|
||||||
|
final String userLogin;
|
||||||
|
final String userName;
|
||||||
|
final String gameId;
|
||||||
|
final String gameName;
|
||||||
|
final String type;
|
||||||
|
final String title;
|
||||||
|
final int viewerCount;
|
||||||
|
final String startedAt;
|
||||||
|
final String language;
|
||||||
|
final String thumbnailUrl;
|
||||||
|
final List<String> tagIds;
|
||||||
|
final bool isMature;
|
||||||
|
|
||||||
|
Channel(this.id, this.userId, this.userLogin, this.userName, this.gameId, this.gameName, this.type, this.title, this.viewerCount, this.startedAt,
|
||||||
|
this.language, this.thumbnailUrl, this.tagIds, this.isMature);
|
||||||
|
|
||||||
|
factory Channel.fromJson(Map<String, dynamic> json) => _$ChannelFromJson(json);
|
||||||
|
}
|
||||||
26
lib/models/channel.g.dart
Normal file
26
lib/models/channel.g.dart
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'channel.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
Channel _$ChannelFromJson(Map<String, dynamic> json) {
|
||||||
|
return Channel(
|
||||||
|
json['id'] as String,
|
||||||
|
json['user_id'] as String,
|
||||||
|
json['user_login'] as String,
|
||||||
|
json['user_name'] as String,
|
||||||
|
json['game_id'] as String,
|
||||||
|
json['game_name'] as String,
|
||||||
|
json['type'] as String,
|
||||||
|
json['title'] as String,
|
||||||
|
json['viewer_count'] as int,
|
||||||
|
json['started_at'] as String,
|
||||||
|
json['language'] as String,
|
||||||
|
json['thumbnail_url'] as String,
|
||||||
|
(json['tag_ids'] as List<dynamic>).map((e) => e as String).toList(),
|
||||||
|
json['is_mature'] as bool,
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue