Skip to content

Commit

Permalink
fix ci test
Browse files Browse the repository at this point in the history
  • Loading branch information
shiosyakeyakini-info committed Aug 14, 2024
1 parent d53a597 commit be5ecfd
Show file tree
Hide file tree
Showing 7 changed files with 214 additions and 190 deletions.
3 changes: 3 additions & 0 deletions lib/misskey_dart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export 'src/data/get_avatar_decorations_response.dart';
export 'src/data/server_info_response.dart';
export 'src/data/emoji_request.dart';
export 'src/data/emoji_response.dart';
export 'src/data/stats_response.dart';
export 'src/data/ping_response.dart';
export 'src/data/channels/channels_show_request.dart';
export 'src/data/channels/channels_timeline_request.dart';
export 'src/data/channels/channels_followed_request.dart';
Expand Down Expand Up @@ -251,3 +253,4 @@ export 'src/misskey_roles.dart';
export 'src/misskey_users.dart';
export 'src/misskey_bubble_game.dart';
export 'src/misskey_reversi.dart';
export 'src/misskey_flash.dart';
20 changes: 10 additions & 10 deletions lib/src/data/streaming/stats_log_response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'stats_log_response.freezed.dart';
part 'stats_log_response.g.dart';

class StatsResponseConverter
implements JsonConverter<StatsResponse, Map<String, dynamic>> {
const StatsResponseConverter();
class StreamingStatsConverter
implements JsonConverter<StreamingStats, Map<String, dynamic>> {
const StreamingStatsConverter();

@override
StatsResponse fromJson(Map<String, dynamic> json) {
StreamingStats fromJson(Map<String, dynamic> json) {
if (json.containsKey("inbox")) {
return JobQueueResponse.fromJson(json);
}
Expand All @@ -19,25 +19,25 @@ class StatsResponseConverter
}

@override
Map<String, dynamic> toJson(StatsResponse data) => data.toJson();
Map<String, dynamic> toJson(StreamingStats data) => data.toJson();
}

@freezed
sealed class StatsResponse with _$StatsResponse {
const factory StatsResponse.serverMetrics({
sealed class StreamingStats with _$StreamingStats {
const factory StreamingStats.serverMetrics({
required double cpu,
required StatsLogFs fs,
required StatsLogMem mem,
required StatsLogNet net,
}) = ServerMetricsResponse;

const factory StatsResponse.jobQueue({
const factory StreamingStats.jobQueue({
required QueueStatsLogResponseData inbox,
required QueueStatsLogResponseData deliver,
}) = JobQueueResponse;

factory StatsResponse.fromJson(Map<String, dynamic> json) =>
_$StatsResponseFromJson(json);
factory StreamingStats.fromJson(Map<String, dynamic> json) =>
_$StreamingStatsFromJson(json);
}

@freezed
Expand Down
32 changes: 16 additions & 16 deletions lib/src/data/streaming/stats_log_response.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');

StatsResponse _$StatsResponseFromJson(Map<String, dynamic> json) {
StreamingStats _$StreamingStatsFromJson(Map<String, dynamic> json) {
switch (json['runtimeType']) {
case 'serverMetrics':
return ServerMetricsResponse.fromJson(json);
case 'jobQueue':
return JobQueueResponse.fromJson(json);

default:
throw CheckedFromJsonException(json, 'runtimeType', 'StatsResponse',
throw CheckedFromJsonException(json, 'runtimeType', 'StreamingStats',
'Invalid union type "${json['runtimeType']}"!');
}
}

/// @nodoc
mixin _$StatsResponse {
mixin _$StreamingStats {
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(
Expand Down Expand Up @@ -83,16 +83,16 @@ mixin _$StatsResponse {
}

/// @nodoc
abstract class $StatsResponseCopyWith<$Res> {
factory $StatsResponseCopyWith(
StatsResponse value, $Res Function(StatsResponse) then) =
_$StatsResponseCopyWithImpl<$Res, StatsResponse>;
abstract class $StreamingStatsCopyWith<$Res> {
factory $StreamingStatsCopyWith(
StreamingStats value, $Res Function(StreamingStats) then) =
_$StreamingStatsCopyWithImpl<$Res, StreamingStats>;
}

/// @nodoc
class _$StatsResponseCopyWithImpl<$Res, $Val extends StatsResponse>
implements $StatsResponseCopyWith<$Res> {
_$StatsResponseCopyWithImpl(this._value, this._then);
class _$StreamingStatsCopyWithImpl<$Res, $Val extends StreamingStats>
implements $StreamingStatsCopyWith<$Res> {
_$StreamingStatsCopyWithImpl(this._value, this._then);

// ignore: unused_field
final $Val _value;
Expand All @@ -116,7 +116,7 @@ abstract class _$$ServerMetricsResponseImplCopyWith<$Res> {

/// @nodoc
class __$$ServerMetricsResponseImplCopyWithImpl<$Res>
extends _$StatsResponseCopyWithImpl<$Res, _$ServerMetricsResponseImpl>
extends _$StreamingStatsCopyWithImpl<$Res, _$ServerMetricsResponseImpl>
implements _$$ServerMetricsResponseImplCopyWith<$Res> {
__$$ServerMetricsResponseImplCopyWithImpl(_$ServerMetricsResponseImpl _value,
$Res Function(_$ServerMetricsResponseImpl) _then)
Expand Down Expand Up @@ -203,7 +203,7 @@ class _$ServerMetricsResponseImpl implements ServerMetricsResponse {

@override
String toString() {
return 'StatsResponse.serverMetrics(cpu: $cpu, fs: $fs, mem: $mem, net: $net)';
return 'StreamingStats.serverMetrics(cpu: $cpu, fs: $fs, mem: $mem, net: $net)';
}

@override
Expand Down Expand Up @@ -310,7 +310,7 @@ class _$ServerMetricsResponseImpl implements ServerMetricsResponse {
}
}

abstract class ServerMetricsResponse implements StatsResponse {
abstract class ServerMetricsResponse implements StreamingStats {
const factory ServerMetricsResponse(
{required final double cpu,
required final StatsLogFs fs,
Expand Down Expand Up @@ -344,7 +344,7 @@ abstract class _$$JobQueueResponseImplCopyWith<$Res> {

/// @nodoc
class __$$JobQueueResponseImplCopyWithImpl<$Res>
extends _$StatsResponseCopyWithImpl<$Res, _$JobQueueResponseImpl>
extends _$StreamingStatsCopyWithImpl<$Res, _$JobQueueResponseImpl>
implements _$$JobQueueResponseImplCopyWith<$Res> {
__$$JobQueueResponseImplCopyWithImpl(_$JobQueueResponseImpl _value,
$Res Function(_$JobQueueResponseImpl) _then)
Expand Down Expand Up @@ -405,7 +405,7 @@ class _$JobQueueResponseImpl implements JobQueueResponse {

@override
String toString() {
return 'StatsResponse.jobQueue(inbox: $inbox, deliver: $deliver)';
return 'StreamingStats.jobQueue(inbox: $inbox, deliver: $deliver)';
}

@override
Expand Down Expand Up @@ -510,7 +510,7 @@ class _$JobQueueResponseImpl implements JobQueueResponse {
}
}

abstract class JobQueueResponse implements StatsResponse {
abstract class JobQueueResponse implements StreamingStats {
const factory JobQueueResponse(
{required final QueueStatsLogResponseData inbox,
required final QueueStatsLogResponseData deliver}) =
Expand Down
4 changes: 2 additions & 2 deletions lib/src/data/streaming/streaming_response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ sealed class ChannelStreamEvent with _$ChannelStreamEvent {
@FreezedUnionValue("statsLog")
const factory ChannelStreamEvent.statsLog({
required String id,
@StatsResponseConverter() required List<StatsResponse> body,
@StreamingStatsConverter() required List<StreamingStats> body,
}) = StatsLogChannelEvent;

@FreezedUnionValue("stats")
const factory ChannelStreamEvent.stats({
required String id,
@StatsResponseConverter() required StatsResponse body,
@StreamingStatsConverter() required StreamingStats body,
}) = StatsChannelEvent;

// list
Expand Down
Loading

0 comments on commit be5ecfd

Please sign in to comment.