add push rule settings

Fixes #126
This commit is contained in:
Henry Hiles 2026-10-31 15:22:13 -04:00
commit c9172e92eb
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -0,0 +1,27 @@
import "package:freezed_annotation/freezed_annotation.dart";
import "package:nexus/models/push_rules.dart";
part "update_push_rule.freezed.dart";
part "update_push_rule.g.dart";
@Freezed(toJson: false, fromJson: false)
@JsonSerializable()
class const UpdatePushRuleRequest({
required final PushRuleKind kind,
required final String ruleId,
required final UpdatePushRuleAction action,
/// The new rule, when putting it. Only its actions and pattern are used.
final PushRule? newContent,
/// The new actions, when putting only them.
final PushActions? actions,
}) with _$UpdatePushRuleRequest {
Map<String, Object?> toJson() => _$UpdatePushRuleRequestToJson(this);
factory UpdatePushRuleRequest.fromJson(Map<String, Object?> json) =>
_$UpdatePushRuleRequestFromJson(json);
}
@JsonEnum(fieldRename: .snake)
enum UpdatePushRuleAction { enable, disable, put, putActions, delete }