Skip to content

Commit

Permalink
feat(worldstate): add kinepage model
Browse files Browse the repository at this point in the history
  • Loading branch information
SlayerOrnstein committed Oct 15, 2024
1 parent 4f137d1 commit 0711415
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/src/enums.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,19 @@ enum Language {
sr,

/// Czech
cs
cs,

/// United Kingdowm
uk,

/// Japanese
ja,

/// Traditional Chines
tc,

/// Thai
th
}

extension on Language {
Expand Down
34 changes: 34 additions & 0 deletions lib/src/models/worldstate/kinepage.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:warframestat_client/src/enums.dart';

part 'kinepage.g.dart';

/// {@template kinepage}
/// Data class for kinepage
/// {@endtemplate}
@JsonSerializable()
class Kinepage {
/// {@macro kinepage}
Kinepage({
required this.timestamp,
required this.message,
required this.translations,
});

/// Creates a [Kinepage] instance from a json map
factory Kinepage.fromJson(Map<String, dynamic> json) {
return _$KinepageFromJson(json);
}

/// The date the message was sent
final DateTime timestamp;

/// The message itself
final String message;

/// The message in different translations
final Map<Language, String> translations;

/// Returns a map from [Kinepage]
Map<String, dynamic> toJson() => _$KinepageToJson(this);
}
53 changes: 53 additions & 0 deletions lib/src/models/worldstate/kinepage.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions lib/src/models/worldstate/worldstate.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:warframestat_client/src/models/worldstate/kinepage.dart';
import 'package:warframestat_client/warframestat_client.dart';

part 'worldstate.g.dart';
Expand Down Expand Up @@ -40,6 +41,7 @@ class Worldstate extends Equatable {
required this.steelPath,
required this.zarimanCycle,
required this.duviriCycle,
required this.kinepage,
required this.deepArchimedea,
});

Expand Down Expand Up @@ -136,6 +138,9 @@ class Worldstate extends Equatable {
/// Duviri cycle data.
final DuviriCycle duviriCycle;

/// Recent kinepage message
final Kinepage kinepage;

/// Deep Archimedea data
final DeepArchimedea deepArchimedea;

Expand Down Expand Up @@ -171,6 +176,7 @@ class Worldstate extends Equatable {
simaris,
steelPath,
duviriCycle,
kinepage,
deepArchimedea,
];
}
3 changes: 3 additions & 0 deletions lib/src/models/worldstate/worldstate.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0711415

Please sign in to comment.