2026-04-25 12:52:43 +02:00
|
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
|
|
|
|
|
|
|
|
part 'plex_activity.g.dart';
|
|
|
|
|
|
|
2026-03-25 11:33:01 -04:00
|
|
|
|
/// Represents a running background task on a Plex Media Server (from /activities endpoint).
|
2026-04-25 12:52:43 +02:00
|
|
|
|
@JsonSerializable(createToJson: false)
|
2026-03-25 11:33:01 -04:00
|
|
|
|
class PlexActivity {
|
2026-04-25 12:52:43 +02:00
|
|
|
|
@JsonKey(defaultValue: '')
|
2026-03-25 11:33:01 -04:00
|
|
|
|
final String uuid;
|
2026-04-25 12:52:43 +02:00
|
|
|
|
@JsonKey(defaultValue: '')
|
2026-03-25 11:33:01 -04:00
|
|
|
|
final String type;
|
2026-04-25 12:52:43 +02:00
|
|
|
|
@JsonKey(defaultValue: '')
|
2026-03-25 11:33:01 -04:00
|
|
|
|
final String title;
|
|
|
|
|
|
final String? subtitle;
|
2026-04-25 12:52:43 +02:00
|
|
|
|
@JsonKey(defaultValue: 0)
|
2026-03-25 11:33:01 -04:00
|
|
|
|
final int progress; // 0–100
|
2026-04-25 12:52:43 +02:00
|
|
|
|
@JsonKey(defaultValue: false)
|
2026-03-25 11:33:01 -04:00
|
|
|
|
final bool cancellable;
|
|
|
|
|
|
|
|
|
|
|
|
const PlexActivity({
|
|
|
|
|
|
required this.uuid,
|
|
|
|
|
|
required this.type,
|
|
|
|
|
|
required this.title,
|
|
|
|
|
|
this.subtitle,
|
|
|
|
|
|
required this.progress,
|
|
|
|
|
|
required this.cancellable,
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2026-04-25 12:52:43 +02:00
|
|
|
|
factory PlexActivity.fromJson(Map<String, dynamic> json) => _$PlexActivityFromJson(json);
|
2026-03-25 11:33:01 -04:00
|
|
|
|
}
|