diff --git a/lib/data/api/api_client.dart b/lib/data/api/api_client.dart index 366c603..c8c4ae8 100644 --- a/lib/data/api/api_client.dart +++ b/lib/data/api/api_client.dart @@ -83,6 +83,26 @@ class ApiClient { return _neoClient.getMyReactions(); } + // Get single user reaction for specific media + Future getMyReaction(String mediaType, String mediaId) async { + final reactions = await _neoClient.getMyReactions(); + try { + return reactions.firstWhere( + (r) => r.mediaType == mediaType && r.mediaId == mediaId, + ); + } catch (e) { + return null; // No reaction found + } + } + + // ---- External IDs (IMDb) ---- + Future getImdbId(String mediaId, String mediaType) async { + // This would need to be implemented in NeoMoviesApiClient + // For now, return null or implement a stub + // TODO: Add getExternalIds endpoint to backend + return null; + } + // ---- Auth ---- Future register(String name, String email, String password) { return _neoClient.register( diff --git a/lib/data/api/neomovies_api_client.dart b/lib/data/api/neomovies_api_client.dart index 9ee9652..7868435 100644 --- a/lib/data/api/neomovies_api_client.dart +++ b/lib/data/api/neomovies_api_client.dart @@ -7,6 +7,7 @@ import 'package:neomovies_mobile/data/models/movie.dart'; import 'package:neomovies_mobile/data/models/reaction.dart'; import 'package:neomovies_mobile/data/models/user.dart'; import 'package:neomovies_mobile/data/models/torrent.dart'; +import 'package:neomovies_mobile/data/models/torrent/torrent_item.dart'; import 'package:neomovies_mobile/data/models/player/player_response.dart'; /// New API client for neomovies-api (Go-based backend) diff --git a/lib/data/models/player/player_response.g.dart b/lib/data/models/player/player_response.g.dart new file mode 100644 index 0000000..ae34c82 --- /dev/null +++ b/lib/data/models/player/player_response.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'player_response.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PlayerResponse _$PlayerResponseFromJson(Map json) => + PlayerResponse( + embedUrl: json['embedUrl'] as String?, + playerType: json['playerType'] as String?, + error: json['error'] as String?, + ); + +Map _$PlayerResponseToJson(PlayerResponse instance) => + { + 'embedUrl': instance.embedUrl, + 'playerType': instance.playerType, + 'error': instance.error, + }; diff --git a/lib/data/models/torrent.freezed.dart b/lib/data/models/torrent.freezed.dart index c5678a3..cef7e71 100644 --- a/lib/data/models/torrent.freezed.dart +++ b/lib/data/models/torrent.freezed.dart @@ -27,12 +27,8 @@ mixin _$Torrent { int? get seeders => throw _privateConstructorUsedError; int? get size => throw _privateConstructorUsedError; - /// Serializes this Torrent to a JSON map. Map toJson() => throw _privateConstructorUsedError; - - /// Create a copy of Torrent - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) + @JsonKey(ignore: true) $TorrentCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -60,8 +56,6 @@ class _$TorrentCopyWithImpl<$Res, $Val extends Torrent> // ignore: unused_field final $Res Function($Val) _then; - /// Create a copy of Torrent - /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -125,8 +119,6 @@ class __$$TorrentImplCopyWithImpl<$Res> _$TorrentImpl _value, $Res Function(_$TorrentImpl) _then) : super(_value, _then); - /// Create a copy of Torrent - /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -211,14 +203,12 @@ class _$TorrentImpl implements _Torrent { (identical(other.size, size) || other.size == size)); } - @JsonKey(includeFromJson: false, includeToJson: false) + @JsonKey(ignore: true) @override int get hashCode => Object.hash(runtimeType, magnet, title, name, quality, seeders, size); - /// Create a copy of Torrent - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) + @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') _$$TorrentImplCopyWith<_$TorrentImpl> get copyWith => @@ -255,11 +245,8 @@ abstract class _Torrent implements Torrent { int? get seeders; @override int? get size; - - /// Create a copy of Torrent - /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(includeFromJson: false, includeToJson: false) + @JsonKey(ignore: true) _$$TorrentImplCopyWith<_$TorrentImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/data/models/torrent/torrent_item.dart b/lib/data/models/torrent/torrent_item.dart new file mode 100644 index 0000000..e8db8ec --- /dev/null +++ b/lib/data/models/torrent/torrent_item.dart @@ -0,0 +1,29 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'torrent_item.g.dart'; + +@JsonSerializable() +class TorrentItem { + final String? title; + final String? magnetUrl; + final String? quality; + final int? seeders; + final int? leechers; + final String? size; + final String? source; + + TorrentItem({ + this.title, + this.magnetUrl, + this.quality, + this.seeders, + this.leechers, + this.size, + this.source, + }); + + factory TorrentItem.fromJson(Map json) => + _$TorrentItemFromJson(json); + + Map toJson() => _$TorrentItemToJson(this); +} diff --git a/lib/data/models/torrent/torrent_item.g.dart b/lib/data/models/torrent/torrent_item.g.dart new file mode 100644 index 0000000..a591f38 --- /dev/null +++ b/lib/data/models/torrent/torrent_item.g.dart @@ -0,0 +1,28 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'torrent_item.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +TorrentItem _$TorrentItemFromJson(Map json) => TorrentItem( + title: json['title'] as String?, + magnetUrl: json['magnetUrl'] as String?, + quality: json['quality'] as String?, + seeders: (json['seeders'] as num?)?.toInt(), + leechers: (json['leechers'] as num?)?.toInt(), + size: json['size'] as String?, + source: json['source'] as String?, + ); + +Map _$TorrentItemToJson(TorrentItem instance) => + { + 'title': instance.title, + 'magnetUrl': instance.magnetUrl, + 'quality': instance.quality, + 'seeders': instance.seeders, + 'leechers': instance.leechers, + 'size': instance.size, + 'source': instance.source, + }; diff --git a/lib/presentation/cubits/torrent/torrent_state.freezed.dart b/lib/presentation/cubits/torrent/torrent_state.freezed.dart index d52838c..eb8c6ce 100644 --- a/lib/presentation/cubits/torrent/torrent_state.freezed.dart +++ b/lib/presentation/cubits/torrent/torrent_state.freezed.dart @@ -108,9 +108,6 @@ class _$TorrentStateCopyWithImpl<$Res, $Val extends TorrentState> final $Val _value; // ignore: unused_field final $Res Function($Val) _then; - - /// Create a copy of TorrentState - /// with the given fields replaced by the non-null parameter values. } /// @nodoc @@ -127,9 +124,6 @@ class __$$InitialImplCopyWithImpl<$Res> __$$InitialImplCopyWithImpl( _$InitialImpl _value, $Res Function(_$InitialImpl) _then) : super(_value, _then); - - /// Create a copy of TorrentState - /// with the given fields replaced by the non-null parameter values. } /// @nodoc @@ -268,9 +262,6 @@ class __$$LoadingImplCopyWithImpl<$Res> __$$LoadingImplCopyWithImpl( _$LoadingImpl _value, $Res Function(_$LoadingImpl) _then) : super(_value, _then); - - /// Create a copy of TorrentState - /// with the given fields replaced by the non-null parameter values. } /// @nodoc @@ -419,8 +410,6 @@ class __$$LoadedImplCopyWithImpl<$Res> _$LoadedImpl _value, $Res Function(_$LoadedImpl) _then) : super(_value, _then); - /// Create a copy of TorrentState - /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -551,9 +540,7 @@ class _$LoadedImpl implements _Loaded { const DeepCollectionEquality().hash(_availableSeasons), selectedQuality); - /// Create a copy of TorrentState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) + @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') _$$LoadedImplCopyWith<_$LoadedImpl> get copyWith => @@ -678,10 +665,7 @@ abstract class _Loaded implements TorrentState { int? get selectedSeason; List? get availableSeasons; String? get selectedQuality; - - /// Create a copy of TorrentState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) + @JsonKey(ignore: true) _$$LoadedImplCopyWith<_$LoadedImpl> get copyWith => throw _privateConstructorUsedError; } @@ -703,8 +687,6 @@ class __$$ErrorImplCopyWithImpl<$Res> _$ErrorImpl _value, $Res Function(_$ErrorImpl) _then) : super(_value, _then); - /// Create a copy of TorrentState - /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -743,9 +725,7 @@ class _$ErrorImpl implements _Error { @override int get hashCode => Object.hash(runtimeType, message); - /// Create a copy of TorrentState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) + @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') _$$ErrorImplCopyWith<_$ErrorImpl> get copyWith => @@ -854,10 +834,7 @@ abstract class _Error implements TorrentState { const factory _Error({required final String message}) = _$ErrorImpl; String get message; - - /// Create a copy of TorrentState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) + @JsonKey(ignore: true) _$$ErrorImplCopyWith<_$ErrorImpl> get copyWith => throw _privateConstructorUsedError; }