frosty/lib/models/stream.dart
tommyxchow 57c5d1f4a9 Twitch API tweaks & additions (#41)
- Added request for streams under a desired category
- Tweaked models
2021-11-26 01:14:47 -05:00

54 lines
1.2 KiB
Dart

import 'package:json_annotation/json_annotation.dart';
part 'stream.g.dart';
// Object for live Twitch streams.
@JsonSerializable(createToJson: false, fieldRename: FieldRename.snake)
class StreamTwitch {
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;
const StreamTwitch(
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 StreamTwitch.fromJson(Map<String, dynamic> json) => _$StreamTwitchFromJson(json);
}
@JsonSerializable(createToJson: false, fieldRename: FieldRename.snake)
class StreamsTwitch {
final List<StreamTwitch> data;
final Map<String, String> pagination;
const StreamsTwitch(
this.data,
this.pagination,
);
factory StreamsTwitch.fromJson(Map<String, dynamic> json) => _$StreamsTwitchFromJson(json);
}