diff --git a/packages/poptart_lex/CHANGELOG.md b/packages/poptart_lex/CHANGELOG.md index d18d263a7..870b3c0c5 100644 --- a/packages/poptart_lex/CHANGELOG.md +++ b/packages/poptart_lex/CHANGELOG.md @@ -1,5 +1,9 @@ # Release Note +## v0.2.0 + +- **BREAKING**: Regenerate lexicon models with role-scoped nested parameter, input, and output type names. + ## v0.1.0 - Initial Poptart fork release under the new `poptart_*` package name. diff --git a/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes.dart b/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes.dart index a8a883df8..8ad4397cc 100644 --- a/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes.dart +++ b/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes.dart @@ -9,5 +9,5 @@ export 'get_invite_codes/descriptor.dart'; export 'get_invite_codes/input.dart'; -export 'get_invite_codes/main_sort.dart'; +export 'get_invite_codes/main_parameters_sort.dart'; export 'get_invite_codes/output.dart'; diff --git a/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/input.dart b/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/input.dart index 4ea242bf5..16518d349 100644 --- a/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/input.dart +++ b/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/input.dart @@ -7,7 +7,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:poptart_core/poptart_core.dart'; import 'package:poptart_core/internals.dart'; -import './main_sort.dart'; +import './main_parameters_sort.dart'; part 'input.freezed.dart'; part 'input.g.dart'; @@ -22,7 +22,8 @@ abstract class AdminGetInviteCodesInput with _$AdminGetInviteCodesInput { @JsonSerializable(includeIfNull: false) const factory AdminGetInviteCodesInput({ - @AdminGetInviteCodesSortConverter() AdminGetInviteCodesSort? sort, + @AdminGetInviteCodesParametersSortConverter() + AdminGetInviteCodesParametersSort? sort, @Default(100) int limit, String? cursor, diff --git a/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/input.freezed.dart b/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/input.freezed.dart index 8728f8aeb..308eadfa5 100644 --- a/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/input.freezed.dart +++ b/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/input.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$AdminGetInviteCodesInput { -@AdminGetInviteCodesSortConverter() AdminGetInviteCodesSort? get sort; int get limit; String? get cursor; Map? get $unknown; +@AdminGetInviteCodesParametersSortConverter() AdminGetInviteCodesParametersSort? get sort; int get limit; String? get cursor; Map? get $unknown; /// Create a copy of AdminGetInviteCodesInput /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -48,11 +48,11 @@ abstract mixin class $AdminGetInviteCodesInputCopyWith<$Res> { factory $AdminGetInviteCodesInputCopyWith(AdminGetInviteCodesInput value, $Res Function(AdminGetInviteCodesInput) _then) = _$AdminGetInviteCodesInputCopyWithImpl; @useResult $Res call({ -@AdminGetInviteCodesSortConverter() AdminGetInviteCodesSort? sort, int limit, String? cursor, Map? $unknown +@AdminGetInviteCodesParametersSortConverter() AdminGetInviteCodesParametersSort? sort, int limit, String? cursor, Map? $unknown }); -$AdminGetInviteCodesSortCopyWith<$Res>? get sort; +$AdminGetInviteCodesParametersSortCopyWith<$Res>? get sort; } /// @nodoc @@ -68,7 +68,7 @@ class _$AdminGetInviteCodesInputCopyWithImpl<$Res> @pragma('vm:prefer-inline') @override $Res call({Object? sort = freezed,Object? limit = null,Object? cursor = freezed,Object? $unknown = freezed,}) { return _then(_self.copyWith( sort: freezed == sort ? _self.sort : sort // ignore: cast_nullable_to_non_nullable -as AdminGetInviteCodesSort?,limit: null == limit ? _self.limit : limit // ignore: cast_nullable_to_non_nullable +as AdminGetInviteCodesParametersSort?,limit: null == limit ? _self.limit : limit // ignore: cast_nullable_to_non_nullable as int,cursor: freezed == cursor ? _self.cursor : cursor // ignore: cast_nullable_to_non_nullable as String?,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, @@ -78,12 +78,12 @@ as Map?, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$AdminGetInviteCodesSortCopyWith<$Res>? get sort { +$AdminGetInviteCodesParametersSortCopyWith<$Res>? get sort { if (_self.sort == null) { return null; } - return $AdminGetInviteCodesSortCopyWith<$Res>(_self.sort!, (value) { + return $AdminGetInviteCodesParametersSortCopyWith<$Res>(_self.sort!, (value) { return _then(_self.copyWith(sort: value)); }); } @@ -168,7 +168,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function(@AdminGetInviteCodesSortConverter() AdminGetInviteCodesSort? sort, int limit, String? cursor, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function(@AdminGetInviteCodesParametersSortConverter() AdminGetInviteCodesParametersSort? sort, int limit, String? cursor, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _AdminGetInviteCodesInput() when $default != null: return $default(_that.sort,_that.limit,_that.cursor,_that.$unknown);case _: @@ -189,7 +189,7 @@ return $default(_that.sort,_that.limit,_that.cursor,_that.$unknown);case _: /// } /// ``` -@optionalTypeArgs TResult when(TResult Function(@AdminGetInviteCodesSortConverter() AdminGetInviteCodesSort? sort, int limit, String? cursor, Map? $unknown) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function(@AdminGetInviteCodesParametersSortConverter() AdminGetInviteCodesParametersSort? sort, int limit, String? cursor, Map? $unknown) $default,) {final _that = this; switch (_that) { case _AdminGetInviteCodesInput(): return $default(_that.sort,_that.limit,_that.cursor,_that.$unknown);case _: @@ -209,7 +209,7 @@ return $default(_that.sort,_that.limit,_that.cursor,_that.$unknown);case _: /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function(@AdminGetInviteCodesSortConverter() AdminGetInviteCodesSort? sort, int limit, String? cursor, Map? $unknown)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function(@AdminGetInviteCodesParametersSortConverter() AdminGetInviteCodesParametersSort? sort, int limit, String? cursor, Map? $unknown)? $default,) {final _that = this; switch (_that) { case _AdminGetInviteCodesInput() when $default != null: return $default(_that.sort,_that.limit,_that.cursor,_that.$unknown);case _: @@ -224,10 +224,10 @@ return $default(_that.sort,_that.limit,_that.cursor,_that.$unknown);case _: @JsonSerializable(includeIfNull: false) class _AdminGetInviteCodesInput implements AdminGetInviteCodesInput { - const _AdminGetInviteCodesInput({@AdminGetInviteCodesSortConverter() this.sort, this.limit = 100, this.cursor, final Map? $unknown}): _$unknown = $unknown; + const _AdminGetInviteCodesInput({@AdminGetInviteCodesParametersSortConverter() this.sort, this.limit = 100, this.cursor, final Map? $unknown}): _$unknown = $unknown; factory _AdminGetInviteCodesInput.fromJson(Map json) => _$AdminGetInviteCodesInputFromJson(json); -@override@AdminGetInviteCodesSortConverter() final AdminGetInviteCodesSort? sort; +@override@AdminGetInviteCodesParametersSortConverter() final AdminGetInviteCodesParametersSort? sort; @override@JsonKey() final int limit; @override final String? cursor; final Map? _$unknown; @@ -273,11 +273,11 @@ abstract mixin class _$AdminGetInviteCodesInputCopyWith<$Res> implements $AdminG factory _$AdminGetInviteCodesInputCopyWith(_AdminGetInviteCodesInput value, $Res Function(_AdminGetInviteCodesInput) _then) = __$AdminGetInviteCodesInputCopyWithImpl; @override @useResult $Res call({ -@AdminGetInviteCodesSortConverter() AdminGetInviteCodesSort? sort, int limit, String? cursor, Map? $unknown +@AdminGetInviteCodesParametersSortConverter() AdminGetInviteCodesParametersSort? sort, int limit, String? cursor, Map? $unknown }); -@override $AdminGetInviteCodesSortCopyWith<$Res>? get sort; +@override $AdminGetInviteCodesParametersSortCopyWith<$Res>? get sort; } /// @nodoc @@ -293,7 +293,7 @@ class __$AdminGetInviteCodesInputCopyWithImpl<$Res> @override @pragma('vm:prefer-inline') $Res call({Object? sort = freezed,Object? limit = null,Object? cursor = freezed,Object? $unknown = freezed,}) { return _then(_AdminGetInviteCodesInput( sort: freezed == sort ? _self.sort : sort // ignore: cast_nullable_to_non_nullable -as AdminGetInviteCodesSort?,limit: null == limit ? _self.limit : limit // ignore: cast_nullable_to_non_nullable +as AdminGetInviteCodesParametersSort?,limit: null == limit ? _self.limit : limit // ignore: cast_nullable_to_non_nullable as int,cursor: freezed == cursor ? _self.cursor : cursor // ignore: cast_nullable_to_non_nullable as String?,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, @@ -304,12 +304,12 @@ as Map?, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$AdminGetInviteCodesSortCopyWith<$Res>? get sort { +$AdminGetInviteCodesParametersSortCopyWith<$Res>? get sort { if (_self.sort == null) { return null; } - return $AdminGetInviteCodesSortCopyWith<$Res>(_self.sort!, (value) { + return $AdminGetInviteCodesParametersSortCopyWith<$Res>(_self.sort!, (value) { return _then(_self.copyWith(sort: value)); }); } diff --git a/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/input.g.dart b/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/input.g.dart index 302c74ceb..9811a2317 100644 --- a/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/input.g.dart +++ b/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/input.g.dart @@ -8,32 +8,33 @@ part of 'input.dart'; // JsonSerializableGenerator // ************************************************************************** -_AdminGetInviteCodesInput _$AdminGetInviteCodesInputFromJson(Map json) => - $checkedCreate('_AdminGetInviteCodesInput', json, ($checkedConvert) { - final val = _AdminGetInviteCodesInput( - sort: $checkedConvert( - 'sort', - (v) => _$JsonConverterFromJson( - v, - const AdminGetInviteCodesSortConverter().fromJson, - ), - ), - limit: $checkedConvert('limit', (v) => (v as num?)?.toInt() ?? 100), - cursor: $checkedConvert('cursor', (v) => v as String?), - $unknown: $checkedConvert( - r'$unknown', - (v) => (v as Map?)?.map((k, e) => MapEntry(k as String, e)), - ), - ); - return val; - }); +_AdminGetInviteCodesInput _$AdminGetInviteCodesInputFromJson( + Map json, +) => $checkedCreate('_AdminGetInviteCodesInput', json, ($checkedConvert) { + final val = _AdminGetInviteCodesInput( + sort: $checkedConvert( + 'sort', + (v) => _$JsonConverterFromJson( + v, + const AdminGetInviteCodesParametersSortConverter().fromJson, + ), + ), + limit: $checkedConvert('limit', (v) => (v as num?)?.toInt() ?? 100), + cursor: $checkedConvert('cursor', (v) => v as String?), + $unknown: $checkedConvert( + r'$unknown', + (v) => (v as Map?)?.map((k, e) => MapEntry(k as String, e)), + ), + ); + return val; +}); Map _$AdminGetInviteCodesInputToJson( _AdminGetInviteCodesInput instance, ) => { - 'sort': ?_$JsonConverterToJson( + 'sort': ?_$JsonConverterToJson( instance.sort, - const AdminGetInviteCodesSortConverter().toJson, + const AdminGetInviteCodesParametersSortConverter().toJson, ), 'limit': instance.limit, 'cursor': ?instance.cursor, diff --git a/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/main_parameters_sort.dart b/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/main_parameters_sort.dart new file mode 100644 index 000000000..21f15c98f --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/main_parameters_sort.dart @@ -0,0 +1,104 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, unused_import, duplicate_import, unnecessary_cast, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +import 'package:poptart_core/poptart_core.dart' show Serializable; +import 'package:poptart_core/internals.dart' show isA; + +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'main_parameters_sort.freezed.dart'; + +// ************************************************************************** +// LexGenerator +// ************************************************************************** + +@freezed +abstract class AdminGetInviteCodesParametersSort + with _$AdminGetInviteCodesParametersSort { + const AdminGetInviteCodesParametersSort._(); + + const factory AdminGetInviteCodesParametersSort.knownValue({ + required KnownAdminGetInviteCodesParametersSort data, + }) = AdminGetInviteCodesParametersSortKnownValue; + + const factory AdminGetInviteCodesParametersSort.unknown({ + required String data, + }) = AdminGetInviteCodesParametersSortUnknown; + + static AdminGetInviteCodesParametersSort? valueOf(final String? value) { + if (value == null) return null; + final knownValue = KnownAdminGetInviteCodesParametersSort.valueOf(value); + + return knownValue != null + ? AdminGetInviteCodesParametersSort.knownValue(data: knownValue) + : AdminGetInviteCodesParametersSort.unknown(data: value); + } + + String toJson() => + const AdminGetInviteCodesParametersSortConverter().toJson(this); +} + +extension AdminGetInviteCodesParametersSortExtension + on AdminGetInviteCodesParametersSort { + bool get isKnownValue => + isA(this); + bool get isNotKnownValue => !isKnownValue; + KnownAdminGetInviteCodesParametersSort? get knownValue => + isKnownValue ? data as KnownAdminGetInviteCodesParametersSort : null; + bool get isUnknown => isA(this); + bool get isNotUnknown => !isUnknown; + String? get unknown => isUnknown ? data as String : null; +} + +final class AdminGetInviteCodesParametersSortConverter + extends JsonConverter { + const AdminGetInviteCodesParametersSortConverter(); + + @override + AdminGetInviteCodesParametersSort fromJson(String json) { + try { + final knownValue = KnownAdminGetInviteCodesParametersSort.valueOf(json); + if (knownValue != null) { + return AdminGetInviteCodesParametersSort.knownValue(data: knownValue); + } + + return AdminGetInviteCodesParametersSort.unknown(data: json); + } catch (_) { + return AdminGetInviteCodesParametersSort.unknown(data: json); + } + } + + @override + String toJson(AdminGetInviteCodesParametersSort object) => + object.when(knownValue: (data) => data.value, unknown: (data) => data); +} + +enum KnownAdminGetInviteCodesParametersSort implements Serializable { + @JsonValue('recent') + recent('recent'), + @JsonValue('usage') + usage('usage'); + + @override + final String value; + + const KnownAdminGetInviteCodesParametersSort(this.value); + + static bool isKnownValue(final String value) { + return valueOf(value) != null; + } + + static KnownAdminGetInviteCodesParametersSort? valueOf(final String? value) { + if (value == null) return null; + + for (final v in values) { + if (v.value == value) { + return v; + } + } + + return null; + } +} diff --git a/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/main_parameters_sort.freezed.dart b/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/main_parameters_sort.freezed.dart new file mode 100644 index 000000000..db3bd9e48 --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/main_parameters_sort.freezed.dart @@ -0,0 +1,312 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'main_parameters_sort.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$AdminGetInviteCodesParametersSort { + + Object get data; + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is AdminGetInviteCodesParametersSort&&const DeepCollectionEquality().equals(other.data, data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); + +@override +String toString() { + return 'AdminGetInviteCodesParametersSort(data: $data)'; +} + + +} + +/// @nodoc +class $AdminGetInviteCodesParametersSortCopyWith<$Res> { +$AdminGetInviteCodesParametersSortCopyWith(AdminGetInviteCodesParametersSort _, $Res Function(AdminGetInviteCodesParametersSort) __); +} + + +/// Adds pattern-matching-related methods to [AdminGetInviteCodesParametersSort]. +extension AdminGetInviteCodesParametersSortPatterns on AdminGetInviteCodesParametersSort { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap({TResult Function( AdminGetInviteCodesParametersSortKnownValue value)? knownValue,TResult Function( AdminGetInviteCodesParametersSortUnknown value)? unknown,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case AdminGetInviteCodesParametersSortKnownValue() when knownValue != null: +return knownValue(_that);case AdminGetInviteCodesParametersSortUnknown() when unknown != null: +return unknown(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map({required TResult Function( AdminGetInviteCodesParametersSortKnownValue value) knownValue,required TResult Function( AdminGetInviteCodesParametersSortUnknown value) unknown,}){ +final _that = this; +switch (_that) { +case AdminGetInviteCodesParametersSortKnownValue(): +return knownValue(_that);case AdminGetInviteCodesParametersSortUnknown(): +return unknown(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull({TResult? Function( AdminGetInviteCodesParametersSortKnownValue value)? knownValue,TResult? Function( AdminGetInviteCodesParametersSortUnknown value)? unknown,}){ +final _that = this; +switch (_that) { +case AdminGetInviteCodesParametersSortKnownValue() when knownValue != null: +return knownValue(_that);case AdminGetInviteCodesParametersSortUnknown() when unknown != null: +return unknown(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen({TResult Function( KnownAdminGetInviteCodesParametersSort data)? knownValue,TResult Function( String data)? unknown,required TResult orElse(),}) {final _that = this; +switch (_that) { +case AdminGetInviteCodesParametersSortKnownValue() when knownValue != null: +return knownValue(_that.data);case AdminGetInviteCodesParametersSortUnknown() when unknown != null: +return unknown(_that.data);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when({required TResult Function( KnownAdminGetInviteCodesParametersSort data) knownValue,required TResult Function( String data) unknown,}) {final _that = this; +switch (_that) { +case AdminGetInviteCodesParametersSortKnownValue(): +return knownValue(_that.data);case AdminGetInviteCodesParametersSortUnknown(): +return unknown(_that.data);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull({TResult? Function( KnownAdminGetInviteCodesParametersSort data)? knownValue,TResult? Function( String data)? unknown,}) {final _that = this; +switch (_that) { +case AdminGetInviteCodesParametersSortKnownValue() when knownValue != null: +return knownValue(_that.data);case AdminGetInviteCodesParametersSortUnknown() when unknown != null: +return unknown(_that.data);case _: + return null; + +} +} + +} + +/// @nodoc + + +class AdminGetInviteCodesParametersSortKnownValue extends AdminGetInviteCodesParametersSort { + const AdminGetInviteCodesParametersSortKnownValue({required this.data}): super._(); + + +@override final KnownAdminGetInviteCodesParametersSort data; + +/// Create a copy of AdminGetInviteCodesParametersSort +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$AdminGetInviteCodesParametersSortKnownValueCopyWith get copyWith => _$AdminGetInviteCodesParametersSortKnownValueCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is AdminGetInviteCodesParametersSortKnownValue&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'AdminGetInviteCodesParametersSort.knownValue(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $AdminGetInviteCodesParametersSortKnownValueCopyWith<$Res> implements $AdminGetInviteCodesParametersSortCopyWith<$Res> { + factory $AdminGetInviteCodesParametersSortKnownValueCopyWith(AdminGetInviteCodesParametersSortKnownValue value, $Res Function(AdminGetInviteCodesParametersSortKnownValue) _then) = _$AdminGetInviteCodesParametersSortKnownValueCopyWithImpl; +@useResult +$Res call({ + KnownAdminGetInviteCodesParametersSort data +}); + + + + +} +/// @nodoc +class _$AdminGetInviteCodesParametersSortKnownValueCopyWithImpl<$Res> + implements $AdminGetInviteCodesParametersSortKnownValueCopyWith<$Res> { + _$AdminGetInviteCodesParametersSortKnownValueCopyWithImpl(this._self, this._then); + + final AdminGetInviteCodesParametersSortKnownValue _self; + final $Res Function(AdminGetInviteCodesParametersSortKnownValue) _then; + +/// Create a copy of AdminGetInviteCodesParametersSort +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(AdminGetInviteCodesParametersSortKnownValue( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as KnownAdminGetInviteCodesParametersSort, + )); +} + + +} + +/// @nodoc + + +class AdminGetInviteCodesParametersSortUnknown extends AdminGetInviteCodesParametersSort { + const AdminGetInviteCodesParametersSortUnknown({required this.data}): super._(); + + +@override final String data; + +/// Create a copy of AdminGetInviteCodesParametersSort +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$AdminGetInviteCodesParametersSortUnknownCopyWith get copyWith => _$AdminGetInviteCodesParametersSortUnknownCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is AdminGetInviteCodesParametersSortUnknown&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'AdminGetInviteCodesParametersSort.unknown(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $AdminGetInviteCodesParametersSortUnknownCopyWith<$Res> implements $AdminGetInviteCodesParametersSortCopyWith<$Res> { + factory $AdminGetInviteCodesParametersSortUnknownCopyWith(AdminGetInviteCodesParametersSortUnknown value, $Res Function(AdminGetInviteCodesParametersSortUnknown) _then) = _$AdminGetInviteCodesParametersSortUnknownCopyWithImpl; +@useResult +$Res call({ + String data +}); + + + + +} +/// @nodoc +class _$AdminGetInviteCodesParametersSortUnknownCopyWithImpl<$Res> + implements $AdminGetInviteCodesParametersSortUnknownCopyWith<$Res> { + _$AdminGetInviteCodesParametersSortUnknownCopyWithImpl(this._self, this._then); + + final AdminGetInviteCodesParametersSortUnknown _self; + final $Res Function(AdminGetInviteCodesParametersSortUnknown) _then; + +/// Create a copy of AdminGetInviteCodesParametersSort +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(AdminGetInviteCodesParametersSortUnknown( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/main_sort.dart b/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/main_sort.dart deleted file mode 100644 index ff1001af6..000000000 --- a/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/main_sort.dart +++ /dev/null @@ -1,99 +0,0 @@ -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, unused_import, duplicate_import, unnecessary_cast, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -import 'package:poptart_core/poptart_core.dart' show Serializable; -import 'package:poptart_core/internals.dart' show isA; - -import 'package:freezed_annotation/freezed_annotation.dart'; - -part 'main_sort.freezed.dart'; - -// ************************************************************************** -// LexGenerator -// ************************************************************************** - -@freezed -abstract class AdminGetInviteCodesSort with _$AdminGetInviteCodesSort { - const AdminGetInviteCodesSort._(); - - const factory AdminGetInviteCodesSort.knownValue({ - required KnownAdminGetInviteCodesSort data, - }) = AdminGetInviteCodesSortKnownValue; - - const factory AdminGetInviteCodesSort.unknown({required String data}) = - AdminGetInviteCodesSortUnknown; - - static AdminGetInviteCodesSort? valueOf(final String? value) { - if (value == null) return null; - final knownValue = KnownAdminGetInviteCodesSort.valueOf(value); - - return knownValue != null - ? AdminGetInviteCodesSort.knownValue(data: knownValue) - : AdminGetInviteCodesSort.unknown(data: value); - } - - String toJson() => const AdminGetInviteCodesSortConverter().toJson(this); -} - -extension AdminGetInviteCodesSortExtension on AdminGetInviteCodesSort { - bool get isKnownValue => isA(this); - bool get isNotKnownValue => !isKnownValue; - KnownAdminGetInviteCodesSort? get knownValue => - isKnownValue ? data as KnownAdminGetInviteCodesSort : null; - bool get isUnknown => isA(this); - bool get isNotUnknown => !isUnknown; - String? get unknown => isUnknown ? data as String : null; -} - -final class AdminGetInviteCodesSortConverter - extends JsonConverter { - const AdminGetInviteCodesSortConverter(); - - @override - AdminGetInviteCodesSort fromJson(String json) { - try { - final knownValue = KnownAdminGetInviteCodesSort.valueOf(json); - if (knownValue != null) { - return AdminGetInviteCodesSort.knownValue(data: knownValue); - } - - return AdminGetInviteCodesSort.unknown(data: json); - } catch (_) { - return AdminGetInviteCodesSort.unknown(data: json); - } - } - - @override - String toJson(AdminGetInviteCodesSort object) => - object.when(knownValue: (data) => data.value, unknown: (data) => data); -} - -enum KnownAdminGetInviteCodesSort implements Serializable { - @JsonValue('recent') - recent('recent'), - @JsonValue('usage') - usage('usage'); - - @override - final String value; - - const KnownAdminGetInviteCodesSort(this.value); - - static bool isKnownValue(final String value) { - return valueOf(value) != null; - } - - static KnownAdminGetInviteCodesSort? valueOf(final String? value) { - if (value == null) return null; - - for (final v in values) { - if (v.value == value) { - return v; - } - } - - return null; - } -} diff --git a/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/main_sort.freezed.dart b/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/main_sort.freezed.dart deleted file mode 100644 index 500594abf..000000000 --- a/packages/poptart_lex/lib/com/atproto/admin/get_invite_codes/main_sort.freezed.dart +++ /dev/null @@ -1,312 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND -// coverage:ignore-file -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'main_sort.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; -/// @nodoc -mixin _$AdminGetInviteCodesSort { - - Object get data; - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is AdminGetInviteCodesSort&&const DeepCollectionEquality().equals(other.data, data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); - -@override -String toString() { - return 'AdminGetInviteCodesSort(data: $data)'; -} - - -} - -/// @nodoc -class $AdminGetInviteCodesSortCopyWith<$Res> { -$AdminGetInviteCodesSortCopyWith(AdminGetInviteCodesSort _, $Res Function(AdminGetInviteCodesSort) __); -} - - -/// Adds pattern-matching-related methods to [AdminGetInviteCodesSort]. -extension AdminGetInviteCodesSortPatterns on AdminGetInviteCodesSort { -/// A variant of `map` that fallback to returning `orElse`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeMap({TResult Function( AdminGetInviteCodesSortKnownValue value)? knownValue,TResult Function( AdminGetInviteCodesSortUnknown value)? unknown,required TResult orElse(),}){ -final _that = this; -switch (_that) { -case AdminGetInviteCodesSortKnownValue() when knownValue != null: -return knownValue(_that);case AdminGetInviteCodesSortUnknown() when unknown != null: -return unknown(_that);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// Callbacks receives the raw object, upcasted. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case final Subclass2 value: -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult map({required TResult Function( AdminGetInviteCodesSortKnownValue value) knownValue,required TResult Function( AdminGetInviteCodesSortUnknown value) unknown,}){ -final _that = this; -switch (_that) { -case AdminGetInviteCodesSortKnownValue(): -return knownValue(_that);case AdminGetInviteCodesSortUnknown(): -return unknown(_that);case _: - throw StateError('Unexpected subclass'); - -} -} -/// A variant of `map` that fallback to returning `null`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? mapOrNull({TResult? Function( AdminGetInviteCodesSortKnownValue value)? knownValue,TResult? Function( AdminGetInviteCodesSortUnknown value)? unknown,}){ -final _that = this; -switch (_that) { -case AdminGetInviteCodesSortKnownValue() when knownValue != null: -return knownValue(_that);case AdminGetInviteCodesSortUnknown() when unknown != null: -return unknown(_that);case _: - return null; - -} -} -/// A variant of `when` that fallback to an `orElse` callback. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeWhen({TResult Function( KnownAdminGetInviteCodesSort data)? knownValue,TResult Function( String data)? unknown,required TResult orElse(),}) {final _that = this; -switch (_that) { -case AdminGetInviteCodesSortKnownValue() when knownValue != null: -return knownValue(_that.data);case AdminGetInviteCodesSortUnknown() when unknown != null: -return unknown(_that.data);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// As opposed to `map`, this offers destructuring. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case Subclass2(:final field2): -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult when({required TResult Function( KnownAdminGetInviteCodesSort data) knownValue,required TResult Function( String data) unknown,}) {final _that = this; -switch (_that) { -case AdminGetInviteCodesSortKnownValue(): -return knownValue(_that.data);case AdminGetInviteCodesSortUnknown(): -return unknown(_that.data);case _: - throw StateError('Unexpected subclass'); - -} -} -/// A variant of `when` that fallback to returning `null` -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? whenOrNull({TResult? Function( KnownAdminGetInviteCodesSort data)? knownValue,TResult? Function( String data)? unknown,}) {final _that = this; -switch (_that) { -case AdminGetInviteCodesSortKnownValue() when knownValue != null: -return knownValue(_that.data);case AdminGetInviteCodesSortUnknown() when unknown != null: -return unknown(_that.data);case _: - return null; - -} -} - -} - -/// @nodoc - - -class AdminGetInviteCodesSortKnownValue extends AdminGetInviteCodesSort { - const AdminGetInviteCodesSortKnownValue({required this.data}): super._(); - - -@override final KnownAdminGetInviteCodesSort data; - -/// Create a copy of AdminGetInviteCodesSort -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$AdminGetInviteCodesSortKnownValueCopyWith get copyWith => _$AdminGetInviteCodesSortKnownValueCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is AdminGetInviteCodesSortKnownValue&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'AdminGetInviteCodesSort.knownValue(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $AdminGetInviteCodesSortKnownValueCopyWith<$Res> implements $AdminGetInviteCodesSortCopyWith<$Res> { - factory $AdminGetInviteCodesSortKnownValueCopyWith(AdminGetInviteCodesSortKnownValue value, $Res Function(AdminGetInviteCodesSortKnownValue) _then) = _$AdminGetInviteCodesSortKnownValueCopyWithImpl; -@useResult -$Res call({ - KnownAdminGetInviteCodesSort data -}); - - - - -} -/// @nodoc -class _$AdminGetInviteCodesSortKnownValueCopyWithImpl<$Res> - implements $AdminGetInviteCodesSortKnownValueCopyWith<$Res> { - _$AdminGetInviteCodesSortKnownValueCopyWithImpl(this._self, this._then); - - final AdminGetInviteCodesSortKnownValue _self; - final $Res Function(AdminGetInviteCodesSortKnownValue) _then; - -/// Create a copy of AdminGetInviteCodesSort -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(AdminGetInviteCodesSortKnownValue( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as KnownAdminGetInviteCodesSort, - )); -} - - -} - -/// @nodoc - - -class AdminGetInviteCodesSortUnknown extends AdminGetInviteCodesSort { - const AdminGetInviteCodesSortUnknown({required this.data}): super._(); - - -@override final String data; - -/// Create a copy of AdminGetInviteCodesSort -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$AdminGetInviteCodesSortUnknownCopyWith get copyWith => _$AdminGetInviteCodesSortUnknownCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is AdminGetInviteCodesSortUnknown&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'AdminGetInviteCodesSort.unknown(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $AdminGetInviteCodesSortUnknownCopyWith<$Res> implements $AdminGetInviteCodesSortCopyWith<$Res> { - factory $AdminGetInviteCodesSortUnknownCopyWith(AdminGetInviteCodesSortUnknown value, $Res Function(AdminGetInviteCodesSortUnknown) _then) = _$AdminGetInviteCodesSortUnknownCopyWithImpl; -@useResult -$Res call({ - String data -}); - - - - -} -/// @nodoc -class _$AdminGetInviteCodesSortUnknownCopyWithImpl<$Res> - implements $AdminGetInviteCodesSortUnknownCopyWith<$Res> { - _$AdminGetInviteCodesSortUnknownCopyWithImpl(this._self, this._then); - - final AdminGetInviteCodesSortUnknown _self; - final $Res Function(AdminGetInviteCodesSortUnknown) _then; - -/// Create a copy of AdminGetInviteCodesSort -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(AdminGetInviteCodesSortUnknown( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as String, - )); -} - - -} - -// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/admin/get_subject_status.dart b/packages/poptart_lex/lib/com/atproto/admin/get_subject_status.dart index fe14dc26d..f7d4d6dd0 100644 --- a/packages/poptart_lex/lib/com/atproto/admin/get_subject_status.dart +++ b/packages/poptart_lex/lib/com/atproto/admin/get_subject_status.dart @@ -10,4 +10,4 @@ export 'get_subject_status/descriptor.dart'; export 'get_subject_status/input.dart'; export 'get_subject_status/output.dart'; -export 'get_subject_status/union_main_subject.dart'; +export 'get_subject_status/union_main_output_subject.dart'; diff --git a/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/output.dart b/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/output.dart index 3befcf445..1b72b4fba 100644 --- a/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/output.dart +++ b/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/output.dart @@ -7,7 +7,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:poptart_core/poptart_core.dart'; import 'package:poptart_core/internals.dart'; -import './union_main_subject.dart'; +import './union_main_output_subject.dart'; import '../defs/status_attr.dart'; part 'output.freezed.dart'; @@ -23,8 +23,8 @@ abstract class AdminGetSubjectStatusOutput with _$AdminGetSubjectStatusOutput { @JsonSerializable(includeIfNull: false) const factory AdminGetSubjectStatusOutput({ - @UAdminGetSubjectStatusSubjectConverter() - required UAdminGetSubjectStatusSubject subject, + @UAdminGetSubjectStatusOutputSubjectConverter() + required UAdminGetSubjectStatusOutputSubject subject, @StatusAttrConverter() StatusAttr? takedown, @StatusAttrConverter() StatusAttr? deactivated, diff --git a/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/output.freezed.dart b/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/output.freezed.dart index 88279a850..0ea952d43 100644 --- a/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/output.freezed.dart +++ b/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/output.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$AdminGetSubjectStatusOutput { -@UAdminGetSubjectStatusSubjectConverter() UAdminGetSubjectStatusSubject get subject;@StatusAttrConverter() StatusAttr? get takedown;@StatusAttrConverter() StatusAttr? get deactivated; Map? get $unknown; +@UAdminGetSubjectStatusOutputSubjectConverter() UAdminGetSubjectStatusOutputSubject get subject;@StatusAttrConverter() StatusAttr? get takedown;@StatusAttrConverter() StatusAttr? get deactivated; Map? get $unknown; /// Create a copy of AdminGetSubjectStatusOutput /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -48,11 +48,11 @@ abstract mixin class $AdminGetSubjectStatusOutputCopyWith<$Res> { factory $AdminGetSubjectStatusOutputCopyWith(AdminGetSubjectStatusOutput value, $Res Function(AdminGetSubjectStatusOutput) _then) = _$AdminGetSubjectStatusOutputCopyWithImpl; @useResult $Res call({ -@UAdminGetSubjectStatusSubjectConverter() UAdminGetSubjectStatusSubject subject,@StatusAttrConverter() StatusAttr? takedown,@StatusAttrConverter() StatusAttr? deactivated, Map? $unknown +@UAdminGetSubjectStatusOutputSubjectConverter() UAdminGetSubjectStatusOutputSubject subject,@StatusAttrConverter() StatusAttr? takedown,@StatusAttrConverter() StatusAttr? deactivated, Map? $unknown }); -$UAdminGetSubjectStatusSubjectCopyWith<$Res> get subject;$StatusAttrCopyWith<$Res>? get takedown;$StatusAttrCopyWith<$Res>? get deactivated; +$UAdminGetSubjectStatusOutputSubjectCopyWith<$Res> get subject;$StatusAttrCopyWith<$Res>? get takedown;$StatusAttrCopyWith<$Res>? get deactivated; } /// @nodoc @@ -68,7 +68,7 @@ class _$AdminGetSubjectStatusOutputCopyWithImpl<$Res> @pragma('vm:prefer-inline') @override $Res call({Object? subject = null,Object? takedown = freezed,Object? deactivated = freezed,Object? $unknown = freezed,}) { return _then(_self.copyWith( subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable -as UAdminGetSubjectStatusSubject,takedown: freezed == takedown ? _self.takedown : takedown // ignore: cast_nullable_to_non_nullable +as UAdminGetSubjectStatusOutputSubject,takedown: freezed == takedown ? _self.takedown : takedown // ignore: cast_nullable_to_non_nullable as StatusAttr?,deactivated: freezed == deactivated ? _self.deactivated : deactivated // ignore: cast_nullable_to_non_nullable as StatusAttr?,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, @@ -78,9 +78,9 @@ as Map?, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$UAdminGetSubjectStatusSubjectCopyWith<$Res> get subject { +$UAdminGetSubjectStatusOutputSubjectCopyWith<$Res> get subject { - return $UAdminGetSubjectStatusSubjectCopyWith<$Res>(_self.subject, (value) { + return $UAdminGetSubjectStatusOutputSubjectCopyWith<$Res>(_self.subject, (value) { return _then(_self.copyWith(subject: value)); }); }/// Create a copy of AdminGetSubjectStatusOutput @@ -189,7 +189,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function(@UAdminGetSubjectStatusSubjectConverter() UAdminGetSubjectStatusSubject subject, @StatusAttrConverter() StatusAttr? takedown, @StatusAttrConverter() StatusAttr? deactivated, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function(@UAdminGetSubjectStatusOutputSubjectConverter() UAdminGetSubjectStatusOutputSubject subject, @StatusAttrConverter() StatusAttr? takedown, @StatusAttrConverter() StatusAttr? deactivated, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _AdminGetSubjectStatusOutput() when $default != null: return $default(_that.subject,_that.takedown,_that.deactivated,_that.$unknown);case _: @@ -210,7 +210,7 @@ return $default(_that.subject,_that.takedown,_that.deactivated,_that.$unknown);c /// } /// ``` -@optionalTypeArgs TResult when(TResult Function(@UAdminGetSubjectStatusSubjectConverter() UAdminGetSubjectStatusSubject subject, @StatusAttrConverter() StatusAttr? takedown, @StatusAttrConverter() StatusAttr? deactivated, Map? $unknown) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function(@UAdminGetSubjectStatusOutputSubjectConverter() UAdminGetSubjectStatusOutputSubject subject, @StatusAttrConverter() StatusAttr? takedown, @StatusAttrConverter() StatusAttr? deactivated, Map? $unknown) $default,) {final _that = this; switch (_that) { case _AdminGetSubjectStatusOutput(): return $default(_that.subject,_that.takedown,_that.deactivated,_that.$unknown);case _: @@ -230,7 +230,7 @@ return $default(_that.subject,_that.takedown,_that.deactivated,_that.$unknown);c /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function(@UAdminGetSubjectStatusSubjectConverter() UAdminGetSubjectStatusSubject subject, @StatusAttrConverter() StatusAttr? takedown, @StatusAttrConverter() StatusAttr? deactivated, Map? $unknown)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function(@UAdminGetSubjectStatusOutputSubjectConverter() UAdminGetSubjectStatusOutputSubject subject, @StatusAttrConverter() StatusAttr? takedown, @StatusAttrConverter() StatusAttr? deactivated, Map? $unknown)? $default,) {final _that = this; switch (_that) { case _AdminGetSubjectStatusOutput() when $default != null: return $default(_that.subject,_that.takedown,_that.deactivated,_that.$unknown);case _: @@ -245,10 +245,10 @@ return $default(_that.subject,_that.takedown,_that.deactivated,_that.$unknown);c @JsonSerializable(includeIfNull: false) class _AdminGetSubjectStatusOutput implements AdminGetSubjectStatusOutput { - const _AdminGetSubjectStatusOutput({@UAdminGetSubjectStatusSubjectConverter() required this.subject, @StatusAttrConverter() this.takedown, @StatusAttrConverter() this.deactivated, final Map? $unknown}): _$unknown = $unknown; + const _AdminGetSubjectStatusOutput({@UAdminGetSubjectStatusOutputSubjectConverter() required this.subject, @StatusAttrConverter() this.takedown, @StatusAttrConverter() this.deactivated, final Map? $unknown}): _$unknown = $unknown; factory _AdminGetSubjectStatusOutput.fromJson(Map json) => _$AdminGetSubjectStatusOutputFromJson(json); -@override@UAdminGetSubjectStatusSubjectConverter() final UAdminGetSubjectStatusSubject subject; +@override@UAdminGetSubjectStatusOutputSubjectConverter() final UAdminGetSubjectStatusOutputSubject subject; @override@StatusAttrConverter() final StatusAttr? takedown; @override@StatusAttrConverter() final StatusAttr? deactivated; final Map? _$unknown; @@ -294,11 +294,11 @@ abstract mixin class _$AdminGetSubjectStatusOutputCopyWith<$Res> implements $Adm factory _$AdminGetSubjectStatusOutputCopyWith(_AdminGetSubjectStatusOutput value, $Res Function(_AdminGetSubjectStatusOutput) _then) = __$AdminGetSubjectStatusOutputCopyWithImpl; @override @useResult $Res call({ -@UAdminGetSubjectStatusSubjectConverter() UAdminGetSubjectStatusSubject subject,@StatusAttrConverter() StatusAttr? takedown,@StatusAttrConverter() StatusAttr? deactivated, Map? $unknown +@UAdminGetSubjectStatusOutputSubjectConverter() UAdminGetSubjectStatusOutputSubject subject,@StatusAttrConverter() StatusAttr? takedown,@StatusAttrConverter() StatusAttr? deactivated, Map? $unknown }); -@override $UAdminGetSubjectStatusSubjectCopyWith<$Res> get subject;@override $StatusAttrCopyWith<$Res>? get takedown;@override $StatusAttrCopyWith<$Res>? get deactivated; +@override $UAdminGetSubjectStatusOutputSubjectCopyWith<$Res> get subject;@override $StatusAttrCopyWith<$Res>? get takedown;@override $StatusAttrCopyWith<$Res>? get deactivated; } /// @nodoc @@ -314,7 +314,7 @@ class __$AdminGetSubjectStatusOutputCopyWithImpl<$Res> @override @pragma('vm:prefer-inline') $Res call({Object? subject = null,Object? takedown = freezed,Object? deactivated = freezed,Object? $unknown = freezed,}) { return _then(_AdminGetSubjectStatusOutput( subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable -as UAdminGetSubjectStatusSubject,takedown: freezed == takedown ? _self.takedown : takedown // ignore: cast_nullable_to_non_nullable +as UAdminGetSubjectStatusOutputSubject,takedown: freezed == takedown ? _self.takedown : takedown // ignore: cast_nullable_to_non_nullable as StatusAttr?,deactivated: freezed == deactivated ? _self.deactivated : deactivated // ignore: cast_nullable_to_non_nullable as StatusAttr?,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, @@ -325,9 +325,9 @@ as Map?, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$UAdminGetSubjectStatusSubjectCopyWith<$Res> get subject { +$UAdminGetSubjectStatusOutputSubjectCopyWith<$Res> get subject { - return $UAdminGetSubjectStatusSubjectCopyWith<$Res>(_self.subject, (value) { + return $UAdminGetSubjectStatusOutputSubjectCopyWith<$Res>(_self.subject, (value) { return _then(_self.copyWith(subject: value)); }); }/// Create a copy of AdminGetSubjectStatusOutput diff --git a/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/output.g.dart b/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/output.g.dart index c1bd03844..88d5ad0c2 100644 --- a/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/output.g.dart +++ b/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/output.g.dart @@ -13,7 +13,7 @@ _AdminGetSubjectStatusOutput _$AdminGetSubjectStatusOutputFromJson(Map json) => final val = _AdminGetSubjectStatusOutput( subject: $checkedConvert( 'subject', - (v) => const UAdminGetSubjectStatusSubjectConverter().fromJson( + (v) => const UAdminGetSubjectStatusOutputSubjectConverter().fromJson( v as Map, ), ), @@ -42,7 +42,7 @@ _AdminGetSubjectStatusOutput _$AdminGetSubjectStatusOutputFromJson(Map json) => Map _$AdminGetSubjectStatusOutputToJson( _AdminGetSubjectStatusOutput instance, ) => { - 'subject': const UAdminGetSubjectStatusSubjectConverter().toJson( + 'subject': const UAdminGetSubjectStatusOutputSubjectConverter().toJson( instance.subject, ), 'takedown': ?_$JsonConverterToJson, StatusAttr>( diff --git a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/union_main_subject.dart b/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/union_main_output_subject.dart similarity index 56% rename from packages/poptart_lex/lib/com/atproto/admin/update_subject_status/union_main_subject.dart rename to packages/poptart_lex/lib/com/atproto/admin/get_subject_status/union_main_output_subject.dart index 995da9e33..1a2c32c09 100644 --- a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/union_main_subject.dart +++ b/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/union_main_output_subject.dart @@ -10,87 +10,90 @@ import '../defs/repo_ref.dart'; import '../../repo/strong_ref/main.dart'; import '../defs/repo_blob_ref.dart'; -part 'union_main_subject.freezed.dart'; +part 'union_main_output_subject.freezed.dart'; // ************************************************************************** // LexGenerator // ************************************************************************** @freezed -sealed class UAdminUpdateSubjectStatusSubject - with _$UAdminUpdateSubjectStatusSubject { - const UAdminUpdateSubjectStatusSubject._(); +sealed class UAdminGetSubjectStatusOutputSubject + with _$UAdminGetSubjectStatusOutputSubject { + const UAdminGetSubjectStatusOutputSubject._(); - const factory UAdminUpdateSubjectStatusSubject.repoRef({ + const factory UAdminGetSubjectStatusOutputSubject.repoRef({ required RepoRef data, - }) = UAdminUpdateSubjectStatusSubjectRepoRef; - const factory UAdminUpdateSubjectStatusSubject.repoStrongRef({ + }) = UAdminGetSubjectStatusOutputSubjectRepoRef; + const factory UAdminGetSubjectStatusOutputSubject.repoStrongRef({ required RepoStrongRef data, - }) = UAdminUpdateSubjectStatusSubjectRepoStrongRef; - const factory UAdminUpdateSubjectStatusSubject.repoBlobRef({ + }) = UAdminGetSubjectStatusOutputSubjectRepoStrongRef; + const factory UAdminGetSubjectStatusOutputSubject.repoBlobRef({ required RepoBlobRef data, - }) = UAdminUpdateSubjectStatusSubjectRepoBlobRef; + }) = UAdminGetSubjectStatusOutputSubjectRepoBlobRef; - const factory UAdminUpdateSubjectStatusSubject.unknown({ + const factory UAdminGetSubjectStatusOutputSubject.unknown({ required Map data, - }) = UAdminUpdateSubjectStatusSubjectUnknown; + }) = UAdminGetSubjectStatusOutputSubjectUnknown; Map toJson() => - const UAdminUpdateSubjectStatusSubjectConverter().toJson(this); + const UAdminGetSubjectStatusOutputSubjectConverter().toJson(this); } -extension UAdminUpdateSubjectStatusSubjectExtension - on UAdminUpdateSubjectStatusSubject { - bool get isRepoRef => isA(this); +extension UAdminGetSubjectStatusOutputSubjectExtension + on UAdminGetSubjectStatusOutputSubject { + bool get isRepoRef => isA(this); bool get isNotRepoRef => !isRepoRef; RepoRef? get repoRef => isRepoRef ? data as RepoRef : null; bool get isRepoStrongRef => - isA(this); + isA(this); bool get isNotRepoStrongRef => !isRepoStrongRef; RepoStrongRef? get repoStrongRef => isRepoStrongRef ? data as RepoStrongRef : null; bool get isRepoBlobRef => - isA(this); + isA(this); bool get isNotRepoBlobRef => !isRepoBlobRef; RepoBlobRef? get repoBlobRef => isRepoBlobRef ? data as RepoBlobRef : null; - bool get isUnknown => isA(this); + bool get isUnknown => isA(this); bool get isNotUnknown => !isUnknown; Map? get unknown => isUnknown ? data as Map : null; } -final class UAdminUpdateSubjectStatusSubjectConverter +final class UAdminGetSubjectStatusOutputSubjectConverter implements - JsonConverter> { - const UAdminUpdateSubjectStatusSubjectConverter(); + JsonConverter< + UAdminGetSubjectStatusOutputSubject, + Map + > { + const UAdminGetSubjectStatusOutputSubjectConverter(); @override - UAdminUpdateSubjectStatusSubject fromJson(Map json) { + UAdminGetSubjectStatusOutputSubject fromJson(Map json) { try { if (RepoRef.validate(json)) { - return UAdminUpdateSubjectStatusSubject.repoRef( + return UAdminGetSubjectStatusOutputSubject.repoRef( data: const RepoRefConverter().fromJson(json), ); } if (RepoStrongRef.validate(json)) { - return UAdminUpdateSubjectStatusSubject.repoStrongRef( + return UAdminGetSubjectStatusOutputSubject.repoStrongRef( data: const RepoStrongRefConverter().fromJson(json), ); } if (RepoBlobRef.validate(json)) { - return UAdminUpdateSubjectStatusSubject.repoBlobRef( + return UAdminGetSubjectStatusOutputSubject.repoBlobRef( data: const RepoBlobRefConverter().fromJson(json), ); } - return UAdminUpdateSubjectStatusSubject.unknown(data: json); + return UAdminGetSubjectStatusOutputSubject.unknown(data: json); } catch (_) { - return UAdminUpdateSubjectStatusSubject.unknown(data: json); + return UAdminGetSubjectStatusOutputSubject.unknown(data: json); } } @override - Map toJson(UAdminUpdateSubjectStatusSubject object) => + Map toJson(UAdminGetSubjectStatusOutputSubject object) => object.when( repoRef: (data) => const RepoRefConverter().toJson(data), repoStrongRef: (data) => const RepoStrongRefConverter().toJson(data), diff --git a/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/union_main_output_subject.freezed.dart b/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/union_main_output_subject.freezed.dart new file mode 100644 index 000000000..b5666aadc --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/union_main_output_subject.freezed.dart @@ -0,0 +1,483 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'union_main_output_subject.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$UAdminGetSubjectStatusOutputSubject { + + Object get data; + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminGetSubjectStatusOutputSubject&&const DeepCollectionEquality().equals(other.data, data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); + +@override +String toString() { + return 'UAdminGetSubjectStatusOutputSubject(data: $data)'; +} + + +} + +/// @nodoc +class $UAdminGetSubjectStatusOutputSubjectCopyWith<$Res> { +$UAdminGetSubjectStatusOutputSubjectCopyWith(UAdminGetSubjectStatusOutputSubject _, $Res Function(UAdminGetSubjectStatusOutputSubject) __); +} + + +/// Adds pattern-matching-related methods to [UAdminGetSubjectStatusOutputSubject]. +extension UAdminGetSubjectStatusOutputSubjectPatterns on UAdminGetSubjectStatusOutputSubject { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap({TResult Function( UAdminGetSubjectStatusOutputSubjectRepoRef value)? repoRef,TResult Function( UAdminGetSubjectStatusOutputSubjectRepoStrongRef value)? repoStrongRef,TResult Function( UAdminGetSubjectStatusOutputSubjectRepoBlobRef value)? repoBlobRef,TResult Function( UAdminGetSubjectStatusOutputSubjectUnknown value)? unknown,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case UAdminGetSubjectStatusOutputSubjectRepoRef() when repoRef != null: +return repoRef(_that);case UAdminGetSubjectStatusOutputSubjectRepoStrongRef() when repoStrongRef != null: +return repoStrongRef(_that);case UAdminGetSubjectStatusOutputSubjectRepoBlobRef() when repoBlobRef != null: +return repoBlobRef(_that);case UAdminGetSubjectStatusOutputSubjectUnknown() when unknown != null: +return unknown(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map({required TResult Function( UAdminGetSubjectStatusOutputSubjectRepoRef value) repoRef,required TResult Function( UAdminGetSubjectStatusOutputSubjectRepoStrongRef value) repoStrongRef,required TResult Function( UAdminGetSubjectStatusOutputSubjectRepoBlobRef value) repoBlobRef,required TResult Function( UAdminGetSubjectStatusOutputSubjectUnknown value) unknown,}){ +final _that = this; +switch (_that) { +case UAdminGetSubjectStatusOutputSubjectRepoRef(): +return repoRef(_that);case UAdminGetSubjectStatusOutputSubjectRepoStrongRef(): +return repoStrongRef(_that);case UAdminGetSubjectStatusOutputSubjectRepoBlobRef(): +return repoBlobRef(_that);case UAdminGetSubjectStatusOutputSubjectUnknown(): +return unknown(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull({TResult? Function( UAdminGetSubjectStatusOutputSubjectRepoRef value)? repoRef,TResult? Function( UAdminGetSubjectStatusOutputSubjectRepoStrongRef value)? repoStrongRef,TResult? Function( UAdminGetSubjectStatusOutputSubjectRepoBlobRef value)? repoBlobRef,TResult? Function( UAdminGetSubjectStatusOutputSubjectUnknown value)? unknown,}){ +final _that = this; +switch (_that) { +case UAdminGetSubjectStatusOutputSubjectRepoRef() when repoRef != null: +return repoRef(_that);case UAdminGetSubjectStatusOutputSubjectRepoStrongRef() when repoStrongRef != null: +return repoStrongRef(_that);case UAdminGetSubjectStatusOutputSubjectRepoBlobRef() when repoBlobRef != null: +return repoBlobRef(_that);case UAdminGetSubjectStatusOutputSubjectUnknown() when unknown != null: +return unknown(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen({TResult Function( RepoRef data)? repoRef,TResult Function( RepoStrongRef data)? repoStrongRef,TResult Function( RepoBlobRef data)? repoBlobRef,TResult Function( Map data)? unknown,required TResult orElse(),}) {final _that = this; +switch (_that) { +case UAdminGetSubjectStatusOutputSubjectRepoRef() when repoRef != null: +return repoRef(_that.data);case UAdminGetSubjectStatusOutputSubjectRepoStrongRef() when repoStrongRef != null: +return repoStrongRef(_that.data);case UAdminGetSubjectStatusOutputSubjectRepoBlobRef() when repoBlobRef != null: +return repoBlobRef(_that.data);case UAdminGetSubjectStatusOutputSubjectUnknown() when unknown != null: +return unknown(_that.data);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when({required TResult Function( RepoRef data) repoRef,required TResult Function( RepoStrongRef data) repoStrongRef,required TResult Function( RepoBlobRef data) repoBlobRef,required TResult Function( Map data) unknown,}) {final _that = this; +switch (_that) { +case UAdminGetSubjectStatusOutputSubjectRepoRef(): +return repoRef(_that.data);case UAdminGetSubjectStatusOutputSubjectRepoStrongRef(): +return repoStrongRef(_that.data);case UAdminGetSubjectStatusOutputSubjectRepoBlobRef(): +return repoBlobRef(_that.data);case UAdminGetSubjectStatusOutputSubjectUnknown(): +return unknown(_that.data);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull({TResult? Function( RepoRef data)? repoRef,TResult? Function( RepoStrongRef data)? repoStrongRef,TResult? Function( RepoBlobRef data)? repoBlobRef,TResult? Function( Map data)? unknown,}) {final _that = this; +switch (_that) { +case UAdminGetSubjectStatusOutputSubjectRepoRef() when repoRef != null: +return repoRef(_that.data);case UAdminGetSubjectStatusOutputSubjectRepoStrongRef() when repoStrongRef != null: +return repoStrongRef(_that.data);case UAdminGetSubjectStatusOutputSubjectRepoBlobRef() when repoBlobRef != null: +return repoBlobRef(_that.data);case UAdminGetSubjectStatusOutputSubjectUnknown() when unknown != null: +return unknown(_that.data);case _: + return null; + +} +} + +} + +/// @nodoc + + +class UAdminGetSubjectStatusOutputSubjectRepoRef extends UAdminGetSubjectStatusOutputSubject { + const UAdminGetSubjectStatusOutputSubjectRepoRef({required this.data}): super._(); + + +@override final RepoRef data; + +/// Create a copy of UAdminGetSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UAdminGetSubjectStatusOutputSubjectRepoRefCopyWith get copyWith => _$UAdminGetSubjectStatusOutputSubjectRepoRefCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminGetSubjectStatusOutputSubjectRepoRef&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'UAdminGetSubjectStatusOutputSubject.repoRef(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UAdminGetSubjectStatusOutputSubjectRepoRefCopyWith<$Res> implements $UAdminGetSubjectStatusOutputSubjectCopyWith<$Res> { + factory $UAdminGetSubjectStatusOutputSubjectRepoRefCopyWith(UAdminGetSubjectStatusOutputSubjectRepoRef value, $Res Function(UAdminGetSubjectStatusOutputSubjectRepoRef) _then) = _$UAdminGetSubjectStatusOutputSubjectRepoRefCopyWithImpl; +@useResult +$Res call({ + RepoRef data +}); + + +$RepoRefCopyWith<$Res> get data; + +} +/// @nodoc +class _$UAdminGetSubjectStatusOutputSubjectRepoRefCopyWithImpl<$Res> + implements $UAdminGetSubjectStatusOutputSubjectRepoRefCopyWith<$Res> { + _$UAdminGetSubjectStatusOutputSubjectRepoRefCopyWithImpl(this._self, this._then); + + final UAdminGetSubjectStatusOutputSubjectRepoRef _self; + final $Res Function(UAdminGetSubjectStatusOutputSubjectRepoRef) _then; + +/// Create a copy of UAdminGetSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UAdminGetSubjectStatusOutputSubjectRepoRef( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as RepoRef, + )); +} + +/// Create a copy of UAdminGetSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$RepoRefCopyWith<$Res> get data { + + return $RepoRefCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class UAdminGetSubjectStatusOutputSubjectRepoStrongRef extends UAdminGetSubjectStatusOutputSubject { + const UAdminGetSubjectStatusOutputSubjectRepoStrongRef({required this.data}): super._(); + + +@override final RepoStrongRef data; + +/// Create a copy of UAdminGetSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UAdminGetSubjectStatusOutputSubjectRepoStrongRefCopyWith get copyWith => _$UAdminGetSubjectStatusOutputSubjectRepoStrongRefCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminGetSubjectStatusOutputSubjectRepoStrongRef&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'UAdminGetSubjectStatusOutputSubject.repoStrongRef(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UAdminGetSubjectStatusOutputSubjectRepoStrongRefCopyWith<$Res> implements $UAdminGetSubjectStatusOutputSubjectCopyWith<$Res> { + factory $UAdminGetSubjectStatusOutputSubjectRepoStrongRefCopyWith(UAdminGetSubjectStatusOutputSubjectRepoStrongRef value, $Res Function(UAdminGetSubjectStatusOutputSubjectRepoStrongRef) _then) = _$UAdminGetSubjectStatusOutputSubjectRepoStrongRefCopyWithImpl; +@useResult +$Res call({ + RepoStrongRef data +}); + + +$RepoStrongRefCopyWith<$Res> get data; + +} +/// @nodoc +class _$UAdminGetSubjectStatusOutputSubjectRepoStrongRefCopyWithImpl<$Res> + implements $UAdminGetSubjectStatusOutputSubjectRepoStrongRefCopyWith<$Res> { + _$UAdminGetSubjectStatusOutputSubjectRepoStrongRefCopyWithImpl(this._self, this._then); + + final UAdminGetSubjectStatusOutputSubjectRepoStrongRef _self; + final $Res Function(UAdminGetSubjectStatusOutputSubjectRepoStrongRef) _then; + +/// Create a copy of UAdminGetSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UAdminGetSubjectStatusOutputSubjectRepoStrongRef( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as RepoStrongRef, + )); +} + +/// Create a copy of UAdminGetSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$RepoStrongRefCopyWith<$Res> get data { + + return $RepoStrongRefCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class UAdminGetSubjectStatusOutputSubjectRepoBlobRef extends UAdminGetSubjectStatusOutputSubject { + const UAdminGetSubjectStatusOutputSubjectRepoBlobRef({required this.data}): super._(); + + +@override final RepoBlobRef data; + +/// Create a copy of UAdminGetSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UAdminGetSubjectStatusOutputSubjectRepoBlobRefCopyWith get copyWith => _$UAdminGetSubjectStatusOutputSubjectRepoBlobRefCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminGetSubjectStatusOutputSubjectRepoBlobRef&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'UAdminGetSubjectStatusOutputSubject.repoBlobRef(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UAdminGetSubjectStatusOutputSubjectRepoBlobRefCopyWith<$Res> implements $UAdminGetSubjectStatusOutputSubjectCopyWith<$Res> { + factory $UAdminGetSubjectStatusOutputSubjectRepoBlobRefCopyWith(UAdminGetSubjectStatusOutputSubjectRepoBlobRef value, $Res Function(UAdminGetSubjectStatusOutputSubjectRepoBlobRef) _then) = _$UAdminGetSubjectStatusOutputSubjectRepoBlobRefCopyWithImpl; +@useResult +$Res call({ + RepoBlobRef data +}); + + +$RepoBlobRefCopyWith<$Res> get data; + +} +/// @nodoc +class _$UAdminGetSubjectStatusOutputSubjectRepoBlobRefCopyWithImpl<$Res> + implements $UAdminGetSubjectStatusOutputSubjectRepoBlobRefCopyWith<$Res> { + _$UAdminGetSubjectStatusOutputSubjectRepoBlobRefCopyWithImpl(this._self, this._then); + + final UAdminGetSubjectStatusOutputSubjectRepoBlobRef _self; + final $Res Function(UAdminGetSubjectStatusOutputSubjectRepoBlobRef) _then; + +/// Create a copy of UAdminGetSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UAdminGetSubjectStatusOutputSubjectRepoBlobRef( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as RepoBlobRef, + )); +} + +/// Create a copy of UAdminGetSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$RepoBlobRefCopyWith<$Res> get data { + + return $RepoBlobRefCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class UAdminGetSubjectStatusOutputSubjectUnknown extends UAdminGetSubjectStatusOutputSubject { + const UAdminGetSubjectStatusOutputSubjectUnknown({required final Map data}): _data = data,super._(); + + + final Map _data; +@override Map get data { + if (_data is EqualUnmodifiableMapView) return _data; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_data); +} + + +/// Create a copy of UAdminGetSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UAdminGetSubjectStatusOutputSubjectUnknownCopyWith get copyWith => _$UAdminGetSubjectStatusOutputSubjectUnknownCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminGetSubjectStatusOutputSubjectUnknown&&const DeepCollectionEquality().equals(other._data, _data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_data)); + +@override +String toString() { + return 'UAdminGetSubjectStatusOutputSubject.unknown(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UAdminGetSubjectStatusOutputSubjectUnknownCopyWith<$Res> implements $UAdminGetSubjectStatusOutputSubjectCopyWith<$Res> { + factory $UAdminGetSubjectStatusOutputSubjectUnknownCopyWith(UAdminGetSubjectStatusOutputSubjectUnknown value, $Res Function(UAdminGetSubjectStatusOutputSubjectUnknown) _then) = _$UAdminGetSubjectStatusOutputSubjectUnknownCopyWithImpl; +@useResult +$Res call({ + Map data +}); + + + + +} +/// @nodoc +class _$UAdminGetSubjectStatusOutputSubjectUnknownCopyWithImpl<$Res> + implements $UAdminGetSubjectStatusOutputSubjectUnknownCopyWith<$Res> { + _$UAdminGetSubjectStatusOutputSubjectUnknownCopyWithImpl(this._self, this._then); + + final UAdminGetSubjectStatusOutputSubjectUnknown _self; + final $Res Function(UAdminGetSubjectStatusOutputSubjectUnknown) _then; + +/// Create a copy of UAdminGetSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UAdminGetSubjectStatusOutputSubjectUnknown( +data: null == data ? _self._data : data // ignore: cast_nullable_to_non_nullable +as Map, + )); +} + + +} + +// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/union_main_subject.freezed.dart b/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/union_main_subject.freezed.dart deleted file mode 100644 index ebc70978e..000000000 --- a/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/union_main_subject.freezed.dart +++ /dev/null @@ -1,483 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND -// coverage:ignore-file -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'union_main_subject.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; -/// @nodoc -mixin _$UAdminGetSubjectStatusSubject { - - Object get data; - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminGetSubjectStatusSubject&&const DeepCollectionEquality().equals(other.data, data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); - -@override -String toString() { - return 'UAdminGetSubjectStatusSubject(data: $data)'; -} - - -} - -/// @nodoc -class $UAdminGetSubjectStatusSubjectCopyWith<$Res> { -$UAdminGetSubjectStatusSubjectCopyWith(UAdminGetSubjectStatusSubject _, $Res Function(UAdminGetSubjectStatusSubject) __); -} - - -/// Adds pattern-matching-related methods to [UAdminGetSubjectStatusSubject]. -extension UAdminGetSubjectStatusSubjectPatterns on UAdminGetSubjectStatusSubject { -/// A variant of `map` that fallback to returning `orElse`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeMap({TResult Function( UAdminGetSubjectStatusSubjectRepoRef value)? repoRef,TResult Function( UAdminGetSubjectStatusSubjectRepoStrongRef value)? repoStrongRef,TResult Function( UAdminGetSubjectStatusSubjectRepoBlobRef value)? repoBlobRef,TResult Function( UAdminGetSubjectStatusSubjectUnknown value)? unknown,required TResult orElse(),}){ -final _that = this; -switch (_that) { -case UAdminGetSubjectStatusSubjectRepoRef() when repoRef != null: -return repoRef(_that);case UAdminGetSubjectStatusSubjectRepoStrongRef() when repoStrongRef != null: -return repoStrongRef(_that);case UAdminGetSubjectStatusSubjectRepoBlobRef() when repoBlobRef != null: -return repoBlobRef(_that);case UAdminGetSubjectStatusSubjectUnknown() when unknown != null: -return unknown(_that);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// Callbacks receives the raw object, upcasted. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case final Subclass2 value: -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult map({required TResult Function( UAdminGetSubjectStatusSubjectRepoRef value) repoRef,required TResult Function( UAdminGetSubjectStatusSubjectRepoStrongRef value) repoStrongRef,required TResult Function( UAdminGetSubjectStatusSubjectRepoBlobRef value) repoBlobRef,required TResult Function( UAdminGetSubjectStatusSubjectUnknown value) unknown,}){ -final _that = this; -switch (_that) { -case UAdminGetSubjectStatusSubjectRepoRef(): -return repoRef(_that);case UAdminGetSubjectStatusSubjectRepoStrongRef(): -return repoStrongRef(_that);case UAdminGetSubjectStatusSubjectRepoBlobRef(): -return repoBlobRef(_that);case UAdminGetSubjectStatusSubjectUnknown(): -return unknown(_that);} -} -/// A variant of `map` that fallback to returning `null`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? mapOrNull({TResult? Function( UAdminGetSubjectStatusSubjectRepoRef value)? repoRef,TResult? Function( UAdminGetSubjectStatusSubjectRepoStrongRef value)? repoStrongRef,TResult? Function( UAdminGetSubjectStatusSubjectRepoBlobRef value)? repoBlobRef,TResult? Function( UAdminGetSubjectStatusSubjectUnknown value)? unknown,}){ -final _that = this; -switch (_that) { -case UAdminGetSubjectStatusSubjectRepoRef() when repoRef != null: -return repoRef(_that);case UAdminGetSubjectStatusSubjectRepoStrongRef() when repoStrongRef != null: -return repoStrongRef(_that);case UAdminGetSubjectStatusSubjectRepoBlobRef() when repoBlobRef != null: -return repoBlobRef(_that);case UAdminGetSubjectStatusSubjectUnknown() when unknown != null: -return unknown(_that);case _: - return null; - -} -} -/// A variant of `when` that fallback to an `orElse` callback. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeWhen({TResult Function( RepoRef data)? repoRef,TResult Function( RepoStrongRef data)? repoStrongRef,TResult Function( RepoBlobRef data)? repoBlobRef,TResult Function( Map data)? unknown,required TResult orElse(),}) {final _that = this; -switch (_that) { -case UAdminGetSubjectStatusSubjectRepoRef() when repoRef != null: -return repoRef(_that.data);case UAdminGetSubjectStatusSubjectRepoStrongRef() when repoStrongRef != null: -return repoStrongRef(_that.data);case UAdminGetSubjectStatusSubjectRepoBlobRef() when repoBlobRef != null: -return repoBlobRef(_that.data);case UAdminGetSubjectStatusSubjectUnknown() when unknown != null: -return unknown(_that.data);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// As opposed to `map`, this offers destructuring. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case Subclass2(:final field2): -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult when({required TResult Function( RepoRef data) repoRef,required TResult Function( RepoStrongRef data) repoStrongRef,required TResult Function( RepoBlobRef data) repoBlobRef,required TResult Function( Map data) unknown,}) {final _that = this; -switch (_that) { -case UAdminGetSubjectStatusSubjectRepoRef(): -return repoRef(_that.data);case UAdminGetSubjectStatusSubjectRepoStrongRef(): -return repoStrongRef(_that.data);case UAdminGetSubjectStatusSubjectRepoBlobRef(): -return repoBlobRef(_that.data);case UAdminGetSubjectStatusSubjectUnknown(): -return unknown(_that.data);} -} -/// A variant of `when` that fallback to returning `null` -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? whenOrNull({TResult? Function( RepoRef data)? repoRef,TResult? Function( RepoStrongRef data)? repoStrongRef,TResult? Function( RepoBlobRef data)? repoBlobRef,TResult? Function( Map data)? unknown,}) {final _that = this; -switch (_that) { -case UAdminGetSubjectStatusSubjectRepoRef() when repoRef != null: -return repoRef(_that.data);case UAdminGetSubjectStatusSubjectRepoStrongRef() when repoStrongRef != null: -return repoStrongRef(_that.data);case UAdminGetSubjectStatusSubjectRepoBlobRef() when repoBlobRef != null: -return repoBlobRef(_that.data);case UAdminGetSubjectStatusSubjectUnknown() when unknown != null: -return unknown(_that.data);case _: - return null; - -} -} - -} - -/// @nodoc - - -class UAdminGetSubjectStatusSubjectRepoRef extends UAdminGetSubjectStatusSubject { - const UAdminGetSubjectStatusSubjectRepoRef({required this.data}): super._(); - - -@override final RepoRef data; - -/// Create a copy of UAdminGetSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$UAdminGetSubjectStatusSubjectRepoRefCopyWith get copyWith => _$UAdminGetSubjectStatusSubjectRepoRefCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminGetSubjectStatusSubjectRepoRef&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'UAdminGetSubjectStatusSubject.repoRef(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $UAdminGetSubjectStatusSubjectRepoRefCopyWith<$Res> implements $UAdminGetSubjectStatusSubjectCopyWith<$Res> { - factory $UAdminGetSubjectStatusSubjectRepoRefCopyWith(UAdminGetSubjectStatusSubjectRepoRef value, $Res Function(UAdminGetSubjectStatusSubjectRepoRef) _then) = _$UAdminGetSubjectStatusSubjectRepoRefCopyWithImpl; -@useResult -$Res call({ - RepoRef data -}); - - -$RepoRefCopyWith<$Res> get data; - -} -/// @nodoc -class _$UAdminGetSubjectStatusSubjectRepoRefCopyWithImpl<$Res> - implements $UAdminGetSubjectStatusSubjectRepoRefCopyWith<$Res> { - _$UAdminGetSubjectStatusSubjectRepoRefCopyWithImpl(this._self, this._then); - - final UAdminGetSubjectStatusSubjectRepoRef _self; - final $Res Function(UAdminGetSubjectStatusSubjectRepoRef) _then; - -/// Create a copy of UAdminGetSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(UAdminGetSubjectStatusSubjectRepoRef( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as RepoRef, - )); -} - -/// Create a copy of UAdminGetSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$RepoRefCopyWith<$Res> get data { - - return $RepoRefCopyWith<$Res>(_self.data, (value) { - return _then(_self.copyWith(data: value)); - }); -} -} - -/// @nodoc - - -class UAdminGetSubjectStatusSubjectRepoStrongRef extends UAdminGetSubjectStatusSubject { - const UAdminGetSubjectStatusSubjectRepoStrongRef({required this.data}): super._(); - - -@override final RepoStrongRef data; - -/// Create a copy of UAdminGetSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$UAdminGetSubjectStatusSubjectRepoStrongRefCopyWith get copyWith => _$UAdminGetSubjectStatusSubjectRepoStrongRefCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminGetSubjectStatusSubjectRepoStrongRef&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'UAdminGetSubjectStatusSubject.repoStrongRef(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $UAdminGetSubjectStatusSubjectRepoStrongRefCopyWith<$Res> implements $UAdminGetSubjectStatusSubjectCopyWith<$Res> { - factory $UAdminGetSubjectStatusSubjectRepoStrongRefCopyWith(UAdminGetSubjectStatusSubjectRepoStrongRef value, $Res Function(UAdminGetSubjectStatusSubjectRepoStrongRef) _then) = _$UAdminGetSubjectStatusSubjectRepoStrongRefCopyWithImpl; -@useResult -$Res call({ - RepoStrongRef data -}); - - -$RepoStrongRefCopyWith<$Res> get data; - -} -/// @nodoc -class _$UAdminGetSubjectStatusSubjectRepoStrongRefCopyWithImpl<$Res> - implements $UAdminGetSubjectStatusSubjectRepoStrongRefCopyWith<$Res> { - _$UAdminGetSubjectStatusSubjectRepoStrongRefCopyWithImpl(this._self, this._then); - - final UAdminGetSubjectStatusSubjectRepoStrongRef _self; - final $Res Function(UAdminGetSubjectStatusSubjectRepoStrongRef) _then; - -/// Create a copy of UAdminGetSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(UAdminGetSubjectStatusSubjectRepoStrongRef( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as RepoStrongRef, - )); -} - -/// Create a copy of UAdminGetSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$RepoStrongRefCopyWith<$Res> get data { - - return $RepoStrongRefCopyWith<$Res>(_self.data, (value) { - return _then(_self.copyWith(data: value)); - }); -} -} - -/// @nodoc - - -class UAdminGetSubjectStatusSubjectRepoBlobRef extends UAdminGetSubjectStatusSubject { - const UAdminGetSubjectStatusSubjectRepoBlobRef({required this.data}): super._(); - - -@override final RepoBlobRef data; - -/// Create a copy of UAdminGetSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$UAdminGetSubjectStatusSubjectRepoBlobRefCopyWith get copyWith => _$UAdminGetSubjectStatusSubjectRepoBlobRefCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminGetSubjectStatusSubjectRepoBlobRef&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'UAdminGetSubjectStatusSubject.repoBlobRef(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $UAdminGetSubjectStatusSubjectRepoBlobRefCopyWith<$Res> implements $UAdminGetSubjectStatusSubjectCopyWith<$Res> { - factory $UAdminGetSubjectStatusSubjectRepoBlobRefCopyWith(UAdminGetSubjectStatusSubjectRepoBlobRef value, $Res Function(UAdminGetSubjectStatusSubjectRepoBlobRef) _then) = _$UAdminGetSubjectStatusSubjectRepoBlobRefCopyWithImpl; -@useResult -$Res call({ - RepoBlobRef data -}); - - -$RepoBlobRefCopyWith<$Res> get data; - -} -/// @nodoc -class _$UAdminGetSubjectStatusSubjectRepoBlobRefCopyWithImpl<$Res> - implements $UAdminGetSubjectStatusSubjectRepoBlobRefCopyWith<$Res> { - _$UAdminGetSubjectStatusSubjectRepoBlobRefCopyWithImpl(this._self, this._then); - - final UAdminGetSubjectStatusSubjectRepoBlobRef _self; - final $Res Function(UAdminGetSubjectStatusSubjectRepoBlobRef) _then; - -/// Create a copy of UAdminGetSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(UAdminGetSubjectStatusSubjectRepoBlobRef( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as RepoBlobRef, - )); -} - -/// Create a copy of UAdminGetSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$RepoBlobRefCopyWith<$Res> get data { - - return $RepoBlobRefCopyWith<$Res>(_self.data, (value) { - return _then(_self.copyWith(data: value)); - }); -} -} - -/// @nodoc - - -class UAdminGetSubjectStatusSubjectUnknown extends UAdminGetSubjectStatusSubject { - const UAdminGetSubjectStatusSubjectUnknown({required final Map data}): _data = data,super._(); - - - final Map _data; -@override Map get data { - if (_data is EqualUnmodifiableMapView) return _data; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(_data); -} - - -/// Create a copy of UAdminGetSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$UAdminGetSubjectStatusSubjectUnknownCopyWith get copyWith => _$UAdminGetSubjectStatusSubjectUnknownCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminGetSubjectStatusSubjectUnknown&&const DeepCollectionEquality().equals(other._data, _data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_data)); - -@override -String toString() { - return 'UAdminGetSubjectStatusSubject.unknown(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $UAdminGetSubjectStatusSubjectUnknownCopyWith<$Res> implements $UAdminGetSubjectStatusSubjectCopyWith<$Res> { - factory $UAdminGetSubjectStatusSubjectUnknownCopyWith(UAdminGetSubjectStatusSubjectUnknown value, $Res Function(UAdminGetSubjectStatusSubjectUnknown) _then) = _$UAdminGetSubjectStatusSubjectUnknownCopyWithImpl; -@useResult -$Res call({ - Map data -}); - - - - -} -/// @nodoc -class _$UAdminGetSubjectStatusSubjectUnknownCopyWithImpl<$Res> - implements $UAdminGetSubjectStatusSubjectUnknownCopyWith<$Res> { - _$UAdminGetSubjectStatusSubjectUnknownCopyWithImpl(this._self, this._then); - - final UAdminGetSubjectStatusSubjectUnknown _self; - final $Res Function(UAdminGetSubjectStatusSubjectUnknown) _then; - -/// Create a copy of UAdminGetSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(UAdminGetSubjectStatusSubjectUnknown( -data: null == data ? _self._data : data // ignore: cast_nullable_to_non_nullable -as Map, - )); -} - - -} - -// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status.dart b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status.dart index e4b82b4dc..5e2aed84e 100644 --- a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status.dart +++ b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status.dart @@ -10,4 +10,5 @@ export 'update_subject_status/descriptor.dart'; export 'update_subject_status/input.dart'; export 'update_subject_status/output.dart'; -export 'update_subject_status/union_main_subject.dart'; +export 'update_subject_status/union_main_input_subject.dart'; +export 'update_subject_status/union_main_output_subject.dart'; diff --git a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/input.dart b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/input.dart index 58e29b01f..5c9c2ce19 100644 --- a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/input.dart +++ b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/input.dart @@ -7,7 +7,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:poptart_core/poptart_core.dart'; import 'package:poptart_core/internals.dart'; -import './union_main_subject.dart'; +import './union_main_input_subject.dart'; import '../defs/status_attr.dart'; part 'input.freezed.dart'; @@ -24,8 +24,8 @@ abstract class AdminUpdateSubjectStatusInput @JsonSerializable(includeIfNull: false) const factory AdminUpdateSubjectStatusInput({ - @UAdminUpdateSubjectStatusSubjectConverter() - required UAdminUpdateSubjectStatusSubject subject, + @UAdminUpdateSubjectStatusInputSubjectConverter() + required UAdminUpdateSubjectStatusInputSubject subject, @StatusAttrConverter() StatusAttr? takedown, @StatusAttrConverter() StatusAttr? deactivated, diff --git a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/input.freezed.dart b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/input.freezed.dart index 47a1ba383..ead9cd8ef 100644 --- a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/input.freezed.dart +++ b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/input.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$AdminUpdateSubjectStatusInput { -@UAdminUpdateSubjectStatusSubjectConverter() UAdminUpdateSubjectStatusSubject get subject;@StatusAttrConverter() StatusAttr? get takedown;@StatusAttrConverter() StatusAttr? get deactivated; Map? get $unknown; +@UAdminUpdateSubjectStatusInputSubjectConverter() UAdminUpdateSubjectStatusInputSubject get subject;@StatusAttrConverter() StatusAttr? get takedown;@StatusAttrConverter() StatusAttr? get deactivated; Map? get $unknown; /// Create a copy of AdminUpdateSubjectStatusInput /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -48,11 +48,11 @@ abstract mixin class $AdminUpdateSubjectStatusInputCopyWith<$Res> { factory $AdminUpdateSubjectStatusInputCopyWith(AdminUpdateSubjectStatusInput value, $Res Function(AdminUpdateSubjectStatusInput) _then) = _$AdminUpdateSubjectStatusInputCopyWithImpl; @useResult $Res call({ -@UAdminUpdateSubjectStatusSubjectConverter() UAdminUpdateSubjectStatusSubject subject,@StatusAttrConverter() StatusAttr? takedown,@StatusAttrConverter() StatusAttr? deactivated, Map? $unknown +@UAdminUpdateSubjectStatusInputSubjectConverter() UAdminUpdateSubjectStatusInputSubject subject,@StatusAttrConverter() StatusAttr? takedown,@StatusAttrConverter() StatusAttr? deactivated, Map? $unknown }); -$UAdminUpdateSubjectStatusSubjectCopyWith<$Res> get subject;$StatusAttrCopyWith<$Res>? get takedown;$StatusAttrCopyWith<$Res>? get deactivated; +$UAdminUpdateSubjectStatusInputSubjectCopyWith<$Res> get subject;$StatusAttrCopyWith<$Res>? get takedown;$StatusAttrCopyWith<$Res>? get deactivated; } /// @nodoc @@ -68,7 +68,7 @@ class _$AdminUpdateSubjectStatusInputCopyWithImpl<$Res> @pragma('vm:prefer-inline') @override $Res call({Object? subject = null,Object? takedown = freezed,Object? deactivated = freezed,Object? $unknown = freezed,}) { return _then(_self.copyWith( subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable -as UAdminUpdateSubjectStatusSubject,takedown: freezed == takedown ? _self.takedown : takedown // ignore: cast_nullable_to_non_nullable +as UAdminUpdateSubjectStatusInputSubject,takedown: freezed == takedown ? _self.takedown : takedown // ignore: cast_nullable_to_non_nullable as StatusAttr?,deactivated: freezed == deactivated ? _self.deactivated : deactivated // ignore: cast_nullable_to_non_nullable as StatusAttr?,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, @@ -78,9 +78,9 @@ as Map?, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$UAdminUpdateSubjectStatusSubjectCopyWith<$Res> get subject { +$UAdminUpdateSubjectStatusInputSubjectCopyWith<$Res> get subject { - return $UAdminUpdateSubjectStatusSubjectCopyWith<$Res>(_self.subject, (value) { + return $UAdminUpdateSubjectStatusInputSubjectCopyWith<$Res>(_self.subject, (value) { return _then(_self.copyWith(subject: value)); }); }/// Create a copy of AdminUpdateSubjectStatusInput @@ -189,7 +189,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function(@UAdminUpdateSubjectStatusSubjectConverter() UAdminUpdateSubjectStatusSubject subject, @StatusAttrConverter() StatusAttr? takedown, @StatusAttrConverter() StatusAttr? deactivated, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function(@UAdminUpdateSubjectStatusInputSubjectConverter() UAdminUpdateSubjectStatusInputSubject subject, @StatusAttrConverter() StatusAttr? takedown, @StatusAttrConverter() StatusAttr? deactivated, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _AdminUpdateSubjectStatusInput() when $default != null: return $default(_that.subject,_that.takedown,_that.deactivated,_that.$unknown);case _: @@ -210,7 +210,7 @@ return $default(_that.subject,_that.takedown,_that.deactivated,_that.$unknown);c /// } /// ``` -@optionalTypeArgs TResult when(TResult Function(@UAdminUpdateSubjectStatusSubjectConverter() UAdminUpdateSubjectStatusSubject subject, @StatusAttrConverter() StatusAttr? takedown, @StatusAttrConverter() StatusAttr? deactivated, Map? $unknown) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function(@UAdminUpdateSubjectStatusInputSubjectConverter() UAdminUpdateSubjectStatusInputSubject subject, @StatusAttrConverter() StatusAttr? takedown, @StatusAttrConverter() StatusAttr? deactivated, Map? $unknown) $default,) {final _that = this; switch (_that) { case _AdminUpdateSubjectStatusInput(): return $default(_that.subject,_that.takedown,_that.deactivated,_that.$unknown);case _: @@ -230,7 +230,7 @@ return $default(_that.subject,_that.takedown,_that.deactivated,_that.$unknown);c /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function(@UAdminUpdateSubjectStatusSubjectConverter() UAdminUpdateSubjectStatusSubject subject, @StatusAttrConverter() StatusAttr? takedown, @StatusAttrConverter() StatusAttr? deactivated, Map? $unknown)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function(@UAdminUpdateSubjectStatusInputSubjectConverter() UAdminUpdateSubjectStatusInputSubject subject, @StatusAttrConverter() StatusAttr? takedown, @StatusAttrConverter() StatusAttr? deactivated, Map? $unknown)? $default,) {final _that = this; switch (_that) { case _AdminUpdateSubjectStatusInput() when $default != null: return $default(_that.subject,_that.takedown,_that.deactivated,_that.$unknown);case _: @@ -245,10 +245,10 @@ return $default(_that.subject,_that.takedown,_that.deactivated,_that.$unknown);c @JsonSerializable(includeIfNull: false) class _AdminUpdateSubjectStatusInput implements AdminUpdateSubjectStatusInput { - const _AdminUpdateSubjectStatusInput({@UAdminUpdateSubjectStatusSubjectConverter() required this.subject, @StatusAttrConverter() this.takedown, @StatusAttrConverter() this.deactivated, final Map? $unknown}): _$unknown = $unknown; + const _AdminUpdateSubjectStatusInput({@UAdminUpdateSubjectStatusInputSubjectConverter() required this.subject, @StatusAttrConverter() this.takedown, @StatusAttrConverter() this.deactivated, final Map? $unknown}): _$unknown = $unknown; factory _AdminUpdateSubjectStatusInput.fromJson(Map json) => _$AdminUpdateSubjectStatusInputFromJson(json); -@override@UAdminUpdateSubjectStatusSubjectConverter() final UAdminUpdateSubjectStatusSubject subject; +@override@UAdminUpdateSubjectStatusInputSubjectConverter() final UAdminUpdateSubjectStatusInputSubject subject; @override@StatusAttrConverter() final StatusAttr? takedown; @override@StatusAttrConverter() final StatusAttr? deactivated; final Map? _$unknown; @@ -294,11 +294,11 @@ abstract mixin class _$AdminUpdateSubjectStatusInputCopyWith<$Res> implements $A factory _$AdminUpdateSubjectStatusInputCopyWith(_AdminUpdateSubjectStatusInput value, $Res Function(_AdminUpdateSubjectStatusInput) _then) = __$AdminUpdateSubjectStatusInputCopyWithImpl; @override @useResult $Res call({ -@UAdminUpdateSubjectStatusSubjectConverter() UAdminUpdateSubjectStatusSubject subject,@StatusAttrConverter() StatusAttr? takedown,@StatusAttrConverter() StatusAttr? deactivated, Map? $unknown +@UAdminUpdateSubjectStatusInputSubjectConverter() UAdminUpdateSubjectStatusInputSubject subject,@StatusAttrConverter() StatusAttr? takedown,@StatusAttrConverter() StatusAttr? deactivated, Map? $unknown }); -@override $UAdminUpdateSubjectStatusSubjectCopyWith<$Res> get subject;@override $StatusAttrCopyWith<$Res>? get takedown;@override $StatusAttrCopyWith<$Res>? get deactivated; +@override $UAdminUpdateSubjectStatusInputSubjectCopyWith<$Res> get subject;@override $StatusAttrCopyWith<$Res>? get takedown;@override $StatusAttrCopyWith<$Res>? get deactivated; } /// @nodoc @@ -314,7 +314,7 @@ class __$AdminUpdateSubjectStatusInputCopyWithImpl<$Res> @override @pragma('vm:prefer-inline') $Res call({Object? subject = null,Object? takedown = freezed,Object? deactivated = freezed,Object? $unknown = freezed,}) { return _then(_AdminUpdateSubjectStatusInput( subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable -as UAdminUpdateSubjectStatusSubject,takedown: freezed == takedown ? _self.takedown : takedown // ignore: cast_nullable_to_non_nullable +as UAdminUpdateSubjectStatusInputSubject,takedown: freezed == takedown ? _self.takedown : takedown // ignore: cast_nullable_to_non_nullable as StatusAttr?,deactivated: freezed == deactivated ? _self.deactivated : deactivated // ignore: cast_nullable_to_non_nullable as StatusAttr?,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, @@ -325,9 +325,9 @@ as Map?, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$UAdminUpdateSubjectStatusSubjectCopyWith<$Res> get subject { +$UAdminUpdateSubjectStatusInputSubjectCopyWith<$Res> get subject { - return $UAdminUpdateSubjectStatusSubjectCopyWith<$Res>(_self.subject, (value) { + return $UAdminUpdateSubjectStatusInputSubjectCopyWith<$Res>(_self.subject, (value) { return _then(_self.copyWith(subject: value)); }); }/// Create a copy of AdminUpdateSubjectStatusInput diff --git a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/input.g.dart b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/input.g.dart index 83b3ddb21..b31123287 100644 --- a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/input.g.dart +++ b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/input.g.dart @@ -14,7 +14,7 @@ _AdminUpdateSubjectStatusInput _$AdminUpdateSubjectStatusInputFromJson( final val = _AdminUpdateSubjectStatusInput( subject: $checkedConvert( 'subject', - (v) => const UAdminUpdateSubjectStatusSubjectConverter().fromJson( + (v) => const UAdminUpdateSubjectStatusInputSubjectConverter().fromJson( v as Map, ), ), @@ -43,7 +43,7 @@ _AdminUpdateSubjectStatusInput _$AdminUpdateSubjectStatusInputFromJson( Map _$AdminUpdateSubjectStatusInputToJson( _AdminUpdateSubjectStatusInput instance, ) => { - 'subject': const UAdminUpdateSubjectStatusSubjectConverter().toJson( + 'subject': const UAdminUpdateSubjectStatusInputSubjectConverter().toJson( instance.subject, ), 'takedown': ?_$JsonConverterToJson, StatusAttr>( diff --git a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/output.dart b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/output.dart index 92054144b..3aa3bacaa 100644 --- a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/output.dart +++ b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/output.dart @@ -7,7 +7,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:poptart_core/poptart_core.dart'; import 'package:poptart_core/internals.dart'; -import './union_main_subject.dart'; +import './union_main_output_subject.dart'; import '../defs/status_attr.dart'; part 'output.freezed.dart'; @@ -24,8 +24,8 @@ abstract class AdminUpdateSubjectStatusOutput @JsonSerializable(includeIfNull: false) const factory AdminUpdateSubjectStatusOutput({ - @UAdminUpdateSubjectStatusSubjectConverter() - required UAdminUpdateSubjectStatusSubject subject, + @UAdminUpdateSubjectStatusOutputSubjectConverter() + required UAdminUpdateSubjectStatusOutputSubject subject, @StatusAttrConverter() StatusAttr? takedown, Map? $unknown, diff --git a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/output.freezed.dart b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/output.freezed.dart index 96c3f146e..07d6b3a39 100644 --- a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/output.freezed.dart +++ b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/output.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$AdminUpdateSubjectStatusOutput { -@UAdminUpdateSubjectStatusSubjectConverter() UAdminUpdateSubjectStatusSubject get subject;@StatusAttrConverter() StatusAttr? get takedown; Map? get $unknown; +@UAdminUpdateSubjectStatusOutputSubjectConverter() UAdminUpdateSubjectStatusOutputSubject get subject;@StatusAttrConverter() StatusAttr? get takedown; Map? get $unknown; /// Create a copy of AdminUpdateSubjectStatusOutput /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -48,11 +48,11 @@ abstract mixin class $AdminUpdateSubjectStatusOutputCopyWith<$Res> { factory $AdminUpdateSubjectStatusOutputCopyWith(AdminUpdateSubjectStatusOutput value, $Res Function(AdminUpdateSubjectStatusOutput) _then) = _$AdminUpdateSubjectStatusOutputCopyWithImpl; @useResult $Res call({ -@UAdminUpdateSubjectStatusSubjectConverter() UAdminUpdateSubjectStatusSubject subject,@StatusAttrConverter() StatusAttr? takedown, Map? $unknown +@UAdminUpdateSubjectStatusOutputSubjectConverter() UAdminUpdateSubjectStatusOutputSubject subject,@StatusAttrConverter() StatusAttr? takedown, Map? $unknown }); -$UAdminUpdateSubjectStatusSubjectCopyWith<$Res> get subject;$StatusAttrCopyWith<$Res>? get takedown; +$UAdminUpdateSubjectStatusOutputSubjectCopyWith<$Res> get subject;$StatusAttrCopyWith<$Res>? get takedown; } /// @nodoc @@ -68,7 +68,7 @@ class _$AdminUpdateSubjectStatusOutputCopyWithImpl<$Res> @pragma('vm:prefer-inline') @override $Res call({Object? subject = null,Object? takedown = freezed,Object? $unknown = freezed,}) { return _then(_self.copyWith( subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable -as UAdminUpdateSubjectStatusSubject,takedown: freezed == takedown ? _self.takedown : takedown // ignore: cast_nullable_to_non_nullable +as UAdminUpdateSubjectStatusOutputSubject,takedown: freezed == takedown ? _self.takedown : takedown // ignore: cast_nullable_to_non_nullable as StatusAttr?,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); @@ -77,9 +77,9 @@ as Map?, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$UAdminUpdateSubjectStatusSubjectCopyWith<$Res> get subject { +$UAdminUpdateSubjectStatusOutputSubjectCopyWith<$Res> get subject { - return $UAdminUpdateSubjectStatusSubjectCopyWith<$Res>(_self.subject, (value) { + return $UAdminUpdateSubjectStatusOutputSubjectCopyWith<$Res>(_self.subject, (value) { return _then(_self.copyWith(subject: value)); }); }/// Create a copy of AdminUpdateSubjectStatusOutput @@ -176,7 +176,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function(@UAdminUpdateSubjectStatusSubjectConverter() UAdminUpdateSubjectStatusSubject subject, @StatusAttrConverter() StatusAttr? takedown, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function(@UAdminUpdateSubjectStatusOutputSubjectConverter() UAdminUpdateSubjectStatusOutputSubject subject, @StatusAttrConverter() StatusAttr? takedown, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _AdminUpdateSubjectStatusOutput() when $default != null: return $default(_that.subject,_that.takedown,_that.$unknown);case _: @@ -197,7 +197,7 @@ return $default(_that.subject,_that.takedown,_that.$unknown);case _: /// } /// ``` -@optionalTypeArgs TResult when(TResult Function(@UAdminUpdateSubjectStatusSubjectConverter() UAdminUpdateSubjectStatusSubject subject, @StatusAttrConverter() StatusAttr? takedown, Map? $unknown) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function(@UAdminUpdateSubjectStatusOutputSubjectConverter() UAdminUpdateSubjectStatusOutputSubject subject, @StatusAttrConverter() StatusAttr? takedown, Map? $unknown) $default,) {final _that = this; switch (_that) { case _AdminUpdateSubjectStatusOutput(): return $default(_that.subject,_that.takedown,_that.$unknown);case _: @@ -217,7 +217,7 @@ return $default(_that.subject,_that.takedown,_that.$unknown);case _: /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function(@UAdminUpdateSubjectStatusSubjectConverter() UAdminUpdateSubjectStatusSubject subject, @StatusAttrConverter() StatusAttr? takedown, Map? $unknown)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function(@UAdminUpdateSubjectStatusOutputSubjectConverter() UAdminUpdateSubjectStatusOutputSubject subject, @StatusAttrConverter() StatusAttr? takedown, Map? $unknown)? $default,) {final _that = this; switch (_that) { case _AdminUpdateSubjectStatusOutput() when $default != null: return $default(_that.subject,_that.takedown,_that.$unknown);case _: @@ -232,10 +232,10 @@ return $default(_that.subject,_that.takedown,_that.$unknown);case _: @JsonSerializable(includeIfNull: false) class _AdminUpdateSubjectStatusOutput implements AdminUpdateSubjectStatusOutput { - const _AdminUpdateSubjectStatusOutput({@UAdminUpdateSubjectStatusSubjectConverter() required this.subject, @StatusAttrConverter() this.takedown, final Map? $unknown}): _$unknown = $unknown; + const _AdminUpdateSubjectStatusOutput({@UAdminUpdateSubjectStatusOutputSubjectConverter() required this.subject, @StatusAttrConverter() this.takedown, final Map? $unknown}): _$unknown = $unknown; factory _AdminUpdateSubjectStatusOutput.fromJson(Map json) => _$AdminUpdateSubjectStatusOutputFromJson(json); -@override@UAdminUpdateSubjectStatusSubjectConverter() final UAdminUpdateSubjectStatusSubject subject; +@override@UAdminUpdateSubjectStatusOutputSubjectConverter() final UAdminUpdateSubjectStatusOutputSubject subject; @override@StatusAttrConverter() final StatusAttr? takedown; final Map? _$unknown; @override Map? get $unknown { @@ -280,11 +280,11 @@ abstract mixin class _$AdminUpdateSubjectStatusOutputCopyWith<$Res> implements $ factory _$AdminUpdateSubjectStatusOutputCopyWith(_AdminUpdateSubjectStatusOutput value, $Res Function(_AdminUpdateSubjectStatusOutput) _then) = __$AdminUpdateSubjectStatusOutputCopyWithImpl; @override @useResult $Res call({ -@UAdminUpdateSubjectStatusSubjectConverter() UAdminUpdateSubjectStatusSubject subject,@StatusAttrConverter() StatusAttr? takedown, Map? $unknown +@UAdminUpdateSubjectStatusOutputSubjectConverter() UAdminUpdateSubjectStatusOutputSubject subject,@StatusAttrConverter() StatusAttr? takedown, Map? $unknown }); -@override $UAdminUpdateSubjectStatusSubjectCopyWith<$Res> get subject;@override $StatusAttrCopyWith<$Res>? get takedown; +@override $UAdminUpdateSubjectStatusOutputSubjectCopyWith<$Res> get subject;@override $StatusAttrCopyWith<$Res>? get takedown; } /// @nodoc @@ -300,7 +300,7 @@ class __$AdminUpdateSubjectStatusOutputCopyWithImpl<$Res> @override @pragma('vm:prefer-inline') $Res call({Object? subject = null,Object? takedown = freezed,Object? $unknown = freezed,}) { return _then(_AdminUpdateSubjectStatusOutput( subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable -as UAdminUpdateSubjectStatusSubject,takedown: freezed == takedown ? _self.takedown : takedown // ignore: cast_nullable_to_non_nullable +as UAdminUpdateSubjectStatusOutputSubject,takedown: freezed == takedown ? _self.takedown : takedown // ignore: cast_nullable_to_non_nullable as StatusAttr?,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); @@ -310,9 +310,9 @@ as Map?, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$UAdminUpdateSubjectStatusSubjectCopyWith<$Res> get subject { +$UAdminUpdateSubjectStatusOutputSubjectCopyWith<$Res> get subject { - return $UAdminUpdateSubjectStatusSubjectCopyWith<$Res>(_self.subject, (value) { + return $UAdminUpdateSubjectStatusOutputSubjectCopyWith<$Res>(_self.subject, (value) { return _then(_self.copyWith(subject: value)); }); }/// Create a copy of AdminUpdateSubjectStatusOutput diff --git a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/output.g.dart b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/output.g.dart index c675699ca..def74522f 100644 --- a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/output.g.dart +++ b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/output.g.dart @@ -14,7 +14,7 @@ _AdminUpdateSubjectStatusOutput _$AdminUpdateSubjectStatusOutputFromJson( final val = _AdminUpdateSubjectStatusOutput( subject: $checkedConvert( 'subject', - (v) => const UAdminUpdateSubjectStatusSubjectConverter().fromJson( + (v) => const UAdminUpdateSubjectStatusOutputSubjectConverter().fromJson( v as Map, ), ), @@ -36,7 +36,7 @@ _AdminUpdateSubjectStatusOutput _$AdminUpdateSubjectStatusOutputFromJson( Map _$AdminUpdateSubjectStatusOutputToJson( _AdminUpdateSubjectStatusOutput instance, ) => { - 'subject': const UAdminUpdateSubjectStatusSubjectConverter().toJson( + 'subject': const UAdminUpdateSubjectStatusOutputSubjectConverter().toJson( instance.subject, ), 'takedown': ?_$JsonConverterToJson, StatusAttr>( diff --git a/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/union_main_subject.dart b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/union_main_input_subject.dart similarity index 54% rename from packages/poptart_lex/lib/com/atproto/admin/get_subject_status/union_main_subject.dart rename to packages/poptart_lex/lib/com/atproto/admin/update_subject_status/union_main_input_subject.dart index d6673b4c3..72c249cb4 100644 --- a/packages/poptart_lex/lib/com/atproto/admin/get_subject_status/union_main_subject.dart +++ b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/union_main_input_subject.dart @@ -10,85 +10,90 @@ import '../defs/repo_ref.dart'; import '../../repo/strong_ref/main.dart'; import '../defs/repo_blob_ref.dart'; -part 'union_main_subject.freezed.dart'; +part 'union_main_input_subject.freezed.dart'; // ************************************************************************** // LexGenerator // ************************************************************************** @freezed -sealed class UAdminGetSubjectStatusSubject - with _$UAdminGetSubjectStatusSubject { - const UAdminGetSubjectStatusSubject._(); +sealed class UAdminUpdateSubjectStatusInputSubject + with _$UAdminUpdateSubjectStatusInputSubject { + const UAdminUpdateSubjectStatusInputSubject._(); - const factory UAdminGetSubjectStatusSubject.repoRef({required RepoRef data}) = - UAdminGetSubjectStatusSubjectRepoRef; - const factory UAdminGetSubjectStatusSubject.repoStrongRef({ + const factory UAdminUpdateSubjectStatusInputSubject.repoRef({ + required RepoRef data, + }) = UAdminUpdateSubjectStatusInputSubjectRepoRef; + const factory UAdminUpdateSubjectStatusInputSubject.repoStrongRef({ required RepoStrongRef data, - }) = UAdminGetSubjectStatusSubjectRepoStrongRef; - const factory UAdminGetSubjectStatusSubject.repoBlobRef({ + }) = UAdminUpdateSubjectStatusInputSubjectRepoStrongRef; + const factory UAdminUpdateSubjectStatusInputSubject.repoBlobRef({ required RepoBlobRef data, - }) = UAdminGetSubjectStatusSubjectRepoBlobRef; + }) = UAdminUpdateSubjectStatusInputSubjectRepoBlobRef; - const factory UAdminGetSubjectStatusSubject.unknown({ + const factory UAdminUpdateSubjectStatusInputSubject.unknown({ required Map data, - }) = UAdminGetSubjectStatusSubjectUnknown; + }) = UAdminUpdateSubjectStatusInputSubjectUnknown; Map toJson() => - const UAdminGetSubjectStatusSubjectConverter().toJson(this); + const UAdminUpdateSubjectStatusInputSubjectConverter().toJson(this); } -extension UAdminGetSubjectStatusSubjectExtension - on UAdminGetSubjectStatusSubject { - bool get isRepoRef => isA(this); +extension UAdminUpdateSubjectStatusInputSubjectExtension + on UAdminUpdateSubjectStatusInputSubject { + bool get isRepoRef => isA(this); bool get isNotRepoRef => !isRepoRef; RepoRef? get repoRef => isRepoRef ? data as RepoRef : null; bool get isRepoStrongRef => - isA(this); + isA(this); bool get isNotRepoStrongRef => !isRepoStrongRef; RepoStrongRef? get repoStrongRef => isRepoStrongRef ? data as RepoStrongRef : null; - bool get isRepoBlobRef => isA(this); + bool get isRepoBlobRef => + isA(this); bool get isNotRepoBlobRef => !isRepoBlobRef; RepoBlobRef? get repoBlobRef => isRepoBlobRef ? data as RepoBlobRef : null; - bool get isUnknown => isA(this); + bool get isUnknown => isA(this); bool get isNotUnknown => !isUnknown; Map? get unknown => isUnknown ? data as Map : null; } -final class UAdminGetSubjectStatusSubjectConverter +final class UAdminUpdateSubjectStatusInputSubjectConverter implements - JsonConverter> { - const UAdminGetSubjectStatusSubjectConverter(); + JsonConverter< + UAdminUpdateSubjectStatusInputSubject, + Map + > { + const UAdminUpdateSubjectStatusInputSubjectConverter(); @override - UAdminGetSubjectStatusSubject fromJson(Map json) { + UAdminUpdateSubjectStatusInputSubject fromJson(Map json) { try { if (RepoRef.validate(json)) { - return UAdminGetSubjectStatusSubject.repoRef( + return UAdminUpdateSubjectStatusInputSubject.repoRef( data: const RepoRefConverter().fromJson(json), ); } if (RepoStrongRef.validate(json)) { - return UAdminGetSubjectStatusSubject.repoStrongRef( + return UAdminUpdateSubjectStatusInputSubject.repoStrongRef( data: const RepoStrongRefConverter().fromJson(json), ); } if (RepoBlobRef.validate(json)) { - return UAdminGetSubjectStatusSubject.repoBlobRef( + return UAdminUpdateSubjectStatusInputSubject.repoBlobRef( data: const RepoBlobRefConverter().fromJson(json), ); } - return UAdminGetSubjectStatusSubject.unknown(data: json); + return UAdminUpdateSubjectStatusInputSubject.unknown(data: json); } catch (_) { - return UAdminGetSubjectStatusSubject.unknown(data: json); + return UAdminUpdateSubjectStatusInputSubject.unknown(data: json); } } @override - Map toJson(UAdminGetSubjectStatusSubject object) => + Map toJson(UAdminUpdateSubjectStatusInputSubject object) => object.when( repoRef: (data) => const RepoRefConverter().toJson(data), repoStrongRef: (data) => const RepoStrongRefConverter().toJson(data), diff --git a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/union_main_input_subject.freezed.dart b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/union_main_input_subject.freezed.dart new file mode 100644 index 000000000..98b44368f --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/union_main_input_subject.freezed.dart @@ -0,0 +1,483 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'union_main_input_subject.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$UAdminUpdateSubjectStatusInputSubject { + + Object get data; + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminUpdateSubjectStatusInputSubject&&const DeepCollectionEquality().equals(other.data, data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); + +@override +String toString() { + return 'UAdminUpdateSubjectStatusInputSubject(data: $data)'; +} + + +} + +/// @nodoc +class $UAdminUpdateSubjectStatusInputSubjectCopyWith<$Res> { +$UAdminUpdateSubjectStatusInputSubjectCopyWith(UAdminUpdateSubjectStatusInputSubject _, $Res Function(UAdminUpdateSubjectStatusInputSubject) __); +} + + +/// Adds pattern-matching-related methods to [UAdminUpdateSubjectStatusInputSubject]. +extension UAdminUpdateSubjectStatusInputSubjectPatterns on UAdminUpdateSubjectStatusInputSubject { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap({TResult Function( UAdminUpdateSubjectStatusInputSubjectRepoRef value)? repoRef,TResult Function( UAdminUpdateSubjectStatusInputSubjectRepoStrongRef value)? repoStrongRef,TResult Function( UAdminUpdateSubjectStatusInputSubjectRepoBlobRef value)? repoBlobRef,TResult Function( UAdminUpdateSubjectStatusInputSubjectUnknown value)? unknown,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case UAdminUpdateSubjectStatusInputSubjectRepoRef() when repoRef != null: +return repoRef(_that);case UAdminUpdateSubjectStatusInputSubjectRepoStrongRef() when repoStrongRef != null: +return repoStrongRef(_that);case UAdminUpdateSubjectStatusInputSubjectRepoBlobRef() when repoBlobRef != null: +return repoBlobRef(_that);case UAdminUpdateSubjectStatusInputSubjectUnknown() when unknown != null: +return unknown(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map({required TResult Function( UAdminUpdateSubjectStatusInputSubjectRepoRef value) repoRef,required TResult Function( UAdminUpdateSubjectStatusInputSubjectRepoStrongRef value) repoStrongRef,required TResult Function( UAdminUpdateSubjectStatusInputSubjectRepoBlobRef value) repoBlobRef,required TResult Function( UAdminUpdateSubjectStatusInputSubjectUnknown value) unknown,}){ +final _that = this; +switch (_that) { +case UAdminUpdateSubjectStatusInputSubjectRepoRef(): +return repoRef(_that);case UAdminUpdateSubjectStatusInputSubjectRepoStrongRef(): +return repoStrongRef(_that);case UAdminUpdateSubjectStatusInputSubjectRepoBlobRef(): +return repoBlobRef(_that);case UAdminUpdateSubjectStatusInputSubjectUnknown(): +return unknown(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull({TResult? Function( UAdminUpdateSubjectStatusInputSubjectRepoRef value)? repoRef,TResult? Function( UAdminUpdateSubjectStatusInputSubjectRepoStrongRef value)? repoStrongRef,TResult? Function( UAdminUpdateSubjectStatusInputSubjectRepoBlobRef value)? repoBlobRef,TResult? Function( UAdminUpdateSubjectStatusInputSubjectUnknown value)? unknown,}){ +final _that = this; +switch (_that) { +case UAdminUpdateSubjectStatusInputSubjectRepoRef() when repoRef != null: +return repoRef(_that);case UAdminUpdateSubjectStatusInputSubjectRepoStrongRef() when repoStrongRef != null: +return repoStrongRef(_that);case UAdminUpdateSubjectStatusInputSubjectRepoBlobRef() when repoBlobRef != null: +return repoBlobRef(_that);case UAdminUpdateSubjectStatusInputSubjectUnknown() when unknown != null: +return unknown(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen({TResult Function( RepoRef data)? repoRef,TResult Function( RepoStrongRef data)? repoStrongRef,TResult Function( RepoBlobRef data)? repoBlobRef,TResult Function( Map data)? unknown,required TResult orElse(),}) {final _that = this; +switch (_that) { +case UAdminUpdateSubjectStatusInputSubjectRepoRef() when repoRef != null: +return repoRef(_that.data);case UAdminUpdateSubjectStatusInputSubjectRepoStrongRef() when repoStrongRef != null: +return repoStrongRef(_that.data);case UAdminUpdateSubjectStatusInputSubjectRepoBlobRef() when repoBlobRef != null: +return repoBlobRef(_that.data);case UAdminUpdateSubjectStatusInputSubjectUnknown() when unknown != null: +return unknown(_that.data);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when({required TResult Function( RepoRef data) repoRef,required TResult Function( RepoStrongRef data) repoStrongRef,required TResult Function( RepoBlobRef data) repoBlobRef,required TResult Function( Map data) unknown,}) {final _that = this; +switch (_that) { +case UAdminUpdateSubjectStatusInputSubjectRepoRef(): +return repoRef(_that.data);case UAdminUpdateSubjectStatusInputSubjectRepoStrongRef(): +return repoStrongRef(_that.data);case UAdminUpdateSubjectStatusInputSubjectRepoBlobRef(): +return repoBlobRef(_that.data);case UAdminUpdateSubjectStatusInputSubjectUnknown(): +return unknown(_that.data);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull({TResult? Function( RepoRef data)? repoRef,TResult? Function( RepoStrongRef data)? repoStrongRef,TResult? Function( RepoBlobRef data)? repoBlobRef,TResult? Function( Map data)? unknown,}) {final _that = this; +switch (_that) { +case UAdminUpdateSubjectStatusInputSubjectRepoRef() when repoRef != null: +return repoRef(_that.data);case UAdminUpdateSubjectStatusInputSubjectRepoStrongRef() when repoStrongRef != null: +return repoStrongRef(_that.data);case UAdminUpdateSubjectStatusInputSubjectRepoBlobRef() when repoBlobRef != null: +return repoBlobRef(_that.data);case UAdminUpdateSubjectStatusInputSubjectUnknown() when unknown != null: +return unknown(_that.data);case _: + return null; + +} +} + +} + +/// @nodoc + + +class UAdminUpdateSubjectStatusInputSubjectRepoRef extends UAdminUpdateSubjectStatusInputSubject { + const UAdminUpdateSubjectStatusInputSubjectRepoRef({required this.data}): super._(); + + +@override final RepoRef data; + +/// Create a copy of UAdminUpdateSubjectStatusInputSubject +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UAdminUpdateSubjectStatusInputSubjectRepoRefCopyWith get copyWith => _$UAdminUpdateSubjectStatusInputSubjectRepoRefCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminUpdateSubjectStatusInputSubjectRepoRef&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'UAdminUpdateSubjectStatusInputSubject.repoRef(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UAdminUpdateSubjectStatusInputSubjectRepoRefCopyWith<$Res> implements $UAdminUpdateSubjectStatusInputSubjectCopyWith<$Res> { + factory $UAdminUpdateSubjectStatusInputSubjectRepoRefCopyWith(UAdminUpdateSubjectStatusInputSubjectRepoRef value, $Res Function(UAdminUpdateSubjectStatusInputSubjectRepoRef) _then) = _$UAdminUpdateSubjectStatusInputSubjectRepoRefCopyWithImpl; +@useResult +$Res call({ + RepoRef data +}); + + +$RepoRefCopyWith<$Res> get data; + +} +/// @nodoc +class _$UAdminUpdateSubjectStatusInputSubjectRepoRefCopyWithImpl<$Res> + implements $UAdminUpdateSubjectStatusInputSubjectRepoRefCopyWith<$Res> { + _$UAdminUpdateSubjectStatusInputSubjectRepoRefCopyWithImpl(this._self, this._then); + + final UAdminUpdateSubjectStatusInputSubjectRepoRef _self; + final $Res Function(UAdminUpdateSubjectStatusInputSubjectRepoRef) _then; + +/// Create a copy of UAdminUpdateSubjectStatusInputSubject +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UAdminUpdateSubjectStatusInputSubjectRepoRef( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as RepoRef, + )); +} + +/// Create a copy of UAdminUpdateSubjectStatusInputSubject +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$RepoRefCopyWith<$Res> get data { + + return $RepoRefCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class UAdminUpdateSubjectStatusInputSubjectRepoStrongRef extends UAdminUpdateSubjectStatusInputSubject { + const UAdminUpdateSubjectStatusInputSubjectRepoStrongRef({required this.data}): super._(); + + +@override final RepoStrongRef data; + +/// Create a copy of UAdminUpdateSubjectStatusInputSubject +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UAdminUpdateSubjectStatusInputSubjectRepoStrongRefCopyWith get copyWith => _$UAdminUpdateSubjectStatusInputSubjectRepoStrongRefCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminUpdateSubjectStatusInputSubjectRepoStrongRef&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'UAdminUpdateSubjectStatusInputSubject.repoStrongRef(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UAdminUpdateSubjectStatusInputSubjectRepoStrongRefCopyWith<$Res> implements $UAdminUpdateSubjectStatusInputSubjectCopyWith<$Res> { + factory $UAdminUpdateSubjectStatusInputSubjectRepoStrongRefCopyWith(UAdminUpdateSubjectStatusInputSubjectRepoStrongRef value, $Res Function(UAdminUpdateSubjectStatusInputSubjectRepoStrongRef) _then) = _$UAdminUpdateSubjectStatusInputSubjectRepoStrongRefCopyWithImpl; +@useResult +$Res call({ + RepoStrongRef data +}); + + +$RepoStrongRefCopyWith<$Res> get data; + +} +/// @nodoc +class _$UAdminUpdateSubjectStatusInputSubjectRepoStrongRefCopyWithImpl<$Res> + implements $UAdminUpdateSubjectStatusInputSubjectRepoStrongRefCopyWith<$Res> { + _$UAdminUpdateSubjectStatusInputSubjectRepoStrongRefCopyWithImpl(this._self, this._then); + + final UAdminUpdateSubjectStatusInputSubjectRepoStrongRef _self; + final $Res Function(UAdminUpdateSubjectStatusInputSubjectRepoStrongRef) _then; + +/// Create a copy of UAdminUpdateSubjectStatusInputSubject +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UAdminUpdateSubjectStatusInputSubjectRepoStrongRef( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as RepoStrongRef, + )); +} + +/// Create a copy of UAdminUpdateSubjectStatusInputSubject +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$RepoStrongRefCopyWith<$Res> get data { + + return $RepoStrongRefCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class UAdminUpdateSubjectStatusInputSubjectRepoBlobRef extends UAdminUpdateSubjectStatusInputSubject { + const UAdminUpdateSubjectStatusInputSubjectRepoBlobRef({required this.data}): super._(); + + +@override final RepoBlobRef data; + +/// Create a copy of UAdminUpdateSubjectStatusInputSubject +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UAdminUpdateSubjectStatusInputSubjectRepoBlobRefCopyWith get copyWith => _$UAdminUpdateSubjectStatusInputSubjectRepoBlobRefCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminUpdateSubjectStatusInputSubjectRepoBlobRef&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'UAdminUpdateSubjectStatusInputSubject.repoBlobRef(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UAdminUpdateSubjectStatusInputSubjectRepoBlobRefCopyWith<$Res> implements $UAdminUpdateSubjectStatusInputSubjectCopyWith<$Res> { + factory $UAdminUpdateSubjectStatusInputSubjectRepoBlobRefCopyWith(UAdminUpdateSubjectStatusInputSubjectRepoBlobRef value, $Res Function(UAdminUpdateSubjectStatusInputSubjectRepoBlobRef) _then) = _$UAdminUpdateSubjectStatusInputSubjectRepoBlobRefCopyWithImpl; +@useResult +$Res call({ + RepoBlobRef data +}); + + +$RepoBlobRefCopyWith<$Res> get data; + +} +/// @nodoc +class _$UAdminUpdateSubjectStatusInputSubjectRepoBlobRefCopyWithImpl<$Res> + implements $UAdminUpdateSubjectStatusInputSubjectRepoBlobRefCopyWith<$Res> { + _$UAdminUpdateSubjectStatusInputSubjectRepoBlobRefCopyWithImpl(this._self, this._then); + + final UAdminUpdateSubjectStatusInputSubjectRepoBlobRef _self; + final $Res Function(UAdminUpdateSubjectStatusInputSubjectRepoBlobRef) _then; + +/// Create a copy of UAdminUpdateSubjectStatusInputSubject +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UAdminUpdateSubjectStatusInputSubjectRepoBlobRef( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as RepoBlobRef, + )); +} + +/// Create a copy of UAdminUpdateSubjectStatusInputSubject +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$RepoBlobRefCopyWith<$Res> get data { + + return $RepoBlobRefCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class UAdminUpdateSubjectStatusInputSubjectUnknown extends UAdminUpdateSubjectStatusInputSubject { + const UAdminUpdateSubjectStatusInputSubjectUnknown({required final Map data}): _data = data,super._(); + + + final Map _data; +@override Map get data { + if (_data is EqualUnmodifiableMapView) return _data; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_data); +} + + +/// Create a copy of UAdminUpdateSubjectStatusInputSubject +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UAdminUpdateSubjectStatusInputSubjectUnknownCopyWith get copyWith => _$UAdminUpdateSubjectStatusInputSubjectUnknownCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminUpdateSubjectStatusInputSubjectUnknown&&const DeepCollectionEquality().equals(other._data, _data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_data)); + +@override +String toString() { + return 'UAdminUpdateSubjectStatusInputSubject.unknown(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UAdminUpdateSubjectStatusInputSubjectUnknownCopyWith<$Res> implements $UAdminUpdateSubjectStatusInputSubjectCopyWith<$Res> { + factory $UAdminUpdateSubjectStatusInputSubjectUnknownCopyWith(UAdminUpdateSubjectStatusInputSubjectUnknown value, $Res Function(UAdminUpdateSubjectStatusInputSubjectUnknown) _then) = _$UAdminUpdateSubjectStatusInputSubjectUnknownCopyWithImpl; +@useResult +$Res call({ + Map data +}); + + + + +} +/// @nodoc +class _$UAdminUpdateSubjectStatusInputSubjectUnknownCopyWithImpl<$Res> + implements $UAdminUpdateSubjectStatusInputSubjectUnknownCopyWith<$Res> { + _$UAdminUpdateSubjectStatusInputSubjectUnknownCopyWithImpl(this._self, this._then); + + final UAdminUpdateSubjectStatusInputSubjectUnknown _self; + final $Res Function(UAdminUpdateSubjectStatusInputSubjectUnknown) _then; + +/// Create a copy of UAdminUpdateSubjectStatusInputSubject +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UAdminUpdateSubjectStatusInputSubjectUnknown( +data: null == data ? _self._data : data // ignore: cast_nullable_to_non_nullable +as Map, + )); +} + + +} + +// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/union_main_output_subject.dart b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/union_main_output_subject.dart new file mode 100644 index 000000000..ce8b240ff --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/union_main_output_subject.dart @@ -0,0 +1,106 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, unused_import, duplicate_import, unnecessary_cast, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:poptart_core/internals.dart' show isA; + +import '../defs/repo_ref.dart'; +import '../../repo/strong_ref/main.dart'; +import '../defs/repo_blob_ref.dart'; + +part 'union_main_output_subject.freezed.dart'; + +// ************************************************************************** +// LexGenerator +// ************************************************************************** + +@freezed +sealed class UAdminUpdateSubjectStatusOutputSubject + with _$UAdminUpdateSubjectStatusOutputSubject { + const UAdminUpdateSubjectStatusOutputSubject._(); + + const factory UAdminUpdateSubjectStatusOutputSubject.repoRef({ + required RepoRef data, + }) = UAdminUpdateSubjectStatusOutputSubjectRepoRef; + const factory UAdminUpdateSubjectStatusOutputSubject.repoStrongRef({ + required RepoStrongRef data, + }) = UAdminUpdateSubjectStatusOutputSubjectRepoStrongRef; + const factory UAdminUpdateSubjectStatusOutputSubject.repoBlobRef({ + required RepoBlobRef data, + }) = UAdminUpdateSubjectStatusOutputSubjectRepoBlobRef; + + const factory UAdminUpdateSubjectStatusOutputSubject.unknown({ + required Map data, + }) = UAdminUpdateSubjectStatusOutputSubjectUnknown; + + Map toJson() => + const UAdminUpdateSubjectStatusOutputSubjectConverter().toJson(this); +} + +extension UAdminUpdateSubjectStatusOutputSubjectExtension + on UAdminUpdateSubjectStatusOutputSubject { + bool get isRepoRef => + isA(this); + bool get isNotRepoRef => !isRepoRef; + RepoRef? get repoRef => isRepoRef ? data as RepoRef : null; + bool get isRepoStrongRef => + isA(this); + bool get isNotRepoStrongRef => !isRepoStrongRef; + RepoStrongRef? get repoStrongRef => + isRepoStrongRef ? data as RepoStrongRef : null; + bool get isRepoBlobRef => + isA(this); + bool get isNotRepoBlobRef => !isRepoBlobRef; + RepoBlobRef? get repoBlobRef => isRepoBlobRef ? data as RepoBlobRef : null; + bool get isUnknown => + isA(this); + bool get isNotUnknown => !isUnknown; + Map? get unknown => + isUnknown ? data as Map : null; +} + +final class UAdminUpdateSubjectStatusOutputSubjectConverter + implements + JsonConverter< + UAdminUpdateSubjectStatusOutputSubject, + Map + > { + const UAdminUpdateSubjectStatusOutputSubjectConverter(); + + @override + UAdminUpdateSubjectStatusOutputSubject fromJson(Map json) { + try { + if (RepoRef.validate(json)) { + return UAdminUpdateSubjectStatusOutputSubject.repoRef( + data: const RepoRefConverter().fromJson(json), + ); + } + if (RepoStrongRef.validate(json)) { + return UAdminUpdateSubjectStatusOutputSubject.repoStrongRef( + data: const RepoStrongRefConverter().fromJson(json), + ); + } + if (RepoBlobRef.validate(json)) { + return UAdminUpdateSubjectStatusOutputSubject.repoBlobRef( + data: const RepoBlobRefConverter().fromJson(json), + ); + } + + return UAdminUpdateSubjectStatusOutputSubject.unknown(data: json); + } catch (_) { + return UAdminUpdateSubjectStatusOutputSubject.unknown(data: json); + } + } + + @override + Map toJson(UAdminUpdateSubjectStatusOutputSubject object) => + object.when( + repoRef: (data) => const RepoRefConverter().toJson(data), + repoStrongRef: (data) => const RepoStrongRefConverter().toJson(data), + repoBlobRef: (data) => const RepoBlobRefConverter().toJson(data), + + unknown: (data) => data, + ); +} diff --git a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/union_main_output_subject.freezed.dart b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/union_main_output_subject.freezed.dart new file mode 100644 index 000000000..a989c85cb --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/union_main_output_subject.freezed.dart @@ -0,0 +1,483 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'union_main_output_subject.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$UAdminUpdateSubjectStatusOutputSubject { + + Object get data; + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminUpdateSubjectStatusOutputSubject&&const DeepCollectionEquality().equals(other.data, data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); + +@override +String toString() { + return 'UAdminUpdateSubjectStatusOutputSubject(data: $data)'; +} + + +} + +/// @nodoc +class $UAdminUpdateSubjectStatusOutputSubjectCopyWith<$Res> { +$UAdminUpdateSubjectStatusOutputSubjectCopyWith(UAdminUpdateSubjectStatusOutputSubject _, $Res Function(UAdminUpdateSubjectStatusOutputSubject) __); +} + + +/// Adds pattern-matching-related methods to [UAdminUpdateSubjectStatusOutputSubject]. +extension UAdminUpdateSubjectStatusOutputSubjectPatterns on UAdminUpdateSubjectStatusOutputSubject { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap({TResult Function( UAdminUpdateSubjectStatusOutputSubjectRepoRef value)? repoRef,TResult Function( UAdminUpdateSubjectStatusOutputSubjectRepoStrongRef value)? repoStrongRef,TResult Function( UAdminUpdateSubjectStatusOutputSubjectRepoBlobRef value)? repoBlobRef,TResult Function( UAdminUpdateSubjectStatusOutputSubjectUnknown value)? unknown,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case UAdminUpdateSubjectStatusOutputSubjectRepoRef() when repoRef != null: +return repoRef(_that);case UAdminUpdateSubjectStatusOutputSubjectRepoStrongRef() when repoStrongRef != null: +return repoStrongRef(_that);case UAdminUpdateSubjectStatusOutputSubjectRepoBlobRef() when repoBlobRef != null: +return repoBlobRef(_that);case UAdminUpdateSubjectStatusOutputSubjectUnknown() when unknown != null: +return unknown(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map({required TResult Function( UAdminUpdateSubjectStatusOutputSubjectRepoRef value) repoRef,required TResult Function( UAdminUpdateSubjectStatusOutputSubjectRepoStrongRef value) repoStrongRef,required TResult Function( UAdminUpdateSubjectStatusOutputSubjectRepoBlobRef value) repoBlobRef,required TResult Function( UAdminUpdateSubjectStatusOutputSubjectUnknown value) unknown,}){ +final _that = this; +switch (_that) { +case UAdminUpdateSubjectStatusOutputSubjectRepoRef(): +return repoRef(_that);case UAdminUpdateSubjectStatusOutputSubjectRepoStrongRef(): +return repoStrongRef(_that);case UAdminUpdateSubjectStatusOutputSubjectRepoBlobRef(): +return repoBlobRef(_that);case UAdminUpdateSubjectStatusOutputSubjectUnknown(): +return unknown(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull({TResult? Function( UAdminUpdateSubjectStatusOutputSubjectRepoRef value)? repoRef,TResult? Function( UAdminUpdateSubjectStatusOutputSubjectRepoStrongRef value)? repoStrongRef,TResult? Function( UAdminUpdateSubjectStatusOutputSubjectRepoBlobRef value)? repoBlobRef,TResult? Function( UAdminUpdateSubjectStatusOutputSubjectUnknown value)? unknown,}){ +final _that = this; +switch (_that) { +case UAdminUpdateSubjectStatusOutputSubjectRepoRef() when repoRef != null: +return repoRef(_that);case UAdminUpdateSubjectStatusOutputSubjectRepoStrongRef() when repoStrongRef != null: +return repoStrongRef(_that);case UAdminUpdateSubjectStatusOutputSubjectRepoBlobRef() when repoBlobRef != null: +return repoBlobRef(_that);case UAdminUpdateSubjectStatusOutputSubjectUnknown() when unknown != null: +return unknown(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen({TResult Function( RepoRef data)? repoRef,TResult Function( RepoStrongRef data)? repoStrongRef,TResult Function( RepoBlobRef data)? repoBlobRef,TResult Function( Map data)? unknown,required TResult orElse(),}) {final _that = this; +switch (_that) { +case UAdminUpdateSubjectStatusOutputSubjectRepoRef() when repoRef != null: +return repoRef(_that.data);case UAdminUpdateSubjectStatusOutputSubjectRepoStrongRef() when repoStrongRef != null: +return repoStrongRef(_that.data);case UAdminUpdateSubjectStatusOutputSubjectRepoBlobRef() when repoBlobRef != null: +return repoBlobRef(_that.data);case UAdminUpdateSubjectStatusOutputSubjectUnknown() when unknown != null: +return unknown(_that.data);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when({required TResult Function( RepoRef data) repoRef,required TResult Function( RepoStrongRef data) repoStrongRef,required TResult Function( RepoBlobRef data) repoBlobRef,required TResult Function( Map data) unknown,}) {final _that = this; +switch (_that) { +case UAdminUpdateSubjectStatusOutputSubjectRepoRef(): +return repoRef(_that.data);case UAdminUpdateSubjectStatusOutputSubjectRepoStrongRef(): +return repoStrongRef(_that.data);case UAdminUpdateSubjectStatusOutputSubjectRepoBlobRef(): +return repoBlobRef(_that.data);case UAdminUpdateSubjectStatusOutputSubjectUnknown(): +return unknown(_that.data);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull({TResult? Function( RepoRef data)? repoRef,TResult? Function( RepoStrongRef data)? repoStrongRef,TResult? Function( RepoBlobRef data)? repoBlobRef,TResult? Function( Map data)? unknown,}) {final _that = this; +switch (_that) { +case UAdminUpdateSubjectStatusOutputSubjectRepoRef() when repoRef != null: +return repoRef(_that.data);case UAdminUpdateSubjectStatusOutputSubjectRepoStrongRef() when repoStrongRef != null: +return repoStrongRef(_that.data);case UAdminUpdateSubjectStatusOutputSubjectRepoBlobRef() when repoBlobRef != null: +return repoBlobRef(_that.data);case UAdminUpdateSubjectStatusOutputSubjectUnknown() when unknown != null: +return unknown(_that.data);case _: + return null; + +} +} + +} + +/// @nodoc + + +class UAdminUpdateSubjectStatusOutputSubjectRepoRef extends UAdminUpdateSubjectStatusOutputSubject { + const UAdminUpdateSubjectStatusOutputSubjectRepoRef({required this.data}): super._(); + + +@override final RepoRef data; + +/// Create a copy of UAdminUpdateSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UAdminUpdateSubjectStatusOutputSubjectRepoRefCopyWith get copyWith => _$UAdminUpdateSubjectStatusOutputSubjectRepoRefCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminUpdateSubjectStatusOutputSubjectRepoRef&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'UAdminUpdateSubjectStatusOutputSubject.repoRef(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UAdminUpdateSubjectStatusOutputSubjectRepoRefCopyWith<$Res> implements $UAdminUpdateSubjectStatusOutputSubjectCopyWith<$Res> { + factory $UAdminUpdateSubjectStatusOutputSubjectRepoRefCopyWith(UAdminUpdateSubjectStatusOutputSubjectRepoRef value, $Res Function(UAdminUpdateSubjectStatusOutputSubjectRepoRef) _then) = _$UAdminUpdateSubjectStatusOutputSubjectRepoRefCopyWithImpl; +@useResult +$Res call({ + RepoRef data +}); + + +$RepoRefCopyWith<$Res> get data; + +} +/// @nodoc +class _$UAdminUpdateSubjectStatusOutputSubjectRepoRefCopyWithImpl<$Res> + implements $UAdminUpdateSubjectStatusOutputSubjectRepoRefCopyWith<$Res> { + _$UAdminUpdateSubjectStatusOutputSubjectRepoRefCopyWithImpl(this._self, this._then); + + final UAdminUpdateSubjectStatusOutputSubjectRepoRef _self; + final $Res Function(UAdminUpdateSubjectStatusOutputSubjectRepoRef) _then; + +/// Create a copy of UAdminUpdateSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UAdminUpdateSubjectStatusOutputSubjectRepoRef( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as RepoRef, + )); +} + +/// Create a copy of UAdminUpdateSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$RepoRefCopyWith<$Res> get data { + + return $RepoRefCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class UAdminUpdateSubjectStatusOutputSubjectRepoStrongRef extends UAdminUpdateSubjectStatusOutputSubject { + const UAdminUpdateSubjectStatusOutputSubjectRepoStrongRef({required this.data}): super._(); + + +@override final RepoStrongRef data; + +/// Create a copy of UAdminUpdateSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UAdminUpdateSubjectStatusOutputSubjectRepoStrongRefCopyWith get copyWith => _$UAdminUpdateSubjectStatusOutputSubjectRepoStrongRefCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminUpdateSubjectStatusOutputSubjectRepoStrongRef&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'UAdminUpdateSubjectStatusOutputSubject.repoStrongRef(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UAdminUpdateSubjectStatusOutputSubjectRepoStrongRefCopyWith<$Res> implements $UAdminUpdateSubjectStatusOutputSubjectCopyWith<$Res> { + factory $UAdminUpdateSubjectStatusOutputSubjectRepoStrongRefCopyWith(UAdminUpdateSubjectStatusOutputSubjectRepoStrongRef value, $Res Function(UAdminUpdateSubjectStatusOutputSubjectRepoStrongRef) _then) = _$UAdminUpdateSubjectStatusOutputSubjectRepoStrongRefCopyWithImpl; +@useResult +$Res call({ + RepoStrongRef data +}); + + +$RepoStrongRefCopyWith<$Res> get data; + +} +/// @nodoc +class _$UAdminUpdateSubjectStatusOutputSubjectRepoStrongRefCopyWithImpl<$Res> + implements $UAdminUpdateSubjectStatusOutputSubjectRepoStrongRefCopyWith<$Res> { + _$UAdminUpdateSubjectStatusOutputSubjectRepoStrongRefCopyWithImpl(this._self, this._then); + + final UAdminUpdateSubjectStatusOutputSubjectRepoStrongRef _self; + final $Res Function(UAdminUpdateSubjectStatusOutputSubjectRepoStrongRef) _then; + +/// Create a copy of UAdminUpdateSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UAdminUpdateSubjectStatusOutputSubjectRepoStrongRef( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as RepoStrongRef, + )); +} + +/// Create a copy of UAdminUpdateSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$RepoStrongRefCopyWith<$Res> get data { + + return $RepoStrongRefCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class UAdminUpdateSubjectStatusOutputSubjectRepoBlobRef extends UAdminUpdateSubjectStatusOutputSubject { + const UAdminUpdateSubjectStatusOutputSubjectRepoBlobRef({required this.data}): super._(); + + +@override final RepoBlobRef data; + +/// Create a copy of UAdminUpdateSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UAdminUpdateSubjectStatusOutputSubjectRepoBlobRefCopyWith get copyWith => _$UAdminUpdateSubjectStatusOutputSubjectRepoBlobRefCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminUpdateSubjectStatusOutputSubjectRepoBlobRef&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'UAdminUpdateSubjectStatusOutputSubject.repoBlobRef(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UAdminUpdateSubjectStatusOutputSubjectRepoBlobRefCopyWith<$Res> implements $UAdminUpdateSubjectStatusOutputSubjectCopyWith<$Res> { + factory $UAdminUpdateSubjectStatusOutputSubjectRepoBlobRefCopyWith(UAdminUpdateSubjectStatusOutputSubjectRepoBlobRef value, $Res Function(UAdminUpdateSubjectStatusOutputSubjectRepoBlobRef) _then) = _$UAdminUpdateSubjectStatusOutputSubjectRepoBlobRefCopyWithImpl; +@useResult +$Res call({ + RepoBlobRef data +}); + + +$RepoBlobRefCopyWith<$Res> get data; + +} +/// @nodoc +class _$UAdminUpdateSubjectStatusOutputSubjectRepoBlobRefCopyWithImpl<$Res> + implements $UAdminUpdateSubjectStatusOutputSubjectRepoBlobRefCopyWith<$Res> { + _$UAdminUpdateSubjectStatusOutputSubjectRepoBlobRefCopyWithImpl(this._self, this._then); + + final UAdminUpdateSubjectStatusOutputSubjectRepoBlobRef _self; + final $Res Function(UAdminUpdateSubjectStatusOutputSubjectRepoBlobRef) _then; + +/// Create a copy of UAdminUpdateSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UAdminUpdateSubjectStatusOutputSubjectRepoBlobRef( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as RepoBlobRef, + )); +} + +/// Create a copy of UAdminUpdateSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$RepoBlobRefCopyWith<$Res> get data { + + return $RepoBlobRefCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class UAdminUpdateSubjectStatusOutputSubjectUnknown extends UAdminUpdateSubjectStatusOutputSubject { + const UAdminUpdateSubjectStatusOutputSubjectUnknown({required final Map data}): _data = data,super._(); + + + final Map _data; +@override Map get data { + if (_data is EqualUnmodifiableMapView) return _data; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_data); +} + + +/// Create a copy of UAdminUpdateSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UAdminUpdateSubjectStatusOutputSubjectUnknownCopyWith get copyWith => _$UAdminUpdateSubjectStatusOutputSubjectUnknownCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminUpdateSubjectStatusOutputSubjectUnknown&&const DeepCollectionEquality().equals(other._data, _data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_data)); + +@override +String toString() { + return 'UAdminUpdateSubjectStatusOutputSubject.unknown(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UAdminUpdateSubjectStatusOutputSubjectUnknownCopyWith<$Res> implements $UAdminUpdateSubjectStatusOutputSubjectCopyWith<$Res> { + factory $UAdminUpdateSubjectStatusOutputSubjectUnknownCopyWith(UAdminUpdateSubjectStatusOutputSubjectUnknown value, $Res Function(UAdminUpdateSubjectStatusOutputSubjectUnknown) _then) = _$UAdminUpdateSubjectStatusOutputSubjectUnknownCopyWithImpl; +@useResult +$Res call({ + Map data +}); + + + + +} +/// @nodoc +class _$UAdminUpdateSubjectStatusOutputSubjectUnknownCopyWithImpl<$Res> + implements $UAdminUpdateSubjectStatusOutputSubjectUnknownCopyWith<$Res> { + _$UAdminUpdateSubjectStatusOutputSubjectUnknownCopyWithImpl(this._self, this._then); + + final UAdminUpdateSubjectStatusOutputSubjectUnknown _self; + final $Res Function(UAdminUpdateSubjectStatusOutputSubjectUnknown) _then; + +/// Create a copy of UAdminUpdateSubjectStatusOutputSubject +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UAdminUpdateSubjectStatusOutputSubjectUnknown( +data: null == data ? _self._data : data // ignore: cast_nullable_to_non_nullable +as Map, + )); +} + + +} + +// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/union_main_subject.freezed.dart b/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/union_main_subject.freezed.dart deleted file mode 100644 index 5d81a2a88..000000000 --- a/packages/poptart_lex/lib/com/atproto/admin/update_subject_status/union_main_subject.freezed.dart +++ /dev/null @@ -1,483 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND -// coverage:ignore-file -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'union_main_subject.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; -/// @nodoc -mixin _$UAdminUpdateSubjectStatusSubject { - - Object get data; - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminUpdateSubjectStatusSubject&&const DeepCollectionEquality().equals(other.data, data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); - -@override -String toString() { - return 'UAdminUpdateSubjectStatusSubject(data: $data)'; -} - - -} - -/// @nodoc -class $UAdminUpdateSubjectStatusSubjectCopyWith<$Res> { -$UAdminUpdateSubjectStatusSubjectCopyWith(UAdminUpdateSubjectStatusSubject _, $Res Function(UAdminUpdateSubjectStatusSubject) __); -} - - -/// Adds pattern-matching-related methods to [UAdminUpdateSubjectStatusSubject]. -extension UAdminUpdateSubjectStatusSubjectPatterns on UAdminUpdateSubjectStatusSubject { -/// A variant of `map` that fallback to returning `orElse`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeMap({TResult Function( UAdminUpdateSubjectStatusSubjectRepoRef value)? repoRef,TResult Function( UAdminUpdateSubjectStatusSubjectRepoStrongRef value)? repoStrongRef,TResult Function( UAdminUpdateSubjectStatusSubjectRepoBlobRef value)? repoBlobRef,TResult Function( UAdminUpdateSubjectStatusSubjectUnknown value)? unknown,required TResult orElse(),}){ -final _that = this; -switch (_that) { -case UAdminUpdateSubjectStatusSubjectRepoRef() when repoRef != null: -return repoRef(_that);case UAdminUpdateSubjectStatusSubjectRepoStrongRef() when repoStrongRef != null: -return repoStrongRef(_that);case UAdminUpdateSubjectStatusSubjectRepoBlobRef() when repoBlobRef != null: -return repoBlobRef(_that);case UAdminUpdateSubjectStatusSubjectUnknown() when unknown != null: -return unknown(_that);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// Callbacks receives the raw object, upcasted. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case final Subclass2 value: -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult map({required TResult Function( UAdminUpdateSubjectStatusSubjectRepoRef value) repoRef,required TResult Function( UAdminUpdateSubjectStatusSubjectRepoStrongRef value) repoStrongRef,required TResult Function( UAdminUpdateSubjectStatusSubjectRepoBlobRef value) repoBlobRef,required TResult Function( UAdminUpdateSubjectStatusSubjectUnknown value) unknown,}){ -final _that = this; -switch (_that) { -case UAdminUpdateSubjectStatusSubjectRepoRef(): -return repoRef(_that);case UAdminUpdateSubjectStatusSubjectRepoStrongRef(): -return repoStrongRef(_that);case UAdminUpdateSubjectStatusSubjectRepoBlobRef(): -return repoBlobRef(_that);case UAdminUpdateSubjectStatusSubjectUnknown(): -return unknown(_that);} -} -/// A variant of `map` that fallback to returning `null`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? mapOrNull({TResult? Function( UAdminUpdateSubjectStatusSubjectRepoRef value)? repoRef,TResult? Function( UAdminUpdateSubjectStatusSubjectRepoStrongRef value)? repoStrongRef,TResult? Function( UAdminUpdateSubjectStatusSubjectRepoBlobRef value)? repoBlobRef,TResult? Function( UAdminUpdateSubjectStatusSubjectUnknown value)? unknown,}){ -final _that = this; -switch (_that) { -case UAdminUpdateSubjectStatusSubjectRepoRef() when repoRef != null: -return repoRef(_that);case UAdminUpdateSubjectStatusSubjectRepoStrongRef() when repoStrongRef != null: -return repoStrongRef(_that);case UAdminUpdateSubjectStatusSubjectRepoBlobRef() when repoBlobRef != null: -return repoBlobRef(_that);case UAdminUpdateSubjectStatusSubjectUnknown() when unknown != null: -return unknown(_that);case _: - return null; - -} -} -/// A variant of `when` that fallback to an `orElse` callback. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeWhen({TResult Function( RepoRef data)? repoRef,TResult Function( RepoStrongRef data)? repoStrongRef,TResult Function( RepoBlobRef data)? repoBlobRef,TResult Function( Map data)? unknown,required TResult orElse(),}) {final _that = this; -switch (_that) { -case UAdminUpdateSubjectStatusSubjectRepoRef() when repoRef != null: -return repoRef(_that.data);case UAdminUpdateSubjectStatusSubjectRepoStrongRef() when repoStrongRef != null: -return repoStrongRef(_that.data);case UAdminUpdateSubjectStatusSubjectRepoBlobRef() when repoBlobRef != null: -return repoBlobRef(_that.data);case UAdminUpdateSubjectStatusSubjectUnknown() when unknown != null: -return unknown(_that.data);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// As opposed to `map`, this offers destructuring. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case Subclass2(:final field2): -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult when({required TResult Function( RepoRef data) repoRef,required TResult Function( RepoStrongRef data) repoStrongRef,required TResult Function( RepoBlobRef data) repoBlobRef,required TResult Function( Map data) unknown,}) {final _that = this; -switch (_that) { -case UAdminUpdateSubjectStatusSubjectRepoRef(): -return repoRef(_that.data);case UAdminUpdateSubjectStatusSubjectRepoStrongRef(): -return repoStrongRef(_that.data);case UAdminUpdateSubjectStatusSubjectRepoBlobRef(): -return repoBlobRef(_that.data);case UAdminUpdateSubjectStatusSubjectUnknown(): -return unknown(_that.data);} -} -/// A variant of `when` that fallback to returning `null` -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? whenOrNull({TResult? Function( RepoRef data)? repoRef,TResult? Function( RepoStrongRef data)? repoStrongRef,TResult? Function( RepoBlobRef data)? repoBlobRef,TResult? Function( Map data)? unknown,}) {final _that = this; -switch (_that) { -case UAdminUpdateSubjectStatusSubjectRepoRef() when repoRef != null: -return repoRef(_that.data);case UAdminUpdateSubjectStatusSubjectRepoStrongRef() when repoStrongRef != null: -return repoStrongRef(_that.data);case UAdminUpdateSubjectStatusSubjectRepoBlobRef() when repoBlobRef != null: -return repoBlobRef(_that.data);case UAdminUpdateSubjectStatusSubjectUnknown() when unknown != null: -return unknown(_that.data);case _: - return null; - -} -} - -} - -/// @nodoc - - -class UAdminUpdateSubjectStatusSubjectRepoRef extends UAdminUpdateSubjectStatusSubject { - const UAdminUpdateSubjectStatusSubjectRepoRef({required this.data}): super._(); - - -@override final RepoRef data; - -/// Create a copy of UAdminUpdateSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$UAdminUpdateSubjectStatusSubjectRepoRefCopyWith get copyWith => _$UAdminUpdateSubjectStatusSubjectRepoRefCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminUpdateSubjectStatusSubjectRepoRef&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'UAdminUpdateSubjectStatusSubject.repoRef(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $UAdminUpdateSubjectStatusSubjectRepoRefCopyWith<$Res> implements $UAdminUpdateSubjectStatusSubjectCopyWith<$Res> { - factory $UAdminUpdateSubjectStatusSubjectRepoRefCopyWith(UAdminUpdateSubjectStatusSubjectRepoRef value, $Res Function(UAdminUpdateSubjectStatusSubjectRepoRef) _then) = _$UAdminUpdateSubjectStatusSubjectRepoRefCopyWithImpl; -@useResult -$Res call({ - RepoRef data -}); - - -$RepoRefCopyWith<$Res> get data; - -} -/// @nodoc -class _$UAdminUpdateSubjectStatusSubjectRepoRefCopyWithImpl<$Res> - implements $UAdminUpdateSubjectStatusSubjectRepoRefCopyWith<$Res> { - _$UAdminUpdateSubjectStatusSubjectRepoRefCopyWithImpl(this._self, this._then); - - final UAdminUpdateSubjectStatusSubjectRepoRef _self; - final $Res Function(UAdminUpdateSubjectStatusSubjectRepoRef) _then; - -/// Create a copy of UAdminUpdateSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(UAdminUpdateSubjectStatusSubjectRepoRef( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as RepoRef, - )); -} - -/// Create a copy of UAdminUpdateSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$RepoRefCopyWith<$Res> get data { - - return $RepoRefCopyWith<$Res>(_self.data, (value) { - return _then(_self.copyWith(data: value)); - }); -} -} - -/// @nodoc - - -class UAdminUpdateSubjectStatusSubjectRepoStrongRef extends UAdminUpdateSubjectStatusSubject { - const UAdminUpdateSubjectStatusSubjectRepoStrongRef({required this.data}): super._(); - - -@override final RepoStrongRef data; - -/// Create a copy of UAdminUpdateSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$UAdminUpdateSubjectStatusSubjectRepoStrongRefCopyWith get copyWith => _$UAdminUpdateSubjectStatusSubjectRepoStrongRefCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminUpdateSubjectStatusSubjectRepoStrongRef&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'UAdminUpdateSubjectStatusSubject.repoStrongRef(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $UAdminUpdateSubjectStatusSubjectRepoStrongRefCopyWith<$Res> implements $UAdminUpdateSubjectStatusSubjectCopyWith<$Res> { - factory $UAdminUpdateSubjectStatusSubjectRepoStrongRefCopyWith(UAdminUpdateSubjectStatusSubjectRepoStrongRef value, $Res Function(UAdminUpdateSubjectStatusSubjectRepoStrongRef) _then) = _$UAdminUpdateSubjectStatusSubjectRepoStrongRefCopyWithImpl; -@useResult -$Res call({ - RepoStrongRef data -}); - - -$RepoStrongRefCopyWith<$Res> get data; - -} -/// @nodoc -class _$UAdminUpdateSubjectStatusSubjectRepoStrongRefCopyWithImpl<$Res> - implements $UAdminUpdateSubjectStatusSubjectRepoStrongRefCopyWith<$Res> { - _$UAdminUpdateSubjectStatusSubjectRepoStrongRefCopyWithImpl(this._self, this._then); - - final UAdminUpdateSubjectStatusSubjectRepoStrongRef _self; - final $Res Function(UAdminUpdateSubjectStatusSubjectRepoStrongRef) _then; - -/// Create a copy of UAdminUpdateSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(UAdminUpdateSubjectStatusSubjectRepoStrongRef( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as RepoStrongRef, - )); -} - -/// Create a copy of UAdminUpdateSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$RepoStrongRefCopyWith<$Res> get data { - - return $RepoStrongRefCopyWith<$Res>(_self.data, (value) { - return _then(_self.copyWith(data: value)); - }); -} -} - -/// @nodoc - - -class UAdminUpdateSubjectStatusSubjectRepoBlobRef extends UAdminUpdateSubjectStatusSubject { - const UAdminUpdateSubjectStatusSubjectRepoBlobRef({required this.data}): super._(); - - -@override final RepoBlobRef data; - -/// Create a copy of UAdminUpdateSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$UAdminUpdateSubjectStatusSubjectRepoBlobRefCopyWith get copyWith => _$UAdminUpdateSubjectStatusSubjectRepoBlobRefCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminUpdateSubjectStatusSubjectRepoBlobRef&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'UAdminUpdateSubjectStatusSubject.repoBlobRef(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $UAdminUpdateSubjectStatusSubjectRepoBlobRefCopyWith<$Res> implements $UAdminUpdateSubjectStatusSubjectCopyWith<$Res> { - factory $UAdminUpdateSubjectStatusSubjectRepoBlobRefCopyWith(UAdminUpdateSubjectStatusSubjectRepoBlobRef value, $Res Function(UAdminUpdateSubjectStatusSubjectRepoBlobRef) _then) = _$UAdminUpdateSubjectStatusSubjectRepoBlobRefCopyWithImpl; -@useResult -$Res call({ - RepoBlobRef data -}); - - -$RepoBlobRefCopyWith<$Res> get data; - -} -/// @nodoc -class _$UAdminUpdateSubjectStatusSubjectRepoBlobRefCopyWithImpl<$Res> - implements $UAdminUpdateSubjectStatusSubjectRepoBlobRefCopyWith<$Res> { - _$UAdminUpdateSubjectStatusSubjectRepoBlobRefCopyWithImpl(this._self, this._then); - - final UAdminUpdateSubjectStatusSubjectRepoBlobRef _self; - final $Res Function(UAdminUpdateSubjectStatusSubjectRepoBlobRef) _then; - -/// Create a copy of UAdminUpdateSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(UAdminUpdateSubjectStatusSubjectRepoBlobRef( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as RepoBlobRef, - )); -} - -/// Create a copy of UAdminUpdateSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$RepoBlobRefCopyWith<$Res> get data { - - return $RepoBlobRefCopyWith<$Res>(_self.data, (value) { - return _then(_self.copyWith(data: value)); - }); -} -} - -/// @nodoc - - -class UAdminUpdateSubjectStatusSubjectUnknown extends UAdminUpdateSubjectStatusSubject { - const UAdminUpdateSubjectStatusSubjectUnknown({required final Map data}): _data = data,super._(); - - - final Map _data; -@override Map get data { - if (_data is EqualUnmodifiableMapView) return _data; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(_data); -} - - -/// Create a copy of UAdminUpdateSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$UAdminUpdateSubjectStatusSubjectUnknownCopyWith get copyWith => _$UAdminUpdateSubjectStatusSubjectUnknownCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UAdminUpdateSubjectStatusSubjectUnknown&&const DeepCollectionEquality().equals(other._data, _data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_data)); - -@override -String toString() { - return 'UAdminUpdateSubjectStatusSubject.unknown(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $UAdminUpdateSubjectStatusSubjectUnknownCopyWith<$Res> implements $UAdminUpdateSubjectStatusSubjectCopyWith<$Res> { - factory $UAdminUpdateSubjectStatusSubjectUnknownCopyWith(UAdminUpdateSubjectStatusSubjectUnknown value, $Res Function(UAdminUpdateSubjectStatusSubjectUnknown) _then) = _$UAdminUpdateSubjectStatusSubjectUnknownCopyWithImpl; -@useResult -$Res call({ - Map data -}); - - - - -} -/// @nodoc -class _$UAdminUpdateSubjectStatusSubjectUnknownCopyWithImpl<$Res> - implements $UAdminUpdateSubjectStatusSubjectUnknownCopyWith<$Res> { - _$UAdminUpdateSubjectStatusSubjectUnknownCopyWithImpl(this._self, this._then); - - final UAdminUpdateSubjectStatusSubjectUnknown _self; - final $Res Function(UAdminUpdateSubjectStatusSubjectUnknown) _then; - -/// Create a copy of UAdminUpdateSubjectStatusSubject -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(UAdminUpdateSubjectStatusSubjectUnknown( -data: null == data ? _self._data : data // ignore: cast_nullable_to_non_nullable -as Map, - )); -} - - -} - -// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/moderation/create_report.dart b/packages/poptart_lex/lib/com/atproto/moderation/create_report.dart index 2fc7ecfd9..47a737adf 100644 --- a/packages/poptart_lex/lib/com/atproto/moderation/create_report.dart +++ b/packages/poptart_lex/lib/com/atproto/moderation/create_report.dart @@ -11,4 +11,5 @@ export 'create_report/descriptor.dart'; export 'create_report/input.dart'; export 'create_report/mod_tool.dart'; export 'create_report/output.dart'; -export 'create_report/union_main_subject.dart'; +export 'create_report/union_main_input_subject.dart'; +export 'create_report/union_main_output_subject.dart'; diff --git a/packages/poptart_lex/lib/com/atproto/moderation/create_report/input.dart b/packages/poptart_lex/lib/com/atproto/moderation/create_report/input.dart index 27fc90f19..58bd62bcc 100644 --- a/packages/poptart_lex/lib/com/atproto/moderation/create_report/input.dart +++ b/packages/poptart_lex/lib/com/atproto/moderation/create_report/input.dart @@ -8,7 +8,7 @@ import 'package:poptart_core/poptart_core.dart'; import 'package:poptart_core/internals.dart'; import '../defs/reason_type.dart'; -import './union_main_subject.dart'; +import './union_main_input_subject.dart'; import './mod_tool.dart'; part 'input.freezed.dart'; @@ -34,8 +34,8 @@ abstract class ModerationCreateReportInput with _$ModerationCreateReportInput { /// Additional context about the content and violation. String? reason, - @UModerationCreateReportSubjectConverter() - required UModerationCreateReportSubject subject, + @UModerationCreateReportInputSubjectConverter() + required UModerationCreateReportInputSubject subject, @ModToolConverter() ModTool? modTool, Map? $unknown, diff --git a/packages/poptart_lex/lib/com/atproto/moderation/create_report/input.freezed.dart b/packages/poptart_lex/lib/com/atproto/moderation/create_report/input.freezed.dart index d557342ec..cab115557 100644 --- a/packages/poptart_lex/lib/com/atproto/moderation/create_report/input.freezed.dart +++ b/packages/poptart_lex/lib/com/atproto/moderation/create_report/input.freezed.dart @@ -17,7 +17,7 @@ mixin _$ModerationCreateReportInput { /// Indicates the broad category of violation the report is for. @ReasonTypeConverter() ReasonType get reasonType;/// Additional context about the content and violation. - String? get reason;@UModerationCreateReportSubjectConverter() UModerationCreateReportSubject get subject;@ModToolConverter() ModTool? get modTool; Map? get $unknown; + String? get reason;@UModerationCreateReportInputSubjectConverter() UModerationCreateReportInputSubject get subject;@ModToolConverter() ModTool? get modTool; Map? get $unknown; /// Create a copy of ModerationCreateReportInput /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -50,11 +50,11 @@ abstract mixin class $ModerationCreateReportInputCopyWith<$Res> { factory $ModerationCreateReportInputCopyWith(ModerationCreateReportInput value, $Res Function(ModerationCreateReportInput) _then) = _$ModerationCreateReportInputCopyWithImpl; @useResult $Res call({ -@ReasonTypeConverter() ReasonType reasonType, String? reason,@UModerationCreateReportSubjectConverter() UModerationCreateReportSubject subject,@ModToolConverter() ModTool? modTool, Map? $unknown +@ReasonTypeConverter() ReasonType reasonType, String? reason,@UModerationCreateReportInputSubjectConverter() UModerationCreateReportInputSubject subject,@ModToolConverter() ModTool? modTool, Map? $unknown }); -$ReasonTypeCopyWith<$Res> get reasonType;$UModerationCreateReportSubjectCopyWith<$Res> get subject;$ModToolCopyWith<$Res>? get modTool; +$ReasonTypeCopyWith<$Res> get reasonType;$UModerationCreateReportInputSubjectCopyWith<$Res> get subject;$ModToolCopyWith<$Res>? get modTool; } /// @nodoc @@ -72,7 +72,7 @@ class _$ModerationCreateReportInputCopyWithImpl<$Res> reasonType: null == reasonType ? _self.reasonType : reasonType // ignore: cast_nullable_to_non_nullable as ReasonType,reason: freezed == reason ? _self.reason : reason // ignore: cast_nullable_to_non_nullable as String?,subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable -as UModerationCreateReportSubject,modTool: freezed == modTool ? _self.modTool : modTool // ignore: cast_nullable_to_non_nullable +as UModerationCreateReportInputSubject,modTool: freezed == modTool ? _self.modTool : modTool // ignore: cast_nullable_to_non_nullable as ModTool?,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); @@ -90,9 +90,9 @@ $ReasonTypeCopyWith<$Res> get reasonType { /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$UModerationCreateReportSubjectCopyWith<$Res> get subject { +$UModerationCreateReportInputSubjectCopyWith<$Res> get subject { - return $UModerationCreateReportSubjectCopyWith<$Res>(_self.subject, (value) { + return $UModerationCreateReportInputSubjectCopyWith<$Res>(_self.subject, (value) { return _then(_self.copyWith(subject: value)); }); }/// Create a copy of ModerationCreateReportInput @@ -189,7 +189,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function(@ReasonTypeConverter() ReasonType reasonType, String? reason, @UModerationCreateReportSubjectConverter() UModerationCreateReportSubject subject, @ModToolConverter() ModTool? modTool, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function(@ReasonTypeConverter() ReasonType reasonType, String? reason, @UModerationCreateReportInputSubjectConverter() UModerationCreateReportInputSubject subject, @ModToolConverter() ModTool? modTool, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _ModerationCreateReportInput() when $default != null: return $default(_that.reasonType,_that.reason,_that.subject,_that.modTool,_that.$unknown);case _: @@ -210,7 +210,7 @@ return $default(_that.reasonType,_that.reason,_that.subject,_that.modTool,_that. /// } /// ``` -@optionalTypeArgs TResult when(TResult Function(@ReasonTypeConverter() ReasonType reasonType, String? reason, @UModerationCreateReportSubjectConverter() UModerationCreateReportSubject subject, @ModToolConverter() ModTool? modTool, Map? $unknown) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function(@ReasonTypeConverter() ReasonType reasonType, String? reason, @UModerationCreateReportInputSubjectConverter() UModerationCreateReportInputSubject subject, @ModToolConverter() ModTool? modTool, Map? $unknown) $default,) {final _that = this; switch (_that) { case _ModerationCreateReportInput(): return $default(_that.reasonType,_that.reason,_that.subject,_that.modTool,_that.$unknown);case _: @@ -230,7 +230,7 @@ return $default(_that.reasonType,_that.reason,_that.subject,_that.modTool,_that. /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function(@ReasonTypeConverter() ReasonType reasonType, String? reason, @UModerationCreateReportSubjectConverter() UModerationCreateReportSubject subject, @ModToolConverter() ModTool? modTool, Map? $unknown)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function(@ReasonTypeConverter() ReasonType reasonType, String? reason, @UModerationCreateReportInputSubjectConverter() UModerationCreateReportInputSubject subject, @ModToolConverter() ModTool? modTool, Map? $unknown)? $default,) {final _that = this; switch (_that) { case _ModerationCreateReportInput() when $default != null: return $default(_that.reasonType,_that.reason,_that.subject,_that.modTool,_that.$unknown);case _: @@ -245,14 +245,14 @@ return $default(_that.reasonType,_that.reason,_that.subject,_that.modTool,_that. @JsonSerializable(includeIfNull: false) class _ModerationCreateReportInput implements ModerationCreateReportInput { - const _ModerationCreateReportInput({@ReasonTypeConverter() required this.reasonType, this.reason, @UModerationCreateReportSubjectConverter() required this.subject, @ModToolConverter() this.modTool, final Map? $unknown}): _$unknown = $unknown; + const _ModerationCreateReportInput({@ReasonTypeConverter() required this.reasonType, this.reason, @UModerationCreateReportInputSubjectConverter() required this.subject, @ModToolConverter() this.modTool, final Map? $unknown}): _$unknown = $unknown; factory _ModerationCreateReportInput.fromJson(Map json) => _$ModerationCreateReportInputFromJson(json); /// Indicates the broad category of violation the report is for. @override@ReasonTypeConverter() final ReasonType reasonType; /// Additional context about the content and violation. @override final String? reason; -@override@UModerationCreateReportSubjectConverter() final UModerationCreateReportSubject subject; +@override@UModerationCreateReportInputSubjectConverter() final UModerationCreateReportInputSubject subject; @override@ModToolConverter() final ModTool? modTool; final Map? _$unknown; @override Map? get $unknown { @@ -297,11 +297,11 @@ abstract mixin class _$ModerationCreateReportInputCopyWith<$Res> implements $Mod factory _$ModerationCreateReportInputCopyWith(_ModerationCreateReportInput value, $Res Function(_ModerationCreateReportInput) _then) = __$ModerationCreateReportInputCopyWithImpl; @override @useResult $Res call({ -@ReasonTypeConverter() ReasonType reasonType, String? reason,@UModerationCreateReportSubjectConverter() UModerationCreateReportSubject subject,@ModToolConverter() ModTool? modTool, Map? $unknown +@ReasonTypeConverter() ReasonType reasonType, String? reason,@UModerationCreateReportInputSubjectConverter() UModerationCreateReportInputSubject subject,@ModToolConverter() ModTool? modTool, Map? $unknown }); -@override $ReasonTypeCopyWith<$Res> get reasonType;@override $UModerationCreateReportSubjectCopyWith<$Res> get subject;@override $ModToolCopyWith<$Res>? get modTool; +@override $ReasonTypeCopyWith<$Res> get reasonType;@override $UModerationCreateReportInputSubjectCopyWith<$Res> get subject;@override $ModToolCopyWith<$Res>? get modTool; } /// @nodoc @@ -319,7 +319,7 @@ class __$ModerationCreateReportInputCopyWithImpl<$Res> reasonType: null == reasonType ? _self.reasonType : reasonType // ignore: cast_nullable_to_non_nullable as ReasonType,reason: freezed == reason ? _self.reason : reason // ignore: cast_nullable_to_non_nullable as String?,subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable -as UModerationCreateReportSubject,modTool: freezed == modTool ? _self.modTool : modTool // ignore: cast_nullable_to_non_nullable +as UModerationCreateReportInputSubject,modTool: freezed == modTool ? _self.modTool : modTool // ignore: cast_nullable_to_non_nullable as ModTool?,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); @@ -338,9 +338,9 @@ $ReasonTypeCopyWith<$Res> get reasonType { /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$UModerationCreateReportSubjectCopyWith<$Res> get subject { +$UModerationCreateReportInputSubjectCopyWith<$Res> get subject { - return $UModerationCreateReportSubjectCopyWith<$Res>(_self.subject, (value) { + return $UModerationCreateReportInputSubjectCopyWith<$Res>(_self.subject, (value) { return _then(_self.copyWith(subject: value)); }); }/// Create a copy of ModerationCreateReportInput diff --git a/packages/poptart_lex/lib/com/atproto/moderation/create_report/input.g.dart b/packages/poptart_lex/lib/com/atproto/moderation/create_report/input.g.dart index c08205034..4128e69e3 100644 --- a/packages/poptart_lex/lib/com/atproto/moderation/create_report/input.g.dart +++ b/packages/poptart_lex/lib/com/atproto/moderation/create_report/input.g.dart @@ -18,7 +18,7 @@ _ModerationCreateReportInput _$ModerationCreateReportInputFromJson(Map json) => reason: $checkedConvert('reason', (v) => v as String?), subject: $checkedConvert( 'subject', - (v) => const UModerationCreateReportSubjectConverter().fromJson( + (v) => const UModerationCreateReportInputSubjectConverter().fromJson( v as Map, ), ), @@ -42,7 +42,7 @@ Map _$ModerationCreateReportInputToJson( ) => { 'reasonType': const ReasonTypeConverter().toJson(instance.reasonType), 'reason': ?instance.reason, - 'subject': const UModerationCreateReportSubjectConverter().toJson( + 'subject': const UModerationCreateReportInputSubjectConverter().toJson( instance.subject, ), 'modTool': ?_$JsonConverterToJson, ModTool>( diff --git a/packages/poptart_lex/lib/com/atproto/moderation/create_report/output.dart b/packages/poptart_lex/lib/com/atproto/moderation/create_report/output.dart index fac47373e..d0be971e7 100644 --- a/packages/poptart_lex/lib/com/atproto/moderation/create_report/output.dart +++ b/packages/poptart_lex/lib/com/atproto/moderation/create_report/output.dart @@ -8,7 +8,7 @@ import 'package:poptart_core/poptart_core.dart'; import 'package:poptart_core/internals.dart'; import '../defs/reason_type.dart'; -import './union_main_subject.dart'; +import './union_main_output_subject.dart'; part 'output.freezed.dart'; part 'output.g.dart'; @@ -34,8 +34,8 @@ abstract class ModerationCreateReportOutput required int id, @ReasonTypeConverter() required ReasonType reasonType, String? reason, - @UModerationCreateReportSubjectConverter() - required UModerationCreateReportSubject subject, + @UModerationCreateReportOutputSubjectConverter() + required UModerationCreateReportOutputSubject subject, required String reportedBy, required DateTime createdAt, diff --git a/packages/poptart_lex/lib/com/atproto/moderation/create_report/output.freezed.dart b/packages/poptart_lex/lib/com/atproto/moderation/create_report/output.freezed.dart index 1128e5fc0..5f1366922 100644 --- a/packages/poptart_lex/lib/com/atproto/moderation/create_report/output.freezed.dart +++ b/packages/poptart_lex/lib/com/atproto/moderation/create_report/output.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$ModerationCreateReportOutput { - int get id;@ReasonTypeConverter() ReasonType get reasonType; String? get reason;@UModerationCreateReportSubjectConverter() UModerationCreateReportSubject get subject; String get reportedBy; DateTime get createdAt; Map? get $unknown; + int get id;@ReasonTypeConverter() ReasonType get reasonType; String? get reason;@UModerationCreateReportOutputSubjectConverter() UModerationCreateReportOutputSubject get subject; String get reportedBy; DateTime get createdAt; Map? get $unknown; /// Create a copy of ModerationCreateReportOutput /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -48,11 +48,11 @@ abstract mixin class $ModerationCreateReportOutputCopyWith<$Res> { factory $ModerationCreateReportOutputCopyWith(ModerationCreateReportOutput value, $Res Function(ModerationCreateReportOutput) _then) = _$ModerationCreateReportOutputCopyWithImpl; @useResult $Res call({ - int id,@ReasonTypeConverter() ReasonType reasonType, String? reason,@UModerationCreateReportSubjectConverter() UModerationCreateReportSubject subject, String reportedBy, DateTime createdAt, Map? $unknown + int id,@ReasonTypeConverter() ReasonType reasonType, String? reason,@UModerationCreateReportOutputSubjectConverter() UModerationCreateReportOutputSubject subject, String reportedBy, DateTime createdAt, Map? $unknown }); -$ReasonTypeCopyWith<$Res> get reasonType;$UModerationCreateReportSubjectCopyWith<$Res> get subject; +$ReasonTypeCopyWith<$Res> get reasonType;$UModerationCreateReportOutputSubjectCopyWith<$Res> get subject; } /// @nodoc @@ -71,7 +71,7 @@ id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as int,reasonType: null == reasonType ? _self.reasonType : reasonType // ignore: cast_nullable_to_non_nullable as ReasonType,reason: freezed == reason ? _self.reason : reason // ignore: cast_nullable_to_non_nullable as String?,subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable -as UModerationCreateReportSubject,reportedBy: null == reportedBy ? _self.reportedBy : reportedBy // ignore: cast_nullable_to_non_nullable +as UModerationCreateReportOutputSubject,reportedBy: null == reportedBy ? _self.reportedBy : reportedBy // ignore: cast_nullable_to_non_nullable as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable as DateTime,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, @@ -90,9 +90,9 @@ $ReasonTypeCopyWith<$Res> get reasonType { /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$UModerationCreateReportSubjectCopyWith<$Res> get subject { +$UModerationCreateReportOutputSubjectCopyWith<$Res> get subject { - return $UModerationCreateReportSubjectCopyWith<$Res>(_self.subject, (value) { + return $UModerationCreateReportOutputSubjectCopyWith<$Res>(_self.subject, (value) { return _then(_self.copyWith(subject: value)); }); } @@ -177,7 +177,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( int id, @ReasonTypeConverter() ReasonType reasonType, String? reason, @UModerationCreateReportSubjectConverter() UModerationCreateReportSubject subject, String reportedBy, DateTime createdAt, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( int id, @ReasonTypeConverter() ReasonType reasonType, String? reason, @UModerationCreateReportOutputSubjectConverter() UModerationCreateReportOutputSubject subject, String reportedBy, DateTime createdAt, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _ModerationCreateReportOutput() when $default != null: return $default(_that.id,_that.reasonType,_that.reason,_that.subject,_that.reportedBy,_that.createdAt,_that.$unknown);case _: @@ -198,7 +198,7 @@ return $default(_that.id,_that.reasonType,_that.reason,_that.subject,_that.repor /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( int id, @ReasonTypeConverter() ReasonType reasonType, String? reason, @UModerationCreateReportSubjectConverter() UModerationCreateReportSubject subject, String reportedBy, DateTime createdAt, Map? $unknown) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( int id, @ReasonTypeConverter() ReasonType reasonType, String? reason, @UModerationCreateReportOutputSubjectConverter() UModerationCreateReportOutputSubject subject, String reportedBy, DateTime createdAt, Map? $unknown) $default,) {final _that = this; switch (_that) { case _ModerationCreateReportOutput(): return $default(_that.id,_that.reasonType,_that.reason,_that.subject,_that.reportedBy,_that.createdAt,_that.$unknown);case _: @@ -218,7 +218,7 @@ return $default(_that.id,_that.reasonType,_that.reason,_that.subject,_that.repor /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( int id, @ReasonTypeConverter() ReasonType reasonType, String? reason, @UModerationCreateReportSubjectConverter() UModerationCreateReportSubject subject, String reportedBy, DateTime createdAt, Map? $unknown)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( int id, @ReasonTypeConverter() ReasonType reasonType, String? reason, @UModerationCreateReportOutputSubjectConverter() UModerationCreateReportOutputSubject subject, String reportedBy, DateTime createdAt, Map? $unknown)? $default,) {final _that = this; switch (_that) { case _ModerationCreateReportOutput() when $default != null: return $default(_that.id,_that.reasonType,_that.reason,_that.subject,_that.reportedBy,_that.createdAt,_that.$unknown);case _: @@ -233,13 +233,13 @@ return $default(_that.id,_that.reasonType,_that.reason,_that.subject,_that.repor @JsonSerializable(includeIfNull: false) class _ModerationCreateReportOutput implements ModerationCreateReportOutput { - const _ModerationCreateReportOutput({required this.id, @ReasonTypeConverter() required this.reasonType, this.reason, @UModerationCreateReportSubjectConverter() required this.subject, required this.reportedBy, required this.createdAt, final Map? $unknown}): _$unknown = $unknown; + const _ModerationCreateReportOutput({required this.id, @ReasonTypeConverter() required this.reasonType, this.reason, @UModerationCreateReportOutputSubjectConverter() required this.subject, required this.reportedBy, required this.createdAt, final Map? $unknown}): _$unknown = $unknown; factory _ModerationCreateReportOutput.fromJson(Map json) => _$ModerationCreateReportOutputFromJson(json); @override final int id; @override@ReasonTypeConverter() final ReasonType reasonType; @override final String? reason; -@override@UModerationCreateReportSubjectConverter() final UModerationCreateReportSubject subject; +@override@UModerationCreateReportOutputSubjectConverter() final UModerationCreateReportOutputSubject subject; @override final String reportedBy; @override final DateTime createdAt; final Map? _$unknown; @@ -285,11 +285,11 @@ abstract mixin class _$ModerationCreateReportOutputCopyWith<$Res> implements $Mo factory _$ModerationCreateReportOutputCopyWith(_ModerationCreateReportOutput value, $Res Function(_ModerationCreateReportOutput) _then) = __$ModerationCreateReportOutputCopyWithImpl; @override @useResult $Res call({ - int id,@ReasonTypeConverter() ReasonType reasonType, String? reason,@UModerationCreateReportSubjectConverter() UModerationCreateReportSubject subject, String reportedBy, DateTime createdAt, Map? $unknown + int id,@ReasonTypeConverter() ReasonType reasonType, String? reason,@UModerationCreateReportOutputSubjectConverter() UModerationCreateReportOutputSubject subject, String reportedBy, DateTime createdAt, Map? $unknown }); -@override $ReasonTypeCopyWith<$Res> get reasonType;@override $UModerationCreateReportSubjectCopyWith<$Res> get subject; +@override $ReasonTypeCopyWith<$Res> get reasonType;@override $UModerationCreateReportOutputSubjectCopyWith<$Res> get subject; } /// @nodoc @@ -308,7 +308,7 @@ id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as int,reasonType: null == reasonType ? _self.reasonType : reasonType // ignore: cast_nullable_to_non_nullable as ReasonType,reason: freezed == reason ? _self.reason : reason // ignore: cast_nullable_to_non_nullable as String?,subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable -as UModerationCreateReportSubject,reportedBy: null == reportedBy ? _self.reportedBy : reportedBy // ignore: cast_nullable_to_non_nullable +as UModerationCreateReportOutputSubject,reportedBy: null == reportedBy ? _self.reportedBy : reportedBy // ignore: cast_nullable_to_non_nullable as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable as DateTime,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, @@ -328,9 +328,9 @@ $ReasonTypeCopyWith<$Res> get reasonType { /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$UModerationCreateReportSubjectCopyWith<$Res> get subject { +$UModerationCreateReportOutputSubjectCopyWith<$Res> get subject { - return $UModerationCreateReportSubjectCopyWith<$Res>(_self.subject, (value) { + return $UModerationCreateReportOutputSubjectCopyWith<$Res>(_self.subject, (value) { return _then(_self.copyWith(subject: value)); }); } diff --git a/packages/poptart_lex/lib/com/atproto/moderation/create_report/output.g.dart b/packages/poptart_lex/lib/com/atproto/moderation/create_report/output.g.dart index c602b1126..42cbefd02 100644 --- a/packages/poptart_lex/lib/com/atproto/moderation/create_report/output.g.dart +++ b/packages/poptart_lex/lib/com/atproto/moderation/create_report/output.g.dart @@ -20,7 +20,7 @@ _ModerationCreateReportOutput _$ModerationCreateReportOutputFromJson( reason: $checkedConvert('reason', (v) => v as String?), subject: $checkedConvert( 'subject', - (v) => const UModerationCreateReportSubjectConverter().fromJson( + (v) => const UModerationCreateReportOutputSubjectConverter().fromJson( v as Map, ), ), @@ -40,7 +40,7 @@ Map _$ModerationCreateReportOutputToJson( 'id': instance.id, 'reasonType': const ReasonTypeConverter().toJson(instance.reasonType), 'reason': ?instance.reason, - 'subject': const UModerationCreateReportSubjectConverter().toJson( + 'subject': const UModerationCreateReportOutputSubjectConverter().toJson( instance.subject, ), 'reportedBy': instance.reportedBy, diff --git a/packages/poptart_lex/lib/com/atproto/moderation/create_report/union_main_subject.dart b/packages/poptart_lex/lib/com/atproto/moderation/create_report/union_main_input_subject.dart similarity index 55% rename from packages/poptart_lex/lib/com/atproto/moderation/create_report/union_main_subject.dart rename to packages/poptart_lex/lib/com/atproto/moderation/create_report/union_main_input_subject.dart index 32ba2ba07..3421e9c2e 100644 --- a/packages/poptart_lex/lib/com/atproto/moderation/create_report/union_main_subject.dart +++ b/packages/poptart_lex/lib/com/atproto/moderation/create_report/union_main_input_subject.dart @@ -9,75 +9,78 @@ import 'package:poptart_core/internals.dart' show isA; import '../../admin/defs/repo_ref.dart'; import '../../repo/strong_ref/main.dart'; -part 'union_main_subject.freezed.dart'; +part 'union_main_input_subject.freezed.dart'; // ************************************************************************** // LexGenerator // ************************************************************************** @freezed -sealed class UModerationCreateReportSubject - with _$UModerationCreateReportSubject { - const UModerationCreateReportSubject._(); +sealed class UModerationCreateReportInputSubject + with _$UModerationCreateReportInputSubject { + const UModerationCreateReportInputSubject._(); - const factory UModerationCreateReportSubject.repoRef({ + const factory UModerationCreateReportInputSubject.repoRef({ required RepoRef data, - }) = UModerationCreateReportSubjectRepoRef; - const factory UModerationCreateReportSubject.repoStrongRef({ + }) = UModerationCreateReportInputSubjectRepoRef; + const factory UModerationCreateReportInputSubject.repoStrongRef({ required RepoStrongRef data, - }) = UModerationCreateReportSubjectRepoStrongRef; + }) = UModerationCreateReportInputSubjectRepoStrongRef; - const factory UModerationCreateReportSubject.unknown({ + const factory UModerationCreateReportInputSubject.unknown({ required Map data, - }) = UModerationCreateReportSubjectUnknown; + }) = UModerationCreateReportInputSubjectUnknown; Map toJson() => - const UModerationCreateReportSubjectConverter().toJson(this); + const UModerationCreateReportInputSubjectConverter().toJson(this); } -extension UModerationCreateReportSubjectExtension - on UModerationCreateReportSubject { - bool get isRepoRef => isA(this); +extension UModerationCreateReportInputSubjectExtension + on UModerationCreateReportInputSubject { + bool get isRepoRef => isA(this); bool get isNotRepoRef => !isRepoRef; RepoRef? get repoRef => isRepoRef ? data as RepoRef : null; bool get isRepoStrongRef => - isA(this); + isA(this); bool get isNotRepoStrongRef => !isRepoStrongRef; RepoStrongRef? get repoStrongRef => isRepoStrongRef ? data as RepoStrongRef : null; - bool get isUnknown => isA(this); + bool get isUnknown => isA(this); bool get isNotUnknown => !isUnknown; Map? get unknown => isUnknown ? data as Map : null; } -final class UModerationCreateReportSubjectConverter +final class UModerationCreateReportInputSubjectConverter implements - JsonConverter> { - const UModerationCreateReportSubjectConverter(); + JsonConverter< + UModerationCreateReportInputSubject, + Map + > { + const UModerationCreateReportInputSubjectConverter(); @override - UModerationCreateReportSubject fromJson(Map json) { + UModerationCreateReportInputSubject fromJson(Map json) { try { if (RepoRef.validate(json)) { - return UModerationCreateReportSubject.repoRef( + return UModerationCreateReportInputSubject.repoRef( data: const RepoRefConverter().fromJson(json), ); } if (RepoStrongRef.validate(json)) { - return UModerationCreateReportSubject.repoStrongRef( + return UModerationCreateReportInputSubject.repoStrongRef( data: const RepoStrongRefConverter().fromJson(json), ); } - return UModerationCreateReportSubject.unknown(data: json); + return UModerationCreateReportInputSubject.unknown(data: json); } catch (_) { - return UModerationCreateReportSubject.unknown(data: json); + return UModerationCreateReportInputSubject.unknown(data: json); } } @override - Map toJson(UModerationCreateReportSubject object) => + Map toJson(UModerationCreateReportInputSubject object) => object.when( repoRef: (data) => const RepoRefConverter().toJson(data), repoStrongRef: (data) => const RepoStrongRefConverter().toJson(data), diff --git a/packages/poptart_lex/lib/com/atproto/moderation/create_report/union_main_input_subject.freezed.dart b/packages/poptart_lex/lib/com/atproto/moderation/create_report/union_main_input_subject.freezed.dart new file mode 100644 index 000000000..02739c1a4 --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/moderation/create_report/union_main_input_subject.freezed.dart @@ -0,0 +1,402 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'union_main_input_subject.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$UModerationCreateReportInputSubject { + + Object get data; + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UModerationCreateReportInputSubject&&const DeepCollectionEquality().equals(other.data, data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); + +@override +String toString() { + return 'UModerationCreateReportInputSubject(data: $data)'; +} + + +} + +/// @nodoc +class $UModerationCreateReportInputSubjectCopyWith<$Res> { +$UModerationCreateReportInputSubjectCopyWith(UModerationCreateReportInputSubject _, $Res Function(UModerationCreateReportInputSubject) __); +} + + +/// Adds pattern-matching-related methods to [UModerationCreateReportInputSubject]. +extension UModerationCreateReportInputSubjectPatterns on UModerationCreateReportInputSubject { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap({TResult Function( UModerationCreateReportInputSubjectRepoRef value)? repoRef,TResult Function( UModerationCreateReportInputSubjectRepoStrongRef value)? repoStrongRef,TResult Function( UModerationCreateReportInputSubjectUnknown value)? unknown,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case UModerationCreateReportInputSubjectRepoRef() when repoRef != null: +return repoRef(_that);case UModerationCreateReportInputSubjectRepoStrongRef() when repoStrongRef != null: +return repoStrongRef(_that);case UModerationCreateReportInputSubjectUnknown() when unknown != null: +return unknown(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map({required TResult Function( UModerationCreateReportInputSubjectRepoRef value) repoRef,required TResult Function( UModerationCreateReportInputSubjectRepoStrongRef value) repoStrongRef,required TResult Function( UModerationCreateReportInputSubjectUnknown value) unknown,}){ +final _that = this; +switch (_that) { +case UModerationCreateReportInputSubjectRepoRef(): +return repoRef(_that);case UModerationCreateReportInputSubjectRepoStrongRef(): +return repoStrongRef(_that);case UModerationCreateReportInputSubjectUnknown(): +return unknown(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull({TResult? Function( UModerationCreateReportInputSubjectRepoRef value)? repoRef,TResult? Function( UModerationCreateReportInputSubjectRepoStrongRef value)? repoStrongRef,TResult? Function( UModerationCreateReportInputSubjectUnknown value)? unknown,}){ +final _that = this; +switch (_that) { +case UModerationCreateReportInputSubjectRepoRef() when repoRef != null: +return repoRef(_that);case UModerationCreateReportInputSubjectRepoStrongRef() when repoStrongRef != null: +return repoStrongRef(_that);case UModerationCreateReportInputSubjectUnknown() when unknown != null: +return unknown(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen({TResult Function( RepoRef data)? repoRef,TResult Function( RepoStrongRef data)? repoStrongRef,TResult Function( Map data)? unknown,required TResult orElse(),}) {final _that = this; +switch (_that) { +case UModerationCreateReportInputSubjectRepoRef() when repoRef != null: +return repoRef(_that.data);case UModerationCreateReportInputSubjectRepoStrongRef() when repoStrongRef != null: +return repoStrongRef(_that.data);case UModerationCreateReportInputSubjectUnknown() when unknown != null: +return unknown(_that.data);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when({required TResult Function( RepoRef data) repoRef,required TResult Function( RepoStrongRef data) repoStrongRef,required TResult Function( Map data) unknown,}) {final _that = this; +switch (_that) { +case UModerationCreateReportInputSubjectRepoRef(): +return repoRef(_that.data);case UModerationCreateReportInputSubjectRepoStrongRef(): +return repoStrongRef(_that.data);case UModerationCreateReportInputSubjectUnknown(): +return unknown(_that.data);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull({TResult? Function( RepoRef data)? repoRef,TResult? Function( RepoStrongRef data)? repoStrongRef,TResult? Function( Map data)? unknown,}) {final _that = this; +switch (_that) { +case UModerationCreateReportInputSubjectRepoRef() when repoRef != null: +return repoRef(_that.data);case UModerationCreateReportInputSubjectRepoStrongRef() when repoStrongRef != null: +return repoStrongRef(_that.data);case UModerationCreateReportInputSubjectUnknown() when unknown != null: +return unknown(_that.data);case _: + return null; + +} +} + +} + +/// @nodoc + + +class UModerationCreateReportInputSubjectRepoRef extends UModerationCreateReportInputSubject { + const UModerationCreateReportInputSubjectRepoRef({required this.data}): super._(); + + +@override final RepoRef data; + +/// Create a copy of UModerationCreateReportInputSubject +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UModerationCreateReportInputSubjectRepoRefCopyWith get copyWith => _$UModerationCreateReportInputSubjectRepoRefCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UModerationCreateReportInputSubjectRepoRef&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'UModerationCreateReportInputSubject.repoRef(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UModerationCreateReportInputSubjectRepoRefCopyWith<$Res> implements $UModerationCreateReportInputSubjectCopyWith<$Res> { + factory $UModerationCreateReportInputSubjectRepoRefCopyWith(UModerationCreateReportInputSubjectRepoRef value, $Res Function(UModerationCreateReportInputSubjectRepoRef) _then) = _$UModerationCreateReportInputSubjectRepoRefCopyWithImpl; +@useResult +$Res call({ + RepoRef data +}); + + +$RepoRefCopyWith<$Res> get data; + +} +/// @nodoc +class _$UModerationCreateReportInputSubjectRepoRefCopyWithImpl<$Res> + implements $UModerationCreateReportInputSubjectRepoRefCopyWith<$Res> { + _$UModerationCreateReportInputSubjectRepoRefCopyWithImpl(this._self, this._then); + + final UModerationCreateReportInputSubjectRepoRef _self; + final $Res Function(UModerationCreateReportInputSubjectRepoRef) _then; + +/// Create a copy of UModerationCreateReportInputSubject +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UModerationCreateReportInputSubjectRepoRef( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as RepoRef, + )); +} + +/// Create a copy of UModerationCreateReportInputSubject +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$RepoRefCopyWith<$Res> get data { + + return $RepoRefCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class UModerationCreateReportInputSubjectRepoStrongRef extends UModerationCreateReportInputSubject { + const UModerationCreateReportInputSubjectRepoStrongRef({required this.data}): super._(); + + +@override final RepoStrongRef data; + +/// Create a copy of UModerationCreateReportInputSubject +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UModerationCreateReportInputSubjectRepoStrongRefCopyWith get copyWith => _$UModerationCreateReportInputSubjectRepoStrongRefCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UModerationCreateReportInputSubjectRepoStrongRef&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'UModerationCreateReportInputSubject.repoStrongRef(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UModerationCreateReportInputSubjectRepoStrongRefCopyWith<$Res> implements $UModerationCreateReportInputSubjectCopyWith<$Res> { + factory $UModerationCreateReportInputSubjectRepoStrongRefCopyWith(UModerationCreateReportInputSubjectRepoStrongRef value, $Res Function(UModerationCreateReportInputSubjectRepoStrongRef) _then) = _$UModerationCreateReportInputSubjectRepoStrongRefCopyWithImpl; +@useResult +$Res call({ + RepoStrongRef data +}); + + +$RepoStrongRefCopyWith<$Res> get data; + +} +/// @nodoc +class _$UModerationCreateReportInputSubjectRepoStrongRefCopyWithImpl<$Res> + implements $UModerationCreateReportInputSubjectRepoStrongRefCopyWith<$Res> { + _$UModerationCreateReportInputSubjectRepoStrongRefCopyWithImpl(this._self, this._then); + + final UModerationCreateReportInputSubjectRepoStrongRef _self; + final $Res Function(UModerationCreateReportInputSubjectRepoStrongRef) _then; + +/// Create a copy of UModerationCreateReportInputSubject +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UModerationCreateReportInputSubjectRepoStrongRef( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as RepoStrongRef, + )); +} + +/// Create a copy of UModerationCreateReportInputSubject +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$RepoStrongRefCopyWith<$Res> get data { + + return $RepoStrongRefCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class UModerationCreateReportInputSubjectUnknown extends UModerationCreateReportInputSubject { + const UModerationCreateReportInputSubjectUnknown({required final Map data}): _data = data,super._(); + + + final Map _data; +@override Map get data { + if (_data is EqualUnmodifiableMapView) return _data; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_data); +} + + +/// Create a copy of UModerationCreateReportInputSubject +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UModerationCreateReportInputSubjectUnknownCopyWith get copyWith => _$UModerationCreateReportInputSubjectUnknownCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UModerationCreateReportInputSubjectUnknown&&const DeepCollectionEquality().equals(other._data, _data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_data)); + +@override +String toString() { + return 'UModerationCreateReportInputSubject.unknown(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UModerationCreateReportInputSubjectUnknownCopyWith<$Res> implements $UModerationCreateReportInputSubjectCopyWith<$Res> { + factory $UModerationCreateReportInputSubjectUnknownCopyWith(UModerationCreateReportInputSubjectUnknown value, $Res Function(UModerationCreateReportInputSubjectUnknown) _then) = _$UModerationCreateReportInputSubjectUnknownCopyWithImpl; +@useResult +$Res call({ + Map data +}); + + + + +} +/// @nodoc +class _$UModerationCreateReportInputSubjectUnknownCopyWithImpl<$Res> + implements $UModerationCreateReportInputSubjectUnknownCopyWith<$Res> { + _$UModerationCreateReportInputSubjectUnknownCopyWithImpl(this._self, this._then); + + final UModerationCreateReportInputSubjectUnknown _self; + final $Res Function(UModerationCreateReportInputSubjectUnknown) _then; + +/// Create a copy of UModerationCreateReportInputSubject +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UModerationCreateReportInputSubjectUnknown( +data: null == data ? _self._data : data // ignore: cast_nullable_to_non_nullable +as Map, + )); +} + + +} + +// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/moderation/create_report/union_main_output_subject.dart b/packages/poptart_lex/lib/com/atproto/moderation/create_report/union_main_output_subject.dart new file mode 100644 index 000000000..5b61f32b7 --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/moderation/create_report/union_main_output_subject.dart @@ -0,0 +1,90 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, unused_import, duplicate_import, unnecessary_cast, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:poptart_core/internals.dart' show isA; + +import '../../admin/defs/repo_ref.dart'; +import '../../repo/strong_ref/main.dart'; + +part 'union_main_output_subject.freezed.dart'; + +// ************************************************************************** +// LexGenerator +// ************************************************************************** + +@freezed +sealed class UModerationCreateReportOutputSubject + with _$UModerationCreateReportOutputSubject { + const UModerationCreateReportOutputSubject._(); + + const factory UModerationCreateReportOutputSubject.repoRef({ + required RepoRef data, + }) = UModerationCreateReportOutputSubjectRepoRef; + const factory UModerationCreateReportOutputSubject.repoStrongRef({ + required RepoStrongRef data, + }) = UModerationCreateReportOutputSubjectRepoStrongRef; + + const factory UModerationCreateReportOutputSubject.unknown({ + required Map data, + }) = UModerationCreateReportOutputSubjectUnknown; + + Map toJson() => + const UModerationCreateReportOutputSubjectConverter().toJson(this); +} + +extension UModerationCreateReportOutputSubjectExtension + on UModerationCreateReportOutputSubject { + bool get isRepoRef => isA(this); + bool get isNotRepoRef => !isRepoRef; + RepoRef? get repoRef => isRepoRef ? data as RepoRef : null; + bool get isRepoStrongRef => + isA(this); + bool get isNotRepoStrongRef => !isRepoStrongRef; + RepoStrongRef? get repoStrongRef => + isRepoStrongRef ? data as RepoStrongRef : null; + bool get isUnknown => isA(this); + bool get isNotUnknown => !isUnknown; + Map? get unknown => + isUnknown ? data as Map : null; +} + +final class UModerationCreateReportOutputSubjectConverter + implements + JsonConverter< + UModerationCreateReportOutputSubject, + Map + > { + const UModerationCreateReportOutputSubjectConverter(); + + @override + UModerationCreateReportOutputSubject fromJson(Map json) { + try { + if (RepoRef.validate(json)) { + return UModerationCreateReportOutputSubject.repoRef( + data: const RepoRefConverter().fromJson(json), + ); + } + if (RepoStrongRef.validate(json)) { + return UModerationCreateReportOutputSubject.repoStrongRef( + data: const RepoStrongRefConverter().fromJson(json), + ); + } + + return UModerationCreateReportOutputSubject.unknown(data: json); + } catch (_) { + return UModerationCreateReportOutputSubject.unknown(data: json); + } + } + + @override + Map toJson(UModerationCreateReportOutputSubject object) => + object.when( + repoRef: (data) => const RepoRefConverter().toJson(data), + repoStrongRef: (data) => const RepoStrongRefConverter().toJson(data), + + unknown: (data) => data, + ); +} diff --git a/packages/poptart_lex/lib/com/atproto/moderation/create_report/union_main_output_subject.freezed.dart b/packages/poptart_lex/lib/com/atproto/moderation/create_report/union_main_output_subject.freezed.dart new file mode 100644 index 000000000..fadf85e7c --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/moderation/create_report/union_main_output_subject.freezed.dart @@ -0,0 +1,402 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'union_main_output_subject.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$UModerationCreateReportOutputSubject { + + Object get data; + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UModerationCreateReportOutputSubject&&const DeepCollectionEquality().equals(other.data, data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); + +@override +String toString() { + return 'UModerationCreateReportOutputSubject(data: $data)'; +} + + +} + +/// @nodoc +class $UModerationCreateReportOutputSubjectCopyWith<$Res> { +$UModerationCreateReportOutputSubjectCopyWith(UModerationCreateReportOutputSubject _, $Res Function(UModerationCreateReportOutputSubject) __); +} + + +/// Adds pattern-matching-related methods to [UModerationCreateReportOutputSubject]. +extension UModerationCreateReportOutputSubjectPatterns on UModerationCreateReportOutputSubject { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap({TResult Function( UModerationCreateReportOutputSubjectRepoRef value)? repoRef,TResult Function( UModerationCreateReportOutputSubjectRepoStrongRef value)? repoStrongRef,TResult Function( UModerationCreateReportOutputSubjectUnknown value)? unknown,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case UModerationCreateReportOutputSubjectRepoRef() when repoRef != null: +return repoRef(_that);case UModerationCreateReportOutputSubjectRepoStrongRef() when repoStrongRef != null: +return repoStrongRef(_that);case UModerationCreateReportOutputSubjectUnknown() when unknown != null: +return unknown(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map({required TResult Function( UModerationCreateReportOutputSubjectRepoRef value) repoRef,required TResult Function( UModerationCreateReportOutputSubjectRepoStrongRef value) repoStrongRef,required TResult Function( UModerationCreateReportOutputSubjectUnknown value) unknown,}){ +final _that = this; +switch (_that) { +case UModerationCreateReportOutputSubjectRepoRef(): +return repoRef(_that);case UModerationCreateReportOutputSubjectRepoStrongRef(): +return repoStrongRef(_that);case UModerationCreateReportOutputSubjectUnknown(): +return unknown(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull({TResult? Function( UModerationCreateReportOutputSubjectRepoRef value)? repoRef,TResult? Function( UModerationCreateReportOutputSubjectRepoStrongRef value)? repoStrongRef,TResult? Function( UModerationCreateReportOutputSubjectUnknown value)? unknown,}){ +final _that = this; +switch (_that) { +case UModerationCreateReportOutputSubjectRepoRef() when repoRef != null: +return repoRef(_that);case UModerationCreateReportOutputSubjectRepoStrongRef() when repoStrongRef != null: +return repoStrongRef(_that);case UModerationCreateReportOutputSubjectUnknown() when unknown != null: +return unknown(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen({TResult Function( RepoRef data)? repoRef,TResult Function( RepoStrongRef data)? repoStrongRef,TResult Function( Map data)? unknown,required TResult orElse(),}) {final _that = this; +switch (_that) { +case UModerationCreateReportOutputSubjectRepoRef() when repoRef != null: +return repoRef(_that.data);case UModerationCreateReportOutputSubjectRepoStrongRef() when repoStrongRef != null: +return repoStrongRef(_that.data);case UModerationCreateReportOutputSubjectUnknown() when unknown != null: +return unknown(_that.data);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when({required TResult Function( RepoRef data) repoRef,required TResult Function( RepoStrongRef data) repoStrongRef,required TResult Function( Map data) unknown,}) {final _that = this; +switch (_that) { +case UModerationCreateReportOutputSubjectRepoRef(): +return repoRef(_that.data);case UModerationCreateReportOutputSubjectRepoStrongRef(): +return repoStrongRef(_that.data);case UModerationCreateReportOutputSubjectUnknown(): +return unknown(_that.data);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull({TResult? Function( RepoRef data)? repoRef,TResult? Function( RepoStrongRef data)? repoStrongRef,TResult? Function( Map data)? unknown,}) {final _that = this; +switch (_that) { +case UModerationCreateReportOutputSubjectRepoRef() when repoRef != null: +return repoRef(_that.data);case UModerationCreateReportOutputSubjectRepoStrongRef() when repoStrongRef != null: +return repoStrongRef(_that.data);case UModerationCreateReportOutputSubjectUnknown() when unknown != null: +return unknown(_that.data);case _: + return null; + +} +} + +} + +/// @nodoc + + +class UModerationCreateReportOutputSubjectRepoRef extends UModerationCreateReportOutputSubject { + const UModerationCreateReportOutputSubjectRepoRef({required this.data}): super._(); + + +@override final RepoRef data; + +/// Create a copy of UModerationCreateReportOutputSubject +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UModerationCreateReportOutputSubjectRepoRefCopyWith get copyWith => _$UModerationCreateReportOutputSubjectRepoRefCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UModerationCreateReportOutputSubjectRepoRef&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'UModerationCreateReportOutputSubject.repoRef(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UModerationCreateReportOutputSubjectRepoRefCopyWith<$Res> implements $UModerationCreateReportOutputSubjectCopyWith<$Res> { + factory $UModerationCreateReportOutputSubjectRepoRefCopyWith(UModerationCreateReportOutputSubjectRepoRef value, $Res Function(UModerationCreateReportOutputSubjectRepoRef) _then) = _$UModerationCreateReportOutputSubjectRepoRefCopyWithImpl; +@useResult +$Res call({ + RepoRef data +}); + + +$RepoRefCopyWith<$Res> get data; + +} +/// @nodoc +class _$UModerationCreateReportOutputSubjectRepoRefCopyWithImpl<$Res> + implements $UModerationCreateReportOutputSubjectRepoRefCopyWith<$Res> { + _$UModerationCreateReportOutputSubjectRepoRefCopyWithImpl(this._self, this._then); + + final UModerationCreateReportOutputSubjectRepoRef _self; + final $Res Function(UModerationCreateReportOutputSubjectRepoRef) _then; + +/// Create a copy of UModerationCreateReportOutputSubject +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UModerationCreateReportOutputSubjectRepoRef( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as RepoRef, + )); +} + +/// Create a copy of UModerationCreateReportOutputSubject +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$RepoRefCopyWith<$Res> get data { + + return $RepoRefCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class UModerationCreateReportOutputSubjectRepoStrongRef extends UModerationCreateReportOutputSubject { + const UModerationCreateReportOutputSubjectRepoStrongRef({required this.data}): super._(); + + +@override final RepoStrongRef data; + +/// Create a copy of UModerationCreateReportOutputSubject +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UModerationCreateReportOutputSubjectRepoStrongRefCopyWith get copyWith => _$UModerationCreateReportOutputSubjectRepoStrongRefCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UModerationCreateReportOutputSubjectRepoStrongRef&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'UModerationCreateReportOutputSubject.repoStrongRef(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UModerationCreateReportOutputSubjectRepoStrongRefCopyWith<$Res> implements $UModerationCreateReportOutputSubjectCopyWith<$Res> { + factory $UModerationCreateReportOutputSubjectRepoStrongRefCopyWith(UModerationCreateReportOutputSubjectRepoStrongRef value, $Res Function(UModerationCreateReportOutputSubjectRepoStrongRef) _then) = _$UModerationCreateReportOutputSubjectRepoStrongRefCopyWithImpl; +@useResult +$Res call({ + RepoStrongRef data +}); + + +$RepoStrongRefCopyWith<$Res> get data; + +} +/// @nodoc +class _$UModerationCreateReportOutputSubjectRepoStrongRefCopyWithImpl<$Res> + implements $UModerationCreateReportOutputSubjectRepoStrongRefCopyWith<$Res> { + _$UModerationCreateReportOutputSubjectRepoStrongRefCopyWithImpl(this._self, this._then); + + final UModerationCreateReportOutputSubjectRepoStrongRef _self; + final $Res Function(UModerationCreateReportOutputSubjectRepoStrongRef) _then; + +/// Create a copy of UModerationCreateReportOutputSubject +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UModerationCreateReportOutputSubjectRepoStrongRef( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as RepoStrongRef, + )); +} + +/// Create a copy of UModerationCreateReportOutputSubject +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$RepoStrongRefCopyWith<$Res> get data { + + return $RepoStrongRefCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class UModerationCreateReportOutputSubjectUnknown extends UModerationCreateReportOutputSubject { + const UModerationCreateReportOutputSubjectUnknown({required final Map data}): _data = data,super._(); + + + final Map _data; +@override Map get data { + if (_data is EqualUnmodifiableMapView) return _data; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_data); +} + + +/// Create a copy of UModerationCreateReportOutputSubject +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UModerationCreateReportOutputSubjectUnknownCopyWith get copyWith => _$UModerationCreateReportOutputSubjectUnknownCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UModerationCreateReportOutputSubjectUnknown&&const DeepCollectionEquality().equals(other._data, _data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_data)); + +@override +String toString() { + return 'UModerationCreateReportOutputSubject.unknown(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UModerationCreateReportOutputSubjectUnknownCopyWith<$Res> implements $UModerationCreateReportOutputSubjectCopyWith<$Res> { + factory $UModerationCreateReportOutputSubjectUnknownCopyWith(UModerationCreateReportOutputSubjectUnknown value, $Res Function(UModerationCreateReportOutputSubjectUnknown) _then) = _$UModerationCreateReportOutputSubjectUnknownCopyWithImpl; +@useResult +$Res call({ + Map data +}); + + + + +} +/// @nodoc +class _$UModerationCreateReportOutputSubjectUnknownCopyWithImpl<$Res> + implements $UModerationCreateReportOutputSubjectUnknownCopyWith<$Res> { + _$UModerationCreateReportOutputSubjectUnknownCopyWithImpl(this._self, this._then); + + final UModerationCreateReportOutputSubjectUnknown _self; + final $Res Function(UModerationCreateReportOutputSubjectUnknown) _then; + +/// Create a copy of UModerationCreateReportOutputSubject +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UModerationCreateReportOutputSubjectUnknown( +data: null == data ? _self._data : data // ignore: cast_nullable_to_non_nullable +as Map, + )); +} + + +} + +// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/moderation/create_report/union_main_subject.freezed.dart b/packages/poptart_lex/lib/com/atproto/moderation/create_report/union_main_subject.freezed.dart deleted file mode 100644 index f032057b3..000000000 --- a/packages/poptart_lex/lib/com/atproto/moderation/create_report/union_main_subject.freezed.dart +++ /dev/null @@ -1,402 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND -// coverage:ignore-file -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'union_main_subject.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; -/// @nodoc -mixin _$UModerationCreateReportSubject { - - Object get data; - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UModerationCreateReportSubject&&const DeepCollectionEquality().equals(other.data, data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); - -@override -String toString() { - return 'UModerationCreateReportSubject(data: $data)'; -} - - -} - -/// @nodoc -class $UModerationCreateReportSubjectCopyWith<$Res> { -$UModerationCreateReportSubjectCopyWith(UModerationCreateReportSubject _, $Res Function(UModerationCreateReportSubject) __); -} - - -/// Adds pattern-matching-related methods to [UModerationCreateReportSubject]. -extension UModerationCreateReportSubjectPatterns on UModerationCreateReportSubject { -/// A variant of `map` that fallback to returning `orElse`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeMap({TResult Function( UModerationCreateReportSubjectRepoRef value)? repoRef,TResult Function( UModerationCreateReportSubjectRepoStrongRef value)? repoStrongRef,TResult Function( UModerationCreateReportSubjectUnknown value)? unknown,required TResult orElse(),}){ -final _that = this; -switch (_that) { -case UModerationCreateReportSubjectRepoRef() when repoRef != null: -return repoRef(_that);case UModerationCreateReportSubjectRepoStrongRef() when repoStrongRef != null: -return repoStrongRef(_that);case UModerationCreateReportSubjectUnknown() when unknown != null: -return unknown(_that);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// Callbacks receives the raw object, upcasted. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case final Subclass2 value: -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult map({required TResult Function( UModerationCreateReportSubjectRepoRef value) repoRef,required TResult Function( UModerationCreateReportSubjectRepoStrongRef value) repoStrongRef,required TResult Function( UModerationCreateReportSubjectUnknown value) unknown,}){ -final _that = this; -switch (_that) { -case UModerationCreateReportSubjectRepoRef(): -return repoRef(_that);case UModerationCreateReportSubjectRepoStrongRef(): -return repoStrongRef(_that);case UModerationCreateReportSubjectUnknown(): -return unknown(_that);} -} -/// A variant of `map` that fallback to returning `null`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? mapOrNull({TResult? Function( UModerationCreateReportSubjectRepoRef value)? repoRef,TResult? Function( UModerationCreateReportSubjectRepoStrongRef value)? repoStrongRef,TResult? Function( UModerationCreateReportSubjectUnknown value)? unknown,}){ -final _that = this; -switch (_that) { -case UModerationCreateReportSubjectRepoRef() when repoRef != null: -return repoRef(_that);case UModerationCreateReportSubjectRepoStrongRef() when repoStrongRef != null: -return repoStrongRef(_that);case UModerationCreateReportSubjectUnknown() when unknown != null: -return unknown(_that);case _: - return null; - -} -} -/// A variant of `when` that fallback to an `orElse` callback. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeWhen({TResult Function( RepoRef data)? repoRef,TResult Function( RepoStrongRef data)? repoStrongRef,TResult Function( Map data)? unknown,required TResult orElse(),}) {final _that = this; -switch (_that) { -case UModerationCreateReportSubjectRepoRef() when repoRef != null: -return repoRef(_that.data);case UModerationCreateReportSubjectRepoStrongRef() when repoStrongRef != null: -return repoStrongRef(_that.data);case UModerationCreateReportSubjectUnknown() when unknown != null: -return unknown(_that.data);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// As opposed to `map`, this offers destructuring. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case Subclass2(:final field2): -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult when({required TResult Function( RepoRef data) repoRef,required TResult Function( RepoStrongRef data) repoStrongRef,required TResult Function( Map data) unknown,}) {final _that = this; -switch (_that) { -case UModerationCreateReportSubjectRepoRef(): -return repoRef(_that.data);case UModerationCreateReportSubjectRepoStrongRef(): -return repoStrongRef(_that.data);case UModerationCreateReportSubjectUnknown(): -return unknown(_that.data);} -} -/// A variant of `when` that fallback to returning `null` -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? whenOrNull({TResult? Function( RepoRef data)? repoRef,TResult? Function( RepoStrongRef data)? repoStrongRef,TResult? Function( Map data)? unknown,}) {final _that = this; -switch (_that) { -case UModerationCreateReportSubjectRepoRef() when repoRef != null: -return repoRef(_that.data);case UModerationCreateReportSubjectRepoStrongRef() when repoStrongRef != null: -return repoStrongRef(_that.data);case UModerationCreateReportSubjectUnknown() when unknown != null: -return unknown(_that.data);case _: - return null; - -} -} - -} - -/// @nodoc - - -class UModerationCreateReportSubjectRepoRef extends UModerationCreateReportSubject { - const UModerationCreateReportSubjectRepoRef({required this.data}): super._(); - - -@override final RepoRef data; - -/// Create a copy of UModerationCreateReportSubject -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$UModerationCreateReportSubjectRepoRefCopyWith get copyWith => _$UModerationCreateReportSubjectRepoRefCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UModerationCreateReportSubjectRepoRef&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'UModerationCreateReportSubject.repoRef(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $UModerationCreateReportSubjectRepoRefCopyWith<$Res> implements $UModerationCreateReportSubjectCopyWith<$Res> { - factory $UModerationCreateReportSubjectRepoRefCopyWith(UModerationCreateReportSubjectRepoRef value, $Res Function(UModerationCreateReportSubjectRepoRef) _then) = _$UModerationCreateReportSubjectRepoRefCopyWithImpl; -@useResult -$Res call({ - RepoRef data -}); - - -$RepoRefCopyWith<$Res> get data; - -} -/// @nodoc -class _$UModerationCreateReportSubjectRepoRefCopyWithImpl<$Res> - implements $UModerationCreateReportSubjectRepoRefCopyWith<$Res> { - _$UModerationCreateReportSubjectRepoRefCopyWithImpl(this._self, this._then); - - final UModerationCreateReportSubjectRepoRef _self; - final $Res Function(UModerationCreateReportSubjectRepoRef) _then; - -/// Create a copy of UModerationCreateReportSubject -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(UModerationCreateReportSubjectRepoRef( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as RepoRef, - )); -} - -/// Create a copy of UModerationCreateReportSubject -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$RepoRefCopyWith<$Res> get data { - - return $RepoRefCopyWith<$Res>(_self.data, (value) { - return _then(_self.copyWith(data: value)); - }); -} -} - -/// @nodoc - - -class UModerationCreateReportSubjectRepoStrongRef extends UModerationCreateReportSubject { - const UModerationCreateReportSubjectRepoStrongRef({required this.data}): super._(); - - -@override final RepoStrongRef data; - -/// Create a copy of UModerationCreateReportSubject -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$UModerationCreateReportSubjectRepoStrongRefCopyWith get copyWith => _$UModerationCreateReportSubjectRepoStrongRefCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UModerationCreateReportSubjectRepoStrongRef&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'UModerationCreateReportSubject.repoStrongRef(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $UModerationCreateReportSubjectRepoStrongRefCopyWith<$Res> implements $UModerationCreateReportSubjectCopyWith<$Res> { - factory $UModerationCreateReportSubjectRepoStrongRefCopyWith(UModerationCreateReportSubjectRepoStrongRef value, $Res Function(UModerationCreateReportSubjectRepoStrongRef) _then) = _$UModerationCreateReportSubjectRepoStrongRefCopyWithImpl; -@useResult -$Res call({ - RepoStrongRef data -}); - - -$RepoStrongRefCopyWith<$Res> get data; - -} -/// @nodoc -class _$UModerationCreateReportSubjectRepoStrongRefCopyWithImpl<$Res> - implements $UModerationCreateReportSubjectRepoStrongRefCopyWith<$Res> { - _$UModerationCreateReportSubjectRepoStrongRefCopyWithImpl(this._self, this._then); - - final UModerationCreateReportSubjectRepoStrongRef _self; - final $Res Function(UModerationCreateReportSubjectRepoStrongRef) _then; - -/// Create a copy of UModerationCreateReportSubject -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(UModerationCreateReportSubjectRepoStrongRef( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as RepoStrongRef, - )); -} - -/// Create a copy of UModerationCreateReportSubject -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$RepoStrongRefCopyWith<$Res> get data { - - return $RepoStrongRefCopyWith<$Res>(_self.data, (value) { - return _then(_self.copyWith(data: value)); - }); -} -} - -/// @nodoc - - -class UModerationCreateReportSubjectUnknown extends UModerationCreateReportSubject { - const UModerationCreateReportSubjectUnknown({required final Map data}): _data = data,super._(); - - - final Map _data; -@override Map get data { - if (_data is EqualUnmodifiableMapView) return _data; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(_data); -} - - -/// Create a copy of UModerationCreateReportSubject -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$UModerationCreateReportSubjectUnknownCopyWith get copyWith => _$UModerationCreateReportSubjectUnknownCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UModerationCreateReportSubjectUnknown&&const DeepCollectionEquality().equals(other._data, _data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_data)); - -@override -String toString() { - return 'UModerationCreateReportSubject.unknown(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $UModerationCreateReportSubjectUnknownCopyWith<$Res> implements $UModerationCreateReportSubjectCopyWith<$Res> { - factory $UModerationCreateReportSubjectUnknownCopyWith(UModerationCreateReportSubjectUnknown value, $Res Function(UModerationCreateReportSubjectUnknown) _then) = _$UModerationCreateReportSubjectUnknownCopyWithImpl; -@useResult -$Res call({ - Map data -}); - - - - -} -/// @nodoc -class _$UModerationCreateReportSubjectUnknownCopyWithImpl<$Res> - implements $UModerationCreateReportSubjectUnknownCopyWith<$Res> { - _$UModerationCreateReportSubjectUnknownCopyWithImpl(this._self, this._then); - - final UModerationCreateReportSubjectUnknown _self; - final $Res Function(UModerationCreateReportSubjectUnknown) _then; - -/// Create a copy of UModerationCreateReportSubject -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(UModerationCreateReportSubjectUnknown( -data: null == data ? _self._data : data // ignore: cast_nullable_to_non_nullable -as Map, - )); -} - - -} - -// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/repo/apply_writes.dart b/packages/poptart_lex/lib/com/atproto/repo/apply_writes.dart index 9b3bfe8fa..ed20d6f93 100644 --- a/packages/poptart_lex/lib/com/atproto/repo/apply_writes.dart +++ b/packages/poptart_lex/lib/com/atproto/repo/apply_writes.dart @@ -15,8 +15,8 @@ export 'apply_writes/delete_result.dart'; export 'apply_writes/descriptor.dart'; export 'apply_writes/input.dart'; export 'apply_writes/output.dart'; -export 'apply_writes/union_main_results.dart'; -export 'apply_writes/union_main_writes.dart'; +export 'apply_writes/union_main_input_writes.dart'; +export 'apply_writes/union_main_output_results.dart'; export 'apply_writes/update.dart'; export 'apply_writes/update_result.dart'; export 'apply_writes/update_result_validation_status.dart'; diff --git a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/input.dart b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/input.dart index a654abff5..43f32cc23 100644 --- a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/input.dart +++ b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/input.dart @@ -7,7 +7,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:poptart_core/poptart_core.dart'; import 'package:poptart_core/internals.dart'; -import './union_main_writes.dart'; +import './union_main_input_writes.dart'; part 'input.freezed.dart'; part 'input.g.dart'; @@ -32,8 +32,8 @@ abstract class RepoApplyWritesInput with _$RepoApplyWritesInput { /// Can be set to 'false' to skip Lexicon schema validation of record data across all operations, 'true' to require it, or leave unset to validate only for known Lexicons. bool? validate, - @URepoApplyWritesWritesConverter() - required List writes, + @URepoApplyWritesInputWritesConverter() + required List writes, /// If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations. String? swapCommit, diff --git a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/input.freezed.dart b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/input.freezed.dart index c43c17bca..11de1d6f0 100644 --- a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/input.freezed.dart +++ b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/input.freezed.dart @@ -17,7 +17,7 @@ mixin _$RepoApplyWritesInput { /// The handle or DID of the repo (aka, current account). String get repo;/// Can be set to 'false' to skip Lexicon schema validation of record data across all operations, 'true' to require it, or leave unset to validate only for known Lexicons. - bool? get validate;@URepoApplyWritesWritesConverter() List get writes;/// If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations. + bool? get validate;@URepoApplyWritesInputWritesConverter() List get writes;/// If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations. String? get swapCommit; Map? get $unknown; /// Create a copy of RepoApplyWritesInput /// with the given fields replaced by the non-null parameter values. @@ -51,7 +51,7 @@ abstract mixin class $RepoApplyWritesInputCopyWith<$Res> { factory $RepoApplyWritesInputCopyWith(RepoApplyWritesInput value, $Res Function(RepoApplyWritesInput) _then) = _$RepoApplyWritesInputCopyWithImpl; @useResult $Res call({ - String repo, bool? validate,@URepoApplyWritesWritesConverter() List writes, String? swapCommit, Map? $unknown + String repo, bool? validate,@URepoApplyWritesInputWritesConverter() List writes, String? swapCommit, Map? $unknown }); @@ -73,7 +73,7 @@ class _$RepoApplyWritesInputCopyWithImpl<$Res> repo: null == repo ? _self.repo : repo // ignore: cast_nullable_to_non_nullable as String,validate: freezed == validate ? _self.validate : validate // ignore: cast_nullable_to_non_nullable as bool?,writes: null == writes ? _self.writes : writes // ignore: cast_nullable_to_non_nullable -as List,swapCommit: freezed == swapCommit ? _self.swapCommit : swapCommit // ignore: cast_nullable_to_non_nullable +as List,swapCommit: freezed == swapCommit ? _self.swapCommit : swapCommit // ignore: cast_nullable_to_non_nullable as String?,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); @@ -160,7 +160,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String repo, bool? validate, @URepoApplyWritesWritesConverter() List writes, String? swapCommit, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String repo, bool? validate, @URepoApplyWritesInputWritesConverter() List writes, String? swapCommit, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _RepoApplyWritesInput() when $default != null: return $default(_that.repo,_that.validate,_that.writes,_that.swapCommit,_that.$unknown);case _: @@ -181,7 +181,7 @@ return $default(_that.repo,_that.validate,_that.writes,_that.swapCommit,_that.$u /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String repo, bool? validate, @URepoApplyWritesWritesConverter() List writes, String? swapCommit, Map? $unknown) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String repo, bool? validate, @URepoApplyWritesInputWritesConverter() List writes, String? swapCommit, Map? $unknown) $default,) {final _that = this; switch (_that) { case _RepoApplyWritesInput(): return $default(_that.repo,_that.validate,_that.writes,_that.swapCommit,_that.$unknown);case _: @@ -201,7 +201,7 @@ return $default(_that.repo,_that.validate,_that.writes,_that.swapCommit,_that.$u /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String repo, bool? validate, @URepoApplyWritesWritesConverter() List writes, String? swapCommit, Map? $unknown)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String repo, bool? validate, @URepoApplyWritesInputWritesConverter() List writes, String? swapCommit, Map? $unknown)? $default,) {final _that = this; switch (_that) { case _RepoApplyWritesInput() when $default != null: return $default(_that.repo,_that.validate,_that.writes,_that.swapCommit,_that.$unknown);case _: @@ -216,15 +216,15 @@ return $default(_that.repo,_that.validate,_that.writes,_that.swapCommit,_that.$u @JsonSerializable(includeIfNull: false) class _RepoApplyWritesInput implements RepoApplyWritesInput { - const _RepoApplyWritesInput({required this.repo, this.validate, @URepoApplyWritesWritesConverter() required final List writes, this.swapCommit, final Map? $unknown}): _writes = writes,_$unknown = $unknown; + const _RepoApplyWritesInput({required this.repo, this.validate, @URepoApplyWritesInputWritesConverter() required final List writes, this.swapCommit, final Map? $unknown}): _writes = writes,_$unknown = $unknown; factory _RepoApplyWritesInput.fromJson(Map json) => _$RepoApplyWritesInputFromJson(json); /// The handle or DID of the repo (aka, current account). @override final String repo; /// Can be set to 'false' to skip Lexicon schema validation of record data across all operations, 'true' to require it, or leave unset to validate only for known Lexicons. @override final bool? validate; - final List _writes; -@override@URepoApplyWritesWritesConverter() List get writes { + final List _writes; +@override@URepoApplyWritesInputWritesConverter() List get writes { if (_writes is EqualUnmodifiableListView) return _writes; // ignore: implicit_dynamic_type return EqualUnmodifiableListView(_writes); @@ -275,7 +275,7 @@ abstract mixin class _$RepoApplyWritesInputCopyWith<$Res> implements $RepoApplyW factory _$RepoApplyWritesInputCopyWith(_RepoApplyWritesInput value, $Res Function(_RepoApplyWritesInput) _then) = __$RepoApplyWritesInputCopyWithImpl; @override @useResult $Res call({ - String repo, bool? validate,@URepoApplyWritesWritesConverter() List writes, String? swapCommit, Map? $unknown + String repo, bool? validate,@URepoApplyWritesInputWritesConverter() List writes, String? swapCommit, Map? $unknown }); @@ -297,7 +297,7 @@ class __$RepoApplyWritesInputCopyWithImpl<$Res> repo: null == repo ? _self.repo : repo // ignore: cast_nullable_to_non_nullable as String,validate: freezed == validate ? _self.validate : validate // ignore: cast_nullable_to_non_nullable as bool?,writes: null == writes ? _self._writes : writes // ignore: cast_nullable_to_non_nullable -as List,swapCommit: freezed == swapCommit ? _self.swapCommit : swapCommit // ignore: cast_nullable_to_non_nullable +as List,swapCommit: freezed == swapCommit ? _self.swapCommit : swapCommit // ignore: cast_nullable_to_non_nullable as String?,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); diff --git a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/input.g.dart b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/input.g.dart index e61bba256..787d69524 100644 --- a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/input.g.dart +++ b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/input.g.dart @@ -17,7 +17,7 @@ _RepoApplyWritesInput _$RepoApplyWritesInputFromJson(Map json) => 'writes', (v) => (v as List) .map( - (e) => const URepoApplyWritesWritesConverter().fromJson( + (e) => const URepoApplyWritesInputWritesConverter().fromJson( e as Map, ), ) @@ -38,7 +38,7 @@ Map _$RepoApplyWritesInputToJson( 'repo': instance.repo, 'validate': ?instance.validate, 'writes': instance.writes - .map(const URepoApplyWritesWritesConverter().toJson) + .map(const URepoApplyWritesInputWritesConverter().toJson) .toList(), 'swapCommit': ?instance.swapCommit, r'$unknown': ?instance.$unknown, diff --git a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/output.dart b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/output.dart index cd0db484f..80491a23f 100644 --- a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/output.dart +++ b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/output.dart @@ -8,7 +8,7 @@ import 'package:poptart_core/poptart_core.dart'; import 'package:poptart_core/internals.dart'; import '../defs/commit_meta.dart'; -import './union_main_results.dart'; +import './union_main_output_results.dart'; part 'output.freezed.dart'; part 'output.g.dart'; @@ -24,7 +24,8 @@ abstract class RepoApplyWritesOutput with _$RepoApplyWritesOutput { @JsonSerializable(includeIfNull: false) const factory RepoApplyWritesOutput({ @CommitMetaConverter() CommitMeta? commit, - @URepoApplyWritesResultsConverter() List? results, + @URepoApplyWritesOutputResultsConverter() + List? results, Map? $unknown, }) = _RepoApplyWritesOutput; diff --git a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/output.freezed.dart b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/output.freezed.dart index ab5260ecf..73c9db74c 100644 --- a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/output.freezed.dart +++ b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/output.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$RepoApplyWritesOutput { -@CommitMetaConverter() CommitMeta? get commit;@URepoApplyWritesResultsConverter() List? get results; Map? get $unknown; +@CommitMetaConverter() CommitMeta? get commit;@URepoApplyWritesOutputResultsConverter() List? get results; Map? get $unknown; /// Create a copy of RepoApplyWritesOutput /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -48,7 +48,7 @@ abstract mixin class $RepoApplyWritesOutputCopyWith<$Res> { factory $RepoApplyWritesOutputCopyWith(RepoApplyWritesOutput value, $Res Function(RepoApplyWritesOutput) _then) = _$RepoApplyWritesOutputCopyWithImpl; @useResult $Res call({ -@CommitMetaConverter() CommitMeta? commit,@URepoApplyWritesResultsConverter() List? results, Map? $unknown +@CommitMetaConverter() CommitMeta? commit,@URepoApplyWritesOutputResultsConverter() List? results, Map? $unknown }); @@ -69,7 +69,7 @@ class _$RepoApplyWritesOutputCopyWithImpl<$Res> return _then(_self.copyWith( commit: freezed == commit ? _self.commit : commit // ignore: cast_nullable_to_non_nullable as CommitMeta?,results: freezed == results ? _self.results : results // ignore: cast_nullable_to_non_nullable -as List?,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable +as List?,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); } @@ -167,7 +167,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function(@CommitMetaConverter() CommitMeta? commit, @URepoApplyWritesResultsConverter() List? results, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function(@CommitMetaConverter() CommitMeta? commit, @URepoApplyWritesOutputResultsConverter() List? results, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _RepoApplyWritesOutput() when $default != null: return $default(_that.commit,_that.results,_that.$unknown);case _: @@ -188,7 +188,7 @@ return $default(_that.commit,_that.results,_that.$unknown);case _: /// } /// ``` -@optionalTypeArgs TResult when(TResult Function(@CommitMetaConverter() CommitMeta? commit, @URepoApplyWritesResultsConverter() List? results, Map? $unknown) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function(@CommitMetaConverter() CommitMeta? commit, @URepoApplyWritesOutputResultsConverter() List? results, Map? $unknown) $default,) {final _that = this; switch (_that) { case _RepoApplyWritesOutput(): return $default(_that.commit,_that.results,_that.$unknown);case _: @@ -208,7 +208,7 @@ return $default(_that.commit,_that.results,_that.$unknown);case _: /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function(@CommitMetaConverter() CommitMeta? commit, @URepoApplyWritesResultsConverter() List? results, Map? $unknown)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function(@CommitMetaConverter() CommitMeta? commit, @URepoApplyWritesOutputResultsConverter() List? results, Map? $unknown)? $default,) {final _that = this; switch (_that) { case _RepoApplyWritesOutput() when $default != null: return $default(_that.commit,_that.results,_that.$unknown);case _: @@ -223,12 +223,12 @@ return $default(_that.commit,_that.results,_that.$unknown);case _: @JsonSerializable(includeIfNull: false) class _RepoApplyWritesOutput implements RepoApplyWritesOutput { - const _RepoApplyWritesOutput({@CommitMetaConverter() this.commit, @URepoApplyWritesResultsConverter() final List? results, final Map? $unknown}): _results = results,_$unknown = $unknown; + const _RepoApplyWritesOutput({@CommitMetaConverter() this.commit, @URepoApplyWritesOutputResultsConverter() final List? results, final Map? $unknown}): _results = results,_$unknown = $unknown; factory _RepoApplyWritesOutput.fromJson(Map json) => _$RepoApplyWritesOutputFromJson(json); @override@CommitMetaConverter() final CommitMeta? commit; - final List? _results; -@override@URepoApplyWritesResultsConverter() List? get results { + final List? _results; +@override@URepoApplyWritesOutputResultsConverter() List? get results { final value = _results; if (value == null) return null; if (_results is EqualUnmodifiableListView) return _results; @@ -279,7 +279,7 @@ abstract mixin class _$RepoApplyWritesOutputCopyWith<$Res> implements $RepoApply factory _$RepoApplyWritesOutputCopyWith(_RepoApplyWritesOutput value, $Res Function(_RepoApplyWritesOutput) _then) = __$RepoApplyWritesOutputCopyWithImpl; @override @useResult $Res call({ -@CommitMetaConverter() CommitMeta? commit,@URepoApplyWritesResultsConverter() List? results, Map? $unknown +@CommitMetaConverter() CommitMeta? commit,@URepoApplyWritesOutputResultsConverter() List? results, Map? $unknown }); @@ -300,7 +300,7 @@ class __$RepoApplyWritesOutputCopyWithImpl<$Res> return _then(_RepoApplyWritesOutput( commit: freezed == commit ? _self.commit : commit // ignore: cast_nullable_to_non_nullable as CommitMeta?,results: freezed == results ? _self._results : results // ignore: cast_nullable_to_non_nullable -as List?,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable +as List?,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); } diff --git a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/output.g.dart b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/output.g.dart index c0f5ca14a..9eef272ce 100644 --- a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/output.g.dart +++ b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/output.g.dart @@ -22,7 +22,7 @@ _RepoApplyWritesOutput _$RepoApplyWritesOutputFromJson(Map json) => 'results', (v) => (v as List?) ?.map( - (e) => const URepoApplyWritesResultsConverter().fromJson( + (e) => const URepoApplyWritesOutputResultsConverter().fromJson( e as Map, ), ) @@ -44,7 +44,7 @@ Map _$RepoApplyWritesOutputToJson( const CommitMetaConverter().toJson, ), 'results': ?instance.results - ?.map(const URepoApplyWritesResultsConverter().toJson) + ?.map(const URepoApplyWritesOutputResultsConverter().toJson) .toList(), r'$unknown': ?instance.$unknown, }; diff --git a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_input_writes.dart b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_input_writes.dart new file mode 100644 index 000000000..e58c4940c --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_input_writes.dart @@ -0,0 +1,93 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, unused_import, duplicate_import, unnecessary_cast, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:poptart_core/internals.dart' show isA; + +import './create.dart'; +import './update.dart'; +import './delete.dart'; + +part 'union_main_input_writes.freezed.dart'; + +// ************************************************************************** +// LexGenerator +// ************************************************************************** + +@freezed +sealed class URepoApplyWritesInputWrites with _$URepoApplyWritesInputWrites { + const URepoApplyWritesInputWrites._(); + + const factory URepoApplyWritesInputWrites.create({required Create data}) = + URepoApplyWritesInputWritesCreate; + const factory URepoApplyWritesInputWrites.update({required Update data}) = + URepoApplyWritesInputWritesUpdate; + const factory URepoApplyWritesInputWrites.delete({required Delete data}) = + URepoApplyWritesInputWritesDelete; + + const factory URepoApplyWritesInputWrites.unknown({ + required Map data, + }) = URepoApplyWritesInputWritesUnknown; + + Map toJson() => + const URepoApplyWritesInputWritesConverter().toJson(this); +} + +extension URepoApplyWritesInputWritesExtension on URepoApplyWritesInputWrites { + bool get isCreate => isA(this); + bool get isNotCreate => !isCreate; + Create? get create => isCreate ? data as Create : null; + bool get isUpdate => isA(this); + bool get isNotUpdate => !isUpdate; + Update? get update => isUpdate ? data as Update : null; + bool get isDelete => isA(this); + bool get isNotDelete => !isDelete; + Delete? get delete => isDelete ? data as Delete : null; + bool get isUnknown => isA(this); + bool get isNotUnknown => !isUnknown; + Map? get unknown => + isUnknown ? data as Map : null; +} + +final class URepoApplyWritesInputWritesConverter + implements + JsonConverter> { + const URepoApplyWritesInputWritesConverter(); + + @override + URepoApplyWritesInputWrites fromJson(Map json) { + try { + if (Create.validate(json)) { + return URepoApplyWritesInputWrites.create( + data: const CreateConverter().fromJson(json), + ); + } + if (Update.validate(json)) { + return URepoApplyWritesInputWrites.update( + data: const UpdateConverter().fromJson(json), + ); + } + if (Delete.validate(json)) { + return URepoApplyWritesInputWrites.delete( + data: const DeleteConverter().fromJson(json), + ); + } + + return URepoApplyWritesInputWrites.unknown(data: json); + } catch (_) { + return URepoApplyWritesInputWrites.unknown(data: json); + } + } + + @override + Map toJson(URepoApplyWritesInputWrites object) => + object.when( + create: (data) => const CreateConverter().toJson(data), + update: (data) => const UpdateConverter().toJson(data), + delete: (data) => const DeleteConverter().toJson(data), + + unknown: (data) => data, + ); +} diff --git a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_input_writes.freezed.dart b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_input_writes.freezed.dart new file mode 100644 index 000000000..1ca17fde9 --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_input_writes.freezed.dart @@ -0,0 +1,483 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'union_main_input_writes.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$URepoApplyWritesInputWrites { + + Object get data; + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is URepoApplyWritesInputWrites&&const DeepCollectionEquality().equals(other.data, data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); + +@override +String toString() { + return 'URepoApplyWritesInputWrites(data: $data)'; +} + + +} + +/// @nodoc +class $URepoApplyWritesInputWritesCopyWith<$Res> { +$URepoApplyWritesInputWritesCopyWith(URepoApplyWritesInputWrites _, $Res Function(URepoApplyWritesInputWrites) __); +} + + +/// Adds pattern-matching-related methods to [URepoApplyWritesInputWrites]. +extension URepoApplyWritesInputWritesPatterns on URepoApplyWritesInputWrites { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap({TResult Function( URepoApplyWritesInputWritesCreate value)? create,TResult Function( URepoApplyWritesInputWritesUpdate value)? update,TResult Function( URepoApplyWritesInputWritesDelete value)? delete,TResult Function( URepoApplyWritesInputWritesUnknown value)? unknown,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case URepoApplyWritesInputWritesCreate() when create != null: +return create(_that);case URepoApplyWritesInputWritesUpdate() when update != null: +return update(_that);case URepoApplyWritesInputWritesDelete() when delete != null: +return delete(_that);case URepoApplyWritesInputWritesUnknown() when unknown != null: +return unknown(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map({required TResult Function( URepoApplyWritesInputWritesCreate value) create,required TResult Function( URepoApplyWritesInputWritesUpdate value) update,required TResult Function( URepoApplyWritesInputWritesDelete value) delete,required TResult Function( URepoApplyWritesInputWritesUnknown value) unknown,}){ +final _that = this; +switch (_that) { +case URepoApplyWritesInputWritesCreate(): +return create(_that);case URepoApplyWritesInputWritesUpdate(): +return update(_that);case URepoApplyWritesInputWritesDelete(): +return delete(_that);case URepoApplyWritesInputWritesUnknown(): +return unknown(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull({TResult? Function( URepoApplyWritesInputWritesCreate value)? create,TResult? Function( URepoApplyWritesInputWritesUpdate value)? update,TResult? Function( URepoApplyWritesInputWritesDelete value)? delete,TResult? Function( URepoApplyWritesInputWritesUnknown value)? unknown,}){ +final _that = this; +switch (_that) { +case URepoApplyWritesInputWritesCreate() when create != null: +return create(_that);case URepoApplyWritesInputWritesUpdate() when update != null: +return update(_that);case URepoApplyWritesInputWritesDelete() when delete != null: +return delete(_that);case URepoApplyWritesInputWritesUnknown() when unknown != null: +return unknown(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen({TResult Function( Create data)? create,TResult Function( Update data)? update,TResult Function( Delete data)? delete,TResult Function( Map data)? unknown,required TResult orElse(),}) {final _that = this; +switch (_that) { +case URepoApplyWritesInputWritesCreate() when create != null: +return create(_that.data);case URepoApplyWritesInputWritesUpdate() when update != null: +return update(_that.data);case URepoApplyWritesInputWritesDelete() when delete != null: +return delete(_that.data);case URepoApplyWritesInputWritesUnknown() when unknown != null: +return unknown(_that.data);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when({required TResult Function( Create data) create,required TResult Function( Update data) update,required TResult Function( Delete data) delete,required TResult Function( Map data) unknown,}) {final _that = this; +switch (_that) { +case URepoApplyWritesInputWritesCreate(): +return create(_that.data);case URepoApplyWritesInputWritesUpdate(): +return update(_that.data);case URepoApplyWritesInputWritesDelete(): +return delete(_that.data);case URepoApplyWritesInputWritesUnknown(): +return unknown(_that.data);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull({TResult? Function( Create data)? create,TResult? Function( Update data)? update,TResult? Function( Delete data)? delete,TResult? Function( Map data)? unknown,}) {final _that = this; +switch (_that) { +case URepoApplyWritesInputWritesCreate() when create != null: +return create(_that.data);case URepoApplyWritesInputWritesUpdate() when update != null: +return update(_that.data);case URepoApplyWritesInputWritesDelete() when delete != null: +return delete(_that.data);case URepoApplyWritesInputWritesUnknown() when unknown != null: +return unknown(_that.data);case _: + return null; + +} +} + +} + +/// @nodoc + + +class URepoApplyWritesInputWritesCreate extends URepoApplyWritesInputWrites { + const URepoApplyWritesInputWritesCreate({required this.data}): super._(); + + +@override final Create data; + +/// Create a copy of URepoApplyWritesInputWrites +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$URepoApplyWritesInputWritesCreateCopyWith get copyWith => _$URepoApplyWritesInputWritesCreateCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is URepoApplyWritesInputWritesCreate&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'URepoApplyWritesInputWrites.create(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $URepoApplyWritesInputWritesCreateCopyWith<$Res> implements $URepoApplyWritesInputWritesCopyWith<$Res> { + factory $URepoApplyWritesInputWritesCreateCopyWith(URepoApplyWritesInputWritesCreate value, $Res Function(URepoApplyWritesInputWritesCreate) _then) = _$URepoApplyWritesInputWritesCreateCopyWithImpl; +@useResult +$Res call({ + Create data +}); + + +$CreateCopyWith<$Res> get data; + +} +/// @nodoc +class _$URepoApplyWritesInputWritesCreateCopyWithImpl<$Res> + implements $URepoApplyWritesInputWritesCreateCopyWith<$Res> { + _$URepoApplyWritesInputWritesCreateCopyWithImpl(this._self, this._then); + + final URepoApplyWritesInputWritesCreate _self; + final $Res Function(URepoApplyWritesInputWritesCreate) _then; + +/// Create a copy of URepoApplyWritesInputWrites +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(URepoApplyWritesInputWritesCreate( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as Create, + )); +} + +/// Create a copy of URepoApplyWritesInputWrites +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$CreateCopyWith<$Res> get data { + + return $CreateCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class URepoApplyWritesInputWritesUpdate extends URepoApplyWritesInputWrites { + const URepoApplyWritesInputWritesUpdate({required this.data}): super._(); + + +@override final Update data; + +/// Create a copy of URepoApplyWritesInputWrites +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$URepoApplyWritesInputWritesUpdateCopyWith get copyWith => _$URepoApplyWritesInputWritesUpdateCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is URepoApplyWritesInputWritesUpdate&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'URepoApplyWritesInputWrites.update(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $URepoApplyWritesInputWritesUpdateCopyWith<$Res> implements $URepoApplyWritesInputWritesCopyWith<$Res> { + factory $URepoApplyWritesInputWritesUpdateCopyWith(URepoApplyWritesInputWritesUpdate value, $Res Function(URepoApplyWritesInputWritesUpdate) _then) = _$URepoApplyWritesInputWritesUpdateCopyWithImpl; +@useResult +$Res call({ + Update data +}); + + +$UpdateCopyWith<$Res> get data; + +} +/// @nodoc +class _$URepoApplyWritesInputWritesUpdateCopyWithImpl<$Res> + implements $URepoApplyWritesInputWritesUpdateCopyWith<$Res> { + _$URepoApplyWritesInputWritesUpdateCopyWithImpl(this._self, this._then); + + final URepoApplyWritesInputWritesUpdate _self; + final $Res Function(URepoApplyWritesInputWritesUpdate) _then; + +/// Create a copy of URepoApplyWritesInputWrites +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(URepoApplyWritesInputWritesUpdate( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as Update, + )); +} + +/// Create a copy of URepoApplyWritesInputWrites +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$UpdateCopyWith<$Res> get data { + + return $UpdateCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class URepoApplyWritesInputWritesDelete extends URepoApplyWritesInputWrites { + const URepoApplyWritesInputWritesDelete({required this.data}): super._(); + + +@override final Delete data; + +/// Create a copy of URepoApplyWritesInputWrites +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$URepoApplyWritesInputWritesDeleteCopyWith get copyWith => _$URepoApplyWritesInputWritesDeleteCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is URepoApplyWritesInputWritesDelete&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'URepoApplyWritesInputWrites.delete(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $URepoApplyWritesInputWritesDeleteCopyWith<$Res> implements $URepoApplyWritesInputWritesCopyWith<$Res> { + factory $URepoApplyWritesInputWritesDeleteCopyWith(URepoApplyWritesInputWritesDelete value, $Res Function(URepoApplyWritesInputWritesDelete) _then) = _$URepoApplyWritesInputWritesDeleteCopyWithImpl; +@useResult +$Res call({ + Delete data +}); + + +$DeleteCopyWith<$Res> get data; + +} +/// @nodoc +class _$URepoApplyWritesInputWritesDeleteCopyWithImpl<$Res> + implements $URepoApplyWritesInputWritesDeleteCopyWith<$Res> { + _$URepoApplyWritesInputWritesDeleteCopyWithImpl(this._self, this._then); + + final URepoApplyWritesInputWritesDelete _self; + final $Res Function(URepoApplyWritesInputWritesDelete) _then; + +/// Create a copy of URepoApplyWritesInputWrites +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(URepoApplyWritesInputWritesDelete( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as Delete, + )); +} + +/// Create a copy of URepoApplyWritesInputWrites +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeleteCopyWith<$Res> get data { + + return $DeleteCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class URepoApplyWritesInputWritesUnknown extends URepoApplyWritesInputWrites { + const URepoApplyWritesInputWritesUnknown({required final Map data}): _data = data,super._(); + + + final Map _data; +@override Map get data { + if (_data is EqualUnmodifiableMapView) return _data; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_data); +} + + +/// Create a copy of URepoApplyWritesInputWrites +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$URepoApplyWritesInputWritesUnknownCopyWith get copyWith => _$URepoApplyWritesInputWritesUnknownCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is URepoApplyWritesInputWritesUnknown&&const DeepCollectionEquality().equals(other._data, _data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_data)); + +@override +String toString() { + return 'URepoApplyWritesInputWrites.unknown(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $URepoApplyWritesInputWritesUnknownCopyWith<$Res> implements $URepoApplyWritesInputWritesCopyWith<$Res> { + factory $URepoApplyWritesInputWritesUnknownCopyWith(URepoApplyWritesInputWritesUnknown value, $Res Function(URepoApplyWritesInputWritesUnknown) _then) = _$URepoApplyWritesInputWritesUnknownCopyWithImpl; +@useResult +$Res call({ + Map data +}); + + + + +} +/// @nodoc +class _$URepoApplyWritesInputWritesUnknownCopyWithImpl<$Res> + implements $URepoApplyWritesInputWritesUnknownCopyWith<$Res> { + _$URepoApplyWritesInputWritesUnknownCopyWithImpl(this._self, this._then); + + final URepoApplyWritesInputWritesUnknown _self; + final $Res Function(URepoApplyWritesInputWritesUnknown) _then; + +/// Create a copy of URepoApplyWritesInputWrites +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(URepoApplyWritesInputWritesUnknown( +data: null == data ? _self._data : data // ignore: cast_nullable_to_non_nullable +as Map, + )); +} + + +} + +// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_results.dart b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_output_results.dart similarity index 50% rename from packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_results.dart rename to packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_output_results.dart index bc81a0d00..8c36977ac 100644 --- a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_results.dart +++ b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_output_results.dart @@ -10,88 +10,95 @@ import './create_result.dart'; import './update_result.dart'; import './delete_result.dart'; -part 'union_main_results.freezed.dart'; +part 'union_main_output_results.freezed.dart'; // ************************************************************************** // LexGenerator // ************************************************************************** @freezed -sealed class URepoApplyWritesResults with _$URepoApplyWritesResults { - const URepoApplyWritesResults._(); +sealed class URepoApplyWritesOutputResults + with _$URepoApplyWritesOutputResults { + const URepoApplyWritesOutputResults._(); - const factory URepoApplyWritesResults.createResult({ + const factory URepoApplyWritesOutputResults.createResult({ required CreateResult data, - }) = URepoApplyWritesResultsCreateResult; - const factory URepoApplyWritesResults.updateResult({ + }) = URepoApplyWritesOutputResultsCreateResult; + const factory URepoApplyWritesOutputResults.updateResult({ required UpdateResult data, - }) = URepoApplyWritesResultsUpdateResult; - const factory URepoApplyWritesResults.deleteResult({ + }) = URepoApplyWritesOutputResultsUpdateResult; + const factory URepoApplyWritesOutputResults.deleteResult({ required DeleteResult data, - }) = URepoApplyWritesResultsDeleteResult; + }) = URepoApplyWritesOutputResultsDeleteResult; - const factory URepoApplyWritesResults.unknown({ + const factory URepoApplyWritesOutputResults.unknown({ required Map data, - }) = URepoApplyWritesResultsUnknown; + }) = URepoApplyWritesOutputResultsUnknown; Map toJson() => - const URepoApplyWritesResultsConverter().toJson(this); + const URepoApplyWritesOutputResultsConverter().toJson(this); } -extension URepoApplyWritesResultsExtension on URepoApplyWritesResults { - bool get isCreateResult => isA(this); +extension URepoApplyWritesOutputResultsExtension + on URepoApplyWritesOutputResults { + bool get isCreateResult => + isA(this); bool get isNotCreateResult => !isCreateResult; CreateResult? get createResult => isCreateResult ? data as CreateResult : null; - bool get isUpdateResult => isA(this); + bool get isUpdateResult => + isA(this); bool get isNotUpdateResult => !isUpdateResult; UpdateResult? get updateResult => isUpdateResult ? data as UpdateResult : null; - bool get isDeleteResult => isA(this); + bool get isDeleteResult => + isA(this); bool get isNotDeleteResult => !isDeleteResult; DeleteResult? get deleteResult => isDeleteResult ? data as DeleteResult : null; - bool get isUnknown => isA(this); + bool get isUnknown => isA(this); bool get isNotUnknown => !isUnknown; Map? get unknown => isUnknown ? data as Map : null; } -final class URepoApplyWritesResultsConverter - implements JsonConverter> { - const URepoApplyWritesResultsConverter(); +final class URepoApplyWritesOutputResultsConverter + implements + JsonConverter> { + const URepoApplyWritesOutputResultsConverter(); @override - URepoApplyWritesResults fromJson(Map json) { + URepoApplyWritesOutputResults fromJson(Map json) { try { if (CreateResult.validate(json)) { - return URepoApplyWritesResults.createResult( + return URepoApplyWritesOutputResults.createResult( data: const CreateResultConverter().fromJson(json), ); } if (UpdateResult.validate(json)) { - return URepoApplyWritesResults.updateResult( + return URepoApplyWritesOutputResults.updateResult( data: const UpdateResultConverter().fromJson(json), ); } if (DeleteResult.validate(json)) { - return URepoApplyWritesResults.deleteResult( + return URepoApplyWritesOutputResults.deleteResult( data: const DeleteResultConverter().fromJson(json), ); } - return URepoApplyWritesResults.unknown(data: json); + return URepoApplyWritesOutputResults.unknown(data: json); } catch (_) { - return URepoApplyWritesResults.unknown(data: json); + return URepoApplyWritesOutputResults.unknown(data: json); } } @override - Map toJson(URepoApplyWritesResults object) => object.when( - createResult: (data) => const CreateResultConverter().toJson(data), - updateResult: (data) => const UpdateResultConverter().toJson(data), - deleteResult: (data) => const DeleteResultConverter().toJson(data), + Map toJson(URepoApplyWritesOutputResults object) => + object.when( + createResult: (data) => const CreateResultConverter().toJson(data), + updateResult: (data) => const UpdateResultConverter().toJson(data), + deleteResult: (data) => const DeleteResultConverter().toJson(data), - unknown: (data) => data, - ); + unknown: (data) => data, + ); } diff --git a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_output_results.freezed.dart b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_output_results.freezed.dart new file mode 100644 index 000000000..3d3f5bc39 --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_output_results.freezed.dart @@ -0,0 +1,483 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'union_main_output_results.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$URepoApplyWritesOutputResults { + + Object get data; + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is URepoApplyWritesOutputResults&&const DeepCollectionEquality().equals(other.data, data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); + +@override +String toString() { + return 'URepoApplyWritesOutputResults(data: $data)'; +} + + +} + +/// @nodoc +class $URepoApplyWritesOutputResultsCopyWith<$Res> { +$URepoApplyWritesOutputResultsCopyWith(URepoApplyWritesOutputResults _, $Res Function(URepoApplyWritesOutputResults) __); +} + + +/// Adds pattern-matching-related methods to [URepoApplyWritesOutputResults]. +extension URepoApplyWritesOutputResultsPatterns on URepoApplyWritesOutputResults { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap({TResult Function( URepoApplyWritesOutputResultsCreateResult value)? createResult,TResult Function( URepoApplyWritesOutputResultsUpdateResult value)? updateResult,TResult Function( URepoApplyWritesOutputResultsDeleteResult value)? deleteResult,TResult Function( URepoApplyWritesOutputResultsUnknown value)? unknown,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case URepoApplyWritesOutputResultsCreateResult() when createResult != null: +return createResult(_that);case URepoApplyWritesOutputResultsUpdateResult() when updateResult != null: +return updateResult(_that);case URepoApplyWritesOutputResultsDeleteResult() when deleteResult != null: +return deleteResult(_that);case URepoApplyWritesOutputResultsUnknown() when unknown != null: +return unknown(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map({required TResult Function( URepoApplyWritesOutputResultsCreateResult value) createResult,required TResult Function( URepoApplyWritesOutputResultsUpdateResult value) updateResult,required TResult Function( URepoApplyWritesOutputResultsDeleteResult value) deleteResult,required TResult Function( URepoApplyWritesOutputResultsUnknown value) unknown,}){ +final _that = this; +switch (_that) { +case URepoApplyWritesOutputResultsCreateResult(): +return createResult(_that);case URepoApplyWritesOutputResultsUpdateResult(): +return updateResult(_that);case URepoApplyWritesOutputResultsDeleteResult(): +return deleteResult(_that);case URepoApplyWritesOutputResultsUnknown(): +return unknown(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull({TResult? Function( URepoApplyWritesOutputResultsCreateResult value)? createResult,TResult? Function( URepoApplyWritesOutputResultsUpdateResult value)? updateResult,TResult? Function( URepoApplyWritesOutputResultsDeleteResult value)? deleteResult,TResult? Function( URepoApplyWritesOutputResultsUnknown value)? unknown,}){ +final _that = this; +switch (_that) { +case URepoApplyWritesOutputResultsCreateResult() when createResult != null: +return createResult(_that);case URepoApplyWritesOutputResultsUpdateResult() when updateResult != null: +return updateResult(_that);case URepoApplyWritesOutputResultsDeleteResult() when deleteResult != null: +return deleteResult(_that);case URepoApplyWritesOutputResultsUnknown() when unknown != null: +return unknown(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen({TResult Function( CreateResult data)? createResult,TResult Function( UpdateResult data)? updateResult,TResult Function( DeleteResult data)? deleteResult,TResult Function( Map data)? unknown,required TResult orElse(),}) {final _that = this; +switch (_that) { +case URepoApplyWritesOutputResultsCreateResult() when createResult != null: +return createResult(_that.data);case URepoApplyWritesOutputResultsUpdateResult() when updateResult != null: +return updateResult(_that.data);case URepoApplyWritesOutputResultsDeleteResult() when deleteResult != null: +return deleteResult(_that.data);case URepoApplyWritesOutputResultsUnknown() when unknown != null: +return unknown(_that.data);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when({required TResult Function( CreateResult data) createResult,required TResult Function( UpdateResult data) updateResult,required TResult Function( DeleteResult data) deleteResult,required TResult Function( Map data) unknown,}) {final _that = this; +switch (_that) { +case URepoApplyWritesOutputResultsCreateResult(): +return createResult(_that.data);case URepoApplyWritesOutputResultsUpdateResult(): +return updateResult(_that.data);case URepoApplyWritesOutputResultsDeleteResult(): +return deleteResult(_that.data);case URepoApplyWritesOutputResultsUnknown(): +return unknown(_that.data);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull({TResult? Function( CreateResult data)? createResult,TResult? Function( UpdateResult data)? updateResult,TResult? Function( DeleteResult data)? deleteResult,TResult? Function( Map data)? unknown,}) {final _that = this; +switch (_that) { +case URepoApplyWritesOutputResultsCreateResult() when createResult != null: +return createResult(_that.data);case URepoApplyWritesOutputResultsUpdateResult() when updateResult != null: +return updateResult(_that.data);case URepoApplyWritesOutputResultsDeleteResult() when deleteResult != null: +return deleteResult(_that.data);case URepoApplyWritesOutputResultsUnknown() when unknown != null: +return unknown(_that.data);case _: + return null; + +} +} + +} + +/// @nodoc + + +class URepoApplyWritesOutputResultsCreateResult extends URepoApplyWritesOutputResults { + const URepoApplyWritesOutputResultsCreateResult({required this.data}): super._(); + + +@override final CreateResult data; + +/// Create a copy of URepoApplyWritesOutputResults +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$URepoApplyWritesOutputResultsCreateResultCopyWith get copyWith => _$URepoApplyWritesOutputResultsCreateResultCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is URepoApplyWritesOutputResultsCreateResult&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'URepoApplyWritesOutputResults.createResult(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $URepoApplyWritesOutputResultsCreateResultCopyWith<$Res> implements $URepoApplyWritesOutputResultsCopyWith<$Res> { + factory $URepoApplyWritesOutputResultsCreateResultCopyWith(URepoApplyWritesOutputResultsCreateResult value, $Res Function(URepoApplyWritesOutputResultsCreateResult) _then) = _$URepoApplyWritesOutputResultsCreateResultCopyWithImpl; +@useResult +$Res call({ + CreateResult data +}); + + +$CreateResultCopyWith<$Res> get data; + +} +/// @nodoc +class _$URepoApplyWritesOutputResultsCreateResultCopyWithImpl<$Res> + implements $URepoApplyWritesOutputResultsCreateResultCopyWith<$Res> { + _$URepoApplyWritesOutputResultsCreateResultCopyWithImpl(this._self, this._then); + + final URepoApplyWritesOutputResultsCreateResult _self; + final $Res Function(URepoApplyWritesOutputResultsCreateResult) _then; + +/// Create a copy of URepoApplyWritesOutputResults +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(URepoApplyWritesOutputResultsCreateResult( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as CreateResult, + )); +} + +/// Create a copy of URepoApplyWritesOutputResults +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$CreateResultCopyWith<$Res> get data { + + return $CreateResultCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class URepoApplyWritesOutputResultsUpdateResult extends URepoApplyWritesOutputResults { + const URepoApplyWritesOutputResultsUpdateResult({required this.data}): super._(); + + +@override final UpdateResult data; + +/// Create a copy of URepoApplyWritesOutputResults +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$URepoApplyWritesOutputResultsUpdateResultCopyWith get copyWith => _$URepoApplyWritesOutputResultsUpdateResultCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is URepoApplyWritesOutputResultsUpdateResult&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'URepoApplyWritesOutputResults.updateResult(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $URepoApplyWritesOutputResultsUpdateResultCopyWith<$Res> implements $URepoApplyWritesOutputResultsCopyWith<$Res> { + factory $URepoApplyWritesOutputResultsUpdateResultCopyWith(URepoApplyWritesOutputResultsUpdateResult value, $Res Function(URepoApplyWritesOutputResultsUpdateResult) _then) = _$URepoApplyWritesOutputResultsUpdateResultCopyWithImpl; +@useResult +$Res call({ + UpdateResult data +}); + + +$UpdateResultCopyWith<$Res> get data; + +} +/// @nodoc +class _$URepoApplyWritesOutputResultsUpdateResultCopyWithImpl<$Res> + implements $URepoApplyWritesOutputResultsUpdateResultCopyWith<$Res> { + _$URepoApplyWritesOutputResultsUpdateResultCopyWithImpl(this._self, this._then); + + final URepoApplyWritesOutputResultsUpdateResult _self; + final $Res Function(URepoApplyWritesOutputResultsUpdateResult) _then; + +/// Create a copy of URepoApplyWritesOutputResults +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(URepoApplyWritesOutputResultsUpdateResult( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as UpdateResult, + )); +} + +/// Create a copy of URepoApplyWritesOutputResults +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$UpdateResultCopyWith<$Res> get data { + + return $UpdateResultCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class URepoApplyWritesOutputResultsDeleteResult extends URepoApplyWritesOutputResults { + const URepoApplyWritesOutputResultsDeleteResult({required this.data}): super._(); + + +@override final DeleteResult data; + +/// Create a copy of URepoApplyWritesOutputResults +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$URepoApplyWritesOutputResultsDeleteResultCopyWith get copyWith => _$URepoApplyWritesOutputResultsDeleteResultCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is URepoApplyWritesOutputResultsDeleteResult&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'URepoApplyWritesOutputResults.deleteResult(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $URepoApplyWritesOutputResultsDeleteResultCopyWith<$Res> implements $URepoApplyWritesOutputResultsCopyWith<$Res> { + factory $URepoApplyWritesOutputResultsDeleteResultCopyWith(URepoApplyWritesOutputResultsDeleteResult value, $Res Function(URepoApplyWritesOutputResultsDeleteResult) _then) = _$URepoApplyWritesOutputResultsDeleteResultCopyWithImpl; +@useResult +$Res call({ + DeleteResult data +}); + + +$DeleteResultCopyWith<$Res> get data; + +} +/// @nodoc +class _$URepoApplyWritesOutputResultsDeleteResultCopyWithImpl<$Res> + implements $URepoApplyWritesOutputResultsDeleteResultCopyWith<$Res> { + _$URepoApplyWritesOutputResultsDeleteResultCopyWithImpl(this._self, this._then); + + final URepoApplyWritesOutputResultsDeleteResult _self; + final $Res Function(URepoApplyWritesOutputResultsDeleteResult) _then; + +/// Create a copy of URepoApplyWritesOutputResults +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(URepoApplyWritesOutputResultsDeleteResult( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as DeleteResult, + )); +} + +/// Create a copy of URepoApplyWritesOutputResults +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$DeleteResultCopyWith<$Res> get data { + + return $DeleteResultCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class URepoApplyWritesOutputResultsUnknown extends URepoApplyWritesOutputResults { + const URepoApplyWritesOutputResultsUnknown({required final Map data}): _data = data,super._(); + + + final Map _data; +@override Map get data { + if (_data is EqualUnmodifiableMapView) return _data; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_data); +} + + +/// Create a copy of URepoApplyWritesOutputResults +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$URepoApplyWritesOutputResultsUnknownCopyWith get copyWith => _$URepoApplyWritesOutputResultsUnknownCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is URepoApplyWritesOutputResultsUnknown&&const DeepCollectionEquality().equals(other._data, _data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_data)); + +@override +String toString() { + return 'URepoApplyWritesOutputResults.unknown(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $URepoApplyWritesOutputResultsUnknownCopyWith<$Res> implements $URepoApplyWritesOutputResultsCopyWith<$Res> { + factory $URepoApplyWritesOutputResultsUnknownCopyWith(URepoApplyWritesOutputResultsUnknown value, $Res Function(URepoApplyWritesOutputResultsUnknown) _then) = _$URepoApplyWritesOutputResultsUnknownCopyWithImpl; +@useResult +$Res call({ + Map data +}); + + + + +} +/// @nodoc +class _$URepoApplyWritesOutputResultsUnknownCopyWithImpl<$Res> + implements $URepoApplyWritesOutputResultsUnknownCopyWith<$Res> { + _$URepoApplyWritesOutputResultsUnknownCopyWithImpl(this._self, this._then); + + final URepoApplyWritesOutputResultsUnknown _self; + final $Res Function(URepoApplyWritesOutputResultsUnknown) _then; + +/// Create a copy of URepoApplyWritesOutputResults +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(URepoApplyWritesOutputResultsUnknown( +data: null == data ? _self._data : data // ignore: cast_nullable_to_non_nullable +as Map, + )); +} + + +} + +// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_results.freezed.dart b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_results.freezed.dart deleted file mode 100644 index 8fdd2de84..000000000 --- a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_results.freezed.dart +++ /dev/null @@ -1,483 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND -// coverage:ignore-file -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'union_main_results.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; -/// @nodoc -mixin _$URepoApplyWritesResults { - - Object get data; - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is URepoApplyWritesResults&&const DeepCollectionEquality().equals(other.data, data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); - -@override -String toString() { - return 'URepoApplyWritesResults(data: $data)'; -} - - -} - -/// @nodoc -class $URepoApplyWritesResultsCopyWith<$Res> { -$URepoApplyWritesResultsCopyWith(URepoApplyWritesResults _, $Res Function(URepoApplyWritesResults) __); -} - - -/// Adds pattern-matching-related methods to [URepoApplyWritesResults]. -extension URepoApplyWritesResultsPatterns on URepoApplyWritesResults { -/// A variant of `map` that fallback to returning `orElse`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeMap({TResult Function( URepoApplyWritesResultsCreateResult value)? createResult,TResult Function( URepoApplyWritesResultsUpdateResult value)? updateResult,TResult Function( URepoApplyWritesResultsDeleteResult value)? deleteResult,TResult Function( URepoApplyWritesResultsUnknown value)? unknown,required TResult orElse(),}){ -final _that = this; -switch (_that) { -case URepoApplyWritesResultsCreateResult() when createResult != null: -return createResult(_that);case URepoApplyWritesResultsUpdateResult() when updateResult != null: -return updateResult(_that);case URepoApplyWritesResultsDeleteResult() when deleteResult != null: -return deleteResult(_that);case URepoApplyWritesResultsUnknown() when unknown != null: -return unknown(_that);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// Callbacks receives the raw object, upcasted. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case final Subclass2 value: -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult map({required TResult Function( URepoApplyWritesResultsCreateResult value) createResult,required TResult Function( URepoApplyWritesResultsUpdateResult value) updateResult,required TResult Function( URepoApplyWritesResultsDeleteResult value) deleteResult,required TResult Function( URepoApplyWritesResultsUnknown value) unknown,}){ -final _that = this; -switch (_that) { -case URepoApplyWritesResultsCreateResult(): -return createResult(_that);case URepoApplyWritesResultsUpdateResult(): -return updateResult(_that);case URepoApplyWritesResultsDeleteResult(): -return deleteResult(_that);case URepoApplyWritesResultsUnknown(): -return unknown(_that);} -} -/// A variant of `map` that fallback to returning `null`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? mapOrNull({TResult? Function( URepoApplyWritesResultsCreateResult value)? createResult,TResult? Function( URepoApplyWritesResultsUpdateResult value)? updateResult,TResult? Function( URepoApplyWritesResultsDeleteResult value)? deleteResult,TResult? Function( URepoApplyWritesResultsUnknown value)? unknown,}){ -final _that = this; -switch (_that) { -case URepoApplyWritesResultsCreateResult() when createResult != null: -return createResult(_that);case URepoApplyWritesResultsUpdateResult() when updateResult != null: -return updateResult(_that);case URepoApplyWritesResultsDeleteResult() when deleteResult != null: -return deleteResult(_that);case URepoApplyWritesResultsUnknown() when unknown != null: -return unknown(_that);case _: - return null; - -} -} -/// A variant of `when` that fallback to an `orElse` callback. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeWhen({TResult Function( CreateResult data)? createResult,TResult Function( UpdateResult data)? updateResult,TResult Function( DeleteResult data)? deleteResult,TResult Function( Map data)? unknown,required TResult orElse(),}) {final _that = this; -switch (_that) { -case URepoApplyWritesResultsCreateResult() when createResult != null: -return createResult(_that.data);case URepoApplyWritesResultsUpdateResult() when updateResult != null: -return updateResult(_that.data);case URepoApplyWritesResultsDeleteResult() when deleteResult != null: -return deleteResult(_that.data);case URepoApplyWritesResultsUnknown() when unknown != null: -return unknown(_that.data);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// As opposed to `map`, this offers destructuring. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case Subclass2(:final field2): -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult when({required TResult Function( CreateResult data) createResult,required TResult Function( UpdateResult data) updateResult,required TResult Function( DeleteResult data) deleteResult,required TResult Function( Map data) unknown,}) {final _that = this; -switch (_that) { -case URepoApplyWritesResultsCreateResult(): -return createResult(_that.data);case URepoApplyWritesResultsUpdateResult(): -return updateResult(_that.data);case URepoApplyWritesResultsDeleteResult(): -return deleteResult(_that.data);case URepoApplyWritesResultsUnknown(): -return unknown(_that.data);} -} -/// A variant of `when` that fallback to returning `null` -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? whenOrNull({TResult? Function( CreateResult data)? createResult,TResult? Function( UpdateResult data)? updateResult,TResult? Function( DeleteResult data)? deleteResult,TResult? Function( Map data)? unknown,}) {final _that = this; -switch (_that) { -case URepoApplyWritesResultsCreateResult() when createResult != null: -return createResult(_that.data);case URepoApplyWritesResultsUpdateResult() when updateResult != null: -return updateResult(_that.data);case URepoApplyWritesResultsDeleteResult() when deleteResult != null: -return deleteResult(_that.data);case URepoApplyWritesResultsUnknown() when unknown != null: -return unknown(_that.data);case _: - return null; - -} -} - -} - -/// @nodoc - - -class URepoApplyWritesResultsCreateResult extends URepoApplyWritesResults { - const URepoApplyWritesResultsCreateResult({required this.data}): super._(); - - -@override final CreateResult data; - -/// Create a copy of URepoApplyWritesResults -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$URepoApplyWritesResultsCreateResultCopyWith get copyWith => _$URepoApplyWritesResultsCreateResultCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is URepoApplyWritesResultsCreateResult&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'URepoApplyWritesResults.createResult(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $URepoApplyWritesResultsCreateResultCopyWith<$Res> implements $URepoApplyWritesResultsCopyWith<$Res> { - factory $URepoApplyWritesResultsCreateResultCopyWith(URepoApplyWritesResultsCreateResult value, $Res Function(URepoApplyWritesResultsCreateResult) _then) = _$URepoApplyWritesResultsCreateResultCopyWithImpl; -@useResult -$Res call({ - CreateResult data -}); - - -$CreateResultCopyWith<$Res> get data; - -} -/// @nodoc -class _$URepoApplyWritesResultsCreateResultCopyWithImpl<$Res> - implements $URepoApplyWritesResultsCreateResultCopyWith<$Res> { - _$URepoApplyWritesResultsCreateResultCopyWithImpl(this._self, this._then); - - final URepoApplyWritesResultsCreateResult _self; - final $Res Function(URepoApplyWritesResultsCreateResult) _then; - -/// Create a copy of URepoApplyWritesResults -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(URepoApplyWritesResultsCreateResult( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as CreateResult, - )); -} - -/// Create a copy of URepoApplyWritesResults -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$CreateResultCopyWith<$Res> get data { - - return $CreateResultCopyWith<$Res>(_self.data, (value) { - return _then(_self.copyWith(data: value)); - }); -} -} - -/// @nodoc - - -class URepoApplyWritesResultsUpdateResult extends URepoApplyWritesResults { - const URepoApplyWritesResultsUpdateResult({required this.data}): super._(); - - -@override final UpdateResult data; - -/// Create a copy of URepoApplyWritesResults -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$URepoApplyWritesResultsUpdateResultCopyWith get copyWith => _$URepoApplyWritesResultsUpdateResultCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is URepoApplyWritesResultsUpdateResult&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'URepoApplyWritesResults.updateResult(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $URepoApplyWritesResultsUpdateResultCopyWith<$Res> implements $URepoApplyWritesResultsCopyWith<$Res> { - factory $URepoApplyWritesResultsUpdateResultCopyWith(URepoApplyWritesResultsUpdateResult value, $Res Function(URepoApplyWritesResultsUpdateResult) _then) = _$URepoApplyWritesResultsUpdateResultCopyWithImpl; -@useResult -$Res call({ - UpdateResult data -}); - - -$UpdateResultCopyWith<$Res> get data; - -} -/// @nodoc -class _$URepoApplyWritesResultsUpdateResultCopyWithImpl<$Res> - implements $URepoApplyWritesResultsUpdateResultCopyWith<$Res> { - _$URepoApplyWritesResultsUpdateResultCopyWithImpl(this._self, this._then); - - final URepoApplyWritesResultsUpdateResult _self; - final $Res Function(URepoApplyWritesResultsUpdateResult) _then; - -/// Create a copy of URepoApplyWritesResults -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(URepoApplyWritesResultsUpdateResult( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as UpdateResult, - )); -} - -/// Create a copy of URepoApplyWritesResults -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$UpdateResultCopyWith<$Res> get data { - - return $UpdateResultCopyWith<$Res>(_self.data, (value) { - return _then(_self.copyWith(data: value)); - }); -} -} - -/// @nodoc - - -class URepoApplyWritesResultsDeleteResult extends URepoApplyWritesResults { - const URepoApplyWritesResultsDeleteResult({required this.data}): super._(); - - -@override final DeleteResult data; - -/// Create a copy of URepoApplyWritesResults -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$URepoApplyWritesResultsDeleteResultCopyWith get copyWith => _$URepoApplyWritesResultsDeleteResultCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is URepoApplyWritesResultsDeleteResult&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'URepoApplyWritesResults.deleteResult(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $URepoApplyWritesResultsDeleteResultCopyWith<$Res> implements $URepoApplyWritesResultsCopyWith<$Res> { - factory $URepoApplyWritesResultsDeleteResultCopyWith(URepoApplyWritesResultsDeleteResult value, $Res Function(URepoApplyWritesResultsDeleteResult) _then) = _$URepoApplyWritesResultsDeleteResultCopyWithImpl; -@useResult -$Res call({ - DeleteResult data -}); - - -$DeleteResultCopyWith<$Res> get data; - -} -/// @nodoc -class _$URepoApplyWritesResultsDeleteResultCopyWithImpl<$Res> - implements $URepoApplyWritesResultsDeleteResultCopyWith<$Res> { - _$URepoApplyWritesResultsDeleteResultCopyWithImpl(this._self, this._then); - - final URepoApplyWritesResultsDeleteResult _self; - final $Res Function(URepoApplyWritesResultsDeleteResult) _then; - -/// Create a copy of URepoApplyWritesResults -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(URepoApplyWritesResultsDeleteResult( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as DeleteResult, - )); -} - -/// Create a copy of URepoApplyWritesResults -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$DeleteResultCopyWith<$Res> get data { - - return $DeleteResultCopyWith<$Res>(_self.data, (value) { - return _then(_self.copyWith(data: value)); - }); -} -} - -/// @nodoc - - -class URepoApplyWritesResultsUnknown extends URepoApplyWritesResults { - const URepoApplyWritesResultsUnknown({required final Map data}): _data = data,super._(); - - - final Map _data; -@override Map get data { - if (_data is EqualUnmodifiableMapView) return _data; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(_data); -} - - -/// Create a copy of URepoApplyWritesResults -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$URepoApplyWritesResultsUnknownCopyWith get copyWith => _$URepoApplyWritesResultsUnknownCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is URepoApplyWritesResultsUnknown&&const DeepCollectionEquality().equals(other._data, _data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_data)); - -@override -String toString() { - return 'URepoApplyWritesResults.unknown(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $URepoApplyWritesResultsUnknownCopyWith<$Res> implements $URepoApplyWritesResultsCopyWith<$Res> { - factory $URepoApplyWritesResultsUnknownCopyWith(URepoApplyWritesResultsUnknown value, $Res Function(URepoApplyWritesResultsUnknown) _then) = _$URepoApplyWritesResultsUnknownCopyWithImpl; -@useResult -$Res call({ - Map data -}); - - - - -} -/// @nodoc -class _$URepoApplyWritesResultsUnknownCopyWithImpl<$Res> - implements $URepoApplyWritesResultsUnknownCopyWith<$Res> { - _$URepoApplyWritesResultsUnknownCopyWithImpl(this._self, this._then); - - final URepoApplyWritesResultsUnknown _self; - final $Res Function(URepoApplyWritesResultsUnknown) _then; - -/// Create a copy of URepoApplyWritesResults -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(URepoApplyWritesResultsUnknown( -data: null == data ? _self._data : data // ignore: cast_nullable_to_non_nullable -as Map, - )); -} - - -} - -// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_writes.dart b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_writes.dart deleted file mode 100644 index 051fdc895..000000000 --- a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_writes.dart +++ /dev/null @@ -1,91 +0,0 @@ -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, unused_import, duplicate_import, unnecessary_cast, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:poptart_core/internals.dart' show isA; - -import './create.dart'; -import './update.dart'; -import './delete.dart'; - -part 'union_main_writes.freezed.dart'; - -// ************************************************************************** -// LexGenerator -// ************************************************************************** - -@freezed -sealed class URepoApplyWritesWrites with _$URepoApplyWritesWrites { - const URepoApplyWritesWrites._(); - - const factory URepoApplyWritesWrites.create({required Create data}) = - URepoApplyWritesWritesCreate; - const factory URepoApplyWritesWrites.update({required Update data}) = - URepoApplyWritesWritesUpdate; - const factory URepoApplyWritesWrites.delete({required Delete data}) = - URepoApplyWritesWritesDelete; - - const factory URepoApplyWritesWrites.unknown({ - required Map data, - }) = URepoApplyWritesWritesUnknown; - - Map toJson() => - const URepoApplyWritesWritesConverter().toJson(this); -} - -extension URepoApplyWritesWritesExtension on URepoApplyWritesWrites { - bool get isCreate => isA(this); - bool get isNotCreate => !isCreate; - Create? get create => isCreate ? data as Create : null; - bool get isUpdate => isA(this); - bool get isNotUpdate => !isUpdate; - Update? get update => isUpdate ? data as Update : null; - bool get isDelete => isA(this); - bool get isNotDelete => !isDelete; - Delete? get delete => isDelete ? data as Delete : null; - bool get isUnknown => isA(this); - bool get isNotUnknown => !isUnknown; - Map? get unknown => - isUnknown ? data as Map : null; -} - -final class URepoApplyWritesWritesConverter - implements JsonConverter> { - const URepoApplyWritesWritesConverter(); - - @override - URepoApplyWritesWrites fromJson(Map json) { - try { - if (Create.validate(json)) { - return URepoApplyWritesWrites.create( - data: const CreateConverter().fromJson(json), - ); - } - if (Update.validate(json)) { - return URepoApplyWritesWrites.update( - data: const UpdateConverter().fromJson(json), - ); - } - if (Delete.validate(json)) { - return URepoApplyWritesWrites.delete( - data: const DeleteConverter().fromJson(json), - ); - } - - return URepoApplyWritesWrites.unknown(data: json); - } catch (_) { - return URepoApplyWritesWrites.unknown(data: json); - } - } - - @override - Map toJson(URepoApplyWritesWrites object) => object.when( - create: (data) => const CreateConverter().toJson(data), - update: (data) => const UpdateConverter().toJson(data), - delete: (data) => const DeleteConverter().toJson(data), - - unknown: (data) => data, - ); -} diff --git a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_writes.freezed.dart b/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_writes.freezed.dart deleted file mode 100644 index 0bc987282..000000000 --- a/packages/poptart_lex/lib/com/atproto/repo/apply_writes/union_main_writes.freezed.dart +++ /dev/null @@ -1,483 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND -// coverage:ignore-file -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'union_main_writes.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; -/// @nodoc -mixin _$URepoApplyWritesWrites { - - Object get data; - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is URepoApplyWritesWrites&&const DeepCollectionEquality().equals(other.data, data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); - -@override -String toString() { - return 'URepoApplyWritesWrites(data: $data)'; -} - - -} - -/// @nodoc -class $URepoApplyWritesWritesCopyWith<$Res> { -$URepoApplyWritesWritesCopyWith(URepoApplyWritesWrites _, $Res Function(URepoApplyWritesWrites) __); -} - - -/// Adds pattern-matching-related methods to [URepoApplyWritesWrites]. -extension URepoApplyWritesWritesPatterns on URepoApplyWritesWrites { -/// A variant of `map` that fallback to returning `orElse`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeMap({TResult Function( URepoApplyWritesWritesCreate value)? create,TResult Function( URepoApplyWritesWritesUpdate value)? update,TResult Function( URepoApplyWritesWritesDelete value)? delete,TResult Function( URepoApplyWritesWritesUnknown value)? unknown,required TResult orElse(),}){ -final _that = this; -switch (_that) { -case URepoApplyWritesWritesCreate() when create != null: -return create(_that);case URepoApplyWritesWritesUpdate() when update != null: -return update(_that);case URepoApplyWritesWritesDelete() when delete != null: -return delete(_that);case URepoApplyWritesWritesUnknown() when unknown != null: -return unknown(_that);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// Callbacks receives the raw object, upcasted. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case final Subclass2 value: -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult map({required TResult Function( URepoApplyWritesWritesCreate value) create,required TResult Function( URepoApplyWritesWritesUpdate value) update,required TResult Function( URepoApplyWritesWritesDelete value) delete,required TResult Function( URepoApplyWritesWritesUnknown value) unknown,}){ -final _that = this; -switch (_that) { -case URepoApplyWritesWritesCreate(): -return create(_that);case URepoApplyWritesWritesUpdate(): -return update(_that);case URepoApplyWritesWritesDelete(): -return delete(_that);case URepoApplyWritesWritesUnknown(): -return unknown(_that);} -} -/// A variant of `map` that fallback to returning `null`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? mapOrNull({TResult? Function( URepoApplyWritesWritesCreate value)? create,TResult? Function( URepoApplyWritesWritesUpdate value)? update,TResult? Function( URepoApplyWritesWritesDelete value)? delete,TResult? Function( URepoApplyWritesWritesUnknown value)? unknown,}){ -final _that = this; -switch (_that) { -case URepoApplyWritesWritesCreate() when create != null: -return create(_that);case URepoApplyWritesWritesUpdate() when update != null: -return update(_that);case URepoApplyWritesWritesDelete() when delete != null: -return delete(_that);case URepoApplyWritesWritesUnknown() when unknown != null: -return unknown(_that);case _: - return null; - -} -} -/// A variant of `when` that fallback to an `orElse` callback. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeWhen({TResult Function( Create data)? create,TResult Function( Update data)? update,TResult Function( Delete data)? delete,TResult Function( Map data)? unknown,required TResult orElse(),}) {final _that = this; -switch (_that) { -case URepoApplyWritesWritesCreate() when create != null: -return create(_that.data);case URepoApplyWritesWritesUpdate() when update != null: -return update(_that.data);case URepoApplyWritesWritesDelete() when delete != null: -return delete(_that.data);case URepoApplyWritesWritesUnknown() when unknown != null: -return unknown(_that.data);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// As opposed to `map`, this offers destructuring. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case Subclass2(:final field2): -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult when({required TResult Function( Create data) create,required TResult Function( Update data) update,required TResult Function( Delete data) delete,required TResult Function( Map data) unknown,}) {final _that = this; -switch (_that) { -case URepoApplyWritesWritesCreate(): -return create(_that.data);case URepoApplyWritesWritesUpdate(): -return update(_that.data);case URepoApplyWritesWritesDelete(): -return delete(_that.data);case URepoApplyWritesWritesUnknown(): -return unknown(_that.data);} -} -/// A variant of `when` that fallback to returning `null` -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? whenOrNull({TResult? Function( Create data)? create,TResult? Function( Update data)? update,TResult? Function( Delete data)? delete,TResult? Function( Map data)? unknown,}) {final _that = this; -switch (_that) { -case URepoApplyWritesWritesCreate() when create != null: -return create(_that.data);case URepoApplyWritesWritesUpdate() when update != null: -return update(_that.data);case URepoApplyWritesWritesDelete() when delete != null: -return delete(_that.data);case URepoApplyWritesWritesUnknown() when unknown != null: -return unknown(_that.data);case _: - return null; - -} -} - -} - -/// @nodoc - - -class URepoApplyWritesWritesCreate extends URepoApplyWritesWrites { - const URepoApplyWritesWritesCreate({required this.data}): super._(); - - -@override final Create data; - -/// Create a copy of URepoApplyWritesWrites -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$URepoApplyWritesWritesCreateCopyWith get copyWith => _$URepoApplyWritesWritesCreateCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is URepoApplyWritesWritesCreate&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'URepoApplyWritesWrites.create(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $URepoApplyWritesWritesCreateCopyWith<$Res> implements $URepoApplyWritesWritesCopyWith<$Res> { - factory $URepoApplyWritesWritesCreateCopyWith(URepoApplyWritesWritesCreate value, $Res Function(URepoApplyWritesWritesCreate) _then) = _$URepoApplyWritesWritesCreateCopyWithImpl; -@useResult -$Res call({ - Create data -}); - - -$CreateCopyWith<$Res> get data; - -} -/// @nodoc -class _$URepoApplyWritesWritesCreateCopyWithImpl<$Res> - implements $URepoApplyWritesWritesCreateCopyWith<$Res> { - _$URepoApplyWritesWritesCreateCopyWithImpl(this._self, this._then); - - final URepoApplyWritesWritesCreate _self; - final $Res Function(URepoApplyWritesWritesCreate) _then; - -/// Create a copy of URepoApplyWritesWrites -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(URepoApplyWritesWritesCreate( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as Create, - )); -} - -/// Create a copy of URepoApplyWritesWrites -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$CreateCopyWith<$Res> get data { - - return $CreateCopyWith<$Res>(_self.data, (value) { - return _then(_self.copyWith(data: value)); - }); -} -} - -/// @nodoc - - -class URepoApplyWritesWritesUpdate extends URepoApplyWritesWrites { - const URepoApplyWritesWritesUpdate({required this.data}): super._(); - - -@override final Update data; - -/// Create a copy of URepoApplyWritesWrites -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$URepoApplyWritesWritesUpdateCopyWith get copyWith => _$URepoApplyWritesWritesUpdateCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is URepoApplyWritesWritesUpdate&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'URepoApplyWritesWrites.update(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $URepoApplyWritesWritesUpdateCopyWith<$Res> implements $URepoApplyWritesWritesCopyWith<$Res> { - factory $URepoApplyWritesWritesUpdateCopyWith(URepoApplyWritesWritesUpdate value, $Res Function(URepoApplyWritesWritesUpdate) _then) = _$URepoApplyWritesWritesUpdateCopyWithImpl; -@useResult -$Res call({ - Update data -}); - - -$UpdateCopyWith<$Res> get data; - -} -/// @nodoc -class _$URepoApplyWritesWritesUpdateCopyWithImpl<$Res> - implements $URepoApplyWritesWritesUpdateCopyWith<$Res> { - _$URepoApplyWritesWritesUpdateCopyWithImpl(this._self, this._then); - - final URepoApplyWritesWritesUpdate _self; - final $Res Function(URepoApplyWritesWritesUpdate) _then; - -/// Create a copy of URepoApplyWritesWrites -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(URepoApplyWritesWritesUpdate( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as Update, - )); -} - -/// Create a copy of URepoApplyWritesWrites -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$UpdateCopyWith<$Res> get data { - - return $UpdateCopyWith<$Res>(_self.data, (value) { - return _then(_self.copyWith(data: value)); - }); -} -} - -/// @nodoc - - -class URepoApplyWritesWritesDelete extends URepoApplyWritesWrites { - const URepoApplyWritesWritesDelete({required this.data}): super._(); - - -@override final Delete data; - -/// Create a copy of URepoApplyWritesWrites -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$URepoApplyWritesWritesDeleteCopyWith get copyWith => _$URepoApplyWritesWritesDeleteCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is URepoApplyWritesWritesDelete&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'URepoApplyWritesWrites.delete(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $URepoApplyWritesWritesDeleteCopyWith<$Res> implements $URepoApplyWritesWritesCopyWith<$Res> { - factory $URepoApplyWritesWritesDeleteCopyWith(URepoApplyWritesWritesDelete value, $Res Function(URepoApplyWritesWritesDelete) _then) = _$URepoApplyWritesWritesDeleteCopyWithImpl; -@useResult -$Res call({ - Delete data -}); - - -$DeleteCopyWith<$Res> get data; - -} -/// @nodoc -class _$URepoApplyWritesWritesDeleteCopyWithImpl<$Res> - implements $URepoApplyWritesWritesDeleteCopyWith<$Res> { - _$URepoApplyWritesWritesDeleteCopyWithImpl(this._self, this._then); - - final URepoApplyWritesWritesDelete _self; - final $Res Function(URepoApplyWritesWritesDelete) _then; - -/// Create a copy of URepoApplyWritesWrites -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(URepoApplyWritesWritesDelete( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as Delete, - )); -} - -/// Create a copy of URepoApplyWritesWrites -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$DeleteCopyWith<$Res> get data { - - return $DeleteCopyWith<$Res>(_self.data, (value) { - return _then(_self.copyWith(data: value)); - }); -} -} - -/// @nodoc - - -class URepoApplyWritesWritesUnknown extends URepoApplyWritesWrites { - const URepoApplyWritesWritesUnknown({required final Map data}): _data = data,super._(); - - - final Map _data; -@override Map get data { - if (_data is EqualUnmodifiableMapView) return _data; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(_data); -} - - -/// Create a copy of URepoApplyWritesWrites -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$URepoApplyWritesWritesUnknownCopyWith get copyWith => _$URepoApplyWritesWritesUnknownCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is URepoApplyWritesWritesUnknown&&const DeepCollectionEquality().equals(other._data, _data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_data)); - -@override -String toString() { - return 'URepoApplyWritesWrites.unknown(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $URepoApplyWritesWritesUnknownCopyWith<$Res> implements $URepoApplyWritesWritesCopyWith<$Res> { - factory $URepoApplyWritesWritesUnknownCopyWith(URepoApplyWritesWritesUnknown value, $Res Function(URepoApplyWritesWritesUnknown) _then) = _$URepoApplyWritesWritesUnknownCopyWithImpl; -@useResult -$Res call({ - Map data -}); - - - - -} -/// @nodoc -class _$URepoApplyWritesWritesUnknownCopyWithImpl<$Res> - implements $URepoApplyWritesWritesUnknownCopyWith<$Res> { - _$URepoApplyWritesWritesUnknownCopyWithImpl(this._self, this._then); - - final URepoApplyWritesWritesUnknown _self; - final $Res Function(URepoApplyWritesWritesUnknown) _then; - -/// Create a copy of URepoApplyWritesWrites -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(URepoApplyWritesWritesUnknown( -data: null == data ? _self._data : data // ignore: cast_nullable_to_non_nullable -as Map, - )); -} - - -} - -// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/repo/create_record.dart b/packages/poptart_lex/lib/com/atproto/repo/create_record.dart index fd0d722d4..04fcab98a 100644 --- a/packages/poptart_lex/lib/com/atproto/repo/create_record.dart +++ b/packages/poptart_lex/lib/com/atproto/repo/create_record.dart @@ -9,5 +9,5 @@ export 'create_record/descriptor.dart'; export 'create_record/input.dart'; -export 'create_record/main_validation_status.dart'; +export 'create_record/main_output_validation_status.dart'; export 'create_record/output.dart'; diff --git a/packages/poptart_lex/lib/com/atproto/repo/create_record/main_output_validation_status.dart b/packages/poptart_lex/lib/com/atproto/repo/create_record/main_output_validation_status.dart new file mode 100644 index 000000000..5f317dc9e --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/repo/create_record/main_output_validation_status.dart @@ -0,0 +1,113 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, unused_import, duplicate_import, unnecessary_cast, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +import 'package:poptart_core/poptart_core.dart' show Serializable; +import 'package:poptart_core/internals.dart' show isA; + +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'main_output_validation_status.freezed.dart'; + +// ************************************************************************** +// LexGenerator +// ************************************************************************** + +@freezed +abstract class RepoCreateRecordOutputValidationStatus + with _$RepoCreateRecordOutputValidationStatus { + const RepoCreateRecordOutputValidationStatus._(); + + const factory RepoCreateRecordOutputValidationStatus.knownValue({ + required KnownRepoCreateRecordOutputValidationStatus data, + }) = RepoCreateRecordOutputValidationStatusKnownValue; + + const factory RepoCreateRecordOutputValidationStatus.unknown({ + required String data, + }) = RepoCreateRecordOutputValidationStatusUnknown; + + static RepoCreateRecordOutputValidationStatus? valueOf(final String? value) { + if (value == null) return null; + final knownValue = KnownRepoCreateRecordOutputValidationStatus.valueOf( + value, + ); + + return knownValue != null + ? RepoCreateRecordOutputValidationStatus.knownValue(data: knownValue) + : RepoCreateRecordOutputValidationStatus.unknown(data: value); + } + + String toJson() => + const RepoCreateRecordOutputValidationStatusConverter().toJson(this); +} + +extension RepoCreateRecordOutputValidationStatusExtension + on RepoCreateRecordOutputValidationStatus { + bool get isKnownValue => + isA(this); + bool get isNotKnownValue => !isKnownValue; + KnownRepoCreateRecordOutputValidationStatus? get knownValue => + isKnownValue ? data as KnownRepoCreateRecordOutputValidationStatus : null; + bool get isUnknown => + isA(this); + bool get isNotUnknown => !isUnknown; + String? get unknown => isUnknown ? data as String : null; +} + +final class RepoCreateRecordOutputValidationStatusConverter + extends JsonConverter { + const RepoCreateRecordOutputValidationStatusConverter(); + + @override + RepoCreateRecordOutputValidationStatus fromJson(String json) { + try { + final knownValue = KnownRepoCreateRecordOutputValidationStatus.valueOf( + json, + ); + if (knownValue != null) { + return RepoCreateRecordOutputValidationStatus.knownValue( + data: knownValue, + ); + } + + return RepoCreateRecordOutputValidationStatus.unknown(data: json); + } catch (_) { + return RepoCreateRecordOutputValidationStatus.unknown(data: json); + } + } + + @override + String toJson(RepoCreateRecordOutputValidationStatus object) => + object.when(knownValue: (data) => data.value, unknown: (data) => data); +} + +enum KnownRepoCreateRecordOutputValidationStatus implements Serializable { + @JsonValue('valid') + valid('valid'), + @JsonValue('unknown') + unknown('unknown'); + + @override + final String value; + + const KnownRepoCreateRecordOutputValidationStatus(this.value); + + static bool isKnownValue(final String value) { + return valueOf(value) != null; + } + + static KnownRepoCreateRecordOutputValidationStatus? valueOf( + final String? value, + ) { + if (value == null) return null; + + for (final v in values) { + if (v.value == value) { + return v; + } + } + + return null; + } +} diff --git a/packages/poptart_lex/lib/com/atproto/repo/create_record/main_output_validation_status.freezed.dart b/packages/poptart_lex/lib/com/atproto/repo/create_record/main_output_validation_status.freezed.dart new file mode 100644 index 000000000..27d602fee --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/repo/create_record/main_output_validation_status.freezed.dart @@ -0,0 +1,312 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'main_output_validation_status.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$RepoCreateRecordOutputValidationStatus { + + Object get data; + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is RepoCreateRecordOutputValidationStatus&&const DeepCollectionEquality().equals(other.data, data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); + +@override +String toString() { + return 'RepoCreateRecordOutputValidationStatus(data: $data)'; +} + + +} + +/// @nodoc +class $RepoCreateRecordOutputValidationStatusCopyWith<$Res> { +$RepoCreateRecordOutputValidationStatusCopyWith(RepoCreateRecordOutputValidationStatus _, $Res Function(RepoCreateRecordOutputValidationStatus) __); +} + + +/// Adds pattern-matching-related methods to [RepoCreateRecordOutputValidationStatus]. +extension RepoCreateRecordOutputValidationStatusPatterns on RepoCreateRecordOutputValidationStatus { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap({TResult Function( RepoCreateRecordOutputValidationStatusKnownValue value)? knownValue,TResult Function( RepoCreateRecordOutputValidationStatusUnknown value)? unknown,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case RepoCreateRecordOutputValidationStatusKnownValue() when knownValue != null: +return knownValue(_that);case RepoCreateRecordOutputValidationStatusUnknown() when unknown != null: +return unknown(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map({required TResult Function( RepoCreateRecordOutputValidationStatusKnownValue value) knownValue,required TResult Function( RepoCreateRecordOutputValidationStatusUnknown value) unknown,}){ +final _that = this; +switch (_that) { +case RepoCreateRecordOutputValidationStatusKnownValue(): +return knownValue(_that);case RepoCreateRecordOutputValidationStatusUnknown(): +return unknown(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull({TResult? Function( RepoCreateRecordOutputValidationStatusKnownValue value)? knownValue,TResult? Function( RepoCreateRecordOutputValidationStatusUnknown value)? unknown,}){ +final _that = this; +switch (_that) { +case RepoCreateRecordOutputValidationStatusKnownValue() when knownValue != null: +return knownValue(_that);case RepoCreateRecordOutputValidationStatusUnknown() when unknown != null: +return unknown(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen({TResult Function( KnownRepoCreateRecordOutputValidationStatus data)? knownValue,TResult Function( String data)? unknown,required TResult orElse(),}) {final _that = this; +switch (_that) { +case RepoCreateRecordOutputValidationStatusKnownValue() when knownValue != null: +return knownValue(_that.data);case RepoCreateRecordOutputValidationStatusUnknown() when unknown != null: +return unknown(_that.data);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when({required TResult Function( KnownRepoCreateRecordOutputValidationStatus data) knownValue,required TResult Function( String data) unknown,}) {final _that = this; +switch (_that) { +case RepoCreateRecordOutputValidationStatusKnownValue(): +return knownValue(_that.data);case RepoCreateRecordOutputValidationStatusUnknown(): +return unknown(_that.data);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull({TResult? Function( KnownRepoCreateRecordOutputValidationStatus data)? knownValue,TResult? Function( String data)? unknown,}) {final _that = this; +switch (_that) { +case RepoCreateRecordOutputValidationStatusKnownValue() when knownValue != null: +return knownValue(_that.data);case RepoCreateRecordOutputValidationStatusUnknown() when unknown != null: +return unknown(_that.data);case _: + return null; + +} +} + +} + +/// @nodoc + + +class RepoCreateRecordOutputValidationStatusKnownValue extends RepoCreateRecordOutputValidationStatus { + const RepoCreateRecordOutputValidationStatusKnownValue({required this.data}): super._(); + + +@override final KnownRepoCreateRecordOutputValidationStatus data; + +/// Create a copy of RepoCreateRecordOutputValidationStatus +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$RepoCreateRecordOutputValidationStatusKnownValueCopyWith get copyWith => _$RepoCreateRecordOutputValidationStatusKnownValueCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is RepoCreateRecordOutputValidationStatusKnownValue&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'RepoCreateRecordOutputValidationStatus.knownValue(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $RepoCreateRecordOutputValidationStatusKnownValueCopyWith<$Res> implements $RepoCreateRecordOutputValidationStatusCopyWith<$Res> { + factory $RepoCreateRecordOutputValidationStatusKnownValueCopyWith(RepoCreateRecordOutputValidationStatusKnownValue value, $Res Function(RepoCreateRecordOutputValidationStatusKnownValue) _then) = _$RepoCreateRecordOutputValidationStatusKnownValueCopyWithImpl; +@useResult +$Res call({ + KnownRepoCreateRecordOutputValidationStatus data +}); + + + + +} +/// @nodoc +class _$RepoCreateRecordOutputValidationStatusKnownValueCopyWithImpl<$Res> + implements $RepoCreateRecordOutputValidationStatusKnownValueCopyWith<$Res> { + _$RepoCreateRecordOutputValidationStatusKnownValueCopyWithImpl(this._self, this._then); + + final RepoCreateRecordOutputValidationStatusKnownValue _self; + final $Res Function(RepoCreateRecordOutputValidationStatusKnownValue) _then; + +/// Create a copy of RepoCreateRecordOutputValidationStatus +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(RepoCreateRecordOutputValidationStatusKnownValue( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as KnownRepoCreateRecordOutputValidationStatus, + )); +} + + +} + +/// @nodoc + + +class RepoCreateRecordOutputValidationStatusUnknown extends RepoCreateRecordOutputValidationStatus { + const RepoCreateRecordOutputValidationStatusUnknown({required this.data}): super._(); + + +@override final String data; + +/// Create a copy of RepoCreateRecordOutputValidationStatus +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$RepoCreateRecordOutputValidationStatusUnknownCopyWith get copyWith => _$RepoCreateRecordOutputValidationStatusUnknownCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is RepoCreateRecordOutputValidationStatusUnknown&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'RepoCreateRecordOutputValidationStatus.unknown(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $RepoCreateRecordOutputValidationStatusUnknownCopyWith<$Res> implements $RepoCreateRecordOutputValidationStatusCopyWith<$Res> { + factory $RepoCreateRecordOutputValidationStatusUnknownCopyWith(RepoCreateRecordOutputValidationStatusUnknown value, $Res Function(RepoCreateRecordOutputValidationStatusUnknown) _then) = _$RepoCreateRecordOutputValidationStatusUnknownCopyWithImpl; +@useResult +$Res call({ + String data +}); + + + + +} +/// @nodoc +class _$RepoCreateRecordOutputValidationStatusUnknownCopyWithImpl<$Res> + implements $RepoCreateRecordOutputValidationStatusUnknownCopyWith<$Res> { + _$RepoCreateRecordOutputValidationStatusUnknownCopyWithImpl(this._self, this._then); + + final RepoCreateRecordOutputValidationStatusUnknown _self; + final $Res Function(RepoCreateRecordOutputValidationStatusUnknown) _then; + +/// Create a copy of RepoCreateRecordOutputValidationStatus +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(RepoCreateRecordOutputValidationStatusUnknown( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/repo/create_record/main_validation_status.dart b/packages/poptart_lex/lib/com/atproto/repo/create_record/main_validation_status.dart deleted file mode 100644 index 0508dc976..000000000 --- a/packages/poptart_lex/lib/com/atproto/repo/create_record/main_validation_status.dart +++ /dev/null @@ -1,104 +0,0 @@ -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, unused_import, duplicate_import, unnecessary_cast, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -import 'package:poptart_core/poptart_core.dart' show Serializable; -import 'package:poptart_core/internals.dart' show isA; - -import 'package:freezed_annotation/freezed_annotation.dart'; - -part 'main_validation_status.freezed.dart'; - -// ************************************************************************** -// LexGenerator -// ************************************************************************** - -@freezed -abstract class RepoCreateRecordValidationStatus - with _$RepoCreateRecordValidationStatus { - const RepoCreateRecordValidationStatus._(); - - const factory RepoCreateRecordValidationStatus.knownValue({ - required KnownRepoCreateRecordValidationStatus data, - }) = RepoCreateRecordValidationStatusKnownValue; - - const factory RepoCreateRecordValidationStatus.unknown({ - required String data, - }) = RepoCreateRecordValidationStatusUnknown; - - static RepoCreateRecordValidationStatus? valueOf(final String? value) { - if (value == null) return null; - final knownValue = KnownRepoCreateRecordValidationStatus.valueOf(value); - - return knownValue != null - ? RepoCreateRecordValidationStatus.knownValue(data: knownValue) - : RepoCreateRecordValidationStatus.unknown(data: value); - } - - String toJson() => - const RepoCreateRecordValidationStatusConverter().toJson(this); -} - -extension RepoCreateRecordValidationStatusExtension - on RepoCreateRecordValidationStatus { - bool get isKnownValue => - isA(this); - bool get isNotKnownValue => !isKnownValue; - KnownRepoCreateRecordValidationStatus? get knownValue => - isKnownValue ? data as KnownRepoCreateRecordValidationStatus : null; - bool get isUnknown => isA(this); - bool get isNotUnknown => !isUnknown; - String? get unknown => isUnknown ? data as String : null; -} - -final class RepoCreateRecordValidationStatusConverter - extends JsonConverter { - const RepoCreateRecordValidationStatusConverter(); - - @override - RepoCreateRecordValidationStatus fromJson(String json) { - try { - final knownValue = KnownRepoCreateRecordValidationStatus.valueOf(json); - if (knownValue != null) { - return RepoCreateRecordValidationStatus.knownValue(data: knownValue); - } - - return RepoCreateRecordValidationStatus.unknown(data: json); - } catch (_) { - return RepoCreateRecordValidationStatus.unknown(data: json); - } - } - - @override - String toJson(RepoCreateRecordValidationStatus object) => - object.when(knownValue: (data) => data.value, unknown: (data) => data); -} - -enum KnownRepoCreateRecordValidationStatus implements Serializable { - @JsonValue('valid') - valid('valid'), - @JsonValue('unknown') - unknown('unknown'); - - @override - final String value; - - const KnownRepoCreateRecordValidationStatus(this.value); - - static bool isKnownValue(final String value) { - return valueOf(value) != null; - } - - static KnownRepoCreateRecordValidationStatus? valueOf(final String? value) { - if (value == null) return null; - - for (final v in values) { - if (v.value == value) { - return v; - } - } - - return null; - } -} diff --git a/packages/poptart_lex/lib/com/atproto/repo/create_record/output.dart b/packages/poptart_lex/lib/com/atproto/repo/create_record/output.dart index a28b9b871..95c592a6d 100644 --- a/packages/poptart_lex/lib/com/atproto/repo/create_record/output.dart +++ b/packages/poptart_lex/lib/com/atproto/repo/create_record/output.dart @@ -8,7 +8,7 @@ import 'package:poptart_core/poptart_core.dart'; import 'package:poptart_core/internals.dart'; import '../defs/commit_meta.dart'; -import './main_validation_status.dart'; +import './main_output_validation_status.dart'; part 'output.freezed.dart'; part 'output.g.dart'; @@ -31,8 +31,8 @@ abstract class RepoCreateRecordOutput with _$RepoCreateRecordOutput { @AtUriConverter() required AtUri uri, required String cid, @CommitMetaConverter() CommitMeta? commit, - @RepoCreateRecordValidationStatusConverter() - RepoCreateRecordValidationStatus? validationStatus, + @RepoCreateRecordOutputValidationStatusConverter() + RepoCreateRecordOutputValidationStatus? validationStatus, Map? $unknown, }) = _RepoCreateRecordOutput; diff --git a/packages/poptart_lex/lib/com/atproto/repo/create_record/output.freezed.dart b/packages/poptart_lex/lib/com/atproto/repo/create_record/output.freezed.dart index 2268b9669..909136a5c 100644 --- a/packages/poptart_lex/lib/com/atproto/repo/create_record/output.freezed.dart +++ b/packages/poptart_lex/lib/com/atproto/repo/create_record/output.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$RepoCreateRecordOutput { -@AtUriConverter() AtUri get uri; String get cid;@CommitMetaConverter() CommitMeta? get commit;@RepoCreateRecordValidationStatusConverter() RepoCreateRecordValidationStatus? get validationStatus; Map? get $unknown; +@AtUriConverter() AtUri get uri; String get cid;@CommitMetaConverter() CommitMeta? get commit;@RepoCreateRecordOutputValidationStatusConverter() RepoCreateRecordOutputValidationStatus? get validationStatus; Map? get $unknown; /// Create a copy of RepoCreateRecordOutput /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -48,11 +48,11 @@ abstract mixin class $RepoCreateRecordOutputCopyWith<$Res> { factory $RepoCreateRecordOutputCopyWith(RepoCreateRecordOutput value, $Res Function(RepoCreateRecordOutput) _then) = _$RepoCreateRecordOutputCopyWithImpl; @useResult $Res call({ -@AtUriConverter() AtUri uri, String cid,@CommitMetaConverter() CommitMeta? commit,@RepoCreateRecordValidationStatusConverter() RepoCreateRecordValidationStatus? validationStatus, Map? $unknown +@AtUriConverter() AtUri uri, String cid,@CommitMetaConverter() CommitMeta? commit,@RepoCreateRecordOutputValidationStatusConverter() RepoCreateRecordOutputValidationStatus? validationStatus, Map? $unknown }); -$CommitMetaCopyWith<$Res>? get commit;$RepoCreateRecordValidationStatusCopyWith<$Res>? get validationStatus; +$CommitMetaCopyWith<$Res>? get commit;$RepoCreateRecordOutputValidationStatusCopyWith<$Res>? get validationStatus; } /// @nodoc @@ -71,7 +71,7 @@ uri: null == uri ? _self.uri : uri // ignore: cast_nullable_to_non_nullable as AtUri,cid: null == cid ? _self.cid : cid // ignore: cast_nullable_to_non_nullable as String,commit: freezed == commit ? _self.commit : commit // ignore: cast_nullable_to_non_nullable as CommitMeta?,validationStatus: freezed == validationStatus ? _self.validationStatus : validationStatus // ignore: cast_nullable_to_non_nullable -as RepoCreateRecordValidationStatus?,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable +as RepoCreateRecordOutputValidationStatus?,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); } @@ -91,12 +91,12 @@ $CommitMetaCopyWith<$Res>? get commit { /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$RepoCreateRecordValidationStatusCopyWith<$Res>? get validationStatus { +$RepoCreateRecordOutputValidationStatusCopyWith<$Res>? get validationStatus { if (_self.validationStatus == null) { return null; } - return $RepoCreateRecordValidationStatusCopyWith<$Res>(_self.validationStatus!, (value) { + return $RepoCreateRecordOutputValidationStatusCopyWith<$Res>(_self.validationStatus!, (value) { return _then(_self.copyWith(validationStatus: value)); }); } @@ -181,7 +181,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function(@AtUriConverter() AtUri uri, String cid, @CommitMetaConverter() CommitMeta? commit, @RepoCreateRecordValidationStatusConverter() RepoCreateRecordValidationStatus? validationStatus, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function(@AtUriConverter() AtUri uri, String cid, @CommitMetaConverter() CommitMeta? commit, @RepoCreateRecordOutputValidationStatusConverter() RepoCreateRecordOutputValidationStatus? validationStatus, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _RepoCreateRecordOutput() when $default != null: return $default(_that.uri,_that.cid,_that.commit,_that.validationStatus,_that.$unknown);case _: @@ -202,7 +202,7 @@ return $default(_that.uri,_that.cid,_that.commit,_that.validationStatus,_that.$u /// } /// ``` -@optionalTypeArgs TResult when(TResult Function(@AtUriConverter() AtUri uri, String cid, @CommitMetaConverter() CommitMeta? commit, @RepoCreateRecordValidationStatusConverter() RepoCreateRecordValidationStatus? validationStatus, Map? $unknown) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function(@AtUriConverter() AtUri uri, String cid, @CommitMetaConverter() CommitMeta? commit, @RepoCreateRecordOutputValidationStatusConverter() RepoCreateRecordOutputValidationStatus? validationStatus, Map? $unknown) $default,) {final _that = this; switch (_that) { case _RepoCreateRecordOutput(): return $default(_that.uri,_that.cid,_that.commit,_that.validationStatus,_that.$unknown);case _: @@ -222,7 +222,7 @@ return $default(_that.uri,_that.cid,_that.commit,_that.validationStatus,_that.$u /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function(@AtUriConverter() AtUri uri, String cid, @CommitMetaConverter() CommitMeta? commit, @RepoCreateRecordValidationStatusConverter() RepoCreateRecordValidationStatus? validationStatus, Map? $unknown)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function(@AtUriConverter() AtUri uri, String cid, @CommitMetaConverter() CommitMeta? commit, @RepoCreateRecordOutputValidationStatusConverter() RepoCreateRecordOutputValidationStatus? validationStatus, Map? $unknown)? $default,) {final _that = this; switch (_that) { case _RepoCreateRecordOutput() when $default != null: return $default(_that.uri,_that.cid,_that.commit,_that.validationStatus,_that.$unknown);case _: @@ -237,13 +237,13 @@ return $default(_that.uri,_that.cid,_that.commit,_that.validationStatus,_that.$u @JsonSerializable(includeIfNull: false) class _RepoCreateRecordOutput implements RepoCreateRecordOutput { - const _RepoCreateRecordOutput({@AtUriConverter() required this.uri, required this.cid, @CommitMetaConverter() this.commit, @RepoCreateRecordValidationStatusConverter() this.validationStatus, final Map? $unknown}): _$unknown = $unknown; + const _RepoCreateRecordOutput({@AtUriConverter() required this.uri, required this.cid, @CommitMetaConverter() this.commit, @RepoCreateRecordOutputValidationStatusConverter() this.validationStatus, final Map? $unknown}): _$unknown = $unknown; factory _RepoCreateRecordOutput.fromJson(Map json) => _$RepoCreateRecordOutputFromJson(json); @override@AtUriConverter() final AtUri uri; @override final String cid; @override@CommitMetaConverter() final CommitMeta? commit; -@override@RepoCreateRecordValidationStatusConverter() final RepoCreateRecordValidationStatus? validationStatus; +@override@RepoCreateRecordOutputValidationStatusConverter() final RepoCreateRecordOutputValidationStatus? validationStatus; final Map? _$unknown; @override Map? get $unknown { final value = _$unknown; @@ -287,11 +287,11 @@ abstract mixin class _$RepoCreateRecordOutputCopyWith<$Res> implements $RepoCrea factory _$RepoCreateRecordOutputCopyWith(_RepoCreateRecordOutput value, $Res Function(_RepoCreateRecordOutput) _then) = __$RepoCreateRecordOutputCopyWithImpl; @override @useResult $Res call({ -@AtUriConverter() AtUri uri, String cid,@CommitMetaConverter() CommitMeta? commit,@RepoCreateRecordValidationStatusConverter() RepoCreateRecordValidationStatus? validationStatus, Map? $unknown +@AtUriConverter() AtUri uri, String cid,@CommitMetaConverter() CommitMeta? commit,@RepoCreateRecordOutputValidationStatusConverter() RepoCreateRecordOutputValidationStatus? validationStatus, Map? $unknown }); -@override $CommitMetaCopyWith<$Res>? get commit;@override $RepoCreateRecordValidationStatusCopyWith<$Res>? get validationStatus; +@override $CommitMetaCopyWith<$Res>? get commit;@override $RepoCreateRecordOutputValidationStatusCopyWith<$Res>? get validationStatus; } /// @nodoc @@ -310,7 +310,7 @@ uri: null == uri ? _self.uri : uri // ignore: cast_nullable_to_non_nullable as AtUri,cid: null == cid ? _self.cid : cid // ignore: cast_nullable_to_non_nullable as String,commit: freezed == commit ? _self.commit : commit // ignore: cast_nullable_to_non_nullable as CommitMeta?,validationStatus: freezed == validationStatus ? _self.validationStatus : validationStatus // ignore: cast_nullable_to_non_nullable -as RepoCreateRecordValidationStatus?,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable +as RepoCreateRecordOutputValidationStatus?,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); } @@ -331,12 +331,12 @@ $CommitMetaCopyWith<$Res>? get commit { /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$RepoCreateRecordValidationStatusCopyWith<$Res>? get validationStatus { +$RepoCreateRecordOutputValidationStatusCopyWith<$Res>? get validationStatus { if (_self.validationStatus == null) { return null; } - return $RepoCreateRecordValidationStatusCopyWith<$Res>(_self.validationStatus!, (value) { + return $RepoCreateRecordOutputValidationStatusCopyWith<$Res>(_self.validationStatus!, (value) { return _then(_self.copyWith(validationStatus: value)); }); } diff --git a/packages/poptart_lex/lib/com/atproto/repo/create_record/output.g.dart b/packages/poptart_lex/lib/com/atproto/repo/create_record/output.g.dart index 948435902..24c017bc2 100644 --- a/packages/poptart_lex/lib/com/atproto/repo/create_record/output.g.dart +++ b/packages/poptart_lex/lib/com/atproto/repo/create_record/output.g.dart @@ -8,36 +8,40 @@ part of 'output.dart'; // JsonSerializableGenerator // ************************************************************************** -_RepoCreateRecordOutput _$RepoCreateRecordOutputFromJson(Map json) => - $checkedCreate('_RepoCreateRecordOutput', json, ($checkedConvert) { - final val = _RepoCreateRecordOutput( - uri: $checkedConvert( - 'uri', - (v) => const AtUriConverter().fromJson(v as String), - ), - cid: $checkedConvert('cid', (v) => v as String), - commit: $checkedConvert( - 'commit', - (v) => _$JsonConverterFromJson, CommitMeta>( +_RepoCreateRecordOutput _$RepoCreateRecordOutputFromJson( + Map json, +) => $checkedCreate('_RepoCreateRecordOutput', json, ($checkedConvert) { + final val = _RepoCreateRecordOutput( + uri: $checkedConvert( + 'uri', + (v) => const AtUriConverter().fromJson(v as String), + ), + cid: $checkedConvert('cid', (v) => v as String), + commit: $checkedConvert( + 'commit', + (v) => _$JsonConverterFromJson, CommitMeta>( + v, + const CommitMetaConverter().fromJson, + ), + ), + validationStatus: $checkedConvert( + 'validationStatus', + (v) => + _$JsonConverterFromJson< + String, + RepoCreateRecordOutputValidationStatus + >( v, - const CommitMetaConverter().fromJson, + const RepoCreateRecordOutputValidationStatusConverter().fromJson, ), - ), - validationStatus: $checkedConvert( - 'validationStatus', - (v) => - _$JsonConverterFromJson( - v, - const RepoCreateRecordValidationStatusConverter().fromJson, - ), - ), - $unknown: $checkedConvert( - r'$unknown', - (v) => (v as Map?)?.map((k, e) => MapEntry(k as String, e)), - ), - ); - return val; - }); + ), + $unknown: $checkedConvert( + r'$unknown', + (v) => (v as Map?)?.map((k, e) => MapEntry(k as String, e)), + ), + ); + return val; +}); Map _$RepoCreateRecordOutputToJson( _RepoCreateRecordOutput instance, @@ -49,9 +53,9 @@ Map _$RepoCreateRecordOutputToJson( const CommitMetaConverter().toJson, ), 'validationStatus': - ?_$JsonConverterToJson( + ?_$JsonConverterToJson( instance.validationStatus, - const RepoCreateRecordValidationStatusConverter().toJson, + const RepoCreateRecordOutputValidationStatusConverter().toJson, ), r'$unknown': ?instance.$unknown, }; diff --git a/packages/poptart_lex/lib/com/atproto/repo/put_record.dart b/packages/poptart_lex/lib/com/atproto/repo/put_record.dart index a42a012a5..72ebebffe 100644 --- a/packages/poptart_lex/lib/com/atproto/repo/put_record.dart +++ b/packages/poptart_lex/lib/com/atproto/repo/put_record.dart @@ -9,5 +9,5 @@ export 'put_record/descriptor.dart'; export 'put_record/input.dart'; -export 'put_record/main_validation_status.dart'; +export 'put_record/main_output_validation_status.dart'; export 'put_record/output.dart'; diff --git a/packages/poptart_lex/lib/com/atproto/repo/put_record/main_output_validation_status.dart b/packages/poptart_lex/lib/com/atproto/repo/put_record/main_output_validation_status.dart new file mode 100644 index 000000000..da93ec56a --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/repo/put_record/main_output_validation_status.dart @@ -0,0 +1,106 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, unused_import, duplicate_import, unnecessary_cast, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +import 'package:poptart_core/poptart_core.dart' show Serializable; +import 'package:poptart_core/internals.dart' show isA; + +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'main_output_validation_status.freezed.dart'; + +// ************************************************************************** +// LexGenerator +// ************************************************************************** + +@freezed +abstract class RepoPutRecordOutputValidationStatus + with _$RepoPutRecordOutputValidationStatus { + const RepoPutRecordOutputValidationStatus._(); + + const factory RepoPutRecordOutputValidationStatus.knownValue({ + required KnownRepoPutRecordOutputValidationStatus data, + }) = RepoPutRecordOutputValidationStatusKnownValue; + + const factory RepoPutRecordOutputValidationStatus.unknown({ + required String data, + }) = RepoPutRecordOutputValidationStatusUnknown; + + static RepoPutRecordOutputValidationStatus? valueOf(final String? value) { + if (value == null) return null; + final knownValue = KnownRepoPutRecordOutputValidationStatus.valueOf(value); + + return knownValue != null + ? RepoPutRecordOutputValidationStatus.knownValue(data: knownValue) + : RepoPutRecordOutputValidationStatus.unknown(data: value); + } + + String toJson() => + const RepoPutRecordOutputValidationStatusConverter().toJson(this); +} + +extension RepoPutRecordOutputValidationStatusExtension + on RepoPutRecordOutputValidationStatus { + bool get isKnownValue => + isA(this); + bool get isNotKnownValue => !isKnownValue; + KnownRepoPutRecordOutputValidationStatus? get knownValue => + isKnownValue ? data as KnownRepoPutRecordOutputValidationStatus : null; + bool get isUnknown => isA(this); + bool get isNotUnknown => !isUnknown; + String? get unknown => isUnknown ? data as String : null; +} + +final class RepoPutRecordOutputValidationStatusConverter + extends JsonConverter { + const RepoPutRecordOutputValidationStatusConverter(); + + @override + RepoPutRecordOutputValidationStatus fromJson(String json) { + try { + final knownValue = KnownRepoPutRecordOutputValidationStatus.valueOf(json); + if (knownValue != null) { + return RepoPutRecordOutputValidationStatus.knownValue(data: knownValue); + } + + return RepoPutRecordOutputValidationStatus.unknown(data: json); + } catch (_) { + return RepoPutRecordOutputValidationStatus.unknown(data: json); + } + } + + @override + String toJson(RepoPutRecordOutputValidationStatus object) => + object.when(knownValue: (data) => data.value, unknown: (data) => data); +} + +enum KnownRepoPutRecordOutputValidationStatus implements Serializable { + @JsonValue('valid') + valid('valid'), + @JsonValue('unknown') + unknown('unknown'); + + @override + final String value; + + const KnownRepoPutRecordOutputValidationStatus(this.value); + + static bool isKnownValue(final String value) { + return valueOf(value) != null; + } + + static KnownRepoPutRecordOutputValidationStatus? valueOf( + final String? value, + ) { + if (value == null) return null; + + for (final v in values) { + if (v.value == value) { + return v; + } + } + + return null; + } +} diff --git a/packages/poptart_lex/lib/com/atproto/repo/put_record/main_output_validation_status.freezed.dart b/packages/poptart_lex/lib/com/atproto/repo/put_record/main_output_validation_status.freezed.dart new file mode 100644 index 000000000..74ccbd8c0 --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/repo/put_record/main_output_validation_status.freezed.dart @@ -0,0 +1,312 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'main_output_validation_status.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$RepoPutRecordOutputValidationStatus { + + Object get data; + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is RepoPutRecordOutputValidationStatus&&const DeepCollectionEquality().equals(other.data, data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); + +@override +String toString() { + return 'RepoPutRecordOutputValidationStatus(data: $data)'; +} + + +} + +/// @nodoc +class $RepoPutRecordOutputValidationStatusCopyWith<$Res> { +$RepoPutRecordOutputValidationStatusCopyWith(RepoPutRecordOutputValidationStatus _, $Res Function(RepoPutRecordOutputValidationStatus) __); +} + + +/// Adds pattern-matching-related methods to [RepoPutRecordOutputValidationStatus]. +extension RepoPutRecordOutputValidationStatusPatterns on RepoPutRecordOutputValidationStatus { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap({TResult Function( RepoPutRecordOutputValidationStatusKnownValue value)? knownValue,TResult Function( RepoPutRecordOutputValidationStatusUnknown value)? unknown,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case RepoPutRecordOutputValidationStatusKnownValue() when knownValue != null: +return knownValue(_that);case RepoPutRecordOutputValidationStatusUnknown() when unknown != null: +return unknown(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map({required TResult Function( RepoPutRecordOutputValidationStatusKnownValue value) knownValue,required TResult Function( RepoPutRecordOutputValidationStatusUnknown value) unknown,}){ +final _that = this; +switch (_that) { +case RepoPutRecordOutputValidationStatusKnownValue(): +return knownValue(_that);case RepoPutRecordOutputValidationStatusUnknown(): +return unknown(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull({TResult? Function( RepoPutRecordOutputValidationStatusKnownValue value)? knownValue,TResult? Function( RepoPutRecordOutputValidationStatusUnknown value)? unknown,}){ +final _that = this; +switch (_that) { +case RepoPutRecordOutputValidationStatusKnownValue() when knownValue != null: +return knownValue(_that);case RepoPutRecordOutputValidationStatusUnknown() when unknown != null: +return unknown(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen({TResult Function( KnownRepoPutRecordOutputValidationStatus data)? knownValue,TResult Function( String data)? unknown,required TResult orElse(),}) {final _that = this; +switch (_that) { +case RepoPutRecordOutputValidationStatusKnownValue() when knownValue != null: +return knownValue(_that.data);case RepoPutRecordOutputValidationStatusUnknown() when unknown != null: +return unknown(_that.data);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when({required TResult Function( KnownRepoPutRecordOutputValidationStatus data) knownValue,required TResult Function( String data) unknown,}) {final _that = this; +switch (_that) { +case RepoPutRecordOutputValidationStatusKnownValue(): +return knownValue(_that.data);case RepoPutRecordOutputValidationStatusUnknown(): +return unknown(_that.data);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull({TResult? Function( KnownRepoPutRecordOutputValidationStatus data)? knownValue,TResult? Function( String data)? unknown,}) {final _that = this; +switch (_that) { +case RepoPutRecordOutputValidationStatusKnownValue() when knownValue != null: +return knownValue(_that.data);case RepoPutRecordOutputValidationStatusUnknown() when unknown != null: +return unknown(_that.data);case _: + return null; + +} +} + +} + +/// @nodoc + + +class RepoPutRecordOutputValidationStatusKnownValue extends RepoPutRecordOutputValidationStatus { + const RepoPutRecordOutputValidationStatusKnownValue({required this.data}): super._(); + + +@override final KnownRepoPutRecordOutputValidationStatus data; + +/// Create a copy of RepoPutRecordOutputValidationStatus +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$RepoPutRecordOutputValidationStatusKnownValueCopyWith get copyWith => _$RepoPutRecordOutputValidationStatusKnownValueCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is RepoPutRecordOutputValidationStatusKnownValue&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'RepoPutRecordOutputValidationStatus.knownValue(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $RepoPutRecordOutputValidationStatusKnownValueCopyWith<$Res> implements $RepoPutRecordOutputValidationStatusCopyWith<$Res> { + factory $RepoPutRecordOutputValidationStatusKnownValueCopyWith(RepoPutRecordOutputValidationStatusKnownValue value, $Res Function(RepoPutRecordOutputValidationStatusKnownValue) _then) = _$RepoPutRecordOutputValidationStatusKnownValueCopyWithImpl; +@useResult +$Res call({ + KnownRepoPutRecordOutputValidationStatus data +}); + + + + +} +/// @nodoc +class _$RepoPutRecordOutputValidationStatusKnownValueCopyWithImpl<$Res> + implements $RepoPutRecordOutputValidationStatusKnownValueCopyWith<$Res> { + _$RepoPutRecordOutputValidationStatusKnownValueCopyWithImpl(this._self, this._then); + + final RepoPutRecordOutputValidationStatusKnownValue _self; + final $Res Function(RepoPutRecordOutputValidationStatusKnownValue) _then; + +/// Create a copy of RepoPutRecordOutputValidationStatus +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(RepoPutRecordOutputValidationStatusKnownValue( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as KnownRepoPutRecordOutputValidationStatus, + )); +} + + +} + +/// @nodoc + + +class RepoPutRecordOutputValidationStatusUnknown extends RepoPutRecordOutputValidationStatus { + const RepoPutRecordOutputValidationStatusUnknown({required this.data}): super._(); + + +@override final String data; + +/// Create a copy of RepoPutRecordOutputValidationStatus +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$RepoPutRecordOutputValidationStatusUnknownCopyWith get copyWith => _$RepoPutRecordOutputValidationStatusUnknownCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is RepoPutRecordOutputValidationStatusUnknown&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'RepoPutRecordOutputValidationStatus.unknown(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $RepoPutRecordOutputValidationStatusUnknownCopyWith<$Res> implements $RepoPutRecordOutputValidationStatusCopyWith<$Res> { + factory $RepoPutRecordOutputValidationStatusUnknownCopyWith(RepoPutRecordOutputValidationStatusUnknown value, $Res Function(RepoPutRecordOutputValidationStatusUnknown) _then) = _$RepoPutRecordOutputValidationStatusUnknownCopyWithImpl; +@useResult +$Res call({ + String data +}); + + + + +} +/// @nodoc +class _$RepoPutRecordOutputValidationStatusUnknownCopyWithImpl<$Res> + implements $RepoPutRecordOutputValidationStatusUnknownCopyWith<$Res> { + _$RepoPutRecordOutputValidationStatusUnknownCopyWithImpl(this._self, this._then); + + final RepoPutRecordOutputValidationStatusUnknown _self; + final $Res Function(RepoPutRecordOutputValidationStatusUnknown) _then; + +/// Create a copy of RepoPutRecordOutputValidationStatus +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(RepoPutRecordOutputValidationStatusUnknown( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/repo/put_record/main_validation_status.dart b/packages/poptart_lex/lib/com/atproto/repo/put_record/main_validation_status.dart deleted file mode 100644 index 40abd00e2..000000000 --- a/packages/poptart_lex/lib/com/atproto/repo/put_record/main_validation_status.dart +++ /dev/null @@ -1,102 +0,0 @@ -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, unused_import, duplicate_import, unnecessary_cast, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -import 'package:poptart_core/poptart_core.dart' show Serializable; -import 'package:poptart_core/internals.dart' show isA; - -import 'package:freezed_annotation/freezed_annotation.dart'; - -part 'main_validation_status.freezed.dart'; - -// ************************************************************************** -// LexGenerator -// ************************************************************************** - -@freezed -abstract class RepoPutRecordValidationStatus - with _$RepoPutRecordValidationStatus { - const RepoPutRecordValidationStatus._(); - - const factory RepoPutRecordValidationStatus.knownValue({ - required KnownRepoPutRecordValidationStatus data, - }) = RepoPutRecordValidationStatusKnownValue; - - const factory RepoPutRecordValidationStatus.unknown({required String data}) = - RepoPutRecordValidationStatusUnknown; - - static RepoPutRecordValidationStatus? valueOf(final String? value) { - if (value == null) return null; - final knownValue = KnownRepoPutRecordValidationStatus.valueOf(value); - - return knownValue != null - ? RepoPutRecordValidationStatus.knownValue(data: knownValue) - : RepoPutRecordValidationStatus.unknown(data: value); - } - - String toJson() => - const RepoPutRecordValidationStatusConverter().toJson(this); -} - -extension RepoPutRecordValidationStatusExtension - on RepoPutRecordValidationStatus { - bool get isKnownValue => isA(this); - bool get isNotKnownValue => !isKnownValue; - KnownRepoPutRecordValidationStatus? get knownValue => - isKnownValue ? data as KnownRepoPutRecordValidationStatus : null; - bool get isUnknown => isA(this); - bool get isNotUnknown => !isUnknown; - String? get unknown => isUnknown ? data as String : null; -} - -final class RepoPutRecordValidationStatusConverter - extends JsonConverter { - const RepoPutRecordValidationStatusConverter(); - - @override - RepoPutRecordValidationStatus fromJson(String json) { - try { - final knownValue = KnownRepoPutRecordValidationStatus.valueOf(json); - if (knownValue != null) { - return RepoPutRecordValidationStatus.knownValue(data: knownValue); - } - - return RepoPutRecordValidationStatus.unknown(data: json); - } catch (_) { - return RepoPutRecordValidationStatus.unknown(data: json); - } - } - - @override - String toJson(RepoPutRecordValidationStatus object) => - object.when(knownValue: (data) => data.value, unknown: (data) => data); -} - -enum KnownRepoPutRecordValidationStatus implements Serializable { - @JsonValue('valid') - valid('valid'), - @JsonValue('unknown') - unknown('unknown'); - - @override - final String value; - - const KnownRepoPutRecordValidationStatus(this.value); - - static bool isKnownValue(final String value) { - return valueOf(value) != null; - } - - static KnownRepoPutRecordValidationStatus? valueOf(final String? value) { - if (value == null) return null; - - for (final v in values) { - if (v.value == value) { - return v; - } - } - - return null; - } -} diff --git a/packages/poptart_lex/lib/com/atproto/repo/put_record/output.dart b/packages/poptart_lex/lib/com/atproto/repo/put_record/output.dart index b5fd374f5..9a3384b1c 100644 --- a/packages/poptart_lex/lib/com/atproto/repo/put_record/output.dart +++ b/packages/poptart_lex/lib/com/atproto/repo/put_record/output.dart @@ -8,7 +8,7 @@ import 'package:poptart_core/poptart_core.dart'; import 'package:poptart_core/internals.dart'; import '../defs/commit_meta.dart'; -import './main_validation_status.dart'; +import './main_output_validation_status.dart'; part 'output.freezed.dart'; part 'output.g.dart'; @@ -31,8 +31,8 @@ abstract class RepoPutRecordOutput with _$RepoPutRecordOutput { @AtUriConverter() required AtUri uri, required String cid, @CommitMetaConverter() CommitMeta? commit, - @RepoPutRecordValidationStatusConverter() - RepoPutRecordValidationStatus? validationStatus, + @RepoPutRecordOutputValidationStatusConverter() + RepoPutRecordOutputValidationStatus? validationStatus, Map? $unknown, }) = _RepoPutRecordOutput; diff --git a/packages/poptart_lex/lib/com/atproto/repo/put_record/output.freezed.dart b/packages/poptart_lex/lib/com/atproto/repo/put_record/output.freezed.dart index eb467606a..ed8ac5052 100644 --- a/packages/poptart_lex/lib/com/atproto/repo/put_record/output.freezed.dart +++ b/packages/poptart_lex/lib/com/atproto/repo/put_record/output.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$RepoPutRecordOutput { -@AtUriConverter() AtUri get uri; String get cid;@CommitMetaConverter() CommitMeta? get commit;@RepoPutRecordValidationStatusConverter() RepoPutRecordValidationStatus? get validationStatus; Map? get $unknown; +@AtUriConverter() AtUri get uri; String get cid;@CommitMetaConverter() CommitMeta? get commit;@RepoPutRecordOutputValidationStatusConverter() RepoPutRecordOutputValidationStatus? get validationStatus; Map? get $unknown; /// Create a copy of RepoPutRecordOutput /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -48,11 +48,11 @@ abstract mixin class $RepoPutRecordOutputCopyWith<$Res> { factory $RepoPutRecordOutputCopyWith(RepoPutRecordOutput value, $Res Function(RepoPutRecordOutput) _then) = _$RepoPutRecordOutputCopyWithImpl; @useResult $Res call({ -@AtUriConverter() AtUri uri, String cid,@CommitMetaConverter() CommitMeta? commit,@RepoPutRecordValidationStatusConverter() RepoPutRecordValidationStatus? validationStatus, Map? $unknown +@AtUriConverter() AtUri uri, String cid,@CommitMetaConverter() CommitMeta? commit,@RepoPutRecordOutputValidationStatusConverter() RepoPutRecordOutputValidationStatus? validationStatus, Map? $unknown }); -$CommitMetaCopyWith<$Res>? get commit;$RepoPutRecordValidationStatusCopyWith<$Res>? get validationStatus; +$CommitMetaCopyWith<$Res>? get commit;$RepoPutRecordOutputValidationStatusCopyWith<$Res>? get validationStatus; } /// @nodoc @@ -71,7 +71,7 @@ uri: null == uri ? _self.uri : uri // ignore: cast_nullable_to_non_nullable as AtUri,cid: null == cid ? _self.cid : cid // ignore: cast_nullable_to_non_nullable as String,commit: freezed == commit ? _self.commit : commit // ignore: cast_nullable_to_non_nullable as CommitMeta?,validationStatus: freezed == validationStatus ? _self.validationStatus : validationStatus // ignore: cast_nullable_to_non_nullable -as RepoPutRecordValidationStatus?,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable +as RepoPutRecordOutputValidationStatus?,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); } @@ -91,12 +91,12 @@ $CommitMetaCopyWith<$Res>? get commit { /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$RepoPutRecordValidationStatusCopyWith<$Res>? get validationStatus { +$RepoPutRecordOutputValidationStatusCopyWith<$Res>? get validationStatus { if (_self.validationStatus == null) { return null; } - return $RepoPutRecordValidationStatusCopyWith<$Res>(_self.validationStatus!, (value) { + return $RepoPutRecordOutputValidationStatusCopyWith<$Res>(_self.validationStatus!, (value) { return _then(_self.copyWith(validationStatus: value)); }); } @@ -181,7 +181,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function(@AtUriConverter() AtUri uri, String cid, @CommitMetaConverter() CommitMeta? commit, @RepoPutRecordValidationStatusConverter() RepoPutRecordValidationStatus? validationStatus, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function(@AtUriConverter() AtUri uri, String cid, @CommitMetaConverter() CommitMeta? commit, @RepoPutRecordOutputValidationStatusConverter() RepoPutRecordOutputValidationStatus? validationStatus, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _RepoPutRecordOutput() when $default != null: return $default(_that.uri,_that.cid,_that.commit,_that.validationStatus,_that.$unknown);case _: @@ -202,7 +202,7 @@ return $default(_that.uri,_that.cid,_that.commit,_that.validationStatus,_that.$u /// } /// ``` -@optionalTypeArgs TResult when(TResult Function(@AtUriConverter() AtUri uri, String cid, @CommitMetaConverter() CommitMeta? commit, @RepoPutRecordValidationStatusConverter() RepoPutRecordValidationStatus? validationStatus, Map? $unknown) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function(@AtUriConverter() AtUri uri, String cid, @CommitMetaConverter() CommitMeta? commit, @RepoPutRecordOutputValidationStatusConverter() RepoPutRecordOutputValidationStatus? validationStatus, Map? $unknown) $default,) {final _that = this; switch (_that) { case _RepoPutRecordOutput(): return $default(_that.uri,_that.cid,_that.commit,_that.validationStatus,_that.$unknown);case _: @@ -222,7 +222,7 @@ return $default(_that.uri,_that.cid,_that.commit,_that.validationStatus,_that.$u /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function(@AtUriConverter() AtUri uri, String cid, @CommitMetaConverter() CommitMeta? commit, @RepoPutRecordValidationStatusConverter() RepoPutRecordValidationStatus? validationStatus, Map? $unknown)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function(@AtUriConverter() AtUri uri, String cid, @CommitMetaConverter() CommitMeta? commit, @RepoPutRecordOutputValidationStatusConverter() RepoPutRecordOutputValidationStatus? validationStatus, Map? $unknown)? $default,) {final _that = this; switch (_that) { case _RepoPutRecordOutput() when $default != null: return $default(_that.uri,_that.cid,_that.commit,_that.validationStatus,_that.$unknown);case _: @@ -237,13 +237,13 @@ return $default(_that.uri,_that.cid,_that.commit,_that.validationStatus,_that.$u @JsonSerializable(includeIfNull: false) class _RepoPutRecordOutput implements RepoPutRecordOutput { - const _RepoPutRecordOutput({@AtUriConverter() required this.uri, required this.cid, @CommitMetaConverter() this.commit, @RepoPutRecordValidationStatusConverter() this.validationStatus, final Map? $unknown}): _$unknown = $unknown; + const _RepoPutRecordOutput({@AtUriConverter() required this.uri, required this.cid, @CommitMetaConverter() this.commit, @RepoPutRecordOutputValidationStatusConverter() this.validationStatus, final Map? $unknown}): _$unknown = $unknown; factory _RepoPutRecordOutput.fromJson(Map json) => _$RepoPutRecordOutputFromJson(json); @override@AtUriConverter() final AtUri uri; @override final String cid; @override@CommitMetaConverter() final CommitMeta? commit; -@override@RepoPutRecordValidationStatusConverter() final RepoPutRecordValidationStatus? validationStatus; +@override@RepoPutRecordOutputValidationStatusConverter() final RepoPutRecordOutputValidationStatus? validationStatus; final Map? _$unknown; @override Map? get $unknown { final value = _$unknown; @@ -287,11 +287,11 @@ abstract mixin class _$RepoPutRecordOutputCopyWith<$Res> implements $RepoPutReco factory _$RepoPutRecordOutputCopyWith(_RepoPutRecordOutput value, $Res Function(_RepoPutRecordOutput) _then) = __$RepoPutRecordOutputCopyWithImpl; @override @useResult $Res call({ -@AtUriConverter() AtUri uri, String cid,@CommitMetaConverter() CommitMeta? commit,@RepoPutRecordValidationStatusConverter() RepoPutRecordValidationStatus? validationStatus, Map? $unknown +@AtUriConverter() AtUri uri, String cid,@CommitMetaConverter() CommitMeta? commit,@RepoPutRecordOutputValidationStatusConverter() RepoPutRecordOutputValidationStatus? validationStatus, Map? $unknown }); -@override $CommitMetaCopyWith<$Res>? get commit;@override $RepoPutRecordValidationStatusCopyWith<$Res>? get validationStatus; +@override $CommitMetaCopyWith<$Res>? get commit;@override $RepoPutRecordOutputValidationStatusCopyWith<$Res>? get validationStatus; } /// @nodoc @@ -310,7 +310,7 @@ uri: null == uri ? _self.uri : uri // ignore: cast_nullable_to_non_nullable as AtUri,cid: null == cid ? _self.cid : cid // ignore: cast_nullable_to_non_nullable as String,commit: freezed == commit ? _self.commit : commit // ignore: cast_nullable_to_non_nullable as CommitMeta?,validationStatus: freezed == validationStatus ? _self.validationStatus : validationStatus // ignore: cast_nullable_to_non_nullable -as RepoPutRecordValidationStatus?,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable +as RepoPutRecordOutputValidationStatus?,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); } @@ -331,12 +331,12 @@ $CommitMetaCopyWith<$Res>? get commit { /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$RepoPutRecordValidationStatusCopyWith<$Res>? get validationStatus { +$RepoPutRecordOutputValidationStatusCopyWith<$Res>? get validationStatus { if (_self.validationStatus == null) { return null; } - return $RepoPutRecordValidationStatusCopyWith<$Res>(_self.validationStatus!, (value) { + return $RepoPutRecordOutputValidationStatusCopyWith<$Res>(_self.validationStatus!, (value) { return _then(_self.copyWith(validationStatus: value)); }); } diff --git a/packages/poptart_lex/lib/com/atproto/repo/put_record/output.g.dart b/packages/poptart_lex/lib/com/atproto/repo/put_record/output.g.dart index 38e56b026..0bec30e04 100644 --- a/packages/poptart_lex/lib/com/atproto/repo/put_record/output.g.dart +++ b/packages/poptart_lex/lib/com/atproto/repo/put_record/output.g.dart @@ -8,35 +8,37 @@ part of 'output.dart'; // JsonSerializableGenerator // ************************************************************************** -_RepoPutRecordOutput _$RepoPutRecordOutputFromJson(Map json) => - $checkedCreate('_RepoPutRecordOutput', json, ($checkedConvert) { - final val = _RepoPutRecordOutput( - uri: $checkedConvert( - 'uri', - (v) => const AtUriConverter().fromJson(v as String), - ), - cid: $checkedConvert('cid', (v) => v as String), - commit: $checkedConvert( - 'commit', - (v) => _$JsonConverterFromJson, CommitMeta>( - v, - const CommitMetaConverter().fromJson, - ), - ), - validationStatus: $checkedConvert( - 'validationStatus', - (v) => _$JsonConverterFromJson( +_RepoPutRecordOutput _$RepoPutRecordOutputFromJson( + Map json, +) => $checkedCreate('_RepoPutRecordOutput', json, ($checkedConvert) { + final val = _RepoPutRecordOutput( + uri: $checkedConvert( + 'uri', + (v) => const AtUriConverter().fromJson(v as String), + ), + cid: $checkedConvert('cid', (v) => v as String), + commit: $checkedConvert( + 'commit', + (v) => _$JsonConverterFromJson, CommitMeta>( + v, + const CommitMetaConverter().fromJson, + ), + ), + validationStatus: $checkedConvert( + 'validationStatus', + (v) => + _$JsonConverterFromJson( v, - const RepoPutRecordValidationStatusConverter().fromJson, + const RepoPutRecordOutputValidationStatusConverter().fromJson, ), - ), - $unknown: $checkedConvert( - r'$unknown', - (v) => (v as Map?)?.map((k, e) => MapEntry(k as String, e)), - ), - ); - return val; - }); + ), + $unknown: $checkedConvert( + r'$unknown', + (v) => (v as Map?)?.map((k, e) => MapEntry(k as String, e)), + ), + ); + return val; +}); Map _$RepoPutRecordOutputToJson( _RepoPutRecordOutput instance, @@ -48,9 +50,9 @@ Map _$RepoPutRecordOutputToJson( const CommitMetaConverter().toJson, ), 'validationStatus': - ?_$JsonConverterToJson( + ?_$JsonConverterToJson( instance.validationStatus, - const RepoPutRecordValidationStatusConverter().toJson, + const RepoPutRecordOutputValidationStatusConverter().toJson, ), r'$unknown': ?instance.$unknown, }; diff --git a/packages/poptart_lex/lib/com/atproto/server/create_session.dart b/packages/poptart_lex/lib/com/atproto/server/create_session.dart index 6fdb905ad..bd07e61ec 100644 --- a/packages/poptart_lex/lib/com/atproto/server/create_session.dart +++ b/packages/poptart_lex/lib/com/atproto/server/create_session.dart @@ -9,5 +9,5 @@ export 'create_session/descriptor.dart'; export 'create_session/input.dart'; -export 'create_session/main_status.dart'; +export 'create_session/main_output_status.dart'; export 'create_session/output.dart'; diff --git a/packages/poptart_lex/lib/com/atproto/server/create_session/main_output_status.dart b/packages/poptart_lex/lib/com/atproto/server/create_session/main_output_status.dart new file mode 100644 index 000000000..687365452 --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/server/create_session/main_output_status.dart @@ -0,0 +1,105 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, unused_import, duplicate_import, unnecessary_cast, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +import 'package:poptart_core/poptart_core.dart' show Serializable; +import 'package:poptart_core/internals.dart' show isA; + +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'main_output_status.freezed.dart'; + +// ************************************************************************** +// LexGenerator +// ************************************************************************** + +@freezed +abstract class ServerCreateSessionOutputStatus + with _$ServerCreateSessionOutputStatus { + const ServerCreateSessionOutputStatus._(); + + const factory ServerCreateSessionOutputStatus.knownValue({ + required KnownServerCreateSessionOutputStatus data, + }) = ServerCreateSessionOutputStatusKnownValue; + + const factory ServerCreateSessionOutputStatus.unknown({ + required String data, + }) = ServerCreateSessionOutputStatusUnknown; + + static ServerCreateSessionOutputStatus? valueOf(final String? value) { + if (value == null) return null; + final knownValue = KnownServerCreateSessionOutputStatus.valueOf(value); + + return knownValue != null + ? ServerCreateSessionOutputStatus.knownValue(data: knownValue) + : ServerCreateSessionOutputStatus.unknown(data: value); + } + + String toJson() => + const ServerCreateSessionOutputStatusConverter().toJson(this); +} + +extension ServerCreateSessionOutputStatusExtension + on ServerCreateSessionOutputStatus { + bool get isKnownValue => isA(this); + bool get isNotKnownValue => !isKnownValue; + KnownServerCreateSessionOutputStatus? get knownValue => + isKnownValue ? data as KnownServerCreateSessionOutputStatus : null; + bool get isUnknown => isA(this); + bool get isNotUnknown => !isUnknown; + String? get unknown => isUnknown ? data as String : null; +} + +final class ServerCreateSessionOutputStatusConverter + extends JsonConverter { + const ServerCreateSessionOutputStatusConverter(); + + @override + ServerCreateSessionOutputStatus fromJson(String json) { + try { + final knownValue = KnownServerCreateSessionOutputStatus.valueOf(json); + if (knownValue != null) { + return ServerCreateSessionOutputStatus.knownValue(data: knownValue); + } + + return ServerCreateSessionOutputStatus.unknown(data: json); + } catch (_) { + return ServerCreateSessionOutputStatus.unknown(data: json); + } + } + + @override + String toJson(ServerCreateSessionOutputStatus object) => + object.when(knownValue: (data) => data.value, unknown: (data) => data); +} + +enum KnownServerCreateSessionOutputStatus implements Serializable { + @JsonValue('takendown') + takendown('takendown'), + @JsonValue('suspended') + suspended('suspended'), + @JsonValue('deactivated') + deactivated('deactivated'); + + @override + final String value; + + const KnownServerCreateSessionOutputStatus(this.value); + + static bool isKnownValue(final String value) { + return valueOf(value) != null; + } + + static KnownServerCreateSessionOutputStatus? valueOf(final String? value) { + if (value == null) return null; + + for (final v in values) { + if (v.value == value) { + return v; + } + } + + return null; + } +} diff --git a/packages/poptart_lex/lib/com/atproto/server/create_session/main_output_status.freezed.dart b/packages/poptart_lex/lib/com/atproto/server/create_session/main_output_status.freezed.dart new file mode 100644 index 000000000..a33e451a8 --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/server/create_session/main_output_status.freezed.dart @@ -0,0 +1,312 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'main_output_status.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$ServerCreateSessionOutputStatus { + + Object get data; + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerCreateSessionOutputStatus&&const DeepCollectionEquality().equals(other.data, data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); + +@override +String toString() { + return 'ServerCreateSessionOutputStatus(data: $data)'; +} + + +} + +/// @nodoc +class $ServerCreateSessionOutputStatusCopyWith<$Res> { +$ServerCreateSessionOutputStatusCopyWith(ServerCreateSessionOutputStatus _, $Res Function(ServerCreateSessionOutputStatus) __); +} + + +/// Adds pattern-matching-related methods to [ServerCreateSessionOutputStatus]. +extension ServerCreateSessionOutputStatusPatterns on ServerCreateSessionOutputStatus { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap({TResult Function( ServerCreateSessionOutputStatusKnownValue value)? knownValue,TResult Function( ServerCreateSessionOutputStatusUnknown value)? unknown,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case ServerCreateSessionOutputStatusKnownValue() when knownValue != null: +return knownValue(_that);case ServerCreateSessionOutputStatusUnknown() when unknown != null: +return unknown(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map({required TResult Function( ServerCreateSessionOutputStatusKnownValue value) knownValue,required TResult Function( ServerCreateSessionOutputStatusUnknown value) unknown,}){ +final _that = this; +switch (_that) { +case ServerCreateSessionOutputStatusKnownValue(): +return knownValue(_that);case ServerCreateSessionOutputStatusUnknown(): +return unknown(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull({TResult? Function( ServerCreateSessionOutputStatusKnownValue value)? knownValue,TResult? Function( ServerCreateSessionOutputStatusUnknown value)? unknown,}){ +final _that = this; +switch (_that) { +case ServerCreateSessionOutputStatusKnownValue() when knownValue != null: +return knownValue(_that);case ServerCreateSessionOutputStatusUnknown() when unknown != null: +return unknown(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen({TResult Function( KnownServerCreateSessionOutputStatus data)? knownValue,TResult Function( String data)? unknown,required TResult orElse(),}) {final _that = this; +switch (_that) { +case ServerCreateSessionOutputStatusKnownValue() when knownValue != null: +return knownValue(_that.data);case ServerCreateSessionOutputStatusUnknown() when unknown != null: +return unknown(_that.data);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when({required TResult Function( KnownServerCreateSessionOutputStatus data) knownValue,required TResult Function( String data) unknown,}) {final _that = this; +switch (_that) { +case ServerCreateSessionOutputStatusKnownValue(): +return knownValue(_that.data);case ServerCreateSessionOutputStatusUnknown(): +return unknown(_that.data);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull({TResult? Function( KnownServerCreateSessionOutputStatus data)? knownValue,TResult? Function( String data)? unknown,}) {final _that = this; +switch (_that) { +case ServerCreateSessionOutputStatusKnownValue() when knownValue != null: +return knownValue(_that.data);case ServerCreateSessionOutputStatusUnknown() when unknown != null: +return unknown(_that.data);case _: + return null; + +} +} + +} + +/// @nodoc + + +class ServerCreateSessionOutputStatusKnownValue extends ServerCreateSessionOutputStatus { + const ServerCreateSessionOutputStatusKnownValue({required this.data}): super._(); + + +@override final KnownServerCreateSessionOutputStatus data; + +/// Create a copy of ServerCreateSessionOutputStatus +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ServerCreateSessionOutputStatusKnownValueCopyWith get copyWith => _$ServerCreateSessionOutputStatusKnownValueCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerCreateSessionOutputStatusKnownValue&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'ServerCreateSessionOutputStatus.knownValue(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $ServerCreateSessionOutputStatusKnownValueCopyWith<$Res> implements $ServerCreateSessionOutputStatusCopyWith<$Res> { + factory $ServerCreateSessionOutputStatusKnownValueCopyWith(ServerCreateSessionOutputStatusKnownValue value, $Res Function(ServerCreateSessionOutputStatusKnownValue) _then) = _$ServerCreateSessionOutputStatusKnownValueCopyWithImpl; +@useResult +$Res call({ + KnownServerCreateSessionOutputStatus data +}); + + + + +} +/// @nodoc +class _$ServerCreateSessionOutputStatusKnownValueCopyWithImpl<$Res> + implements $ServerCreateSessionOutputStatusKnownValueCopyWith<$Res> { + _$ServerCreateSessionOutputStatusKnownValueCopyWithImpl(this._self, this._then); + + final ServerCreateSessionOutputStatusKnownValue _self; + final $Res Function(ServerCreateSessionOutputStatusKnownValue) _then; + +/// Create a copy of ServerCreateSessionOutputStatus +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(ServerCreateSessionOutputStatusKnownValue( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as KnownServerCreateSessionOutputStatus, + )); +} + + +} + +/// @nodoc + + +class ServerCreateSessionOutputStatusUnknown extends ServerCreateSessionOutputStatus { + const ServerCreateSessionOutputStatusUnknown({required this.data}): super._(); + + +@override final String data; + +/// Create a copy of ServerCreateSessionOutputStatus +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ServerCreateSessionOutputStatusUnknownCopyWith get copyWith => _$ServerCreateSessionOutputStatusUnknownCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerCreateSessionOutputStatusUnknown&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'ServerCreateSessionOutputStatus.unknown(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $ServerCreateSessionOutputStatusUnknownCopyWith<$Res> implements $ServerCreateSessionOutputStatusCopyWith<$Res> { + factory $ServerCreateSessionOutputStatusUnknownCopyWith(ServerCreateSessionOutputStatusUnknown value, $Res Function(ServerCreateSessionOutputStatusUnknown) _then) = _$ServerCreateSessionOutputStatusUnknownCopyWithImpl; +@useResult +$Res call({ + String data +}); + + + + +} +/// @nodoc +class _$ServerCreateSessionOutputStatusUnknownCopyWithImpl<$Res> + implements $ServerCreateSessionOutputStatusUnknownCopyWith<$Res> { + _$ServerCreateSessionOutputStatusUnknownCopyWithImpl(this._self, this._then); + + final ServerCreateSessionOutputStatusUnknown _self; + final $Res Function(ServerCreateSessionOutputStatusUnknown) _then; + +/// Create a copy of ServerCreateSessionOutputStatus +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(ServerCreateSessionOutputStatusUnknown( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/server/create_session/main_status.dart b/packages/poptart_lex/lib/com/atproto/server/create_session/main_status.dart deleted file mode 100644 index 71a817445..000000000 --- a/packages/poptart_lex/lib/com/atproto/server/create_session/main_status.dart +++ /dev/null @@ -1,101 +0,0 @@ -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, unused_import, duplicate_import, unnecessary_cast, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -import 'package:poptart_core/poptart_core.dart' show Serializable; -import 'package:poptart_core/internals.dart' show isA; - -import 'package:freezed_annotation/freezed_annotation.dart'; - -part 'main_status.freezed.dart'; - -// ************************************************************************** -// LexGenerator -// ************************************************************************** - -@freezed -abstract class ServerCreateSessionStatus with _$ServerCreateSessionStatus { - const ServerCreateSessionStatus._(); - - const factory ServerCreateSessionStatus.knownValue({ - required KnownServerCreateSessionStatus data, - }) = ServerCreateSessionStatusKnownValue; - - const factory ServerCreateSessionStatus.unknown({required String data}) = - ServerCreateSessionStatusUnknown; - - static ServerCreateSessionStatus? valueOf(final String? value) { - if (value == null) return null; - final knownValue = KnownServerCreateSessionStatus.valueOf(value); - - return knownValue != null - ? ServerCreateSessionStatus.knownValue(data: knownValue) - : ServerCreateSessionStatus.unknown(data: value); - } - - String toJson() => const ServerCreateSessionStatusConverter().toJson(this); -} - -extension ServerCreateSessionStatusExtension on ServerCreateSessionStatus { - bool get isKnownValue => isA(this); - bool get isNotKnownValue => !isKnownValue; - KnownServerCreateSessionStatus? get knownValue => - isKnownValue ? data as KnownServerCreateSessionStatus : null; - bool get isUnknown => isA(this); - bool get isNotUnknown => !isUnknown; - String? get unknown => isUnknown ? data as String : null; -} - -final class ServerCreateSessionStatusConverter - extends JsonConverter { - const ServerCreateSessionStatusConverter(); - - @override - ServerCreateSessionStatus fromJson(String json) { - try { - final knownValue = KnownServerCreateSessionStatus.valueOf(json); - if (knownValue != null) { - return ServerCreateSessionStatus.knownValue(data: knownValue); - } - - return ServerCreateSessionStatus.unknown(data: json); - } catch (_) { - return ServerCreateSessionStatus.unknown(data: json); - } - } - - @override - String toJson(ServerCreateSessionStatus object) => - object.when(knownValue: (data) => data.value, unknown: (data) => data); -} - -enum KnownServerCreateSessionStatus implements Serializable { - @JsonValue('takendown') - takendown('takendown'), - @JsonValue('suspended') - suspended('suspended'), - @JsonValue('deactivated') - deactivated('deactivated'); - - @override - final String value; - - const KnownServerCreateSessionStatus(this.value); - - static bool isKnownValue(final String value) { - return valueOf(value) != null; - } - - static KnownServerCreateSessionStatus? valueOf(final String? value) { - if (value == null) return null; - - for (final v in values) { - if (v.value == value) { - return v; - } - } - - return null; - } -} diff --git a/packages/poptart_lex/lib/com/atproto/server/create_session/main_status.freezed.dart b/packages/poptart_lex/lib/com/atproto/server/create_session/main_status.freezed.dart deleted file mode 100644 index 7d5b0c393..000000000 --- a/packages/poptart_lex/lib/com/atproto/server/create_session/main_status.freezed.dart +++ /dev/null @@ -1,312 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND -// coverage:ignore-file -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'main_status.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; -/// @nodoc -mixin _$ServerCreateSessionStatus { - - Object get data; - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerCreateSessionStatus&&const DeepCollectionEquality().equals(other.data, data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); - -@override -String toString() { - return 'ServerCreateSessionStatus(data: $data)'; -} - - -} - -/// @nodoc -class $ServerCreateSessionStatusCopyWith<$Res> { -$ServerCreateSessionStatusCopyWith(ServerCreateSessionStatus _, $Res Function(ServerCreateSessionStatus) __); -} - - -/// Adds pattern-matching-related methods to [ServerCreateSessionStatus]. -extension ServerCreateSessionStatusPatterns on ServerCreateSessionStatus { -/// A variant of `map` that fallback to returning `orElse`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeMap({TResult Function( ServerCreateSessionStatusKnownValue value)? knownValue,TResult Function( ServerCreateSessionStatusUnknown value)? unknown,required TResult orElse(),}){ -final _that = this; -switch (_that) { -case ServerCreateSessionStatusKnownValue() when knownValue != null: -return knownValue(_that);case ServerCreateSessionStatusUnknown() when unknown != null: -return unknown(_that);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// Callbacks receives the raw object, upcasted. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case final Subclass2 value: -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult map({required TResult Function( ServerCreateSessionStatusKnownValue value) knownValue,required TResult Function( ServerCreateSessionStatusUnknown value) unknown,}){ -final _that = this; -switch (_that) { -case ServerCreateSessionStatusKnownValue(): -return knownValue(_that);case ServerCreateSessionStatusUnknown(): -return unknown(_that);case _: - throw StateError('Unexpected subclass'); - -} -} -/// A variant of `map` that fallback to returning `null`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? mapOrNull({TResult? Function( ServerCreateSessionStatusKnownValue value)? knownValue,TResult? Function( ServerCreateSessionStatusUnknown value)? unknown,}){ -final _that = this; -switch (_that) { -case ServerCreateSessionStatusKnownValue() when knownValue != null: -return knownValue(_that);case ServerCreateSessionStatusUnknown() when unknown != null: -return unknown(_that);case _: - return null; - -} -} -/// A variant of `when` that fallback to an `orElse` callback. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeWhen({TResult Function( KnownServerCreateSessionStatus data)? knownValue,TResult Function( String data)? unknown,required TResult orElse(),}) {final _that = this; -switch (_that) { -case ServerCreateSessionStatusKnownValue() when knownValue != null: -return knownValue(_that.data);case ServerCreateSessionStatusUnknown() when unknown != null: -return unknown(_that.data);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// As opposed to `map`, this offers destructuring. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case Subclass2(:final field2): -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult when({required TResult Function( KnownServerCreateSessionStatus data) knownValue,required TResult Function( String data) unknown,}) {final _that = this; -switch (_that) { -case ServerCreateSessionStatusKnownValue(): -return knownValue(_that.data);case ServerCreateSessionStatusUnknown(): -return unknown(_that.data);case _: - throw StateError('Unexpected subclass'); - -} -} -/// A variant of `when` that fallback to returning `null` -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? whenOrNull({TResult? Function( KnownServerCreateSessionStatus data)? knownValue,TResult? Function( String data)? unknown,}) {final _that = this; -switch (_that) { -case ServerCreateSessionStatusKnownValue() when knownValue != null: -return knownValue(_that.data);case ServerCreateSessionStatusUnknown() when unknown != null: -return unknown(_that.data);case _: - return null; - -} -} - -} - -/// @nodoc - - -class ServerCreateSessionStatusKnownValue extends ServerCreateSessionStatus { - const ServerCreateSessionStatusKnownValue({required this.data}): super._(); - - -@override final KnownServerCreateSessionStatus data; - -/// Create a copy of ServerCreateSessionStatus -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$ServerCreateSessionStatusKnownValueCopyWith get copyWith => _$ServerCreateSessionStatusKnownValueCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerCreateSessionStatusKnownValue&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'ServerCreateSessionStatus.knownValue(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $ServerCreateSessionStatusKnownValueCopyWith<$Res> implements $ServerCreateSessionStatusCopyWith<$Res> { - factory $ServerCreateSessionStatusKnownValueCopyWith(ServerCreateSessionStatusKnownValue value, $Res Function(ServerCreateSessionStatusKnownValue) _then) = _$ServerCreateSessionStatusKnownValueCopyWithImpl; -@useResult -$Res call({ - KnownServerCreateSessionStatus data -}); - - - - -} -/// @nodoc -class _$ServerCreateSessionStatusKnownValueCopyWithImpl<$Res> - implements $ServerCreateSessionStatusKnownValueCopyWith<$Res> { - _$ServerCreateSessionStatusKnownValueCopyWithImpl(this._self, this._then); - - final ServerCreateSessionStatusKnownValue _self; - final $Res Function(ServerCreateSessionStatusKnownValue) _then; - -/// Create a copy of ServerCreateSessionStatus -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(ServerCreateSessionStatusKnownValue( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as KnownServerCreateSessionStatus, - )); -} - - -} - -/// @nodoc - - -class ServerCreateSessionStatusUnknown extends ServerCreateSessionStatus { - const ServerCreateSessionStatusUnknown({required this.data}): super._(); - - -@override final String data; - -/// Create a copy of ServerCreateSessionStatus -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$ServerCreateSessionStatusUnknownCopyWith get copyWith => _$ServerCreateSessionStatusUnknownCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerCreateSessionStatusUnknown&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'ServerCreateSessionStatus.unknown(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $ServerCreateSessionStatusUnknownCopyWith<$Res> implements $ServerCreateSessionStatusCopyWith<$Res> { - factory $ServerCreateSessionStatusUnknownCopyWith(ServerCreateSessionStatusUnknown value, $Res Function(ServerCreateSessionStatusUnknown) _then) = _$ServerCreateSessionStatusUnknownCopyWithImpl; -@useResult -$Res call({ - String data -}); - - - - -} -/// @nodoc -class _$ServerCreateSessionStatusUnknownCopyWithImpl<$Res> - implements $ServerCreateSessionStatusUnknownCopyWith<$Res> { - _$ServerCreateSessionStatusUnknownCopyWithImpl(this._self, this._then); - - final ServerCreateSessionStatusUnknown _self; - final $Res Function(ServerCreateSessionStatusUnknown) _then; - -/// Create a copy of ServerCreateSessionStatus -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(ServerCreateSessionStatusUnknown( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as String, - )); -} - - -} - -// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/server/create_session/output.dart b/packages/poptart_lex/lib/com/atproto/server/create_session/output.dart index 0d093ab57..ac7eab7d0 100644 --- a/packages/poptart_lex/lib/com/atproto/server/create_session/output.dart +++ b/packages/poptart_lex/lib/com/atproto/server/create_session/output.dart @@ -7,7 +7,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:poptart_core/poptart_core.dart'; import 'package:poptart_core/internals.dart'; -import './main_status.dart'; +import './main_output_status.dart'; part 'output.freezed.dart'; part 'output.g.dart'; @@ -44,7 +44,8 @@ abstract class ServerCreateSessionOutput with _$ServerCreateSessionOutput { bool? active, /// If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. - @ServerCreateSessionStatusConverter() ServerCreateSessionStatus? status, + @ServerCreateSessionOutputStatusConverter() + ServerCreateSessionOutputStatus? status, Map? $unknown, }) = _ServerCreateSessionOutput; diff --git a/packages/poptart_lex/lib/com/atproto/server/create_session/output.freezed.dart b/packages/poptart_lex/lib/com/atproto/server/create_session/output.freezed.dart index 3cc10993d..d36831325 100644 --- a/packages/poptart_lex/lib/com/atproto/server/create_session/output.freezed.dart +++ b/packages/poptart_lex/lib/com/atproto/server/create_session/output.freezed.dart @@ -16,7 +16,7 @@ T _$identity(T value) => value; mixin _$ServerCreateSessionOutput { String get accessJwt; String get refreshJwt; String get handle; String get did; Map? get didDoc; String? get email; bool? get emailConfirmed; bool? get emailAuthFactor; bool? get active;/// If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. -@ServerCreateSessionStatusConverter() ServerCreateSessionStatus? get status; Map? get $unknown; +@ServerCreateSessionOutputStatusConverter() ServerCreateSessionOutputStatus? get status; Map? get $unknown; /// Create a copy of ServerCreateSessionOutput /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -49,11 +49,11 @@ abstract mixin class $ServerCreateSessionOutputCopyWith<$Res> { factory $ServerCreateSessionOutputCopyWith(ServerCreateSessionOutput value, $Res Function(ServerCreateSessionOutput) _then) = _$ServerCreateSessionOutputCopyWithImpl; @useResult $Res call({ - String accessJwt, String refreshJwt, String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active,@ServerCreateSessionStatusConverter() ServerCreateSessionStatus? status, Map? $unknown + String accessJwt, String refreshJwt, String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active,@ServerCreateSessionOutputStatusConverter() ServerCreateSessionOutputStatus? status, Map? $unknown }); -$ServerCreateSessionStatusCopyWith<$Res>? get status; +$ServerCreateSessionOutputStatusCopyWith<$Res>? get status; } /// @nodoc @@ -78,7 +78,7 @@ as String?,emailConfirmed: freezed == emailConfirmed ? _self.emailConfirmed : em as bool?,emailAuthFactor: freezed == emailAuthFactor ? _self.emailAuthFactor : emailAuthFactor // ignore: cast_nullable_to_non_nullable as bool?,active: freezed == active ? _self.active : active // ignore: cast_nullable_to_non_nullable as bool?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable -as ServerCreateSessionStatus?,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable +as ServerCreateSessionOutputStatus?,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); } @@ -86,12 +86,12 @@ as Map?, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$ServerCreateSessionStatusCopyWith<$Res>? get status { +$ServerCreateSessionOutputStatusCopyWith<$Res>? get status { if (_self.status == null) { return null; } - return $ServerCreateSessionStatusCopyWith<$Res>(_self.status!, (value) { + return $ServerCreateSessionOutputStatusCopyWith<$Res>(_self.status!, (value) { return _then(_self.copyWith(status: value)); }); } @@ -176,7 +176,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String accessJwt, String refreshJwt, String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active, @ServerCreateSessionStatusConverter() ServerCreateSessionStatus? status, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String accessJwt, String refreshJwt, String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active, @ServerCreateSessionOutputStatusConverter() ServerCreateSessionOutputStatus? status, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _ServerCreateSessionOutput() when $default != null: return $default(_that.accessJwt,_that.refreshJwt,_that.handle,_that.did,_that.didDoc,_that.email,_that.emailConfirmed,_that.emailAuthFactor,_that.active,_that.status,_that.$unknown);case _: @@ -197,7 +197,7 @@ return $default(_that.accessJwt,_that.refreshJwt,_that.handle,_that.did,_that.di /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String accessJwt, String refreshJwt, String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active, @ServerCreateSessionStatusConverter() ServerCreateSessionStatus? status, Map? $unknown) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String accessJwt, String refreshJwt, String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active, @ServerCreateSessionOutputStatusConverter() ServerCreateSessionOutputStatus? status, Map? $unknown) $default,) {final _that = this; switch (_that) { case _ServerCreateSessionOutput(): return $default(_that.accessJwt,_that.refreshJwt,_that.handle,_that.did,_that.didDoc,_that.email,_that.emailConfirmed,_that.emailAuthFactor,_that.active,_that.status,_that.$unknown);case _: @@ -217,7 +217,7 @@ return $default(_that.accessJwt,_that.refreshJwt,_that.handle,_that.did,_that.di /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String accessJwt, String refreshJwt, String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active, @ServerCreateSessionStatusConverter() ServerCreateSessionStatus? status, Map? $unknown)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String accessJwt, String refreshJwt, String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active, @ServerCreateSessionOutputStatusConverter() ServerCreateSessionOutputStatus? status, Map? $unknown)? $default,) {final _that = this; switch (_that) { case _ServerCreateSessionOutput() when $default != null: return $default(_that.accessJwt,_that.refreshJwt,_that.handle,_that.did,_that.didDoc,_that.email,_that.emailConfirmed,_that.emailAuthFactor,_that.active,_that.status,_that.$unknown);case _: @@ -232,7 +232,7 @@ return $default(_that.accessJwt,_that.refreshJwt,_that.handle,_that.did,_that.di @JsonSerializable(includeIfNull: false) class _ServerCreateSessionOutput implements ServerCreateSessionOutput { - const _ServerCreateSessionOutput({required this.accessJwt, required this.refreshJwt, required this.handle, required this.did, final Map? didDoc, this.email, this.emailConfirmed, this.emailAuthFactor, this.active, @ServerCreateSessionStatusConverter() this.status, final Map? $unknown}): _didDoc = didDoc,_$unknown = $unknown; + const _ServerCreateSessionOutput({required this.accessJwt, required this.refreshJwt, required this.handle, required this.did, final Map? didDoc, this.email, this.emailConfirmed, this.emailAuthFactor, this.active, @ServerCreateSessionOutputStatusConverter() this.status, final Map? $unknown}): _didDoc = didDoc,_$unknown = $unknown; factory _ServerCreateSessionOutput.fromJson(Map json) => _$ServerCreateSessionOutputFromJson(json); @override final String accessJwt; @@ -253,7 +253,7 @@ class _ServerCreateSessionOutput implements ServerCreateSessionOutput { @override final bool? emailAuthFactor; @override final bool? active; /// If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. -@override@ServerCreateSessionStatusConverter() final ServerCreateSessionStatus? status; +@override@ServerCreateSessionOutputStatusConverter() final ServerCreateSessionOutputStatus? status; final Map? _$unknown; @override Map? get $unknown { final value = _$unknown; @@ -297,11 +297,11 @@ abstract mixin class _$ServerCreateSessionOutputCopyWith<$Res> implements $Serve factory _$ServerCreateSessionOutputCopyWith(_ServerCreateSessionOutput value, $Res Function(_ServerCreateSessionOutput) _then) = __$ServerCreateSessionOutputCopyWithImpl; @override @useResult $Res call({ - String accessJwt, String refreshJwt, String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active,@ServerCreateSessionStatusConverter() ServerCreateSessionStatus? status, Map? $unknown + String accessJwt, String refreshJwt, String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active,@ServerCreateSessionOutputStatusConverter() ServerCreateSessionOutputStatus? status, Map? $unknown }); -@override $ServerCreateSessionStatusCopyWith<$Res>? get status; +@override $ServerCreateSessionOutputStatusCopyWith<$Res>? get status; } /// @nodoc @@ -326,7 +326,7 @@ as String?,emailConfirmed: freezed == emailConfirmed ? _self.emailConfirmed : em as bool?,emailAuthFactor: freezed == emailAuthFactor ? _self.emailAuthFactor : emailAuthFactor // ignore: cast_nullable_to_non_nullable as bool?,active: freezed == active ? _self.active : active // ignore: cast_nullable_to_non_nullable as bool?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable -as ServerCreateSessionStatus?,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable +as ServerCreateSessionOutputStatus?,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); } @@ -335,12 +335,12 @@ as Map?, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$ServerCreateSessionStatusCopyWith<$Res>? get status { +$ServerCreateSessionOutputStatusCopyWith<$Res>? get status { if (_self.status == null) { return null; } - return $ServerCreateSessionStatusCopyWith<$Res>(_self.status!, (value) { + return $ServerCreateSessionOutputStatusCopyWith<$Res>(_self.status!, (value) { return _then(_self.copyWith(status: value)); }); } diff --git a/packages/poptart_lex/lib/com/atproto/server/create_session/output.g.dart b/packages/poptart_lex/lib/com/atproto/server/create_session/output.g.dart index 39b0c8759..fef309df0 100644 --- a/packages/poptart_lex/lib/com/atproto/server/create_session/output.g.dart +++ b/packages/poptart_lex/lib/com/atproto/server/create_session/output.g.dart @@ -25,10 +25,11 @@ _ServerCreateSessionOutput _$ServerCreateSessionOutputFromJson(Map json) => active: $checkedConvert('active', (v) => v as bool?), status: $checkedConvert( 'status', - (v) => _$JsonConverterFromJson( - v, - const ServerCreateSessionStatusConverter().fromJson, - ), + (v) => + _$JsonConverterFromJson( + v, + const ServerCreateSessionOutputStatusConverter().fromJson, + ), ), $unknown: $checkedConvert( r'$unknown', @@ -50,9 +51,9 @@ Map _$ServerCreateSessionOutputToJson( 'emailConfirmed': ?instance.emailConfirmed, 'emailAuthFactor': ?instance.emailAuthFactor, 'active': ?instance.active, - 'status': ?_$JsonConverterToJson( + 'status': ?_$JsonConverterToJson( instance.status, - const ServerCreateSessionStatusConverter().toJson, + const ServerCreateSessionOutputStatusConverter().toJson, ), r'$unknown': ?instance.$unknown, }; diff --git a/packages/poptart_lex/lib/com/atproto/server/get_session.dart b/packages/poptart_lex/lib/com/atproto/server/get_session.dart index 124da1c05..c9953cf66 100644 --- a/packages/poptart_lex/lib/com/atproto/server/get_session.dart +++ b/packages/poptart_lex/lib/com/atproto/server/get_session.dart @@ -8,5 +8,5 @@ // ************************************************************************** export 'get_session/descriptor.dart'; -export 'get_session/main_status.dart'; +export 'get_session/main_output_status.dart'; export 'get_session/output.dart'; diff --git a/packages/poptart_lex/lib/com/atproto/server/get_session/main_output_status.dart b/packages/poptart_lex/lib/com/atproto/server/get_session/main_output_status.dart new file mode 100644 index 000000000..b4122dd57 --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/server/get_session/main_output_status.dart @@ -0,0 +1,103 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, unused_import, duplicate_import, unnecessary_cast, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +import 'package:poptart_core/poptart_core.dart' show Serializable; +import 'package:poptart_core/internals.dart' show isA; + +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'main_output_status.freezed.dart'; + +// ************************************************************************** +// LexGenerator +// ************************************************************************** + +@freezed +abstract class ServerGetSessionOutputStatus + with _$ServerGetSessionOutputStatus { + const ServerGetSessionOutputStatus._(); + + const factory ServerGetSessionOutputStatus.knownValue({ + required KnownServerGetSessionOutputStatus data, + }) = ServerGetSessionOutputStatusKnownValue; + + const factory ServerGetSessionOutputStatus.unknown({required String data}) = + ServerGetSessionOutputStatusUnknown; + + static ServerGetSessionOutputStatus? valueOf(final String? value) { + if (value == null) return null; + final knownValue = KnownServerGetSessionOutputStatus.valueOf(value); + + return knownValue != null + ? ServerGetSessionOutputStatus.knownValue(data: knownValue) + : ServerGetSessionOutputStatus.unknown(data: value); + } + + String toJson() => const ServerGetSessionOutputStatusConverter().toJson(this); +} + +extension ServerGetSessionOutputStatusExtension + on ServerGetSessionOutputStatus { + bool get isKnownValue => isA(this); + bool get isNotKnownValue => !isKnownValue; + KnownServerGetSessionOutputStatus? get knownValue => + isKnownValue ? data as KnownServerGetSessionOutputStatus : null; + bool get isUnknown => isA(this); + bool get isNotUnknown => !isUnknown; + String? get unknown => isUnknown ? data as String : null; +} + +final class ServerGetSessionOutputStatusConverter + extends JsonConverter { + const ServerGetSessionOutputStatusConverter(); + + @override + ServerGetSessionOutputStatus fromJson(String json) { + try { + final knownValue = KnownServerGetSessionOutputStatus.valueOf(json); + if (knownValue != null) { + return ServerGetSessionOutputStatus.knownValue(data: knownValue); + } + + return ServerGetSessionOutputStatus.unknown(data: json); + } catch (_) { + return ServerGetSessionOutputStatus.unknown(data: json); + } + } + + @override + String toJson(ServerGetSessionOutputStatus object) => + object.when(knownValue: (data) => data.value, unknown: (data) => data); +} + +enum KnownServerGetSessionOutputStatus implements Serializable { + @JsonValue('takendown') + takendown('takendown'), + @JsonValue('suspended') + suspended('suspended'), + @JsonValue('deactivated') + deactivated('deactivated'); + + @override + final String value; + + const KnownServerGetSessionOutputStatus(this.value); + + static bool isKnownValue(final String value) { + return valueOf(value) != null; + } + + static KnownServerGetSessionOutputStatus? valueOf(final String? value) { + if (value == null) return null; + + for (final v in values) { + if (v.value == value) { + return v; + } + } + + return null; + } +} diff --git a/packages/poptart_lex/lib/com/atproto/server/get_session/main_output_status.freezed.dart b/packages/poptart_lex/lib/com/atproto/server/get_session/main_output_status.freezed.dart new file mode 100644 index 000000000..363d79761 --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/server/get_session/main_output_status.freezed.dart @@ -0,0 +1,312 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'main_output_status.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$ServerGetSessionOutputStatus { + + Object get data; + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerGetSessionOutputStatus&&const DeepCollectionEquality().equals(other.data, data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); + +@override +String toString() { + return 'ServerGetSessionOutputStatus(data: $data)'; +} + + +} + +/// @nodoc +class $ServerGetSessionOutputStatusCopyWith<$Res> { +$ServerGetSessionOutputStatusCopyWith(ServerGetSessionOutputStatus _, $Res Function(ServerGetSessionOutputStatus) __); +} + + +/// Adds pattern-matching-related methods to [ServerGetSessionOutputStatus]. +extension ServerGetSessionOutputStatusPatterns on ServerGetSessionOutputStatus { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap({TResult Function( ServerGetSessionOutputStatusKnownValue value)? knownValue,TResult Function( ServerGetSessionOutputStatusUnknown value)? unknown,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case ServerGetSessionOutputStatusKnownValue() when knownValue != null: +return knownValue(_that);case ServerGetSessionOutputStatusUnknown() when unknown != null: +return unknown(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map({required TResult Function( ServerGetSessionOutputStatusKnownValue value) knownValue,required TResult Function( ServerGetSessionOutputStatusUnknown value) unknown,}){ +final _that = this; +switch (_that) { +case ServerGetSessionOutputStatusKnownValue(): +return knownValue(_that);case ServerGetSessionOutputStatusUnknown(): +return unknown(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull({TResult? Function( ServerGetSessionOutputStatusKnownValue value)? knownValue,TResult? Function( ServerGetSessionOutputStatusUnknown value)? unknown,}){ +final _that = this; +switch (_that) { +case ServerGetSessionOutputStatusKnownValue() when knownValue != null: +return knownValue(_that);case ServerGetSessionOutputStatusUnknown() when unknown != null: +return unknown(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen({TResult Function( KnownServerGetSessionOutputStatus data)? knownValue,TResult Function( String data)? unknown,required TResult orElse(),}) {final _that = this; +switch (_that) { +case ServerGetSessionOutputStatusKnownValue() when knownValue != null: +return knownValue(_that.data);case ServerGetSessionOutputStatusUnknown() when unknown != null: +return unknown(_that.data);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when({required TResult Function( KnownServerGetSessionOutputStatus data) knownValue,required TResult Function( String data) unknown,}) {final _that = this; +switch (_that) { +case ServerGetSessionOutputStatusKnownValue(): +return knownValue(_that.data);case ServerGetSessionOutputStatusUnknown(): +return unknown(_that.data);case _: + throw StateError('Unexpected subclass'); + +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull({TResult? Function( KnownServerGetSessionOutputStatus data)? knownValue,TResult? Function( String data)? unknown,}) {final _that = this; +switch (_that) { +case ServerGetSessionOutputStatusKnownValue() when knownValue != null: +return knownValue(_that.data);case ServerGetSessionOutputStatusUnknown() when unknown != null: +return unknown(_that.data);case _: + return null; + +} +} + +} + +/// @nodoc + + +class ServerGetSessionOutputStatusKnownValue extends ServerGetSessionOutputStatus { + const ServerGetSessionOutputStatusKnownValue({required this.data}): super._(); + + +@override final KnownServerGetSessionOutputStatus data; + +/// Create a copy of ServerGetSessionOutputStatus +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ServerGetSessionOutputStatusKnownValueCopyWith get copyWith => _$ServerGetSessionOutputStatusKnownValueCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerGetSessionOutputStatusKnownValue&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'ServerGetSessionOutputStatus.knownValue(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $ServerGetSessionOutputStatusKnownValueCopyWith<$Res> implements $ServerGetSessionOutputStatusCopyWith<$Res> { + factory $ServerGetSessionOutputStatusKnownValueCopyWith(ServerGetSessionOutputStatusKnownValue value, $Res Function(ServerGetSessionOutputStatusKnownValue) _then) = _$ServerGetSessionOutputStatusKnownValueCopyWithImpl; +@useResult +$Res call({ + KnownServerGetSessionOutputStatus data +}); + + + + +} +/// @nodoc +class _$ServerGetSessionOutputStatusKnownValueCopyWithImpl<$Res> + implements $ServerGetSessionOutputStatusKnownValueCopyWith<$Res> { + _$ServerGetSessionOutputStatusKnownValueCopyWithImpl(this._self, this._then); + + final ServerGetSessionOutputStatusKnownValue _self; + final $Res Function(ServerGetSessionOutputStatusKnownValue) _then; + +/// Create a copy of ServerGetSessionOutputStatus +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(ServerGetSessionOutputStatusKnownValue( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as KnownServerGetSessionOutputStatus, + )); +} + + +} + +/// @nodoc + + +class ServerGetSessionOutputStatusUnknown extends ServerGetSessionOutputStatus { + const ServerGetSessionOutputStatusUnknown({required this.data}): super._(); + + +@override final String data; + +/// Create a copy of ServerGetSessionOutputStatus +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ServerGetSessionOutputStatusUnknownCopyWith get copyWith => _$ServerGetSessionOutputStatusUnknownCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerGetSessionOutputStatusUnknown&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'ServerGetSessionOutputStatus.unknown(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $ServerGetSessionOutputStatusUnknownCopyWith<$Res> implements $ServerGetSessionOutputStatusCopyWith<$Res> { + factory $ServerGetSessionOutputStatusUnknownCopyWith(ServerGetSessionOutputStatusUnknown value, $Res Function(ServerGetSessionOutputStatusUnknown) _then) = _$ServerGetSessionOutputStatusUnknownCopyWithImpl; +@useResult +$Res call({ + String data +}); + + + + +} +/// @nodoc +class _$ServerGetSessionOutputStatusUnknownCopyWithImpl<$Res> + implements $ServerGetSessionOutputStatusUnknownCopyWith<$Res> { + _$ServerGetSessionOutputStatusUnknownCopyWithImpl(this._self, this._then); + + final ServerGetSessionOutputStatusUnknown _self; + final $Res Function(ServerGetSessionOutputStatusUnknown) _then; + +/// Create a copy of ServerGetSessionOutputStatus +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(ServerGetSessionOutputStatusUnknown( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/server/get_session/main_status.dart b/packages/poptart_lex/lib/com/atproto/server/get_session/main_status.dart deleted file mode 100644 index a34b389c3..000000000 --- a/packages/poptart_lex/lib/com/atproto/server/get_session/main_status.dart +++ /dev/null @@ -1,101 +0,0 @@ -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, unused_import, duplicate_import, unnecessary_cast, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -import 'package:poptart_core/poptart_core.dart' show Serializable; -import 'package:poptart_core/internals.dart' show isA; - -import 'package:freezed_annotation/freezed_annotation.dart'; - -part 'main_status.freezed.dart'; - -// ************************************************************************** -// LexGenerator -// ************************************************************************** - -@freezed -abstract class ServerGetSessionStatus with _$ServerGetSessionStatus { - const ServerGetSessionStatus._(); - - const factory ServerGetSessionStatus.knownValue({ - required KnownServerGetSessionStatus data, - }) = ServerGetSessionStatusKnownValue; - - const factory ServerGetSessionStatus.unknown({required String data}) = - ServerGetSessionStatusUnknown; - - static ServerGetSessionStatus? valueOf(final String? value) { - if (value == null) return null; - final knownValue = KnownServerGetSessionStatus.valueOf(value); - - return knownValue != null - ? ServerGetSessionStatus.knownValue(data: knownValue) - : ServerGetSessionStatus.unknown(data: value); - } - - String toJson() => const ServerGetSessionStatusConverter().toJson(this); -} - -extension ServerGetSessionStatusExtension on ServerGetSessionStatus { - bool get isKnownValue => isA(this); - bool get isNotKnownValue => !isKnownValue; - KnownServerGetSessionStatus? get knownValue => - isKnownValue ? data as KnownServerGetSessionStatus : null; - bool get isUnknown => isA(this); - bool get isNotUnknown => !isUnknown; - String? get unknown => isUnknown ? data as String : null; -} - -final class ServerGetSessionStatusConverter - extends JsonConverter { - const ServerGetSessionStatusConverter(); - - @override - ServerGetSessionStatus fromJson(String json) { - try { - final knownValue = KnownServerGetSessionStatus.valueOf(json); - if (knownValue != null) { - return ServerGetSessionStatus.knownValue(data: knownValue); - } - - return ServerGetSessionStatus.unknown(data: json); - } catch (_) { - return ServerGetSessionStatus.unknown(data: json); - } - } - - @override - String toJson(ServerGetSessionStatus object) => - object.when(knownValue: (data) => data.value, unknown: (data) => data); -} - -enum KnownServerGetSessionStatus implements Serializable { - @JsonValue('takendown') - takendown('takendown'), - @JsonValue('suspended') - suspended('suspended'), - @JsonValue('deactivated') - deactivated('deactivated'); - - @override - final String value; - - const KnownServerGetSessionStatus(this.value); - - static bool isKnownValue(final String value) { - return valueOf(value) != null; - } - - static KnownServerGetSessionStatus? valueOf(final String? value) { - if (value == null) return null; - - for (final v in values) { - if (v.value == value) { - return v; - } - } - - return null; - } -} diff --git a/packages/poptart_lex/lib/com/atproto/server/get_session/main_status.freezed.dart b/packages/poptart_lex/lib/com/atproto/server/get_session/main_status.freezed.dart deleted file mode 100644 index 64a57ce13..000000000 --- a/packages/poptart_lex/lib/com/atproto/server/get_session/main_status.freezed.dart +++ /dev/null @@ -1,312 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND -// coverage:ignore-file -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'main_status.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; -/// @nodoc -mixin _$ServerGetSessionStatus { - - Object get data; - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerGetSessionStatus&&const DeepCollectionEquality().equals(other.data, data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); - -@override -String toString() { - return 'ServerGetSessionStatus(data: $data)'; -} - - -} - -/// @nodoc -class $ServerGetSessionStatusCopyWith<$Res> { -$ServerGetSessionStatusCopyWith(ServerGetSessionStatus _, $Res Function(ServerGetSessionStatus) __); -} - - -/// Adds pattern-matching-related methods to [ServerGetSessionStatus]. -extension ServerGetSessionStatusPatterns on ServerGetSessionStatus { -/// A variant of `map` that fallback to returning `orElse`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeMap({TResult Function( ServerGetSessionStatusKnownValue value)? knownValue,TResult Function( ServerGetSessionStatusUnknown value)? unknown,required TResult orElse(),}){ -final _that = this; -switch (_that) { -case ServerGetSessionStatusKnownValue() when knownValue != null: -return knownValue(_that);case ServerGetSessionStatusUnknown() when unknown != null: -return unknown(_that);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// Callbacks receives the raw object, upcasted. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case final Subclass2 value: -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult map({required TResult Function( ServerGetSessionStatusKnownValue value) knownValue,required TResult Function( ServerGetSessionStatusUnknown value) unknown,}){ -final _that = this; -switch (_that) { -case ServerGetSessionStatusKnownValue(): -return knownValue(_that);case ServerGetSessionStatusUnknown(): -return unknown(_that);case _: - throw StateError('Unexpected subclass'); - -} -} -/// A variant of `map` that fallback to returning `null`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? mapOrNull({TResult? Function( ServerGetSessionStatusKnownValue value)? knownValue,TResult? Function( ServerGetSessionStatusUnknown value)? unknown,}){ -final _that = this; -switch (_that) { -case ServerGetSessionStatusKnownValue() when knownValue != null: -return knownValue(_that);case ServerGetSessionStatusUnknown() when unknown != null: -return unknown(_that);case _: - return null; - -} -} -/// A variant of `when` that fallback to an `orElse` callback. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeWhen({TResult Function( KnownServerGetSessionStatus data)? knownValue,TResult Function( String data)? unknown,required TResult orElse(),}) {final _that = this; -switch (_that) { -case ServerGetSessionStatusKnownValue() when knownValue != null: -return knownValue(_that.data);case ServerGetSessionStatusUnknown() when unknown != null: -return unknown(_that.data);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// As opposed to `map`, this offers destructuring. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case Subclass2(:final field2): -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult when({required TResult Function( KnownServerGetSessionStatus data) knownValue,required TResult Function( String data) unknown,}) {final _that = this; -switch (_that) { -case ServerGetSessionStatusKnownValue(): -return knownValue(_that.data);case ServerGetSessionStatusUnknown(): -return unknown(_that.data);case _: - throw StateError('Unexpected subclass'); - -} -} -/// A variant of `when` that fallback to returning `null` -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? whenOrNull({TResult? Function( KnownServerGetSessionStatus data)? knownValue,TResult? Function( String data)? unknown,}) {final _that = this; -switch (_that) { -case ServerGetSessionStatusKnownValue() when knownValue != null: -return knownValue(_that.data);case ServerGetSessionStatusUnknown() when unknown != null: -return unknown(_that.data);case _: - return null; - -} -} - -} - -/// @nodoc - - -class ServerGetSessionStatusKnownValue extends ServerGetSessionStatus { - const ServerGetSessionStatusKnownValue({required this.data}): super._(); - - -@override final KnownServerGetSessionStatus data; - -/// Create a copy of ServerGetSessionStatus -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$ServerGetSessionStatusKnownValueCopyWith get copyWith => _$ServerGetSessionStatusKnownValueCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerGetSessionStatusKnownValue&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'ServerGetSessionStatus.knownValue(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $ServerGetSessionStatusKnownValueCopyWith<$Res> implements $ServerGetSessionStatusCopyWith<$Res> { - factory $ServerGetSessionStatusKnownValueCopyWith(ServerGetSessionStatusKnownValue value, $Res Function(ServerGetSessionStatusKnownValue) _then) = _$ServerGetSessionStatusKnownValueCopyWithImpl; -@useResult -$Res call({ - KnownServerGetSessionStatus data -}); - - - - -} -/// @nodoc -class _$ServerGetSessionStatusKnownValueCopyWithImpl<$Res> - implements $ServerGetSessionStatusKnownValueCopyWith<$Res> { - _$ServerGetSessionStatusKnownValueCopyWithImpl(this._self, this._then); - - final ServerGetSessionStatusKnownValue _self; - final $Res Function(ServerGetSessionStatusKnownValue) _then; - -/// Create a copy of ServerGetSessionStatus -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(ServerGetSessionStatusKnownValue( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as KnownServerGetSessionStatus, - )); -} - - -} - -/// @nodoc - - -class ServerGetSessionStatusUnknown extends ServerGetSessionStatus { - const ServerGetSessionStatusUnknown({required this.data}): super._(); - - -@override final String data; - -/// Create a copy of ServerGetSessionStatus -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$ServerGetSessionStatusUnknownCopyWith get copyWith => _$ServerGetSessionStatusUnknownCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerGetSessionStatusUnknown&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'ServerGetSessionStatus.unknown(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $ServerGetSessionStatusUnknownCopyWith<$Res> implements $ServerGetSessionStatusCopyWith<$Res> { - factory $ServerGetSessionStatusUnknownCopyWith(ServerGetSessionStatusUnknown value, $Res Function(ServerGetSessionStatusUnknown) _then) = _$ServerGetSessionStatusUnknownCopyWithImpl; -@useResult -$Res call({ - String data -}); - - - - -} -/// @nodoc -class _$ServerGetSessionStatusUnknownCopyWithImpl<$Res> - implements $ServerGetSessionStatusUnknownCopyWith<$Res> { - _$ServerGetSessionStatusUnknownCopyWithImpl(this._self, this._then); - - final ServerGetSessionStatusUnknown _self; - final $Res Function(ServerGetSessionStatusUnknown) _then; - -/// Create a copy of ServerGetSessionStatus -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(ServerGetSessionStatusUnknown( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as String, - )); -} - - -} - -// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/server/get_session/output.dart b/packages/poptart_lex/lib/com/atproto/server/get_session/output.dart index 766a2b7e2..452f10ff7 100644 --- a/packages/poptart_lex/lib/com/atproto/server/get_session/output.dart +++ b/packages/poptart_lex/lib/com/atproto/server/get_session/output.dart @@ -7,7 +7,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:poptart_core/poptart_core.dart'; import 'package:poptart_core/internals.dart'; -import './main_status.dart'; +import './main_output_status.dart'; part 'output.freezed.dart'; part 'output.g.dart'; @@ -40,7 +40,8 @@ abstract class ServerGetSessionOutput with _$ServerGetSessionOutput { bool? active, /// If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. - @ServerGetSessionStatusConverter() ServerGetSessionStatus? status, + @ServerGetSessionOutputStatusConverter() + ServerGetSessionOutputStatus? status, Map? $unknown, }) = _ServerGetSessionOutput; diff --git a/packages/poptart_lex/lib/com/atproto/server/get_session/output.freezed.dart b/packages/poptart_lex/lib/com/atproto/server/get_session/output.freezed.dart index a31cccde7..89cf93637 100644 --- a/packages/poptart_lex/lib/com/atproto/server/get_session/output.freezed.dart +++ b/packages/poptart_lex/lib/com/atproto/server/get_session/output.freezed.dart @@ -16,7 +16,7 @@ T _$identity(T value) => value; mixin _$ServerGetSessionOutput { String get handle; String get did; Map? get didDoc; String? get email; bool? get emailConfirmed; bool? get emailAuthFactor; bool? get active;/// If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. -@ServerGetSessionStatusConverter() ServerGetSessionStatus? get status; Map? get $unknown; +@ServerGetSessionOutputStatusConverter() ServerGetSessionOutputStatus? get status; Map? get $unknown; /// Create a copy of ServerGetSessionOutput /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -49,11 +49,11 @@ abstract mixin class $ServerGetSessionOutputCopyWith<$Res> { factory $ServerGetSessionOutputCopyWith(ServerGetSessionOutput value, $Res Function(ServerGetSessionOutput) _then) = _$ServerGetSessionOutputCopyWithImpl; @useResult $Res call({ - String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active,@ServerGetSessionStatusConverter() ServerGetSessionStatus? status, Map? $unknown + String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active,@ServerGetSessionOutputStatusConverter() ServerGetSessionOutputStatus? status, Map? $unknown }); -$ServerGetSessionStatusCopyWith<$Res>? get status; +$ServerGetSessionOutputStatusCopyWith<$Res>? get status; } /// @nodoc @@ -76,7 +76,7 @@ as String?,emailConfirmed: freezed == emailConfirmed ? _self.emailConfirmed : em as bool?,emailAuthFactor: freezed == emailAuthFactor ? _self.emailAuthFactor : emailAuthFactor // ignore: cast_nullable_to_non_nullable as bool?,active: freezed == active ? _self.active : active // ignore: cast_nullable_to_non_nullable as bool?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable -as ServerGetSessionStatus?,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable +as ServerGetSessionOutputStatus?,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); } @@ -84,12 +84,12 @@ as Map?, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$ServerGetSessionStatusCopyWith<$Res>? get status { +$ServerGetSessionOutputStatusCopyWith<$Res>? get status { if (_self.status == null) { return null; } - return $ServerGetSessionStatusCopyWith<$Res>(_self.status!, (value) { + return $ServerGetSessionOutputStatusCopyWith<$Res>(_self.status!, (value) { return _then(_self.copyWith(status: value)); }); } @@ -174,7 +174,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active, @ServerGetSessionStatusConverter() ServerGetSessionStatus? status, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active, @ServerGetSessionOutputStatusConverter() ServerGetSessionOutputStatus? status, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _ServerGetSessionOutput() when $default != null: return $default(_that.handle,_that.did,_that.didDoc,_that.email,_that.emailConfirmed,_that.emailAuthFactor,_that.active,_that.status,_that.$unknown);case _: @@ -195,7 +195,7 @@ return $default(_that.handle,_that.did,_that.didDoc,_that.email,_that.emailConfi /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active, @ServerGetSessionStatusConverter() ServerGetSessionStatus? status, Map? $unknown) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active, @ServerGetSessionOutputStatusConverter() ServerGetSessionOutputStatus? status, Map? $unknown) $default,) {final _that = this; switch (_that) { case _ServerGetSessionOutput(): return $default(_that.handle,_that.did,_that.didDoc,_that.email,_that.emailConfirmed,_that.emailAuthFactor,_that.active,_that.status,_that.$unknown);case _: @@ -215,7 +215,7 @@ return $default(_that.handle,_that.did,_that.didDoc,_that.email,_that.emailConfi /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active, @ServerGetSessionStatusConverter() ServerGetSessionStatus? status, Map? $unknown)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active, @ServerGetSessionOutputStatusConverter() ServerGetSessionOutputStatus? status, Map? $unknown)? $default,) {final _that = this; switch (_that) { case _ServerGetSessionOutput() when $default != null: return $default(_that.handle,_that.did,_that.didDoc,_that.email,_that.emailConfirmed,_that.emailAuthFactor,_that.active,_that.status,_that.$unknown);case _: @@ -230,7 +230,7 @@ return $default(_that.handle,_that.did,_that.didDoc,_that.email,_that.emailConfi @JsonSerializable(includeIfNull: false) class _ServerGetSessionOutput implements ServerGetSessionOutput { - const _ServerGetSessionOutput({required this.handle, required this.did, final Map? didDoc, this.email, this.emailConfirmed, this.emailAuthFactor, this.active, @ServerGetSessionStatusConverter() this.status, final Map? $unknown}): _didDoc = didDoc,_$unknown = $unknown; + const _ServerGetSessionOutput({required this.handle, required this.did, final Map? didDoc, this.email, this.emailConfirmed, this.emailAuthFactor, this.active, @ServerGetSessionOutputStatusConverter() this.status, final Map? $unknown}): _didDoc = didDoc,_$unknown = $unknown; factory _ServerGetSessionOutput.fromJson(Map json) => _$ServerGetSessionOutputFromJson(json); @override final String handle; @@ -249,7 +249,7 @@ class _ServerGetSessionOutput implements ServerGetSessionOutput { @override final bool? emailAuthFactor; @override final bool? active; /// If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. -@override@ServerGetSessionStatusConverter() final ServerGetSessionStatus? status; +@override@ServerGetSessionOutputStatusConverter() final ServerGetSessionOutputStatus? status; final Map? _$unknown; @override Map? get $unknown { final value = _$unknown; @@ -293,11 +293,11 @@ abstract mixin class _$ServerGetSessionOutputCopyWith<$Res> implements $ServerGe factory _$ServerGetSessionOutputCopyWith(_ServerGetSessionOutput value, $Res Function(_ServerGetSessionOutput) _then) = __$ServerGetSessionOutputCopyWithImpl; @override @useResult $Res call({ - String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active,@ServerGetSessionStatusConverter() ServerGetSessionStatus? status, Map? $unknown + String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active,@ServerGetSessionOutputStatusConverter() ServerGetSessionOutputStatus? status, Map? $unknown }); -@override $ServerGetSessionStatusCopyWith<$Res>? get status; +@override $ServerGetSessionOutputStatusCopyWith<$Res>? get status; } /// @nodoc @@ -320,7 +320,7 @@ as String?,emailConfirmed: freezed == emailConfirmed ? _self.emailConfirmed : em as bool?,emailAuthFactor: freezed == emailAuthFactor ? _self.emailAuthFactor : emailAuthFactor // ignore: cast_nullable_to_non_nullable as bool?,active: freezed == active ? _self.active : active // ignore: cast_nullable_to_non_nullable as bool?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable -as ServerGetSessionStatus?,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable +as ServerGetSessionOutputStatus?,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); } @@ -329,12 +329,12 @@ as Map?, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$ServerGetSessionStatusCopyWith<$Res>? get status { +$ServerGetSessionOutputStatusCopyWith<$Res>? get status { if (_self.status == null) { return null; } - return $ServerGetSessionStatusCopyWith<$Res>(_self.status!, (value) { + return $ServerGetSessionOutputStatusCopyWith<$Res>(_self.status!, (value) { return _then(_self.copyWith(status: value)); }); } diff --git a/packages/poptart_lex/lib/com/atproto/server/get_session/output.g.dart b/packages/poptart_lex/lib/com/atproto/server/get_session/output.g.dart index 7eb79e7df..889bbd66a 100644 --- a/packages/poptart_lex/lib/com/atproto/server/get_session/output.g.dart +++ b/packages/poptart_lex/lib/com/atproto/server/get_session/output.g.dart @@ -23,9 +23,9 @@ _ServerGetSessionOutput _$ServerGetSessionOutputFromJson(Map json) => active: $checkedConvert('active', (v) => v as bool?), status: $checkedConvert( 'status', - (v) => _$JsonConverterFromJson( + (v) => _$JsonConverterFromJson( v, - const ServerGetSessionStatusConverter().fromJson, + const ServerGetSessionOutputStatusConverter().fromJson, ), ), $unknown: $checkedConvert( @@ -46,9 +46,9 @@ Map _$ServerGetSessionOutputToJson( 'emailConfirmed': ?instance.emailConfirmed, 'emailAuthFactor': ?instance.emailAuthFactor, 'active': ?instance.active, - 'status': ?_$JsonConverterToJson( + 'status': ?_$JsonConverterToJson( instance.status, - const ServerGetSessionStatusConverter().toJson, + const ServerGetSessionOutputStatusConverter().toJson, ), r'$unknown': ?instance.$unknown, }; diff --git a/packages/poptart_lex/lib/com/atproto/server/refresh_session.dart b/packages/poptart_lex/lib/com/atproto/server/refresh_session.dart index 49fb800e7..b70a947ff 100644 --- a/packages/poptart_lex/lib/com/atproto/server/refresh_session.dart +++ b/packages/poptart_lex/lib/com/atproto/server/refresh_session.dart @@ -8,5 +8,5 @@ // ************************************************************************** export 'refresh_session/descriptor.dart'; -export 'refresh_session/main_status.dart'; +export 'refresh_session/main_output_status.dart'; export 'refresh_session/output.dart'; diff --git a/packages/poptart_lex/lib/com/atproto/server/refresh_session/main_output_status.dart b/packages/poptart_lex/lib/com/atproto/server/refresh_session/main_output_status.dart new file mode 100644 index 000000000..ef3ece0d3 --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/server/refresh_session/main_output_status.dart @@ -0,0 +1,106 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, unused_import, duplicate_import, unnecessary_cast, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +import 'package:poptart_core/poptart_core.dart' show Serializable; +import 'package:poptart_core/internals.dart' show isA; + +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'main_output_status.freezed.dart'; + +// ************************************************************************** +// LexGenerator +// ************************************************************************** + +@freezed +abstract class ServerRefreshSessionOutputStatus + with _$ServerRefreshSessionOutputStatus { + const ServerRefreshSessionOutputStatus._(); + + const factory ServerRefreshSessionOutputStatus.knownValue({ + required KnownServerRefreshSessionOutputStatus data, + }) = ServerRefreshSessionOutputStatusKnownValue; + + const factory ServerRefreshSessionOutputStatus.unknown({ + required String data, + }) = ServerRefreshSessionOutputStatusUnknown; + + static ServerRefreshSessionOutputStatus? valueOf(final String? value) { + if (value == null) return null; + final knownValue = KnownServerRefreshSessionOutputStatus.valueOf(value); + + return knownValue != null + ? ServerRefreshSessionOutputStatus.knownValue(data: knownValue) + : ServerRefreshSessionOutputStatus.unknown(data: value); + } + + String toJson() => + const ServerRefreshSessionOutputStatusConverter().toJson(this); +} + +extension ServerRefreshSessionOutputStatusExtension + on ServerRefreshSessionOutputStatus { + bool get isKnownValue => + isA(this); + bool get isNotKnownValue => !isKnownValue; + KnownServerRefreshSessionOutputStatus? get knownValue => + isKnownValue ? data as KnownServerRefreshSessionOutputStatus : null; + bool get isUnknown => isA(this); + bool get isNotUnknown => !isUnknown; + String? get unknown => isUnknown ? data as String : null; +} + +final class ServerRefreshSessionOutputStatusConverter + extends JsonConverter { + const ServerRefreshSessionOutputStatusConverter(); + + @override + ServerRefreshSessionOutputStatus fromJson(String json) { + try { + final knownValue = KnownServerRefreshSessionOutputStatus.valueOf(json); + if (knownValue != null) { + return ServerRefreshSessionOutputStatus.knownValue(data: knownValue); + } + + return ServerRefreshSessionOutputStatus.unknown(data: json); + } catch (_) { + return ServerRefreshSessionOutputStatus.unknown(data: json); + } + } + + @override + String toJson(ServerRefreshSessionOutputStatus object) => + object.when(knownValue: (data) => data.value, unknown: (data) => data); +} + +enum KnownServerRefreshSessionOutputStatus implements Serializable { + @JsonValue('takendown') + takendown('takendown'), + @JsonValue('suspended') + suspended('suspended'), + @JsonValue('deactivated') + deactivated('deactivated'); + + @override + final String value; + + const KnownServerRefreshSessionOutputStatus(this.value); + + static bool isKnownValue(final String value) { + return valueOf(value) != null; + } + + static KnownServerRefreshSessionOutputStatus? valueOf(final String? value) { + if (value == null) return null; + + for (final v in values) { + if (v.value == value) { + return v; + } + } + + return null; + } +} diff --git a/packages/poptart_lex/lib/com/atproto/repo/create_record/main_validation_status.freezed.dart b/packages/poptart_lex/lib/com/atproto/server/refresh_session/main_output_status.freezed.dart similarity index 54% rename from packages/poptart_lex/lib/com/atproto/repo/create_record/main_validation_status.freezed.dart rename to packages/poptart_lex/lib/com/atproto/server/refresh_session/main_output_status.freezed.dart index 6a82da037..1b0385978 100644 --- a/packages/poptart_lex/lib/com/atproto/repo/create_record/main_validation_status.freezed.dart +++ b/packages/poptart_lex/lib/com/atproto/server/refresh_session/main_output_status.freezed.dart @@ -3,7 +3,7 @@ // ignore_for_file: type=lint // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark -part of 'main_validation_status.dart'; +part of 'main_output_status.dart'; // ************************************************************************** // FreezedGenerator @@ -12,7 +12,7 @@ part of 'main_validation_status.dart'; // dart format off T _$identity(T value) => value; /// @nodoc -mixin _$RepoCreateRecordValidationStatus { +mixin _$ServerRefreshSessionOutputStatus { Object get data; @@ -20,7 +20,7 @@ mixin _$RepoCreateRecordValidationStatus { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is RepoCreateRecordValidationStatus&&const DeepCollectionEquality().equals(other.data, data)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerRefreshSessionOutputStatus&&const DeepCollectionEquality().equals(other.data, data)); } @@ -29,20 +29,20 @@ int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash( @override String toString() { - return 'RepoCreateRecordValidationStatus(data: $data)'; + return 'ServerRefreshSessionOutputStatus(data: $data)'; } } /// @nodoc -class $RepoCreateRecordValidationStatusCopyWith<$Res> { -$RepoCreateRecordValidationStatusCopyWith(RepoCreateRecordValidationStatus _, $Res Function(RepoCreateRecordValidationStatus) __); +class $ServerRefreshSessionOutputStatusCopyWith<$Res> { +$ServerRefreshSessionOutputStatusCopyWith(ServerRefreshSessionOutputStatus _, $Res Function(ServerRefreshSessionOutputStatus) __); } -/// Adds pattern-matching-related methods to [RepoCreateRecordValidationStatus]. -extension RepoCreateRecordValidationStatusPatterns on RepoCreateRecordValidationStatus { +/// Adds pattern-matching-related methods to [ServerRefreshSessionOutputStatus]. +extension ServerRefreshSessionOutputStatusPatterns on ServerRefreshSessionOutputStatus { /// A variant of `map` that fallback to returning `orElse`. /// /// It is equivalent to doing: @@ -55,11 +55,11 @@ extension RepoCreateRecordValidationStatusPatterns on RepoCreateRecordValidation /// } /// ``` -@optionalTypeArgs TResult maybeMap({TResult Function( RepoCreateRecordValidationStatusKnownValue value)? knownValue,TResult Function( RepoCreateRecordValidationStatusUnknown value)? unknown,required TResult orElse(),}){ +@optionalTypeArgs TResult maybeMap({TResult Function( ServerRefreshSessionOutputStatusKnownValue value)? knownValue,TResult Function( ServerRefreshSessionOutputStatusUnknown value)? unknown,required TResult orElse(),}){ final _that = this; switch (_that) { -case RepoCreateRecordValidationStatusKnownValue() when knownValue != null: -return knownValue(_that);case RepoCreateRecordValidationStatusUnknown() when unknown != null: +case ServerRefreshSessionOutputStatusKnownValue() when knownValue != null: +return knownValue(_that);case ServerRefreshSessionOutputStatusUnknown() when unknown != null: return unknown(_that);case _: return orElse(); @@ -78,11 +78,11 @@ return unknown(_that);case _: /// } /// ``` -@optionalTypeArgs TResult map({required TResult Function( RepoCreateRecordValidationStatusKnownValue value) knownValue,required TResult Function( RepoCreateRecordValidationStatusUnknown value) unknown,}){ +@optionalTypeArgs TResult map({required TResult Function( ServerRefreshSessionOutputStatusKnownValue value) knownValue,required TResult Function( ServerRefreshSessionOutputStatusUnknown value) unknown,}){ final _that = this; switch (_that) { -case RepoCreateRecordValidationStatusKnownValue(): -return knownValue(_that);case RepoCreateRecordValidationStatusUnknown(): +case ServerRefreshSessionOutputStatusKnownValue(): +return knownValue(_that);case ServerRefreshSessionOutputStatusUnknown(): return unknown(_that);case _: throw StateError('Unexpected subclass'); @@ -100,11 +100,11 @@ return unknown(_that);case _: /// } /// ``` -@optionalTypeArgs TResult? mapOrNull({TResult? Function( RepoCreateRecordValidationStatusKnownValue value)? knownValue,TResult? Function( RepoCreateRecordValidationStatusUnknown value)? unknown,}){ +@optionalTypeArgs TResult? mapOrNull({TResult? Function( ServerRefreshSessionOutputStatusKnownValue value)? knownValue,TResult? Function( ServerRefreshSessionOutputStatusUnknown value)? unknown,}){ final _that = this; switch (_that) { -case RepoCreateRecordValidationStatusKnownValue() when knownValue != null: -return knownValue(_that);case RepoCreateRecordValidationStatusUnknown() when unknown != null: +case ServerRefreshSessionOutputStatusKnownValue() when knownValue != null: +return knownValue(_that);case ServerRefreshSessionOutputStatusUnknown() when unknown != null: return unknown(_that);case _: return null; @@ -122,10 +122,10 @@ return unknown(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen({TResult Function( KnownRepoCreateRecordValidationStatus data)? knownValue,TResult Function( String data)? unknown,required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen({TResult Function( KnownServerRefreshSessionOutputStatus data)? knownValue,TResult Function( String data)? unknown,required TResult orElse(),}) {final _that = this; switch (_that) { -case RepoCreateRecordValidationStatusKnownValue() when knownValue != null: -return knownValue(_that.data);case RepoCreateRecordValidationStatusUnknown() when unknown != null: +case ServerRefreshSessionOutputStatusKnownValue() when knownValue != null: +return knownValue(_that.data);case ServerRefreshSessionOutputStatusUnknown() when unknown != null: return unknown(_that.data);case _: return orElse(); @@ -144,10 +144,10 @@ return unknown(_that.data);case _: /// } /// ``` -@optionalTypeArgs TResult when({required TResult Function( KnownRepoCreateRecordValidationStatus data) knownValue,required TResult Function( String data) unknown,}) {final _that = this; +@optionalTypeArgs TResult when({required TResult Function( KnownServerRefreshSessionOutputStatus data) knownValue,required TResult Function( String data) unknown,}) {final _that = this; switch (_that) { -case RepoCreateRecordValidationStatusKnownValue(): -return knownValue(_that.data);case RepoCreateRecordValidationStatusUnknown(): +case ServerRefreshSessionOutputStatusKnownValue(): +return knownValue(_that.data);case ServerRefreshSessionOutputStatusUnknown(): return unknown(_that.data);case _: throw StateError('Unexpected subclass'); @@ -165,10 +165,10 @@ return unknown(_that.data);case _: /// } /// ``` -@optionalTypeArgs TResult? whenOrNull({TResult? Function( KnownRepoCreateRecordValidationStatus data)? knownValue,TResult? Function( String data)? unknown,}) {final _that = this; +@optionalTypeArgs TResult? whenOrNull({TResult? Function( KnownServerRefreshSessionOutputStatus data)? knownValue,TResult? Function( String data)? unknown,}) {final _that = this; switch (_that) { -case RepoCreateRecordValidationStatusKnownValue() when knownValue != null: -return knownValue(_that.data);case RepoCreateRecordValidationStatusUnknown() when unknown != null: +case ServerRefreshSessionOutputStatusKnownValue() when knownValue != null: +return knownValue(_that.data);case ServerRefreshSessionOutputStatusUnknown() when unknown != null: return unknown(_that.data);case _: return null; @@ -180,23 +180,23 @@ return unknown(_that.data);case _: /// @nodoc -class RepoCreateRecordValidationStatusKnownValue extends RepoCreateRecordValidationStatus { - const RepoCreateRecordValidationStatusKnownValue({required this.data}): super._(); +class ServerRefreshSessionOutputStatusKnownValue extends ServerRefreshSessionOutputStatus { + const ServerRefreshSessionOutputStatusKnownValue({required this.data}): super._(); -@override final KnownRepoCreateRecordValidationStatus data; +@override final KnownServerRefreshSessionOutputStatus data; -/// Create a copy of RepoCreateRecordValidationStatus +/// Create a copy of ServerRefreshSessionOutputStatus /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline') -$RepoCreateRecordValidationStatusKnownValueCopyWith get copyWith => _$RepoCreateRecordValidationStatusKnownValueCopyWithImpl(this, _$identity); +$ServerRefreshSessionOutputStatusKnownValueCopyWith get copyWith => _$ServerRefreshSessionOutputStatusKnownValueCopyWithImpl(this, _$identity); @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is RepoCreateRecordValidationStatusKnownValue&&(identical(other.data, data) || other.data == data)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerRefreshSessionOutputStatusKnownValue&&(identical(other.data, data) || other.data == data)); } @@ -205,18 +205,18 @@ int get hashCode => Object.hash(runtimeType,data); @override String toString() { - return 'RepoCreateRecordValidationStatus.knownValue(data: $data)'; + return 'ServerRefreshSessionOutputStatus.knownValue(data: $data)'; } } /// @nodoc -abstract mixin class $RepoCreateRecordValidationStatusKnownValueCopyWith<$Res> implements $RepoCreateRecordValidationStatusCopyWith<$Res> { - factory $RepoCreateRecordValidationStatusKnownValueCopyWith(RepoCreateRecordValidationStatusKnownValue value, $Res Function(RepoCreateRecordValidationStatusKnownValue) _then) = _$RepoCreateRecordValidationStatusKnownValueCopyWithImpl; +abstract mixin class $ServerRefreshSessionOutputStatusKnownValueCopyWith<$Res> implements $ServerRefreshSessionOutputStatusCopyWith<$Res> { + factory $ServerRefreshSessionOutputStatusKnownValueCopyWith(ServerRefreshSessionOutputStatusKnownValue value, $Res Function(ServerRefreshSessionOutputStatusKnownValue) _then) = _$ServerRefreshSessionOutputStatusKnownValueCopyWithImpl; @useResult $Res call({ - KnownRepoCreateRecordValidationStatus data + KnownServerRefreshSessionOutputStatus data }); @@ -224,19 +224,19 @@ $Res call({ } /// @nodoc -class _$RepoCreateRecordValidationStatusKnownValueCopyWithImpl<$Res> - implements $RepoCreateRecordValidationStatusKnownValueCopyWith<$Res> { - _$RepoCreateRecordValidationStatusKnownValueCopyWithImpl(this._self, this._then); +class _$ServerRefreshSessionOutputStatusKnownValueCopyWithImpl<$Res> + implements $ServerRefreshSessionOutputStatusKnownValueCopyWith<$Res> { + _$ServerRefreshSessionOutputStatusKnownValueCopyWithImpl(this._self, this._then); - final RepoCreateRecordValidationStatusKnownValue _self; - final $Res Function(RepoCreateRecordValidationStatusKnownValue) _then; + final ServerRefreshSessionOutputStatusKnownValue _self; + final $Res Function(ServerRefreshSessionOutputStatusKnownValue) _then; -/// Create a copy of RepoCreateRecordValidationStatus +/// Create a copy of ServerRefreshSessionOutputStatus /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(RepoCreateRecordValidationStatusKnownValue( + return _then(ServerRefreshSessionOutputStatusKnownValue( data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as KnownRepoCreateRecordValidationStatus, +as KnownServerRefreshSessionOutputStatus, )); } @@ -246,23 +246,23 @@ as KnownRepoCreateRecordValidationStatus, /// @nodoc -class RepoCreateRecordValidationStatusUnknown extends RepoCreateRecordValidationStatus { - const RepoCreateRecordValidationStatusUnknown({required this.data}): super._(); +class ServerRefreshSessionOutputStatusUnknown extends ServerRefreshSessionOutputStatus { + const ServerRefreshSessionOutputStatusUnknown({required this.data}): super._(); @override final String data; -/// Create a copy of RepoCreateRecordValidationStatus +/// Create a copy of ServerRefreshSessionOutputStatus /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline') -$RepoCreateRecordValidationStatusUnknownCopyWith get copyWith => _$RepoCreateRecordValidationStatusUnknownCopyWithImpl(this, _$identity); +$ServerRefreshSessionOutputStatusUnknownCopyWith get copyWith => _$ServerRefreshSessionOutputStatusUnknownCopyWithImpl(this, _$identity); @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is RepoCreateRecordValidationStatusUnknown&&(identical(other.data, data) || other.data == data)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerRefreshSessionOutputStatusUnknown&&(identical(other.data, data) || other.data == data)); } @@ -271,15 +271,15 @@ int get hashCode => Object.hash(runtimeType,data); @override String toString() { - return 'RepoCreateRecordValidationStatus.unknown(data: $data)'; + return 'ServerRefreshSessionOutputStatus.unknown(data: $data)'; } } /// @nodoc -abstract mixin class $RepoCreateRecordValidationStatusUnknownCopyWith<$Res> implements $RepoCreateRecordValidationStatusCopyWith<$Res> { - factory $RepoCreateRecordValidationStatusUnknownCopyWith(RepoCreateRecordValidationStatusUnknown value, $Res Function(RepoCreateRecordValidationStatusUnknown) _then) = _$RepoCreateRecordValidationStatusUnknownCopyWithImpl; +abstract mixin class $ServerRefreshSessionOutputStatusUnknownCopyWith<$Res> implements $ServerRefreshSessionOutputStatusCopyWith<$Res> { + factory $ServerRefreshSessionOutputStatusUnknownCopyWith(ServerRefreshSessionOutputStatusUnknown value, $Res Function(ServerRefreshSessionOutputStatusUnknown) _then) = _$ServerRefreshSessionOutputStatusUnknownCopyWithImpl; @useResult $Res call({ String data @@ -290,17 +290,17 @@ $Res call({ } /// @nodoc -class _$RepoCreateRecordValidationStatusUnknownCopyWithImpl<$Res> - implements $RepoCreateRecordValidationStatusUnknownCopyWith<$Res> { - _$RepoCreateRecordValidationStatusUnknownCopyWithImpl(this._self, this._then); +class _$ServerRefreshSessionOutputStatusUnknownCopyWithImpl<$Res> + implements $ServerRefreshSessionOutputStatusUnknownCopyWith<$Res> { + _$ServerRefreshSessionOutputStatusUnknownCopyWithImpl(this._self, this._then); - final RepoCreateRecordValidationStatusUnknown _self; - final $Res Function(RepoCreateRecordValidationStatusUnknown) _then; + final ServerRefreshSessionOutputStatusUnknown _self; + final $Res Function(ServerRefreshSessionOutputStatusUnknown) _then; -/// Create a copy of RepoCreateRecordValidationStatus +/// Create a copy of ServerRefreshSessionOutputStatus /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(RepoCreateRecordValidationStatusUnknown( + return _then(ServerRefreshSessionOutputStatusUnknown( data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable as String, )); diff --git a/packages/poptart_lex/lib/com/atproto/server/refresh_session/main_status.dart b/packages/poptart_lex/lib/com/atproto/server/refresh_session/main_status.dart deleted file mode 100644 index 489866136..000000000 --- a/packages/poptart_lex/lib/com/atproto/server/refresh_session/main_status.dart +++ /dev/null @@ -1,101 +0,0 @@ -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, unused_import, duplicate_import, unnecessary_cast, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -import 'package:poptart_core/poptart_core.dart' show Serializable; -import 'package:poptart_core/internals.dart' show isA; - -import 'package:freezed_annotation/freezed_annotation.dart'; - -part 'main_status.freezed.dart'; - -// ************************************************************************** -// LexGenerator -// ************************************************************************** - -@freezed -abstract class ServerRefreshSessionStatus with _$ServerRefreshSessionStatus { - const ServerRefreshSessionStatus._(); - - const factory ServerRefreshSessionStatus.knownValue({ - required KnownServerRefreshSessionStatus data, - }) = ServerRefreshSessionStatusKnownValue; - - const factory ServerRefreshSessionStatus.unknown({required String data}) = - ServerRefreshSessionStatusUnknown; - - static ServerRefreshSessionStatus? valueOf(final String? value) { - if (value == null) return null; - final knownValue = KnownServerRefreshSessionStatus.valueOf(value); - - return knownValue != null - ? ServerRefreshSessionStatus.knownValue(data: knownValue) - : ServerRefreshSessionStatus.unknown(data: value); - } - - String toJson() => const ServerRefreshSessionStatusConverter().toJson(this); -} - -extension ServerRefreshSessionStatusExtension on ServerRefreshSessionStatus { - bool get isKnownValue => isA(this); - bool get isNotKnownValue => !isKnownValue; - KnownServerRefreshSessionStatus? get knownValue => - isKnownValue ? data as KnownServerRefreshSessionStatus : null; - bool get isUnknown => isA(this); - bool get isNotUnknown => !isUnknown; - String? get unknown => isUnknown ? data as String : null; -} - -final class ServerRefreshSessionStatusConverter - extends JsonConverter { - const ServerRefreshSessionStatusConverter(); - - @override - ServerRefreshSessionStatus fromJson(String json) { - try { - final knownValue = KnownServerRefreshSessionStatus.valueOf(json); - if (knownValue != null) { - return ServerRefreshSessionStatus.knownValue(data: knownValue); - } - - return ServerRefreshSessionStatus.unknown(data: json); - } catch (_) { - return ServerRefreshSessionStatus.unknown(data: json); - } - } - - @override - String toJson(ServerRefreshSessionStatus object) => - object.when(knownValue: (data) => data.value, unknown: (data) => data); -} - -enum KnownServerRefreshSessionStatus implements Serializable { - @JsonValue('takendown') - takendown('takendown'), - @JsonValue('suspended') - suspended('suspended'), - @JsonValue('deactivated') - deactivated('deactivated'); - - @override - final String value; - - const KnownServerRefreshSessionStatus(this.value); - - static bool isKnownValue(final String value) { - return valueOf(value) != null; - } - - static KnownServerRefreshSessionStatus? valueOf(final String? value) { - if (value == null) return null; - - for (final v in values) { - if (v.value == value) { - return v; - } - } - - return null; - } -} diff --git a/packages/poptart_lex/lib/com/atproto/server/refresh_session/main_status.freezed.dart b/packages/poptart_lex/lib/com/atproto/server/refresh_session/main_status.freezed.dart deleted file mode 100644 index 14540fa42..000000000 --- a/packages/poptart_lex/lib/com/atproto/server/refresh_session/main_status.freezed.dart +++ /dev/null @@ -1,312 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND -// coverage:ignore-file -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'main_status.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; -/// @nodoc -mixin _$ServerRefreshSessionStatus { - - Object get data; - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerRefreshSessionStatus&&const DeepCollectionEquality().equals(other.data, data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); - -@override -String toString() { - return 'ServerRefreshSessionStatus(data: $data)'; -} - - -} - -/// @nodoc -class $ServerRefreshSessionStatusCopyWith<$Res> { -$ServerRefreshSessionStatusCopyWith(ServerRefreshSessionStatus _, $Res Function(ServerRefreshSessionStatus) __); -} - - -/// Adds pattern-matching-related methods to [ServerRefreshSessionStatus]. -extension ServerRefreshSessionStatusPatterns on ServerRefreshSessionStatus { -/// A variant of `map` that fallback to returning `orElse`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeMap({TResult Function( ServerRefreshSessionStatusKnownValue value)? knownValue,TResult Function( ServerRefreshSessionStatusUnknown value)? unknown,required TResult orElse(),}){ -final _that = this; -switch (_that) { -case ServerRefreshSessionStatusKnownValue() when knownValue != null: -return knownValue(_that);case ServerRefreshSessionStatusUnknown() when unknown != null: -return unknown(_that);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// Callbacks receives the raw object, upcasted. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case final Subclass2 value: -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult map({required TResult Function( ServerRefreshSessionStatusKnownValue value) knownValue,required TResult Function( ServerRefreshSessionStatusUnknown value) unknown,}){ -final _that = this; -switch (_that) { -case ServerRefreshSessionStatusKnownValue(): -return knownValue(_that);case ServerRefreshSessionStatusUnknown(): -return unknown(_that);case _: - throw StateError('Unexpected subclass'); - -} -} -/// A variant of `map` that fallback to returning `null`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? mapOrNull({TResult? Function( ServerRefreshSessionStatusKnownValue value)? knownValue,TResult? Function( ServerRefreshSessionStatusUnknown value)? unknown,}){ -final _that = this; -switch (_that) { -case ServerRefreshSessionStatusKnownValue() when knownValue != null: -return knownValue(_that);case ServerRefreshSessionStatusUnknown() when unknown != null: -return unknown(_that);case _: - return null; - -} -} -/// A variant of `when` that fallback to an `orElse` callback. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeWhen({TResult Function( KnownServerRefreshSessionStatus data)? knownValue,TResult Function( String data)? unknown,required TResult orElse(),}) {final _that = this; -switch (_that) { -case ServerRefreshSessionStatusKnownValue() when knownValue != null: -return knownValue(_that.data);case ServerRefreshSessionStatusUnknown() when unknown != null: -return unknown(_that.data);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// As opposed to `map`, this offers destructuring. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case Subclass2(:final field2): -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult when({required TResult Function( KnownServerRefreshSessionStatus data) knownValue,required TResult Function( String data) unknown,}) {final _that = this; -switch (_that) { -case ServerRefreshSessionStatusKnownValue(): -return knownValue(_that.data);case ServerRefreshSessionStatusUnknown(): -return unknown(_that.data);case _: - throw StateError('Unexpected subclass'); - -} -} -/// A variant of `when` that fallback to returning `null` -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? whenOrNull({TResult? Function( KnownServerRefreshSessionStatus data)? knownValue,TResult? Function( String data)? unknown,}) {final _that = this; -switch (_that) { -case ServerRefreshSessionStatusKnownValue() when knownValue != null: -return knownValue(_that.data);case ServerRefreshSessionStatusUnknown() when unknown != null: -return unknown(_that.data);case _: - return null; - -} -} - -} - -/// @nodoc - - -class ServerRefreshSessionStatusKnownValue extends ServerRefreshSessionStatus { - const ServerRefreshSessionStatusKnownValue({required this.data}): super._(); - - -@override final KnownServerRefreshSessionStatus data; - -/// Create a copy of ServerRefreshSessionStatus -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$ServerRefreshSessionStatusKnownValueCopyWith get copyWith => _$ServerRefreshSessionStatusKnownValueCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerRefreshSessionStatusKnownValue&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'ServerRefreshSessionStatus.knownValue(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $ServerRefreshSessionStatusKnownValueCopyWith<$Res> implements $ServerRefreshSessionStatusCopyWith<$Res> { - factory $ServerRefreshSessionStatusKnownValueCopyWith(ServerRefreshSessionStatusKnownValue value, $Res Function(ServerRefreshSessionStatusKnownValue) _then) = _$ServerRefreshSessionStatusKnownValueCopyWithImpl; -@useResult -$Res call({ - KnownServerRefreshSessionStatus data -}); - - - - -} -/// @nodoc -class _$ServerRefreshSessionStatusKnownValueCopyWithImpl<$Res> - implements $ServerRefreshSessionStatusKnownValueCopyWith<$Res> { - _$ServerRefreshSessionStatusKnownValueCopyWithImpl(this._self, this._then); - - final ServerRefreshSessionStatusKnownValue _self; - final $Res Function(ServerRefreshSessionStatusKnownValue) _then; - -/// Create a copy of ServerRefreshSessionStatus -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(ServerRefreshSessionStatusKnownValue( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as KnownServerRefreshSessionStatus, - )); -} - - -} - -/// @nodoc - - -class ServerRefreshSessionStatusUnknown extends ServerRefreshSessionStatus { - const ServerRefreshSessionStatusUnknown({required this.data}): super._(); - - -@override final String data; - -/// Create a copy of ServerRefreshSessionStatus -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$ServerRefreshSessionStatusUnknownCopyWith get copyWith => _$ServerRefreshSessionStatusUnknownCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerRefreshSessionStatusUnknown&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'ServerRefreshSessionStatus.unknown(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $ServerRefreshSessionStatusUnknownCopyWith<$Res> implements $ServerRefreshSessionStatusCopyWith<$Res> { - factory $ServerRefreshSessionStatusUnknownCopyWith(ServerRefreshSessionStatusUnknown value, $Res Function(ServerRefreshSessionStatusUnknown) _then) = _$ServerRefreshSessionStatusUnknownCopyWithImpl; -@useResult -$Res call({ - String data -}); - - - - -} -/// @nodoc -class _$ServerRefreshSessionStatusUnknownCopyWithImpl<$Res> - implements $ServerRefreshSessionStatusUnknownCopyWith<$Res> { - _$ServerRefreshSessionStatusUnknownCopyWithImpl(this._self, this._then); - - final ServerRefreshSessionStatusUnknown _self; - final $Res Function(ServerRefreshSessionStatusUnknown) _then; - -/// Create a copy of ServerRefreshSessionStatus -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(ServerRefreshSessionStatusUnknown( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as String, - )); -} - - -} - -// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/server/refresh_session/output.dart b/packages/poptart_lex/lib/com/atproto/server/refresh_session/output.dart index 6941dd5e3..c8b0c0538 100644 --- a/packages/poptart_lex/lib/com/atproto/server/refresh_session/output.dart +++ b/packages/poptart_lex/lib/com/atproto/server/refresh_session/output.dart @@ -7,7 +7,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:poptart_core/poptart_core.dart'; import 'package:poptart_core/internals.dart'; -import './main_status.dart'; +import './main_output_status.dart'; part 'output.freezed.dart'; part 'output.g.dart'; @@ -44,7 +44,8 @@ abstract class ServerRefreshSessionOutput with _$ServerRefreshSessionOutput { bool? active, /// Hosting status of the account. If not specified, then assume 'active'. - @ServerRefreshSessionStatusConverter() ServerRefreshSessionStatus? status, + @ServerRefreshSessionOutputStatusConverter() + ServerRefreshSessionOutputStatus? status, Map? $unknown, }) = _ServerRefreshSessionOutput; diff --git a/packages/poptart_lex/lib/com/atproto/server/refresh_session/output.freezed.dart b/packages/poptart_lex/lib/com/atproto/server/refresh_session/output.freezed.dart index 9c664bff9..304bdc64d 100644 --- a/packages/poptart_lex/lib/com/atproto/server/refresh_session/output.freezed.dart +++ b/packages/poptart_lex/lib/com/atproto/server/refresh_session/output.freezed.dart @@ -16,7 +16,7 @@ T _$identity(T value) => value; mixin _$ServerRefreshSessionOutput { String get accessJwt; String get refreshJwt; String get handle; String get did; Map? get didDoc; String? get email; bool? get emailConfirmed; bool? get emailAuthFactor; bool? get active;/// Hosting status of the account. If not specified, then assume 'active'. -@ServerRefreshSessionStatusConverter() ServerRefreshSessionStatus? get status; Map? get $unknown; +@ServerRefreshSessionOutputStatusConverter() ServerRefreshSessionOutputStatus? get status; Map? get $unknown; /// Create a copy of ServerRefreshSessionOutput /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -49,11 +49,11 @@ abstract mixin class $ServerRefreshSessionOutputCopyWith<$Res> { factory $ServerRefreshSessionOutputCopyWith(ServerRefreshSessionOutput value, $Res Function(ServerRefreshSessionOutput) _then) = _$ServerRefreshSessionOutputCopyWithImpl; @useResult $Res call({ - String accessJwt, String refreshJwt, String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active,@ServerRefreshSessionStatusConverter() ServerRefreshSessionStatus? status, Map? $unknown + String accessJwt, String refreshJwt, String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active,@ServerRefreshSessionOutputStatusConverter() ServerRefreshSessionOutputStatus? status, Map? $unknown }); -$ServerRefreshSessionStatusCopyWith<$Res>? get status; +$ServerRefreshSessionOutputStatusCopyWith<$Res>? get status; } /// @nodoc @@ -78,7 +78,7 @@ as String?,emailConfirmed: freezed == emailConfirmed ? _self.emailConfirmed : em as bool?,emailAuthFactor: freezed == emailAuthFactor ? _self.emailAuthFactor : emailAuthFactor // ignore: cast_nullable_to_non_nullable as bool?,active: freezed == active ? _self.active : active // ignore: cast_nullable_to_non_nullable as bool?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable -as ServerRefreshSessionStatus?,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable +as ServerRefreshSessionOutputStatus?,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); } @@ -86,12 +86,12 @@ as Map?, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$ServerRefreshSessionStatusCopyWith<$Res>? get status { +$ServerRefreshSessionOutputStatusCopyWith<$Res>? get status { if (_self.status == null) { return null; } - return $ServerRefreshSessionStatusCopyWith<$Res>(_self.status!, (value) { + return $ServerRefreshSessionOutputStatusCopyWith<$Res>(_self.status!, (value) { return _then(_self.copyWith(status: value)); }); } @@ -176,7 +176,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String accessJwt, String refreshJwt, String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active, @ServerRefreshSessionStatusConverter() ServerRefreshSessionStatus? status, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String accessJwt, String refreshJwt, String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active, @ServerRefreshSessionOutputStatusConverter() ServerRefreshSessionOutputStatus? status, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _ServerRefreshSessionOutput() when $default != null: return $default(_that.accessJwt,_that.refreshJwt,_that.handle,_that.did,_that.didDoc,_that.email,_that.emailConfirmed,_that.emailAuthFactor,_that.active,_that.status,_that.$unknown);case _: @@ -197,7 +197,7 @@ return $default(_that.accessJwt,_that.refreshJwt,_that.handle,_that.did,_that.di /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String accessJwt, String refreshJwt, String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active, @ServerRefreshSessionStatusConverter() ServerRefreshSessionStatus? status, Map? $unknown) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String accessJwt, String refreshJwt, String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active, @ServerRefreshSessionOutputStatusConverter() ServerRefreshSessionOutputStatus? status, Map? $unknown) $default,) {final _that = this; switch (_that) { case _ServerRefreshSessionOutput(): return $default(_that.accessJwt,_that.refreshJwt,_that.handle,_that.did,_that.didDoc,_that.email,_that.emailConfirmed,_that.emailAuthFactor,_that.active,_that.status,_that.$unknown);case _: @@ -217,7 +217,7 @@ return $default(_that.accessJwt,_that.refreshJwt,_that.handle,_that.did,_that.di /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String accessJwt, String refreshJwt, String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active, @ServerRefreshSessionStatusConverter() ServerRefreshSessionStatus? status, Map? $unknown)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String accessJwt, String refreshJwt, String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active, @ServerRefreshSessionOutputStatusConverter() ServerRefreshSessionOutputStatus? status, Map? $unknown)? $default,) {final _that = this; switch (_that) { case _ServerRefreshSessionOutput() when $default != null: return $default(_that.accessJwt,_that.refreshJwt,_that.handle,_that.did,_that.didDoc,_that.email,_that.emailConfirmed,_that.emailAuthFactor,_that.active,_that.status,_that.$unknown);case _: @@ -232,7 +232,7 @@ return $default(_that.accessJwt,_that.refreshJwt,_that.handle,_that.did,_that.di @JsonSerializable(includeIfNull: false) class _ServerRefreshSessionOutput implements ServerRefreshSessionOutput { - const _ServerRefreshSessionOutput({required this.accessJwt, required this.refreshJwt, required this.handle, required this.did, final Map? didDoc, this.email, this.emailConfirmed, this.emailAuthFactor, this.active, @ServerRefreshSessionStatusConverter() this.status, final Map? $unknown}): _didDoc = didDoc,_$unknown = $unknown; + const _ServerRefreshSessionOutput({required this.accessJwt, required this.refreshJwt, required this.handle, required this.did, final Map? didDoc, this.email, this.emailConfirmed, this.emailAuthFactor, this.active, @ServerRefreshSessionOutputStatusConverter() this.status, final Map? $unknown}): _didDoc = didDoc,_$unknown = $unknown; factory _ServerRefreshSessionOutput.fromJson(Map json) => _$ServerRefreshSessionOutputFromJson(json); @override final String accessJwt; @@ -253,7 +253,7 @@ class _ServerRefreshSessionOutput implements ServerRefreshSessionOutput { @override final bool? emailAuthFactor; @override final bool? active; /// Hosting status of the account. If not specified, then assume 'active'. -@override@ServerRefreshSessionStatusConverter() final ServerRefreshSessionStatus? status; +@override@ServerRefreshSessionOutputStatusConverter() final ServerRefreshSessionOutputStatus? status; final Map? _$unknown; @override Map? get $unknown { final value = _$unknown; @@ -297,11 +297,11 @@ abstract mixin class _$ServerRefreshSessionOutputCopyWith<$Res> implements $Serv factory _$ServerRefreshSessionOutputCopyWith(_ServerRefreshSessionOutput value, $Res Function(_ServerRefreshSessionOutput) _then) = __$ServerRefreshSessionOutputCopyWithImpl; @override @useResult $Res call({ - String accessJwt, String refreshJwt, String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active,@ServerRefreshSessionStatusConverter() ServerRefreshSessionStatus? status, Map? $unknown + String accessJwt, String refreshJwt, String handle, String did, Map? didDoc, String? email, bool? emailConfirmed, bool? emailAuthFactor, bool? active,@ServerRefreshSessionOutputStatusConverter() ServerRefreshSessionOutputStatus? status, Map? $unknown }); -@override $ServerRefreshSessionStatusCopyWith<$Res>? get status; +@override $ServerRefreshSessionOutputStatusCopyWith<$Res>? get status; } /// @nodoc @@ -326,7 +326,7 @@ as String?,emailConfirmed: freezed == emailConfirmed ? _self.emailConfirmed : em as bool?,emailAuthFactor: freezed == emailAuthFactor ? _self.emailAuthFactor : emailAuthFactor // ignore: cast_nullable_to_non_nullable as bool?,active: freezed == active ? _self.active : active // ignore: cast_nullable_to_non_nullable as bool?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable -as ServerRefreshSessionStatus?,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable +as ServerRefreshSessionOutputStatus?,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); } @@ -335,12 +335,12 @@ as Map?, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$ServerRefreshSessionStatusCopyWith<$Res>? get status { +$ServerRefreshSessionOutputStatusCopyWith<$Res>? get status { if (_self.status == null) { return null; } - return $ServerRefreshSessionStatusCopyWith<$Res>(_self.status!, (value) { + return $ServerRefreshSessionOutputStatusCopyWith<$Res>(_self.status!, (value) { return _then(_self.copyWith(status: value)); }); } diff --git a/packages/poptart_lex/lib/com/atproto/server/refresh_session/output.g.dart b/packages/poptart_lex/lib/com/atproto/server/refresh_session/output.g.dart index d360d4acf..07d897454 100644 --- a/packages/poptart_lex/lib/com/atproto/server/refresh_session/output.g.dart +++ b/packages/poptart_lex/lib/com/atproto/server/refresh_session/output.g.dart @@ -25,10 +25,11 @@ _ServerRefreshSessionOutput _$ServerRefreshSessionOutputFromJson(Map json) => active: $checkedConvert('active', (v) => v as bool?), status: $checkedConvert( 'status', - (v) => _$JsonConverterFromJson( - v, - const ServerRefreshSessionStatusConverter().fromJson, - ), + (v) => + _$JsonConverterFromJson( + v, + const ServerRefreshSessionOutputStatusConverter().fromJson, + ), ), $unknown: $checkedConvert( r'$unknown', @@ -50,9 +51,9 @@ Map _$ServerRefreshSessionOutputToJson( 'emailConfirmed': ?instance.emailConfirmed, 'emailAuthFactor': ?instance.emailAuthFactor, 'active': ?instance.active, - 'status': ?_$JsonConverterToJson( + 'status': ?_$JsonConverterToJson( instance.status, - const ServerRefreshSessionStatusConverter().toJson, + const ServerRefreshSessionOutputStatusConverter().toJson, ), r'$unknown': ?instance.$unknown, }; diff --git a/packages/poptart_lex/lib/com/atproto/sync/get_repo_status.dart b/packages/poptart_lex/lib/com/atproto/sync/get_repo_status.dart index be0e7e7af..3b25ad064 100644 --- a/packages/poptart_lex/lib/com/atproto/sync/get_repo_status.dart +++ b/packages/poptart_lex/lib/com/atproto/sync/get_repo_status.dart @@ -9,5 +9,5 @@ export 'get_repo_status/descriptor.dart'; export 'get_repo_status/input.dart'; -export 'get_repo_status/main_status.dart'; +export 'get_repo_status/main_output_status.dart'; export 'get_repo_status/output.dart'; diff --git a/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/main_output_status.dart b/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/main_output_status.dart new file mode 100644 index 000000000..00f6ea501 --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/main_output_status.dart @@ -0,0 +1,110 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, unused_import, duplicate_import, unnecessary_cast, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +import 'package:poptart_core/poptart_core.dart' show Serializable; +import 'package:poptart_core/internals.dart' show isA; + +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'main_output_status.freezed.dart'; + +// ************************************************************************** +// LexGenerator +// ************************************************************************** + +@freezed +abstract class SyncGetRepoStatusOutputStatus + with _$SyncGetRepoStatusOutputStatus { + const SyncGetRepoStatusOutputStatus._(); + + const factory SyncGetRepoStatusOutputStatus.knownValue({ + required KnownSyncGetRepoStatusOutputStatus data, + }) = SyncGetRepoStatusOutputStatusKnownValue; + + const factory SyncGetRepoStatusOutputStatus.unknown({required String data}) = + SyncGetRepoStatusOutputStatusUnknown; + + static SyncGetRepoStatusOutputStatus? valueOf(final String? value) { + if (value == null) return null; + final knownValue = KnownSyncGetRepoStatusOutputStatus.valueOf(value); + + return knownValue != null + ? SyncGetRepoStatusOutputStatus.knownValue(data: knownValue) + : SyncGetRepoStatusOutputStatus.unknown(data: value); + } + + String toJson() => + const SyncGetRepoStatusOutputStatusConverter().toJson(this); +} + +extension SyncGetRepoStatusOutputStatusExtension + on SyncGetRepoStatusOutputStatus { + bool get isKnownValue => isA(this); + bool get isNotKnownValue => !isKnownValue; + KnownSyncGetRepoStatusOutputStatus? get knownValue => + isKnownValue ? data as KnownSyncGetRepoStatusOutputStatus : null; + bool get isUnknown => isA(this); + bool get isNotUnknown => !isUnknown; + String? get unknown => isUnknown ? data as String : null; +} + +final class SyncGetRepoStatusOutputStatusConverter + extends JsonConverter { + const SyncGetRepoStatusOutputStatusConverter(); + + @override + SyncGetRepoStatusOutputStatus fromJson(String json) { + try { + final knownValue = KnownSyncGetRepoStatusOutputStatus.valueOf(json); + if (knownValue != null) { + return SyncGetRepoStatusOutputStatus.knownValue(data: knownValue); + } + + return SyncGetRepoStatusOutputStatus.unknown(data: json); + } catch (_) { + return SyncGetRepoStatusOutputStatus.unknown(data: json); + } + } + + @override + String toJson(SyncGetRepoStatusOutputStatus object) => + object.when(knownValue: (data) => data.value, unknown: (data) => data); +} + +enum KnownSyncGetRepoStatusOutputStatus implements Serializable { + @JsonValue('takendown') + takendown('takendown'), + @JsonValue('suspended') + suspended('suspended'), + @JsonValue('deleted') + deleted('deleted'), + @JsonValue('deactivated') + deactivated('deactivated'), + @JsonValue('desynchronized') + desynchronized('desynchronized'), + @JsonValue('throttled') + throttled('throttled'); + + @override + final String value; + + const KnownSyncGetRepoStatusOutputStatus(this.value); + + static bool isKnownValue(final String value) { + return valueOf(value) != null; + } + + static KnownSyncGetRepoStatusOutputStatus? valueOf(final String? value) { + if (value == null) return null; + + for (final v in values) { + if (v.value == value) { + return v; + } + } + + return null; + } +} diff --git a/packages/poptart_lex/lib/com/atproto/repo/put_record/main_validation_status.freezed.dart b/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/main_output_status.freezed.dart similarity index 55% rename from packages/poptart_lex/lib/com/atproto/repo/put_record/main_validation_status.freezed.dart rename to packages/poptart_lex/lib/com/atproto/sync/get_repo_status/main_output_status.freezed.dart index 3171e66ee..4fdb70a72 100644 --- a/packages/poptart_lex/lib/com/atproto/repo/put_record/main_validation_status.freezed.dart +++ b/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/main_output_status.freezed.dart @@ -3,7 +3,7 @@ // ignore_for_file: type=lint // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark -part of 'main_validation_status.dart'; +part of 'main_output_status.dart'; // ************************************************************************** // FreezedGenerator @@ -12,7 +12,7 @@ part of 'main_validation_status.dart'; // dart format off T _$identity(T value) => value; /// @nodoc -mixin _$RepoPutRecordValidationStatus { +mixin _$SyncGetRepoStatusOutputStatus { Object get data; @@ -20,7 +20,7 @@ mixin _$RepoPutRecordValidationStatus { @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is RepoPutRecordValidationStatus&&const DeepCollectionEquality().equals(other.data, data)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is SyncGetRepoStatusOutputStatus&&const DeepCollectionEquality().equals(other.data, data)); } @@ -29,20 +29,20 @@ int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash( @override String toString() { - return 'RepoPutRecordValidationStatus(data: $data)'; + return 'SyncGetRepoStatusOutputStatus(data: $data)'; } } /// @nodoc -class $RepoPutRecordValidationStatusCopyWith<$Res> { -$RepoPutRecordValidationStatusCopyWith(RepoPutRecordValidationStatus _, $Res Function(RepoPutRecordValidationStatus) __); +class $SyncGetRepoStatusOutputStatusCopyWith<$Res> { +$SyncGetRepoStatusOutputStatusCopyWith(SyncGetRepoStatusOutputStatus _, $Res Function(SyncGetRepoStatusOutputStatus) __); } -/// Adds pattern-matching-related methods to [RepoPutRecordValidationStatus]. -extension RepoPutRecordValidationStatusPatterns on RepoPutRecordValidationStatus { +/// Adds pattern-matching-related methods to [SyncGetRepoStatusOutputStatus]. +extension SyncGetRepoStatusOutputStatusPatterns on SyncGetRepoStatusOutputStatus { /// A variant of `map` that fallback to returning `orElse`. /// /// It is equivalent to doing: @@ -55,11 +55,11 @@ extension RepoPutRecordValidationStatusPatterns on RepoPutRecordValidationStatus /// } /// ``` -@optionalTypeArgs TResult maybeMap({TResult Function( RepoPutRecordValidationStatusKnownValue value)? knownValue,TResult Function( RepoPutRecordValidationStatusUnknown value)? unknown,required TResult orElse(),}){ +@optionalTypeArgs TResult maybeMap({TResult Function( SyncGetRepoStatusOutputStatusKnownValue value)? knownValue,TResult Function( SyncGetRepoStatusOutputStatusUnknown value)? unknown,required TResult orElse(),}){ final _that = this; switch (_that) { -case RepoPutRecordValidationStatusKnownValue() when knownValue != null: -return knownValue(_that);case RepoPutRecordValidationStatusUnknown() when unknown != null: +case SyncGetRepoStatusOutputStatusKnownValue() when knownValue != null: +return knownValue(_that);case SyncGetRepoStatusOutputStatusUnknown() when unknown != null: return unknown(_that);case _: return orElse(); @@ -78,11 +78,11 @@ return unknown(_that);case _: /// } /// ``` -@optionalTypeArgs TResult map({required TResult Function( RepoPutRecordValidationStatusKnownValue value) knownValue,required TResult Function( RepoPutRecordValidationStatusUnknown value) unknown,}){ +@optionalTypeArgs TResult map({required TResult Function( SyncGetRepoStatusOutputStatusKnownValue value) knownValue,required TResult Function( SyncGetRepoStatusOutputStatusUnknown value) unknown,}){ final _that = this; switch (_that) { -case RepoPutRecordValidationStatusKnownValue(): -return knownValue(_that);case RepoPutRecordValidationStatusUnknown(): +case SyncGetRepoStatusOutputStatusKnownValue(): +return knownValue(_that);case SyncGetRepoStatusOutputStatusUnknown(): return unknown(_that);case _: throw StateError('Unexpected subclass'); @@ -100,11 +100,11 @@ return unknown(_that);case _: /// } /// ``` -@optionalTypeArgs TResult? mapOrNull({TResult? Function( RepoPutRecordValidationStatusKnownValue value)? knownValue,TResult? Function( RepoPutRecordValidationStatusUnknown value)? unknown,}){ +@optionalTypeArgs TResult? mapOrNull({TResult? Function( SyncGetRepoStatusOutputStatusKnownValue value)? knownValue,TResult? Function( SyncGetRepoStatusOutputStatusUnknown value)? unknown,}){ final _that = this; switch (_that) { -case RepoPutRecordValidationStatusKnownValue() when knownValue != null: -return knownValue(_that);case RepoPutRecordValidationStatusUnknown() when unknown != null: +case SyncGetRepoStatusOutputStatusKnownValue() when knownValue != null: +return knownValue(_that);case SyncGetRepoStatusOutputStatusUnknown() when unknown != null: return unknown(_that);case _: return null; @@ -122,10 +122,10 @@ return unknown(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen({TResult Function( KnownRepoPutRecordValidationStatus data)? knownValue,TResult Function( String data)? unknown,required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen({TResult Function( KnownSyncGetRepoStatusOutputStatus data)? knownValue,TResult Function( String data)? unknown,required TResult orElse(),}) {final _that = this; switch (_that) { -case RepoPutRecordValidationStatusKnownValue() when knownValue != null: -return knownValue(_that.data);case RepoPutRecordValidationStatusUnknown() when unknown != null: +case SyncGetRepoStatusOutputStatusKnownValue() when knownValue != null: +return knownValue(_that.data);case SyncGetRepoStatusOutputStatusUnknown() when unknown != null: return unknown(_that.data);case _: return orElse(); @@ -144,10 +144,10 @@ return unknown(_that.data);case _: /// } /// ``` -@optionalTypeArgs TResult when({required TResult Function( KnownRepoPutRecordValidationStatus data) knownValue,required TResult Function( String data) unknown,}) {final _that = this; +@optionalTypeArgs TResult when({required TResult Function( KnownSyncGetRepoStatusOutputStatus data) knownValue,required TResult Function( String data) unknown,}) {final _that = this; switch (_that) { -case RepoPutRecordValidationStatusKnownValue(): -return knownValue(_that.data);case RepoPutRecordValidationStatusUnknown(): +case SyncGetRepoStatusOutputStatusKnownValue(): +return knownValue(_that.data);case SyncGetRepoStatusOutputStatusUnknown(): return unknown(_that.data);case _: throw StateError('Unexpected subclass'); @@ -165,10 +165,10 @@ return unknown(_that.data);case _: /// } /// ``` -@optionalTypeArgs TResult? whenOrNull({TResult? Function( KnownRepoPutRecordValidationStatus data)? knownValue,TResult? Function( String data)? unknown,}) {final _that = this; +@optionalTypeArgs TResult? whenOrNull({TResult? Function( KnownSyncGetRepoStatusOutputStatus data)? knownValue,TResult? Function( String data)? unknown,}) {final _that = this; switch (_that) { -case RepoPutRecordValidationStatusKnownValue() when knownValue != null: -return knownValue(_that.data);case RepoPutRecordValidationStatusUnknown() when unknown != null: +case SyncGetRepoStatusOutputStatusKnownValue() when knownValue != null: +return knownValue(_that.data);case SyncGetRepoStatusOutputStatusUnknown() when unknown != null: return unknown(_that.data);case _: return null; @@ -180,23 +180,23 @@ return unknown(_that.data);case _: /// @nodoc -class RepoPutRecordValidationStatusKnownValue extends RepoPutRecordValidationStatus { - const RepoPutRecordValidationStatusKnownValue({required this.data}): super._(); +class SyncGetRepoStatusOutputStatusKnownValue extends SyncGetRepoStatusOutputStatus { + const SyncGetRepoStatusOutputStatusKnownValue({required this.data}): super._(); -@override final KnownRepoPutRecordValidationStatus data; +@override final KnownSyncGetRepoStatusOutputStatus data; -/// Create a copy of RepoPutRecordValidationStatus +/// Create a copy of SyncGetRepoStatusOutputStatus /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline') -$RepoPutRecordValidationStatusKnownValueCopyWith get copyWith => _$RepoPutRecordValidationStatusKnownValueCopyWithImpl(this, _$identity); +$SyncGetRepoStatusOutputStatusKnownValueCopyWith get copyWith => _$SyncGetRepoStatusOutputStatusKnownValueCopyWithImpl(this, _$identity); @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is RepoPutRecordValidationStatusKnownValue&&(identical(other.data, data) || other.data == data)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is SyncGetRepoStatusOutputStatusKnownValue&&(identical(other.data, data) || other.data == data)); } @@ -205,18 +205,18 @@ int get hashCode => Object.hash(runtimeType,data); @override String toString() { - return 'RepoPutRecordValidationStatus.knownValue(data: $data)'; + return 'SyncGetRepoStatusOutputStatus.knownValue(data: $data)'; } } /// @nodoc -abstract mixin class $RepoPutRecordValidationStatusKnownValueCopyWith<$Res> implements $RepoPutRecordValidationStatusCopyWith<$Res> { - factory $RepoPutRecordValidationStatusKnownValueCopyWith(RepoPutRecordValidationStatusKnownValue value, $Res Function(RepoPutRecordValidationStatusKnownValue) _then) = _$RepoPutRecordValidationStatusKnownValueCopyWithImpl; +abstract mixin class $SyncGetRepoStatusOutputStatusKnownValueCopyWith<$Res> implements $SyncGetRepoStatusOutputStatusCopyWith<$Res> { + factory $SyncGetRepoStatusOutputStatusKnownValueCopyWith(SyncGetRepoStatusOutputStatusKnownValue value, $Res Function(SyncGetRepoStatusOutputStatusKnownValue) _then) = _$SyncGetRepoStatusOutputStatusKnownValueCopyWithImpl; @useResult $Res call({ - KnownRepoPutRecordValidationStatus data + KnownSyncGetRepoStatusOutputStatus data }); @@ -224,19 +224,19 @@ $Res call({ } /// @nodoc -class _$RepoPutRecordValidationStatusKnownValueCopyWithImpl<$Res> - implements $RepoPutRecordValidationStatusKnownValueCopyWith<$Res> { - _$RepoPutRecordValidationStatusKnownValueCopyWithImpl(this._self, this._then); +class _$SyncGetRepoStatusOutputStatusKnownValueCopyWithImpl<$Res> + implements $SyncGetRepoStatusOutputStatusKnownValueCopyWith<$Res> { + _$SyncGetRepoStatusOutputStatusKnownValueCopyWithImpl(this._self, this._then); - final RepoPutRecordValidationStatusKnownValue _self; - final $Res Function(RepoPutRecordValidationStatusKnownValue) _then; + final SyncGetRepoStatusOutputStatusKnownValue _self; + final $Res Function(SyncGetRepoStatusOutputStatusKnownValue) _then; -/// Create a copy of RepoPutRecordValidationStatus +/// Create a copy of SyncGetRepoStatusOutputStatus /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(RepoPutRecordValidationStatusKnownValue( + return _then(SyncGetRepoStatusOutputStatusKnownValue( data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as KnownRepoPutRecordValidationStatus, +as KnownSyncGetRepoStatusOutputStatus, )); } @@ -246,23 +246,23 @@ as KnownRepoPutRecordValidationStatus, /// @nodoc -class RepoPutRecordValidationStatusUnknown extends RepoPutRecordValidationStatus { - const RepoPutRecordValidationStatusUnknown({required this.data}): super._(); +class SyncGetRepoStatusOutputStatusUnknown extends SyncGetRepoStatusOutputStatus { + const SyncGetRepoStatusOutputStatusUnknown({required this.data}): super._(); @override final String data; -/// Create a copy of RepoPutRecordValidationStatus +/// Create a copy of SyncGetRepoStatusOutputStatus /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @pragma('vm:prefer-inline') -$RepoPutRecordValidationStatusUnknownCopyWith get copyWith => _$RepoPutRecordValidationStatusUnknownCopyWithImpl(this, _$identity); +$SyncGetRepoStatusOutputStatusUnknownCopyWith get copyWith => _$SyncGetRepoStatusOutputStatusUnknownCopyWithImpl(this, _$identity); @override bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is RepoPutRecordValidationStatusUnknown&&(identical(other.data, data) || other.data == data)); + return identical(this, other) || (other.runtimeType == runtimeType&&other is SyncGetRepoStatusOutputStatusUnknown&&(identical(other.data, data) || other.data == data)); } @@ -271,15 +271,15 @@ int get hashCode => Object.hash(runtimeType,data); @override String toString() { - return 'RepoPutRecordValidationStatus.unknown(data: $data)'; + return 'SyncGetRepoStatusOutputStatus.unknown(data: $data)'; } } /// @nodoc -abstract mixin class $RepoPutRecordValidationStatusUnknownCopyWith<$Res> implements $RepoPutRecordValidationStatusCopyWith<$Res> { - factory $RepoPutRecordValidationStatusUnknownCopyWith(RepoPutRecordValidationStatusUnknown value, $Res Function(RepoPutRecordValidationStatusUnknown) _then) = _$RepoPutRecordValidationStatusUnknownCopyWithImpl; +abstract mixin class $SyncGetRepoStatusOutputStatusUnknownCopyWith<$Res> implements $SyncGetRepoStatusOutputStatusCopyWith<$Res> { + factory $SyncGetRepoStatusOutputStatusUnknownCopyWith(SyncGetRepoStatusOutputStatusUnknown value, $Res Function(SyncGetRepoStatusOutputStatusUnknown) _then) = _$SyncGetRepoStatusOutputStatusUnknownCopyWithImpl; @useResult $Res call({ String data @@ -290,17 +290,17 @@ $Res call({ } /// @nodoc -class _$RepoPutRecordValidationStatusUnknownCopyWithImpl<$Res> - implements $RepoPutRecordValidationStatusUnknownCopyWith<$Res> { - _$RepoPutRecordValidationStatusUnknownCopyWithImpl(this._self, this._then); +class _$SyncGetRepoStatusOutputStatusUnknownCopyWithImpl<$Res> + implements $SyncGetRepoStatusOutputStatusUnknownCopyWith<$Res> { + _$SyncGetRepoStatusOutputStatusUnknownCopyWithImpl(this._self, this._then); - final RepoPutRecordValidationStatusUnknown _self; - final $Res Function(RepoPutRecordValidationStatusUnknown) _then; + final SyncGetRepoStatusOutputStatusUnknown _self; + final $Res Function(SyncGetRepoStatusOutputStatusUnknown) _then; -/// Create a copy of RepoPutRecordValidationStatus +/// Create a copy of SyncGetRepoStatusOutputStatus /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(RepoPutRecordValidationStatusUnknown( + return _then(SyncGetRepoStatusOutputStatusUnknown( data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable as String, )); diff --git a/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/main_status.dart b/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/main_status.dart deleted file mode 100644 index cc4087c5a..000000000 --- a/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/main_status.dart +++ /dev/null @@ -1,107 +0,0 @@ -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, unused_import, duplicate_import, unnecessary_cast, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -import 'package:poptart_core/poptart_core.dart' show Serializable; -import 'package:poptart_core/internals.dart' show isA; - -import 'package:freezed_annotation/freezed_annotation.dart'; - -part 'main_status.freezed.dart'; - -// ************************************************************************** -// LexGenerator -// ************************************************************************** - -@freezed -abstract class SyncGetRepoStatusStatus with _$SyncGetRepoStatusStatus { - const SyncGetRepoStatusStatus._(); - - const factory SyncGetRepoStatusStatus.knownValue({ - required KnownSyncGetRepoStatusStatus data, - }) = SyncGetRepoStatusStatusKnownValue; - - const factory SyncGetRepoStatusStatus.unknown({required String data}) = - SyncGetRepoStatusStatusUnknown; - - static SyncGetRepoStatusStatus? valueOf(final String? value) { - if (value == null) return null; - final knownValue = KnownSyncGetRepoStatusStatus.valueOf(value); - - return knownValue != null - ? SyncGetRepoStatusStatus.knownValue(data: knownValue) - : SyncGetRepoStatusStatus.unknown(data: value); - } - - String toJson() => const SyncGetRepoStatusStatusConverter().toJson(this); -} - -extension SyncGetRepoStatusStatusExtension on SyncGetRepoStatusStatus { - bool get isKnownValue => isA(this); - bool get isNotKnownValue => !isKnownValue; - KnownSyncGetRepoStatusStatus? get knownValue => - isKnownValue ? data as KnownSyncGetRepoStatusStatus : null; - bool get isUnknown => isA(this); - bool get isNotUnknown => !isUnknown; - String? get unknown => isUnknown ? data as String : null; -} - -final class SyncGetRepoStatusStatusConverter - extends JsonConverter { - const SyncGetRepoStatusStatusConverter(); - - @override - SyncGetRepoStatusStatus fromJson(String json) { - try { - final knownValue = KnownSyncGetRepoStatusStatus.valueOf(json); - if (knownValue != null) { - return SyncGetRepoStatusStatus.knownValue(data: knownValue); - } - - return SyncGetRepoStatusStatus.unknown(data: json); - } catch (_) { - return SyncGetRepoStatusStatus.unknown(data: json); - } - } - - @override - String toJson(SyncGetRepoStatusStatus object) => - object.when(knownValue: (data) => data.value, unknown: (data) => data); -} - -enum KnownSyncGetRepoStatusStatus implements Serializable { - @JsonValue('takendown') - takendown('takendown'), - @JsonValue('suspended') - suspended('suspended'), - @JsonValue('deleted') - deleted('deleted'), - @JsonValue('deactivated') - deactivated('deactivated'), - @JsonValue('desynchronized') - desynchronized('desynchronized'), - @JsonValue('throttled') - throttled('throttled'); - - @override - final String value; - - const KnownSyncGetRepoStatusStatus(this.value); - - static bool isKnownValue(final String value) { - return valueOf(value) != null; - } - - static KnownSyncGetRepoStatusStatus? valueOf(final String? value) { - if (value == null) return null; - - for (final v in values) { - if (v.value == value) { - return v; - } - } - - return null; - } -} diff --git a/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/main_status.freezed.dart b/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/main_status.freezed.dart deleted file mode 100644 index f30ac240d..000000000 --- a/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/main_status.freezed.dart +++ /dev/null @@ -1,312 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND -// coverage:ignore-file -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'main_status.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; -/// @nodoc -mixin _$SyncGetRepoStatusStatus { - - Object get data; - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is SyncGetRepoStatusStatus&&const DeepCollectionEquality().equals(other.data, data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); - -@override -String toString() { - return 'SyncGetRepoStatusStatus(data: $data)'; -} - - -} - -/// @nodoc -class $SyncGetRepoStatusStatusCopyWith<$Res> { -$SyncGetRepoStatusStatusCopyWith(SyncGetRepoStatusStatus _, $Res Function(SyncGetRepoStatusStatus) __); -} - - -/// Adds pattern-matching-related methods to [SyncGetRepoStatusStatus]. -extension SyncGetRepoStatusStatusPatterns on SyncGetRepoStatusStatus { -/// A variant of `map` that fallback to returning `orElse`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeMap({TResult Function( SyncGetRepoStatusStatusKnownValue value)? knownValue,TResult Function( SyncGetRepoStatusStatusUnknown value)? unknown,required TResult orElse(),}){ -final _that = this; -switch (_that) { -case SyncGetRepoStatusStatusKnownValue() when knownValue != null: -return knownValue(_that);case SyncGetRepoStatusStatusUnknown() when unknown != null: -return unknown(_that);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// Callbacks receives the raw object, upcasted. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case final Subclass2 value: -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult map({required TResult Function( SyncGetRepoStatusStatusKnownValue value) knownValue,required TResult Function( SyncGetRepoStatusStatusUnknown value) unknown,}){ -final _that = this; -switch (_that) { -case SyncGetRepoStatusStatusKnownValue(): -return knownValue(_that);case SyncGetRepoStatusStatusUnknown(): -return unknown(_that);case _: - throw StateError('Unexpected subclass'); - -} -} -/// A variant of `map` that fallback to returning `null`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? mapOrNull({TResult? Function( SyncGetRepoStatusStatusKnownValue value)? knownValue,TResult? Function( SyncGetRepoStatusStatusUnknown value)? unknown,}){ -final _that = this; -switch (_that) { -case SyncGetRepoStatusStatusKnownValue() when knownValue != null: -return knownValue(_that);case SyncGetRepoStatusStatusUnknown() when unknown != null: -return unknown(_that);case _: - return null; - -} -} -/// A variant of `when` that fallback to an `orElse` callback. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeWhen({TResult Function( KnownSyncGetRepoStatusStatus data)? knownValue,TResult Function( String data)? unknown,required TResult orElse(),}) {final _that = this; -switch (_that) { -case SyncGetRepoStatusStatusKnownValue() when knownValue != null: -return knownValue(_that.data);case SyncGetRepoStatusStatusUnknown() when unknown != null: -return unknown(_that.data);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// As opposed to `map`, this offers destructuring. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case Subclass2(:final field2): -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult when({required TResult Function( KnownSyncGetRepoStatusStatus data) knownValue,required TResult Function( String data) unknown,}) {final _that = this; -switch (_that) { -case SyncGetRepoStatusStatusKnownValue(): -return knownValue(_that.data);case SyncGetRepoStatusStatusUnknown(): -return unknown(_that.data);case _: - throw StateError('Unexpected subclass'); - -} -} -/// A variant of `when` that fallback to returning `null` -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? whenOrNull({TResult? Function( KnownSyncGetRepoStatusStatus data)? knownValue,TResult? Function( String data)? unknown,}) {final _that = this; -switch (_that) { -case SyncGetRepoStatusStatusKnownValue() when knownValue != null: -return knownValue(_that.data);case SyncGetRepoStatusStatusUnknown() when unknown != null: -return unknown(_that.data);case _: - return null; - -} -} - -} - -/// @nodoc - - -class SyncGetRepoStatusStatusKnownValue extends SyncGetRepoStatusStatus { - const SyncGetRepoStatusStatusKnownValue({required this.data}): super._(); - - -@override final KnownSyncGetRepoStatusStatus data; - -/// Create a copy of SyncGetRepoStatusStatus -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$SyncGetRepoStatusStatusKnownValueCopyWith get copyWith => _$SyncGetRepoStatusStatusKnownValueCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is SyncGetRepoStatusStatusKnownValue&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'SyncGetRepoStatusStatus.knownValue(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $SyncGetRepoStatusStatusKnownValueCopyWith<$Res> implements $SyncGetRepoStatusStatusCopyWith<$Res> { - factory $SyncGetRepoStatusStatusKnownValueCopyWith(SyncGetRepoStatusStatusKnownValue value, $Res Function(SyncGetRepoStatusStatusKnownValue) _then) = _$SyncGetRepoStatusStatusKnownValueCopyWithImpl; -@useResult -$Res call({ - KnownSyncGetRepoStatusStatus data -}); - - - - -} -/// @nodoc -class _$SyncGetRepoStatusStatusKnownValueCopyWithImpl<$Res> - implements $SyncGetRepoStatusStatusKnownValueCopyWith<$Res> { - _$SyncGetRepoStatusStatusKnownValueCopyWithImpl(this._self, this._then); - - final SyncGetRepoStatusStatusKnownValue _self; - final $Res Function(SyncGetRepoStatusStatusKnownValue) _then; - -/// Create a copy of SyncGetRepoStatusStatus -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(SyncGetRepoStatusStatusKnownValue( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as KnownSyncGetRepoStatusStatus, - )); -} - - -} - -/// @nodoc - - -class SyncGetRepoStatusStatusUnknown extends SyncGetRepoStatusStatus { - const SyncGetRepoStatusStatusUnknown({required this.data}): super._(); - - -@override final String data; - -/// Create a copy of SyncGetRepoStatusStatus -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$SyncGetRepoStatusStatusUnknownCopyWith get copyWith => _$SyncGetRepoStatusStatusUnknownCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is SyncGetRepoStatusStatusUnknown&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'SyncGetRepoStatusStatus.unknown(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $SyncGetRepoStatusStatusUnknownCopyWith<$Res> implements $SyncGetRepoStatusStatusCopyWith<$Res> { - factory $SyncGetRepoStatusStatusUnknownCopyWith(SyncGetRepoStatusStatusUnknown value, $Res Function(SyncGetRepoStatusStatusUnknown) _then) = _$SyncGetRepoStatusStatusUnknownCopyWithImpl; -@useResult -$Res call({ - String data -}); - - - - -} -/// @nodoc -class _$SyncGetRepoStatusStatusUnknownCopyWithImpl<$Res> - implements $SyncGetRepoStatusStatusUnknownCopyWith<$Res> { - _$SyncGetRepoStatusStatusUnknownCopyWithImpl(this._self, this._then); - - final SyncGetRepoStatusStatusUnknown _self; - final $Res Function(SyncGetRepoStatusStatusUnknown) _then; - -/// Create a copy of SyncGetRepoStatusStatus -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(SyncGetRepoStatusStatusUnknown( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as String, - )); -} - - -} - -// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/output.dart b/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/output.dart index 53dcd4e08..5ff142c1a 100644 --- a/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/output.dart +++ b/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/output.dart @@ -7,7 +7,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:poptart_core/poptart_core.dart'; import 'package:poptart_core/internals.dart'; -import './main_status.dart'; +import './main_output_status.dart'; part 'output.freezed.dart'; part 'output.g.dart'; @@ -26,7 +26,8 @@ abstract class SyncGetRepoStatusOutput with _$SyncGetRepoStatusOutput { required bool active, /// If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. - @SyncGetRepoStatusStatusConverter() SyncGetRepoStatusStatus? status, + @SyncGetRepoStatusOutputStatusConverter() + SyncGetRepoStatusOutputStatus? status, /// Optional field, the current rev of the repo, if active=true String? rev, diff --git a/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/output.freezed.dart b/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/output.freezed.dart index e717cd016..c6f793c06 100644 --- a/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/output.freezed.dart +++ b/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/output.freezed.dart @@ -16,7 +16,7 @@ T _$identity(T value) => value; mixin _$SyncGetRepoStatusOutput { String get did; bool get active;/// If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. -@SyncGetRepoStatusStatusConverter() SyncGetRepoStatusStatus? get status;/// Optional field, the current rev of the repo, if active=true +@SyncGetRepoStatusOutputStatusConverter() SyncGetRepoStatusOutputStatus? get status;/// Optional field, the current rev of the repo, if active=true String? get rev; Map? get $unknown; /// Create a copy of SyncGetRepoStatusOutput /// with the given fields replaced by the non-null parameter values. @@ -50,11 +50,11 @@ abstract mixin class $SyncGetRepoStatusOutputCopyWith<$Res> { factory $SyncGetRepoStatusOutputCopyWith(SyncGetRepoStatusOutput value, $Res Function(SyncGetRepoStatusOutput) _then) = _$SyncGetRepoStatusOutputCopyWithImpl; @useResult $Res call({ - String did, bool active,@SyncGetRepoStatusStatusConverter() SyncGetRepoStatusStatus? status, String? rev, Map? $unknown + String did, bool active,@SyncGetRepoStatusOutputStatusConverter() SyncGetRepoStatusOutputStatus? status, String? rev, Map? $unknown }); -$SyncGetRepoStatusStatusCopyWith<$Res>? get status; +$SyncGetRepoStatusOutputStatusCopyWith<$Res>? get status; } /// @nodoc @@ -72,7 +72,7 @@ class _$SyncGetRepoStatusOutputCopyWithImpl<$Res> did: null == did ? _self.did : did // ignore: cast_nullable_to_non_nullable as String,active: null == active ? _self.active : active // ignore: cast_nullable_to_non_nullable as bool,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable -as SyncGetRepoStatusStatus?,rev: freezed == rev ? _self.rev : rev // ignore: cast_nullable_to_non_nullable +as SyncGetRepoStatusOutputStatus?,rev: freezed == rev ? _self.rev : rev // ignore: cast_nullable_to_non_nullable as String?,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); @@ -81,12 +81,12 @@ as Map?, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$SyncGetRepoStatusStatusCopyWith<$Res>? get status { +$SyncGetRepoStatusOutputStatusCopyWith<$Res>? get status { if (_self.status == null) { return null; } - return $SyncGetRepoStatusStatusCopyWith<$Res>(_self.status!, (value) { + return $SyncGetRepoStatusOutputStatusCopyWith<$Res>(_self.status!, (value) { return _then(_self.copyWith(status: value)); }); } @@ -171,7 +171,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String did, bool active, @SyncGetRepoStatusStatusConverter() SyncGetRepoStatusStatus? status, String? rev, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String did, bool active, @SyncGetRepoStatusOutputStatusConverter() SyncGetRepoStatusOutputStatus? status, String? rev, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _SyncGetRepoStatusOutput() when $default != null: return $default(_that.did,_that.active,_that.status,_that.rev,_that.$unknown);case _: @@ -192,7 +192,7 @@ return $default(_that.did,_that.active,_that.status,_that.rev,_that.$unknown);ca /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String did, bool active, @SyncGetRepoStatusStatusConverter() SyncGetRepoStatusStatus? status, String? rev, Map? $unknown) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String did, bool active, @SyncGetRepoStatusOutputStatusConverter() SyncGetRepoStatusOutputStatus? status, String? rev, Map? $unknown) $default,) {final _that = this; switch (_that) { case _SyncGetRepoStatusOutput(): return $default(_that.did,_that.active,_that.status,_that.rev,_that.$unknown);case _: @@ -212,7 +212,7 @@ return $default(_that.did,_that.active,_that.status,_that.rev,_that.$unknown);ca /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String did, bool active, @SyncGetRepoStatusStatusConverter() SyncGetRepoStatusStatus? status, String? rev, Map? $unknown)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String did, bool active, @SyncGetRepoStatusOutputStatusConverter() SyncGetRepoStatusOutputStatus? status, String? rev, Map? $unknown)? $default,) {final _that = this; switch (_that) { case _SyncGetRepoStatusOutput() when $default != null: return $default(_that.did,_that.active,_that.status,_that.rev,_that.$unknown);case _: @@ -227,13 +227,13 @@ return $default(_that.did,_that.active,_that.status,_that.rev,_that.$unknown);ca @JsonSerializable(includeIfNull: false) class _SyncGetRepoStatusOutput implements SyncGetRepoStatusOutput { - const _SyncGetRepoStatusOutput({required this.did, required this.active, @SyncGetRepoStatusStatusConverter() this.status, this.rev, final Map? $unknown}): _$unknown = $unknown; + const _SyncGetRepoStatusOutput({required this.did, required this.active, @SyncGetRepoStatusOutputStatusConverter() this.status, this.rev, final Map? $unknown}): _$unknown = $unknown; factory _SyncGetRepoStatusOutput.fromJson(Map json) => _$SyncGetRepoStatusOutputFromJson(json); @override final String did; @override final bool active; /// If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted. -@override@SyncGetRepoStatusStatusConverter() final SyncGetRepoStatusStatus? status; +@override@SyncGetRepoStatusOutputStatusConverter() final SyncGetRepoStatusOutputStatus? status; /// Optional field, the current rev of the repo, if active=true @override final String? rev; final Map? _$unknown; @@ -279,11 +279,11 @@ abstract mixin class _$SyncGetRepoStatusOutputCopyWith<$Res> implements $SyncGet factory _$SyncGetRepoStatusOutputCopyWith(_SyncGetRepoStatusOutput value, $Res Function(_SyncGetRepoStatusOutput) _then) = __$SyncGetRepoStatusOutputCopyWithImpl; @override @useResult $Res call({ - String did, bool active,@SyncGetRepoStatusStatusConverter() SyncGetRepoStatusStatus? status, String? rev, Map? $unknown + String did, bool active,@SyncGetRepoStatusOutputStatusConverter() SyncGetRepoStatusOutputStatus? status, String? rev, Map? $unknown }); -@override $SyncGetRepoStatusStatusCopyWith<$Res>? get status; +@override $SyncGetRepoStatusOutputStatusCopyWith<$Res>? get status; } /// @nodoc @@ -301,7 +301,7 @@ class __$SyncGetRepoStatusOutputCopyWithImpl<$Res> did: null == did ? _self.did : did // ignore: cast_nullable_to_non_nullable as String,active: null == active ? _self.active : active // ignore: cast_nullable_to_non_nullable as bool,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable -as SyncGetRepoStatusStatus?,rev: freezed == rev ? _self.rev : rev // ignore: cast_nullable_to_non_nullable +as SyncGetRepoStatusOutputStatus?,rev: freezed == rev ? _self.rev : rev // ignore: cast_nullable_to_non_nullable as String?,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); @@ -311,12 +311,12 @@ as Map?, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$SyncGetRepoStatusStatusCopyWith<$Res>? get status { +$SyncGetRepoStatusOutputStatusCopyWith<$Res>? get status { if (_self.status == null) { return null; } - return $SyncGetRepoStatusStatusCopyWith<$Res>(_self.status!, (value) { + return $SyncGetRepoStatusOutputStatusCopyWith<$Res>(_self.status!, (value) { return _then(_self.copyWith(status: value)); }); } diff --git a/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/output.g.dart b/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/output.g.dart index 5e1425872..44ac59fc0 100644 --- a/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/output.g.dart +++ b/packages/poptart_lex/lib/com/atproto/sync/get_repo_status/output.g.dart @@ -15,9 +15,9 @@ _SyncGetRepoStatusOutput _$SyncGetRepoStatusOutputFromJson(Map json) => active: $checkedConvert('active', (v) => v as bool), status: $checkedConvert( 'status', - (v) => _$JsonConverterFromJson( + (v) => _$JsonConverterFromJson( v, - const SyncGetRepoStatusStatusConverter().fromJson, + const SyncGetRepoStatusOutputStatusConverter().fromJson, ), ), rev: $checkedConvert('rev', (v) => v as String?), @@ -34,9 +34,9 @@ Map _$SyncGetRepoStatusOutputToJson( ) => { 'did': instance.did, 'active': instance.active, - 'status': ?_$JsonConverterToJson( + 'status': ?_$JsonConverterToJson( instance.status, - const SyncGetRepoStatusStatusConverter().toJson, + const SyncGetRepoStatusOutputStatusConverter().toJson, ), 'rev': ?instance.rev, r'$unknown': ?instance.$unknown, diff --git a/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability.dart b/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability.dart index 82cace5ab..e633f1006 100644 --- a/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability.dart +++ b/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability.dart @@ -13,4 +13,4 @@ export 'check_handle_availability/output.dart'; export 'check_handle_availability/result_available.dart'; export 'check_handle_availability/result_unavailable.dart'; export 'check_handle_availability/suggestion.dart'; -export 'check_handle_availability/union_main_result.dart'; +export 'check_handle_availability/union_main_output_result.dart'; diff --git a/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/output.dart b/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/output.dart index e919a4287..c4e8bc07e 100644 --- a/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/output.dart +++ b/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/output.dart @@ -7,7 +7,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:poptart_core/poptart_core.dart'; import 'package:poptart_core/internals.dart'; -import './union_main_result.dart'; +import './union_main_output_result.dart'; part 'output.freezed.dart'; part 'output.g.dart'; @@ -25,8 +25,8 @@ abstract class TempCheckHandleAvailabilityOutput const factory TempCheckHandleAvailabilityOutput({ /// Echo of the input handle. required String handle, - @UTempCheckHandleAvailabilityResultConverter() - required UTempCheckHandleAvailabilityResult result, + @UTempCheckHandleAvailabilityOutputResultConverter() + required UTempCheckHandleAvailabilityOutputResult result, Map? $unknown, }) = _TempCheckHandleAvailabilityOutput; diff --git a/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/output.freezed.dart b/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/output.freezed.dart index 3911b9b2f..b03795d42 100644 --- a/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/output.freezed.dart +++ b/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/output.freezed.dart @@ -16,7 +16,7 @@ T _$identity(T value) => value; mixin _$TempCheckHandleAvailabilityOutput { /// Echo of the input handle. - String get handle;@UTempCheckHandleAvailabilityResultConverter() UTempCheckHandleAvailabilityResult get result; Map? get $unknown; + String get handle;@UTempCheckHandleAvailabilityOutputResultConverter() UTempCheckHandleAvailabilityOutputResult get result; Map? get $unknown; /// Create a copy of TempCheckHandleAvailabilityOutput /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @@ -49,11 +49,11 @@ abstract mixin class $TempCheckHandleAvailabilityOutputCopyWith<$Res> { factory $TempCheckHandleAvailabilityOutputCopyWith(TempCheckHandleAvailabilityOutput value, $Res Function(TempCheckHandleAvailabilityOutput) _then) = _$TempCheckHandleAvailabilityOutputCopyWithImpl; @useResult $Res call({ - String handle,@UTempCheckHandleAvailabilityResultConverter() UTempCheckHandleAvailabilityResult result, Map? $unknown + String handle,@UTempCheckHandleAvailabilityOutputResultConverter() UTempCheckHandleAvailabilityOutputResult result, Map? $unknown }); -$UTempCheckHandleAvailabilityResultCopyWith<$Res> get result; +$UTempCheckHandleAvailabilityOutputResultCopyWith<$Res> get result; } /// @nodoc @@ -70,7 +70,7 @@ class _$TempCheckHandleAvailabilityOutputCopyWithImpl<$Res> return _then(_self.copyWith( handle: null == handle ? _self.handle : handle // ignore: cast_nullable_to_non_nullable as String,result: null == result ? _self.result : result // ignore: cast_nullable_to_non_nullable -as UTempCheckHandleAvailabilityResult,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable +as UTempCheckHandleAvailabilityOutputResult,$unknown: freezed == $unknown ? _self.$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); } @@ -78,9 +78,9 @@ as Map?, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$UTempCheckHandleAvailabilityResultCopyWith<$Res> get result { +$UTempCheckHandleAvailabilityOutputResultCopyWith<$Res> get result { - return $UTempCheckHandleAvailabilityResultCopyWith<$Res>(_self.result, (value) { + return $UTempCheckHandleAvailabilityOutputResultCopyWith<$Res>(_self.result, (value) { return _then(_self.copyWith(result: value)); }); } @@ -165,7 +165,7 @@ return $default(_that);case _: /// } /// ``` -@optionalTypeArgs TResult maybeWhen(TResult Function( String handle, @UTempCheckHandleAvailabilityResultConverter() UTempCheckHandleAvailabilityResult result, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; +@optionalTypeArgs TResult maybeWhen(TResult Function( String handle, @UTempCheckHandleAvailabilityOutputResultConverter() UTempCheckHandleAvailabilityOutputResult result, Map? $unknown)? $default,{required TResult orElse(),}) {final _that = this; switch (_that) { case _TempCheckHandleAvailabilityOutput() when $default != null: return $default(_that.handle,_that.result,_that.$unknown);case _: @@ -186,7 +186,7 @@ return $default(_that.handle,_that.result,_that.$unknown);case _: /// } /// ``` -@optionalTypeArgs TResult when(TResult Function( String handle, @UTempCheckHandleAvailabilityResultConverter() UTempCheckHandleAvailabilityResult result, Map? $unknown) $default,) {final _that = this; +@optionalTypeArgs TResult when(TResult Function( String handle, @UTempCheckHandleAvailabilityOutputResultConverter() UTempCheckHandleAvailabilityOutputResult result, Map? $unknown) $default,) {final _that = this; switch (_that) { case _TempCheckHandleAvailabilityOutput(): return $default(_that.handle,_that.result,_that.$unknown);case _: @@ -206,7 +206,7 @@ return $default(_that.handle,_that.result,_that.$unknown);case _: /// } /// ``` -@optionalTypeArgs TResult? whenOrNull(TResult? Function( String handle, @UTempCheckHandleAvailabilityResultConverter() UTempCheckHandleAvailabilityResult result, Map? $unknown)? $default,) {final _that = this; +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String handle, @UTempCheckHandleAvailabilityOutputResultConverter() UTempCheckHandleAvailabilityOutputResult result, Map? $unknown)? $default,) {final _that = this; switch (_that) { case _TempCheckHandleAvailabilityOutput() when $default != null: return $default(_that.handle,_that.result,_that.$unknown);case _: @@ -221,12 +221,12 @@ return $default(_that.handle,_that.result,_that.$unknown);case _: @JsonSerializable(includeIfNull: false) class _TempCheckHandleAvailabilityOutput implements TempCheckHandleAvailabilityOutput { - const _TempCheckHandleAvailabilityOutput({required this.handle, @UTempCheckHandleAvailabilityResultConverter() required this.result, final Map? $unknown}): _$unknown = $unknown; + const _TempCheckHandleAvailabilityOutput({required this.handle, @UTempCheckHandleAvailabilityOutputResultConverter() required this.result, final Map? $unknown}): _$unknown = $unknown; factory _TempCheckHandleAvailabilityOutput.fromJson(Map json) => _$TempCheckHandleAvailabilityOutputFromJson(json); /// Echo of the input handle. @override final String handle; -@override@UTempCheckHandleAvailabilityResultConverter() final UTempCheckHandleAvailabilityResult result; +@override@UTempCheckHandleAvailabilityOutputResultConverter() final UTempCheckHandleAvailabilityOutputResult result; final Map? _$unknown; @override Map? get $unknown { final value = _$unknown; @@ -270,11 +270,11 @@ abstract mixin class _$TempCheckHandleAvailabilityOutputCopyWith<$Res> implement factory _$TempCheckHandleAvailabilityOutputCopyWith(_TempCheckHandleAvailabilityOutput value, $Res Function(_TempCheckHandleAvailabilityOutput) _then) = __$TempCheckHandleAvailabilityOutputCopyWithImpl; @override @useResult $Res call({ - String handle,@UTempCheckHandleAvailabilityResultConverter() UTempCheckHandleAvailabilityResult result, Map? $unknown + String handle,@UTempCheckHandleAvailabilityOutputResultConverter() UTempCheckHandleAvailabilityOutputResult result, Map? $unknown }); -@override $UTempCheckHandleAvailabilityResultCopyWith<$Res> get result; +@override $UTempCheckHandleAvailabilityOutputResultCopyWith<$Res> get result; } /// @nodoc @@ -291,7 +291,7 @@ class __$TempCheckHandleAvailabilityOutputCopyWithImpl<$Res> return _then(_TempCheckHandleAvailabilityOutput( handle: null == handle ? _self.handle : handle // ignore: cast_nullable_to_non_nullable as String,result: null == result ? _self.result : result // ignore: cast_nullable_to_non_nullable -as UTempCheckHandleAvailabilityResult,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable +as UTempCheckHandleAvailabilityOutputResult,$unknown: freezed == $unknown ? _self._$unknown : $unknown // ignore: cast_nullable_to_non_nullable as Map?, )); } @@ -300,9 +300,9 @@ as Map?, /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') -$UTempCheckHandleAvailabilityResultCopyWith<$Res> get result { +$UTempCheckHandleAvailabilityOutputResultCopyWith<$Res> get result { - return $UTempCheckHandleAvailabilityResultCopyWith<$Res>(_self.result, (value) { + return $UTempCheckHandleAvailabilityOutputResultCopyWith<$Res>(_self.result, (value) { return _then(_self.copyWith(result: value)); }); } diff --git a/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/output.g.dart b/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/output.g.dart index 54040ef3a..58f90aa22 100644 --- a/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/output.g.dart +++ b/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/output.g.dart @@ -17,7 +17,7 @@ _TempCheckHandleAvailabilityOutput _$TempCheckHandleAvailabilityOutputFromJson( handle: $checkedConvert('handle', (v) => v as String), result: $checkedConvert( 'result', - (v) => const UTempCheckHandleAvailabilityResultConverter().fromJson( + (v) => const UTempCheckHandleAvailabilityOutputResultConverter().fromJson( v as Map, ), ), @@ -33,7 +33,7 @@ Map _$TempCheckHandleAvailabilityOutputToJson( _TempCheckHandleAvailabilityOutput instance, ) => { 'handle': instance.handle, - 'result': const UTempCheckHandleAvailabilityResultConverter().toJson( + 'result': const UTempCheckHandleAvailabilityOutputResultConverter().toJson( instance.result, ), r'$unknown': ?instance.$unknown, diff --git a/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/union_main_result.dart b/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/union_main_output_result.dart similarity index 50% rename from packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/union_main_result.dart rename to packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/union_main_output_result.dart index fa8b42251..cb648c440 100644 --- a/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/union_main_result.dart +++ b/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/union_main_output_result.dart @@ -9,86 +9,87 @@ import 'package:poptart_core/internals.dart' show isA; import './result_available.dart'; import './result_unavailable.dart'; -part 'union_main_result.freezed.dart'; +part 'union_main_output_result.freezed.dart'; // ************************************************************************** // LexGenerator // ************************************************************************** @freezed -sealed class UTempCheckHandleAvailabilityResult - with _$UTempCheckHandleAvailabilityResult { - const UTempCheckHandleAvailabilityResult._(); +sealed class UTempCheckHandleAvailabilityOutputResult + with _$UTempCheckHandleAvailabilityOutputResult { + const UTempCheckHandleAvailabilityOutputResult._(); - const factory UTempCheckHandleAvailabilityResult.resultAvailable({ + const factory UTempCheckHandleAvailabilityOutputResult.resultAvailable({ required ResultAvailable data, - }) = UTempCheckHandleAvailabilityResultResultAvailable; - const factory UTempCheckHandleAvailabilityResult.resultUnavailable({ + }) = UTempCheckHandleAvailabilityOutputResultResultAvailable; + const factory UTempCheckHandleAvailabilityOutputResult.resultUnavailable({ required ResultUnavailable data, - }) = UTempCheckHandleAvailabilityResultResultUnavailable; + }) = UTempCheckHandleAvailabilityOutputResultResultUnavailable; - const factory UTempCheckHandleAvailabilityResult.unknown({ + const factory UTempCheckHandleAvailabilityOutputResult.unknown({ required Map data, - }) = UTempCheckHandleAvailabilityResultUnknown; + }) = UTempCheckHandleAvailabilityOutputResultUnknown; Map toJson() => - const UTempCheckHandleAvailabilityResultConverter().toJson(this); + const UTempCheckHandleAvailabilityOutputResultConverter().toJson(this); } -extension UTempCheckHandleAvailabilityResultExtension - on UTempCheckHandleAvailabilityResult { +extension UTempCheckHandleAvailabilityOutputResultExtension + on UTempCheckHandleAvailabilityOutputResult { bool get isResultAvailable => - isA(this); + isA(this); bool get isNotResultAvailable => !isResultAvailable; ResultAvailable? get resultAvailable => isResultAvailable ? data as ResultAvailable : null; bool get isResultUnavailable => - isA(this); + isA(this); bool get isNotResultUnavailable => !isResultUnavailable; ResultUnavailable? get resultUnavailable => isResultUnavailable ? data as ResultUnavailable : null; - bool get isUnknown => isA(this); + bool get isUnknown => + isA(this); bool get isNotUnknown => !isUnknown; Map? get unknown => isUnknown ? data as Map : null; } -final class UTempCheckHandleAvailabilityResultConverter +final class UTempCheckHandleAvailabilityOutputResultConverter implements JsonConverter< - UTempCheckHandleAvailabilityResult, + UTempCheckHandleAvailabilityOutputResult, Map > { - const UTempCheckHandleAvailabilityResultConverter(); + const UTempCheckHandleAvailabilityOutputResultConverter(); @override - UTempCheckHandleAvailabilityResult fromJson(Map json) { + UTempCheckHandleAvailabilityOutputResult fromJson(Map json) { try { if (ResultAvailable.validate(json)) { - return UTempCheckHandleAvailabilityResult.resultAvailable( + return UTempCheckHandleAvailabilityOutputResult.resultAvailable( data: const ResultAvailableConverter().fromJson(json), ); } if (ResultUnavailable.validate(json)) { - return UTempCheckHandleAvailabilityResult.resultUnavailable( + return UTempCheckHandleAvailabilityOutputResult.resultUnavailable( data: const ResultUnavailableConverter().fromJson(json), ); } - return UTempCheckHandleAvailabilityResult.unknown(data: json); + return UTempCheckHandleAvailabilityOutputResult.unknown(data: json); } catch (_) { - return UTempCheckHandleAvailabilityResult.unknown(data: json); + return UTempCheckHandleAvailabilityOutputResult.unknown(data: json); } } @override - Map toJson(UTempCheckHandleAvailabilityResult object) => - object.when( - resultAvailable: (data) => - const ResultAvailableConverter().toJson(data), - resultUnavailable: (data) => - const ResultUnavailableConverter().toJson(data), + Map toJson( + UTempCheckHandleAvailabilityOutputResult object, + ) => object.when( + resultAvailable: (data) => const ResultAvailableConverter().toJson(data), + resultUnavailable: (data) => + const ResultUnavailableConverter().toJson(data), - unknown: (data) => data, - ); + unknown: (data) => data, + ); } diff --git a/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/union_main_output_result.freezed.dart b/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/union_main_output_result.freezed.dart new file mode 100644 index 000000000..5f1ea2bee --- /dev/null +++ b/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/union_main_output_result.freezed.dart @@ -0,0 +1,402 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'union_main_output_result.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$UTempCheckHandleAvailabilityOutputResult { + + Object get data; + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UTempCheckHandleAvailabilityOutputResult&&const DeepCollectionEquality().equals(other.data, data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); + +@override +String toString() { + return 'UTempCheckHandleAvailabilityOutputResult(data: $data)'; +} + + +} + +/// @nodoc +class $UTempCheckHandleAvailabilityOutputResultCopyWith<$Res> { +$UTempCheckHandleAvailabilityOutputResultCopyWith(UTempCheckHandleAvailabilityOutputResult _, $Res Function(UTempCheckHandleAvailabilityOutputResult) __); +} + + +/// Adds pattern-matching-related methods to [UTempCheckHandleAvailabilityOutputResult]. +extension UTempCheckHandleAvailabilityOutputResultPatterns on UTempCheckHandleAvailabilityOutputResult { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap({TResult Function( UTempCheckHandleAvailabilityOutputResultResultAvailable value)? resultAvailable,TResult Function( UTempCheckHandleAvailabilityOutputResultResultUnavailable value)? resultUnavailable,TResult Function( UTempCheckHandleAvailabilityOutputResultUnknown value)? unknown,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case UTempCheckHandleAvailabilityOutputResultResultAvailable() when resultAvailable != null: +return resultAvailable(_that);case UTempCheckHandleAvailabilityOutputResultResultUnavailable() when resultUnavailable != null: +return resultUnavailable(_that);case UTempCheckHandleAvailabilityOutputResultUnknown() when unknown != null: +return unknown(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map({required TResult Function( UTempCheckHandleAvailabilityOutputResultResultAvailable value) resultAvailable,required TResult Function( UTempCheckHandleAvailabilityOutputResultResultUnavailable value) resultUnavailable,required TResult Function( UTempCheckHandleAvailabilityOutputResultUnknown value) unknown,}){ +final _that = this; +switch (_that) { +case UTempCheckHandleAvailabilityOutputResultResultAvailable(): +return resultAvailable(_that);case UTempCheckHandleAvailabilityOutputResultResultUnavailable(): +return resultUnavailable(_that);case UTempCheckHandleAvailabilityOutputResultUnknown(): +return unknown(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull({TResult? Function( UTempCheckHandleAvailabilityOutputResultResultAvailable value)? resultAvailable,TResult? Function( UTempCheckHandleAvailabilityOutputResultResultUnavailable value)? resultUnavailable,TResult? Function( UTempCheckHandleAvailabilityOutputResultUnknown value)? unknown,}){ +final _that = this; +switch (_that) { +case UTempCheckHandleAvailabilityOutputResultResultAvailable() when resultAvailable != null: +return resultAvailable(_that);case UTempCheckHandleAvailabilityOutputResultResultUnavailable() when resultUnavailable != null: +return resultUnavailable(_that);case UTempCheckHandleAvailabilityOutputResultUnknown() when unknown != null: +return unknown(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen({TResult Function( ResultAvailable data)? resultAvailable,TResult Function( ResultUnavailable data)? resultUnavailable,TResult Function( Map data)? unknown,required TResult orElse(),}) {final _that = this; +switch (_that) { +case UTempCheckHandleAvailabilityOutputResultResultAvailable() when resultAvailable != null: +return resultAvailable(_that.data);case UTempCheckHandleAvailabilityOutputResultResultUnavailable() when resultUnavailable != null: +return resultUnavailable(_that.data);case UTempCheckHandleAvailabilityOutputResultUnknown() when unknown != null: +return unknown(_that.data);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when({required TResult Function( ResultAvailable data) resultAvailable,required TResult Function( ResultUnavailable data) resultUnavailable,required TResult Function( Map data) unknown,}) {final _that = this; +switch (_that) { +case UTempCheckHandleAvailabilityOutputResultResultAvailable(): +return resultAvailable(_that.data);case UTempCheckHandleAvailabilityOutputResultResultUnavailable(): +return resultUnavailable(_that.data);case UTempCheckHandleAvailabilityOutputResultUnknown(): +return unknown(_that.data);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull({TResult? Function( ResultAvailable data)? resultAvailable,TResult? Function( ResultUnavailable data)? resultUnavailable,TResult? Function( Map data)? unknown,}) {final _that = this; +switch (_that) { +case UTempCheckHandleAvailabilityOutputResultResultAvailable() when resultAvailable != null: +return resultAvailable(_that.data);case UTempCheckHandleAvailabilityOutputResultResultUnavailable() when resultUnavailable != null: +return resultUnavailable(_that.data);case UTempCheckHandleAvailabilityOutputResultUnknown() when unknown != null: +return unknown(_that.data);case _: + return null; + +} +} + +} + +/// @nodoc + + +class UTempCheckHandleAvailabilityOutputResultResultAvailable extends UTempCheckHandleAvailabilityOutputResult { + const UTempCheckHandleAvailabilityOutputResultResultAvailable({required this.data}): super._(); + + +@override final ResultAvailable data; + +/// Create a copy of UTempCheckHandleAvailabilityOutputResult +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UTempCheckHandleAvailabilityOutputResultResultAvailableCopyWith get copyWith => _$UTempCheckHandleAvailabilityOutputResultResultAvailableCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UTempCheckHandleAvailabilityOutputResultResultAvailable&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'UTempCheckHandleAvailabilityOutputResult.resultAvailable(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UTempCheckHandleAvailabilityOutputResultResultAvailableCopyWith<$Res> implements $UTempCheckHandleAvailabilityOutputResultCopyWith<$Res> { + factory $UTempCheckHandleAvailabilityOutputResultResultAvailableCopyWith(UTempCheckHandleAvailabilityOutputResultResultAvailable value, $Res Function(UTempCheckHandleAvailabilityOutputResultResultAvailable) _then) = _$UTempCheckHandleAvailabilityOutputResultResultAvailableCopyWithImpl; +@useResult +$Res call({ + ResultAvailable data +}); + + +$ResultAvailableCopyWith<$Res> get data; + +} +/// @nodoc +class _$UTempCheckHandleAvailabilityOutputResultResultAvailableCopyWithImpl<$Res> + implements $UTempCheckHandleAvailabilityOutputResultResultAvailableCopyWith<$Res> { + _$UTempCheckHandleAvailabilityOutputResultResultAvailableCopyWithImpl(this._self, this._then); + + final UTempCheckHandleAvailabilityOutputResultResultAvailable _self; + final $Res Function(UTempCheckHandleAvailabilityOutputResultResultAvailable) _then; + +/// Create a copy of UTempCheckHandleAvailabilityOutputResult +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UTempCheckHandleAvailabilityOutputResultResultAvailable( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as ResultAvailable, + )); +} + +/// Create a copy of UTempCheckHandleAvailabilityOutputResult +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$ResultAvailableCopyWith<$Res> get data { + + return $ResultAvailableCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class UTempCheckHandleAvailabilityOutputResultResultUnavailable extends UTempCheckHandleAvailabilityOutputResult { + const UTempCheckHandleAvailabilityOutputResultResultUnavailable({required this.data}): super._(); + + +@override final ResultUnavailable data; + +/// Create a copy of UTempCheckHandleAvailabilityOutputResult +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UTempCheckHandleAvailabilityOutputResultResultUnavailableCopyWith get copyWith => _$UTempCheckHandleAvailabilityOutputResultResultUnavailableCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UTempCheckHandleAvailabilityOutputResultResultUnavailable&&(identical(other.data, data) || other.data == data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data); + +@override +String toString() { + return 'UTempCheckHandleAvailabilityOutputResult.resultUnavailable(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UTempCheckHandleAvailabilityOutputResultResultUnavailableCopyWith<$Res> implements $UTempCheckHandleAvailabilityOutputResultCopyWith<$Res> { + factory $UTempCheckHandleAvailabilityOutputResultResultUnavailableCopyWith(UTempCheckHandleAvailabilityOutputResultResultUnavailable value, $Res Function(UTempCheckHandleAvailabilityOutputResultResultUnavailable) _then) = _$UTempCheckHandleAvailabilityOutputResultResultUnavailableCopyWithImpl; +@useResult +$Res call({ + ResultUnavailable data +}); + + +$ResultUnavailableCopyWith<$Res> get data; + +} +/// @nodoc +class _$UTempCheckHandleAvailabilityOutputResultResultUnavailableCopyWithImpl<$Res> + implements $UTempCheckHandleAvailabilityOutputResultResultUnavailableCopyWith<$Res> { + _$UTempCheckHandleAvailabilityOutputResultResultUnavailableCopyWithImpl(this._self, this._then); + + final UTempCheckHandleAvailabilityOutputResultResultUnavailable _self; + final $Res Function(UTempCheckHandleAvailabilityOutputResultResultUnavailable) _then; + +/// Create a copy of UTempCheckHandleAvailabilityOutputResult +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UTempCheckHandleAvailabilityOutputResultResultUnavailable( +data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable +as ResultUnavailable, + )); +} + +/// Create a copy of UTempCheckHandleAvailabilityOutputResult +/// with the given fields replaced by the non-null parameter values. +@override +@pragma('vm:prefer-inline') +$ResultUnavailableCopyWith<$Res> get data { + + return $ResultUnavailableCopyWith<$Res>(_self.data, (value) { + return _then(_self.copyWith(data: value)); + }); +} +} + +/// @nodoc + + +class UTempCheckHandleAvailabilityOutputResultUnknown extends UTempCheckHandleAvailabilityOutputResult { + const UTempCheckHandleAvailabilityOutputResultUnknown({required final Map data}): _data = data,super._(); + + + final Map _data; +@override Map get data { + if (_data is EqualUnmodifiableMapView) return _data; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_data); +} + + +/// Create a copy of UTempCheckHandleAvailabilityOutputResult +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$UTempCheckHandleAvailabilityOutputResultUnknownCopyWith get copyWith => _$UTempCheckHandleAvailabilityOutputResultUnknownCopyWithImpl(this, _$identity); + + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is UTempCheckHandleAvailabilityOutputResultUnknown&&const DeepCollectionEquality().equals(other._data, _data)); +} + + +@override +int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_data)); + +@override +String toString() { + return 'UTempCheckHandleAvailabilityOutputResult.unknown(data: $data)'; +} + + +} + +/// @nodoc +abstract mixin class $UTempCheckHandleAvailabilityOutputResultUnknownCopyWith<$Res> implements $UTempCheckHandleAvailabilityOutputResultCopyWith<$Res> { + factory $UTempCheckHandleAvailabilityOutputResultUnknownCopyWith(UTempCheckHandleAvailabilityOutputResultUnknown value, $Res Function(UTempCheckHandleAvailabilityOutputResultUnknown) _then) = _$UTempCheckHandleAvailabilityOutputResultUnknownCopyWithImpl; +@useResult +$Res call({ + Map data +}); + + + + +} +/// @nodoc +class _$UTempCheckHandleAvailabilityOutputResultUnknownCopyWithImpl<$Res> + implements $UTempCheckHandleAvailabilityOutputResultUnknownCopyWith<$Res> { + _$UTempCheckHandleAvailabilityOutputResultUnknownCopyWithImpl(this._self, this._then); + + final UTempCheckHandleAvailabilityOutputResultUnknown _self; + final $Res Function(UTempCheckHandleAvailabilityOutputResultUnknown) _then; + +/// Create a copy of UTempCheckHandleAvailabilityOutputResult +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { + return _then(UTempCheckHandleAvailabilityOutputResultUnknown( +data: null == data ? _self._data : data // ignore: cast_nullable_to_non_nullable +as Map, + )); +} + + +} + +// dart format on diff --git a/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/union_main_result.freezed.dart b/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/union_main_result.freezed.dart deleted file mode 100644 index ba3229b3e..000000000 --- a/packages/poptart_lex/lib/com/atproto/temp/check_handle_availability/union_main_result.freezed.dart +++ /dev/null @@ -1,402 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND -// coverage:ignore-file -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'union_main_result.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; -/// @nodoc -mixin _$UTempCheckHandleAvailabilityResult { - - Object get data; - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UTempCheckHandleAvailabilityResult&&const DeepCollectionEquality().equals(other.data, data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(data)); - -@override -String toString() { - return 'UTempCheckHandleAvailabilityResult(data: $data)'; -} - - -} - -/// @nodoc -class $UTempCheckHandleAvailabilityResultCopyWith<$Res> { -$UTempCheckHandleAvailabilityResultCopyWith(UTempCheckHandleAvailabilityResult _, $Res Function(UTempCheckHandleAvailabilityResult) __); -} - - -/// Adds pattern-matching-related methods to [UTempCheckHandleAvailabilityResult]. -extension UTempCheckHandleAvailabilityResultPatterns on UTempCheckHandleAvailabilityResult { -/// A variant of `map` that fallback to returning `orElse`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeMap({TResult Function( UTempCheckHandleAvailabilityResultResultAvailable value)? resultAvailable,TResult Function( UTempCheckHandleAvailabilityResultResultUnavailable value)? resultUnavailable,TResult Function( UTempCheckHandleAvailabilityResultUnknown value)? unknown,required TResult orElse(),}){ -final _that = this; -switch (_that) { -case UTempCheckHandleAvailabilityResultResultAvailable() when resultAvailable != null: -return resultAvailable(_that);case UTempCheckHandleAvailabilityResultResultUnavailable() when resultUnavailable != null: -return resultUnavailable(_that);case UTempCheckHandleAvailabilityResultUnknown() when unknown != null: -return unknown(_that);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// Callbacks receives the raw object, upcasted. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case final Subclass2 value: -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult map({required TResult Function( UTempCheckHandleAvailabilityResultResultAvailable value) resultAvailable,required TResult Function( UTempCheckHandleAvailabilityResultResultUnavailable value) resultUnavailable,required TResult Function( UTempCheckHandleAvailabilityResultUnknown value) unknown,}){ -final _that = this; -switch (_that) { -case UTempCheckHandleAvailabilityResultResultAvailable(): -return resultAvailable(_that);case UTempCheckHandleAvailabilityResultResultUnavailable(): -return resultUnavailable(_that);case UTempCheckHandleAvailabilityResultUnknown(): -return unknown(_that);} -} -/// A variant of `map` that fallback to returning `null`. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case final Subclass value: -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? mapOrNull({TResult? Function( UTempCheckHandleAvailabilityResultResultAvailable value)? resultAvailable,TResult? Function( UTempCheckHandleAvailabilityResultResultUnavailable value)? resultUnavailable,TResult? Function( UTempCheckHandleAvailabilityResultUnknown value)? unknown,}){ -final _that = this; -switch (_that) { -case UTempCheckHandleAvailabilityResultResultAvailable() when resultAvailable != null: -return resultAvailable(_that);case UTempCheckHandleAvailabilityResultResultUnavailable() when resultUnavailable != null: -return resultUnavailable(_that);case UTempCheckHandleAvailabilityResultUnknown() when unknown != null: -return unknown(_that);case _: - return null; - -} -} -/// A variant of `when` that fallback to an `orElse` callback. -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return orElse(); -/// } -/// ``` - -@optionalTypeArgs TResult maybeWhen({TResult Function( ResultAvailable data)? resultAvailable,TResult Function( ResultUnavailable data)? resultUnavailable,TResult Function( Map data)? unknown,required TResult orElse(),}) {final _that = this; -switch (_that) { -case UTempCheckHandleAvailabilityResultResultAvailable() when resultAvailable != null: -return resultAvailable(_that.data);case UTempCheckHandleAvailabilityResultResultUnavailable() when resultUnavailable != null: -return resultUnavailable(_that.data);case UTempCheckHandleAvailabilityResultUnknown() when unknown != null: -return unknown(_that.data);case _: - return orElse(); - -} -} -/// A `switch`-like method, using callbacks. -/// -/// As opposed to `map`, this offers destructuring. -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case Subclass2(:final field2): -/// return ...; -/// } -/// ``` - -@optionalTypeArgs TResult when({required TResult Function( ResultAvailable data) resultAvailable,required TResult Function( ResultUnavailable data) resultUnavailable,required TResult Function( Map data) unknown,}) {final _that = this; -switch (_that) { -case UTempCheckHandleAvailabilityResultResultAvailable(): -return resultAvailable(_that.data);case UTempCheckHandleAvailabilityResultResultUnavailable(): -return resultUnavailable(_that.data);case UTempCheckHandleAvailabilityResultUnknown(): -return unknown(_that.data);} -} -/// A variant of `when` that fallback to returning `null` -/// -/// It is equivalent to doing: -/// ```dart -/// switch (sealedClass) { -/// case Subclass(:final field): -/// return ...; -/// case _: -/// return null; -/// } -/// ``` - -@optionalTypeArgs TResult? whenOrNull({TResult? Function( ResultAvailable data)? resultAvailable,TResult? Function( ResultUnavailable data)? resultUnavailable,TResult? Function( Map data)? unknown,}) {final _that = this; -switch (_that) { -case UTempCheckHandleAvailabilityResultResultAvailable() when resultAvailable != null: -return resultAvailable(_that.data);case UTempCheckHandleAvailabilityResultResultUnavailable() when resultUnavailable != null: -return resultUnavailable(_that.data);case UTempCheckHandleAvailabilityResultUnknown() when unknown != null: -return unknown(_that.data);case _: - return null; - -} -} - -} - -/// @nodoc - - -class UTempCheckHandleAvailabilityResultResultAvailable extends UTempCheckHandleAvailabilityResult { - const UTempCheckHandleAvailabilityResultResultAvailable({required this.data}): super._(); - - -@override final ResultAvailable data; - -/// Create a copy of UTempCheckHandleAvailabilityResult -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$UTempCheckHandleAvailabilityResultResultAvailableCopyWith get copyWith => _$UTempCheckHandleAvailabilityResultResultAvailableCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UTempCheckHandleAvailabilityResultResultAvailable&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'UTempCheckHandleAvailabilityResult.resultAvailable(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $UTempCheckHandleAvailabilityResultResultAvailableCopyWith<$Res> implements $UTempCheckHandleAvailabilityResultCopyWith<$Res> { - factory $UTempCheckHandleAvailabilityResultResultAvailableCopyWith(UTempCheckHandleAvailabilityResultResultAvailable value, $Res Function(UTempCheckHandleAvailabilityResultResultAvailable) _then) = _$UTempCheckHandleAvailabilityResultResultAvailableCopyWithImpl; -@useResult -$Res call({ - ResultAvailable data -}); - - -$ResultAvailableCopyWith<$Res> get data; - -} -/// @nodoc -class _$UTempCheckHandleAvailabilityResultResultAvailableCopyWithImpl<$Res> - implements $UTempCheckHandleAvailabilityResultResultAvailableCopyWith<$Res> { - _$UTempCheckHandleAvailabilityResultResultAvailableCopyWithImpl(this._self, this._then); - - final UTempCheckHandleAvailabilityResultResultAvailable _self; - final $Res Function(UTempCheckHandleAvailabilityResultResultAvailable) _then; - -/// Create a copy of UTempCheckHandleAvailabilityResult -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(UTempCheckHandleAvailabilityResultResultAvailable( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as ResultAvailable, - )); -} - -/// Create a copy of UTempCheckHandleAvailabilityResult -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$ResultAvailableCopyWith<$Res> get data { - - return $ResultAvailableCopyWith<$Res>(_self.data, (value) { - return _then(_self.copyWith(data: value)); - }); -} -} - -/// @nodoc - - -class UTempCheckHandleAvailabilityResultResultUnavailable extends UTempCheckHandleAvailabilityResult { - const UTempCheckHandleAvailabilityResultResultUnavailable({required this.data}): super._(); - - -@override final ResultUnavailable data; - -/// Create a copy of UTempCheckHandleAvailabilityResult -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$UTempCheckHandleAvailabilityResultResultUnavailableCopyWith get copyWith => _$UTempCheckHandleAvailabilityResultResultUnavailableCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UTempCheckHandleAvailabilityResultResultUnavailable&&(identical(other.data, data) || other.data == data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,data); - -@override -String toString() { - return 'UTempCheckHandleAvailabilityResult.resultUnavailable(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $UTempCheckHandleAvailabilityResultResultUnavailableCopyWith<$Res> implements $UTempCheckHandleAvailabilityResultCopyWith<$Res> { - factory $UTempCheckHandleAvailabilityResultResultUnavailableCopyWith(UTempCheckHandleAvailabilityResultResultUnavailable value, $Res Function(UTempCheckHandleAvailabilityResultResultUnavailable) _then) = _$UTempCheckHandleAvailabilityResultResultUnavailableCopyWithImpl; -@useResult -$Res call({ - ResultUnavailable data -}); - - -$ResultUnavailableCopyWith<$Res> get data; - -} -/// @nodoc -class _$UTempCheckHandleAvailabilityResultResultUnavailableCopyWithImpl<$Res> - implements $UTempCheckHandleAvailabilityResultResultUnavailableCopyWith<$Res> { - _$UTempCheckHandleAvailabilityResultResultUnavailableCopyWithImpl(this._self, this._then); - - final UTempCheckHandleAvailabilityResultResultUnavailable _self; - final $Res Function(UTempCheckHandleAvailabilityResultResultUnavailable) _then; - -/// Create a copy of UTempCheckHandleAvailabilityResult -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(UTempCheckHandleAvailabilityResultResultUnavailable( -data: null == data ? _self.data : data // ignore: cast_nullable_to_non_nullable -as ResultUnavailable, - )); -} - -/// Create a copy of UTempCheckHandleAvailabilityResult -/// with the given fields replaced by the non-null parameter values. -@override -@pragma('vm:prefer-inline') -$ResultUnavailableCopyWith<$Res> get data { - - return $ResultUnavailableCopyWith<$Res>(_self.data, (value) { - return _then(_self.copyWith(data: value)); - }); -} -} - -/// @nodoc - - -class UTempCheckHandleAvailabilityResultUnknown extends UTempCheckHandleAvailabilityResult { - const UTempCheckHandleAvailabilityResultUnknown({required final Map data}): _data = data,super._(); - - - final Map _data; -@override Map get data { - if (_data is EqualUnmodifiableMapView) return _data; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(_data); -} - - -/// Create a copy of UTempCheckHandleAvailabilityResult -/// with the given fields replaced by the non-null parameter values. -@JsonKey(includeFromJson: false, includeToJson: false) -@pragma('vm:prefer-inline') -$UTempCheckHandleAvailabilityResultUnknownCopyWith get copyWith => _$UTempCheckHandleAvailabilityResultUnknownCopyWithImpl(this, _$identity); - - - -@override -bool operator ==(Object other) { - return identical(this, other) || (other.runtimeType == runtimeType&&other is UTempCheckHandleAvailabilityResultUnknown&&const DeepCollectionEquality().equals(other._data, _data)); -} - - -@override -int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_data)); - -@override -String toString() { - return 'UTempCheckHandleAvailabilityResult.unknown(data: $data)'; -} - - -} - -/// @nodoc -abstract mixin class $UTempCheckHandleAvailabilityResultUnknownCopyWith<$Res> implements $UTempCheckHandleAvailabilityResultCopyWith<$Res> { - factory $UTempCheckHandleAvailabilityResultUnknownCopyWith(UTempCheckHandleAvailabilityResultUnknown value, $Res Function(UTempCheckHandleAvailabilityResultUnknown) _then) = _$UTempCheckHandleAvailabilityResultUnknownCopyWithImpl; -@useResult -$Res call({ - Map data -}); - - - - -} -/// @nodoc -class _$UTempCheckHandleAvailabilityResultUnknownCopyWithImpl<$Res> - implements $UTempCheckHandleAvailabilityResultUnknownCopyWith<$Res> { - _$UTempCheckHandleAvailabilityResultUnknownCopyWithImpl(this._self, this._then); - - final UTempCheckHandleAvailabilityResultUnknown _self; - final $Res Function(UTempCheckHandleAvailabilityResultUnknown) _then; - -/// Create a copy of UTempCheckHandleAvailabilityResult -/// with the given fields replaced by the non-null parameter values. -@pragma('vm:prefer-inline') $Res call({Object? data = null,}) { - return _then(UTempCheckHandleAvailabilityResultUnknown( -data: null == data ? _self._data : data // ignore: cast_nullable_to_non_nullable -as Map, - )); -} - - -} - -// dart format on diff --git a/packages/poptart_lex/pubspec.yaml b/packages/poptart_lex/pubspec.yaml index 088a6446c..04765d1e5 100644 --- a/packages/poptart_lex/pubspec.yaml +++ b/packages/poptart_lex/pubspec.yaml @@ -1,7 +1,7 @@ name: poptart_lex resolution: workspace description: Generated Dart types and method descriptors for AT Protocol ecosystem lexicons. -version: 0.1.0 +version: 0.2.0 homepage: https://poptart.xyz documentation: https://poptart.xyz repository: https://github.com/sprksocial/poptart diff --git a/packages/poptart_lex_gen/CHANGELOG.md b/packages/poptart_lex_gen/CHANGELOG.md index 1212c93d0..a8f70f36e 100644 --- a/packages/poptart_lex_gen/CHANGELOG.md +++ b/packages/poptart_lex_gen/CHANGELOG.md @@ -1,5 +1,10 @@ # Release Note +## v0.3.0 + +- **BREAKING**: Scope nested generated type names by their parameter, input, or output role. +- Preserve procedure parameters alongside request bodies. + ## v0.1.0 - Initial Poptart fork release under the new `poptart_lex_gen` package name. diff --git a/packages/poptart_lex_gen/lib/src/services/fmt/lex_property_generator.dart b/packages/poptart_lex_gen/lib/src/services/fmt/lex_property_generator.dart index 9e1a08e46..90153b544 100644 --- a/packages/poptart_lex_gen/lib/src/services/fmt/lex_property_generator.dart +++ b/packages/poptart_lex_gen/lib/src/services/fmt/lex_property_generator.dart @@ -3,19 +3,23 @@ import 'package:poptart_lexicon/parser.dart' as lex; // Project imports: import '../../dart_type.dart'; +import '../../utils.dart'; import '../object/lex_property.dart'; import '../rule.dart' as rule; import 'lex_known_values_generator.dart'; import 'lex_union_generator.dart'; +enum LexNestedTypeScope { parameters, input, output } + List generateLexPropertiesFromLexXrpcParameters( final lex.NSID lexiconId, final String defName, final Map? properties, final List? requiredProperties, final List? nullableProperties, - final List mainVariants, -) { + final List mainVariants, { + final LexNestedTypeScope? nestedTypeScope, +}) { if (properties == null) return const []; final $properties = properties.map( @@ -32,6 +36,7 @@ List generateLexPropertiesFromLexXrpcParameters( requiredProperties, nullableProperties, mainVariants, + nestedTypeScope: nestedTypeScope, ); } @@ -41,8 +46,9 @@ List generateLexProperties( final Map? properties, final List? requiredProperties, final List? nullableProperties, - final List mainVariants, -) { + final List mainVariants, { + final LexNestedTypeScope? nestedTypeScope, +}) { if (properties == null) return const []; final requiredProps = requiredProperties ?? const []; @@ -58,6 +64,7 @@ List generateLexProperties( defName, mainVariants, isSingleProp, + nestedTypeScope, ); if (type.isNil) continue; @@ -104,6 +111,7 @@ DartType _getDartType( final String defName, final List mainVariants, final bool isSingleProp, + final LexNestedTypeScope? nestedTypeScope, ) { switch (property.value) { case lex.ULexObjectPropertyPrimitive primitive: @@ -113,6 +121,7 @@ DartType _getDartType( mainVariants, property.key, primitive.data, + nestedTypeScope, ); case lex.ULexObjectPropertyBlob blob: @@ -134,6 +143,7 @@ DartType _getDartType( mainVariants, property.key, primitive.data, + nestedTypeScope, ); return DartType.array( lexiconId: type.lexiconId, @@ -162,6 +172,7 @@ DartType _getDartType( property.key, mainVariants, isSingleProp, + nestedTypeScope, ); return DartType.array( @@ -187,6 +198,7 @@ DartType _getDartType( property.key, mainVariants, isSingleProp, + nestedTypeScope, ); default: @@ -200,6 +212,7 @@ DartType _getLexPrimitiveType( final List mainVariants, final String propertyName, final lex.LexPrimitive data, + final LexNestedTypeScope? nestedTypeScope, ) { switch (data) { case lex.ULexPrimitiveString string: @@ -210,12 +223,16 @@ DartType _getLexPrimitiveType( } if (string.data.knownValues != null) { + final nestedFieldName = _getNestedFieldName( + propertyName, + nestedTypeScope, + ); final knownValues = generateLexKnownValues( lexiconId, defName, string.data, mainVariants, - fieldName: propertyName, + fieldName: nestedFieldName, ); final typeName = knownValues.getTypeName(); @@ -225,7 +242,7 @@ DartType _getLexPrimitiveType( name: typeName, lexiconId: lexiconId.toString(), defName: defName, - fieldName: propertyName, + fieldName: nestedFieldName, description: string.data.description, packagePath: './$fileName.dart', annotation: '@${typeName}Converter()', @@ -263,6 +280,7 @@ DartType _getLexRefVariantType( final String fieldName, final List mainVariants, final bool isSingleProp, + final LexNestedTypeScope? nestedTypeScope, ) { switch (ref) { case lex.ULexRefVariantRef ref: @@ -318,10 +336,11 @@ DartType _getLexRefVariantType( isUnion: isUnion, ); case lex.ULexRefVariantRefUnion refUnion: + final nestedFieldName = _getNestedFieldName(fieldName, nestedTypeScope); final union = generateLexUnion( lexiconId, defName, - fieldName, + nestedFieldName, refUnion.data, mainVariants, ); @@ -330,11 +349,11 @@ DartType _getLexRefVariantType( type: union.name, lexiconId: lexiconId.toString(), defName: defName, - fieldName: fieldName, + fieldName: nestedFieldName, packagePath: rule.getLexObjectPackagePathForUnion( lexiconId.toString(), defName, - fieldName, + nestedFieldName, ), union: union, ); @@ -342,3 +361,12 @@ DartType _getLexRefVariantType( return DartType.json(); } } + +String _getNestedFieldName( + final String fieldName, + final LexNestedTypeScope? nestedTypeScope, +) { + if (nestedTypeScope == null) return fieldName; + + return '${nestedTypeScope.name}${toFirstUpperCase(fieldName)}'; +} diff --git a/packages/poptart_lex_gen/lib/src/services/fmt/lex_xrpc_procedure_generator.dart b/packages/poptart_lex_gen/lib/src/services/fmt/lex_xrpc_procedure_generator.dart index 2f7cc2274..465ebd8ff 100644 --- a/packages/poptart_lex_gen/lib/src/services/fmt/lex_xrpc_procedure_generator.dart +++ b/packages/poptart_lex_gen/lib/src/services/fmt/lex_xrpc_procedure_generator.dart @@ -7,7 +7,8 @@ import '../object/lex_output.dart'; import '../rule.dart' as rule; import 'lex_property_generator.dart'; -(LexInput?, LexOutput?)? generateLexXrpcProcedure( +({LexInput? parameters, LexInput? input, LexOutput? output})? +generateLexXrpcProcedure( final lex.NSID lexiconId, final String defName, final lex.LexXrpcProcedure procedure, @@ -34,10 +35,43 @@ final class _LexLexXrpcProcedureGenerator { this.mainVariants, ); - (LexInput?, LexOutput?)? execute() { - if (procedure.input == null && procedure.output == null) return null; + ({LexInput? parameters, LexInput? input, LexOutput? output})? execute() { + if (procedure.parameters == null && + procedure.input == null && + procedure.output == null) { + return null; + } + + return ( + parameters: _getParameters(), + input: _getInput(), + output: _getOutput(), + ); + } + + LexInput? _getParameters() { + if (procedure.parameters?.properties == null) return null; + final parameters = procedure.parameters!; + + final properties = generateLexPropertiesFromLexXrpcParameters( + lexiconId, + defName, + parameters.properties, + parameters.requiredProperties, + null, + mainVariants, + nestedTypeScope: LexNestedTypeScope.parameters, + ); + if (properties.isEmpty) return null; - return (_getInput(), _getOutput()); + return LexInput( + lexiconId: lexiconId.toString(), + defName: defName, + name: rule.getLexObjectName(lexiconId.toString(), defName, mainVariants), + description: parameters.description, + properties: properties, + isParameters: true, + ); } LexInput? _getInput() { @@ -63,6 +97,7 @@ final class _LexLexXrpcProcedureGenerator { object.requiredProperties, object.nullableProperties, mainVariants, + nestedTypeScope: LexNestedTypeScope.input, ); if (properties.isEmpty) return null; @@ -107,6 +142,7 @@ final class _LexLexXrpcProcedureGenerator { object.requiredProperties, object.nullableProperties, mainVariants, + nestedTypeScope: LexNestedTypeScope.output, ); if (properties.isEmpty) return null; diff --git a/packages/poptart_lex_gen/lib/src/services/fmt/lex_xrpc_query_generator.dart b/packages/poptart_lex_gen/lib/src/services/fmt/lex_xrpc_query_generator.dart index 7b55be6cd..9a0be3ddc 100644 --- a/packages/poptart_lex_gen/lib/src/services/fmt/lex_xrpc_query_generator.dart +++ b/packages/poptart_lex_gen/lib/src/services/fmt/lex_xrpc_query_generator.dart @@ -51,6 +51,7 @@ final class _LexLexXrpcQueryGenerator { parameters.requiredProperties, null, mainVariants, + nestedTypeScope: LexNestedTypeScope.parameters, ); if (properties.isEmpty) return null; @@ -86,6 +87,7 @@ final class _LexLexXrpcQueryGenerator { object.requiredProperties, object.nullableProperties, mainVariants, + nestedTypeScope: LexNestedTypeScope.output, ); if (properties.isEmpty) return null; diff --git a/packages/poptart_lex_gen/lib/src/services/fmt/lex_xrpc_subscription_generator.dart b/packages/poptart_lex_gen/lib/src/services/fmt/lex_xrpc_subscription_generator.dart index 6c452234c..f84cd2e2a 100644 --- a/packages/poptart_lex_gen/lib/src/services/fmt/lex_xrpc_subscription_generator.dart +++ b/packages/poptart_lex_gen/lib/src/services/fmt/lex_xrpc_subscription_generator.dart @@ -52,6 +52,7 @@ final class _LexLexXrpcSubscriptionGenerator { parameters.requiredProperties, null, mainVariants, + nestedTypeScope: LexNestedTypeScope.parameters, ); if (properties.isEmpty) return null; diff --git a/packages/poptart_lex_gen/lib/src/services/lex_descriptor_generator.dart b/packages/poptart_lex_gen/lib/src/services/lex_descriptor_generator.dart index c5a9a25ad..35cbca12c 100644 --- a/packages/poptart_lex_gen/lib/src/services/lex_descriptor_generator.dart +++ b/packages/poptart_lex_gen/lib/src/services/lex_descriptor_generator.dart @@ -129,6 +129,9 @@ ${descriptors.join('\n\n')} LexTypeState.input, LexTypeState.record, ]); + final procedureParameters = _relatedType(id, const [ + LexTypeState.parameters, + ]); final output = _relatedType(id, const [LexTypeState.output]); if ((input?.isBytes() ?? false) || (output?.isBytes() ?? false)) { imports.add("import 'dart:typed_data';"); @@ -142,10 +145,10 @@ ${descriptors.join('\n\n')} }; if (kind == null) return null; - final paramsType = - api is ULexUserTypeXrpcQuery || api is ULexUserTypeXrpcSubscription - ? _typeName(input) - : 'EmptyData'; + final parameters = api is ULexUserTypeXrpcProcedure + ? procedureParameters + : input; + final paramsType = _typeName(parameters); final inputType = api is ULexUserTypeXrpcProcedure ? _typeName(input) : 'EmptyData'; @@ -153,12 +156,13 @@ ${descriptors.join('\n\n')} ? 'Object' : _typeName(output); + _addTypeImport(doc.id.toString(), parameters, imports); _addTypeImport(doc.id.toString(), input, imports); _addTypeImport(doc.id.toString(), output, imports); - final paramsLines = paramsType == 'EmptyData' || (input?.isBytes() ?? false) + final paramsLines = paramsType == 'EmptyData' ? '' - : _codecLines('parameters', input!); + : _codecLines('parameters', parameters!); final inputLines = inputType == 'EmptyData' || (input?.isBytes() ?? false) ? '' : _codecLines('input', input!); diff --git a/packages/poptart_lex_gen/lib/src/services/lex_type_generator.dart b/packages/poptart_lex_gen/lib/src/services/lex_type_generator.dart index 7588d82ac..6f1a8884e 100644 --- a/packages/poptart_lex_gen/lib/src/services/lex_type_generator.dart +++ b/packages/poptart_lex_gen/lib/src/services/lex_type_generator.dart @@ -110,8 +110,9 @@ final class _LexTypeGenerator { if (type == null) continue; - _aggregateTypes(types, type.$1); - _aggregateTypes(types, type.$2); + _aggregateTypes(types, type.parameters); + _aggregateTypes(types, type.input); + _aggregateTypes(types, type.output); } else if (def.value is lex.ULexUserTypeXrpcSubscription) { final type = generateLexXrpcSubscription( doc.id, diff --git a/packages/poptart_lex_gen/lib/src/services/object/lex_input.dart b/packages/poptart_lex_gen/lib/src/services/object/lex_input.dart index 844f6a53f..39b0aea89 100644 --- a/packages/poptart_lex_gen/lib/src/services/object/lex_input.dart +++ b/packages/poptart_lex_gen/lib/src/services/object/lex_input.dart @@ -17,11 +17,13 @@ final class LexInput extends LexType { final bool bytes; final String? encoding; + final bool isParameters; final String? ref; @override - LexTypeState get state => LexTypeState.input; + LexTypeState get state => + isParameters ? LexTypeState.parameters : LexTypeState.input; const LexInput({ required this.lexiconId, @@ -32,6 +34,7 @@ final class LexInput extends LexType { this.bytes = false, this.ref, this.encoding, + this.isParameters = false, }); String? getDescription() { @@ -65,12 +68,12 @@ final class LexInput extends LexType { @override String getFileName() { - return 'input'; + return isParameters ? 'parameters' : 'input'; } @override String getTypeName() { - return '${name}Input'; + return '$name${isParameters ? 'Parameters' : 'Input'}'; } @override @@ -95,9 +98,11 @@ final class LexInput extends LexType { } final typeName = getTypeName(); + final suffix = isParameters ? 'Parameters' : 'Input'; + final fileName = getFileName(); final knownProps = getKnownProps(this.properties); - final extensions = getExtensions(name, this.properties, suffix: 'Input'); - final converter = getObjectConverter(name, suffix: 'Input'); + final extensions = getExtensions(name, this.properties, suffix: suffix); + final converter = getObjectConverter(name, suffix: suffix); return '''$kHeaderHint @@ -107,8 +112,8 @@ import 'package:poptart_core/internals.dart'; ${packages.toString()} -part 'input.freezed.dart'; -part 'input.g.dart'; +part '$fileName.freezed.dart'; +part '$fileName.g.dart'; $kHeader diff --git a/packages/poptart_lex_gen/lib/src/services/object/lex_type.dart b/packages/poptart_lex_gen/lib/src/services/object/lex_type.dart index 1dcf13844..590a98315 100644 --- a/packages/poptart_lex_gen/lib/src/services/object/lex_type.dart +++ b/packages/poptart_lex_gen/lib/src/services/object/lex_type.dart @@ -8,6 +8,7 @@ enum LexTypeState { record, knownValues, output, + parameters, input, message, union, diff --git a/packages/poptart_lex_gen/lib/src/services/rule.dart b/packages/poptart_lex_gen/lib/src/services/rule.dart index 745882bcf..816f15960 100644 --- a/packages/poptart_lex_gen/lib/src/services/rule.dart +++ b/packages/poptart_lex_gen/lib/src/services/rule.dart @@ -100,7 +100,9 @@ String getFilePath( final LexTypeState state, { final String? fieldName, }) { - if (state == LexTypeState.input) { + if (state == LexTypeState.parameters) { + return '${getHomeDir(lexiconId)}/${_getFileDir(lexiconId)}/parameters.dart'; + } else if (state == LexTypeState.input) { return '${getHomeDir(lexiconId)}/${_getFileDir(lexiconId)}/input.dart'; } else if (state == LexTypeState.output) { return '${getHomeDir(lexiconId)}/${_getFileDir(lexiconId)}/output.dart'; diff --git a/packages/poptart_lex_gen/pubspec.yaml b/packages/poptart_lex_gen/pubspec.yaml index 6ffb84187..00c00e24f 100644 --- a/packages/poptart_lex_gen/pubspec.yaml +++ b/packages/poptart_lex_gen/pubspec.yaml @@ -1,6 +1,6 @@ name: poptart_lex_gen description: Code generator for building Dart models and runtime descriptors from AT Protocol lexicons. -version: 0.2.0 +version: 0.3.0 resolution: workspace homepage: https://poptart.xyz documentation: https://poptart.xyz diff --git a/packages/poptart_lex_gen/test/src/services/lex_descriptor_generator_test.dart b/packages/poptart_lex_gen/test/src/services/lex_descriptor_generator_test.dart new file mode 100644 index 000000000..fe564f197 --- /dev/null +++ b/packages/poptart_lex_gen/test/src/services/lex_descriptor_generator_test.dart @@ -0,0 +1,243 @@ +// Copyright (c) 2023-2026, Shinya Kato and Poptart contributors. +// All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// Package imports: +import 'package:poptart_lexicon/parser.dart'; +import 'package:test/test.dart'; + +// Project imports: +import 'package:poptart_lex_gen/src/config.dart'; +import 'package:poptart_lex_gen/src/services/fmt/lex_xrpc_procedure_generator.dart'; +import 'package:poptart_lex_gen/src/services/lex_descriptor_generator.dart'; +import 'package:poptart_lex_gen/src/services/object/lex_type.dart'; +import 'package:poptart_lex_gen/src/services/rule.dart' as rule; + +void main() { + test('generates procedure parameters separately from a binary body', () { + final doc = LexiconDoc.fromJson({ + 'lexicon': 1, + 'id': 'com.example.uploadPart', + 'defs': { + 'main': { + 'type': 'procedure', + 'parameters': { + 'type': 'params', + 'required': ['jobId', 'partNumber'], + 'properties': { + 'jobId': {'type': 'string'}, + 'partNumber': {'type': 'integer'}, + }, + }, + 'input': {'encoding': 'application/octet-stream'}, + 'output': { + 'encoding': 'application/json', + 'schema': { + 'type': 'object', + 'required': ['sizeBytes'], + 'properties': { + 'sizeBytes': {'type': 'integer'}, + }, + }, + }, + }, + }, + }); + final procedure = doc.defs['main']!.data as LexXrpcProcedure; + + rule.setLexServiceRuleConfig( + const LexServiceRuleConfig( + namespaceRules: [ + LexiconNamespaceRule( + prefixes: ['com.example.'], + homeDir: 'lib', + exportCodegenPath: '', + servicePackagePath: '', + rootPackageName: 'example', + ), + ], + ), + ); + + final generated = generateLexXrpcProcedure( + doc.id, + 'main', + procedure, + const [], + )!; + + expect(generated.parameters!.state, LexTypeState.parameters); + expect(generated.parameters!.getFileName(), 'parameters'); + expect(generated.parameters!.getTypeName(), 'UploadPartParameters'); + expect( + generated.parameters!.getProperties().map((property) => property.name), + ['jobId', 'partNumber'], + ); + expect( + generated.parameters!.getProperties().map( + (property) => property.isRequired, + ), + everyElement(isTrue), + ); + expect(generated.input!.isBytes(), isTrue); + + final descriptor = generateLexDescriptors( + const ['com.example.'], + [generated.parameters!, generated.input!, generated.output!], + [doc], + ).single.content; + + expect( + descriptor, + contains( + 'XRPCMethodDescriptor', + ), + ); + expect(descriptor, contains("import './parameters.dart';")); + expect(descriptor, contains('parametersFromJson:')); + expect( + descriptor, + contains( + 'parametersToJson: const UploadPartParametersConverter().toJson', + ), + ); + expect(descriptor, contains("inputEncoding: 'application/octet-stream'")); + }); + + test('names nested procedure types by their structural role', () { + final doc = LexiconDoc.fromJson({ + 'lexicon': 1, + 'id': 'com.example.uploadPart', + 'defs': { + 'main': { + 'type': 'procedure', + 'parameters': { + 'type': 'params', + 'required': ['format'], + 'properties': { + 'format': { + 'type': 'string', + 'knownValues': ['parameter'], + }, + }, + }, + 'input': { + 'encoding': 'application/json', + 'schema': { + 'type': 'object', + 'required': ['parametersFormat'], + 'properties': { + 'parametersFormat': { + 'type': 'string', + 'knownValues': ['body'], + }, + }, + }, + }, + 'output': { + 'encoding': 'application/json', + 'schema': { + 'type': 'object', + 'required': ['parametersFormat'], + 'properties': { + 'parametersFormat': { + 'type': 'string', + 'knownValues': ['output'], + }, + }, + }, + }, + }, + }, + }); + final procedure = doc.defs['main']!.data as LexXrpcProcedure; + + rule.setLexServiceRuleConfig( + const LexServiceRuleConfig( + namespaceRules: [ + LexiconNamespaceRule( + prefixes: ['com.example.'], + homeDir: 'lib', + exportCodegenPath: '', + servicePackagePath: '', + rootPackageName: 'example', + ), + ], + ), + ); + + final generated = generateLexXrpcProcedure( + doc.id, + 'main', + procedure, + const [], + )!; + final parameterType = generated.parameters!.getProperties().single.type; + final inputType = generated.input!.getProperties().single.type; + final outputType = generated.output!.getProperties().single.type; + + expect(parameterType.name, 'UploadPartParametersFormat'); + expect(parameterType.packagePath, './main_parameters_format.dart'); + expect( + parameterType.knownValues!.getFilePath(), + 'lib/com/example/upload_part/main_parameters_format.dart', + ); + expect(parameterType.knownValues!.values, ['parameter']); + expect( + generated.parameters!.format(), + contains("import './main_parameters_format.dart';"), + ); + expect( + generated.parameters!.format(), + contains( + '@UploadPartParametersFormatConverter() ' + 'required UploadPartParametersFormat format,', + ), + ); + + expect(inputType.name, 'UploadPartInputParametersFormat'); + expect(inputType.packagePath, './main_input_parameters_format.dart'); + expect( + inputType.knownValues!.getFilePath(), + 'lib/com/example/upload_part/main_input_parameters_format.dart', + ); + expect(inputType.knownValues!.values, ['body']); + expect( + generated.input!.format(), + contains("import './main_input_parameters_format.dart';"), + ); + expect( + generated.input!.format(), + contains( + '@UploadPartInputParametersFormatConverter() ' + 'required UploadPartInputParametersFormat parametersFormat,', + ), + ); + + expect(outputType.name, 'UploadPartOutputParametersFormat'); + expect(outputType.packagePath, './main_output_parameters_format.dart'); + expect( + outputType.knownValues!.getFilePath(), + 'lib/com/example/upload_part/main_output_parameters_format.dart', + ); + expect(outputType.knownValues!.values, ['output']); + expect( + generated.output!.format(), + contains("import './main_output_parameters_format.dart';"), + ); + expect( + generated.output!.format(), + contains( + '@UploadPartOutputParametersFormatConverter() ' + 'required UploadPartOutputParametersFormat parametersFormat,', + ), + ); + + expect({ + parameterType.knownValues!.getFilePath(), + inputType.knownValues!.getFilePath(), + outputType.knownValues!.getFilePath(), + }, hasLength(3)); + }); +} diff --git a/pubspec.yaml b/pubspec.yaml index 6deb408e2..38116aba1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -26,8 +26,8 @@ workspace: dependencies: github: ^9.12.0 http: ^1.4.0 - poptart_lex_gen: ^0.2.0 - poptart_lex: ^0.1.0 + poptart_lex_gen: ^0.3.0 + poptart_lex: ^0.2.0 poptart_lexicon: ^0.1.0 pubspec: ^2.3.0 test: ^1.26.2