mirror of
https://gitlab.com/foxixus/neomovies_mobile.git
synced 2025-10-28 01:18:50 +05:00
better
This commit is contained in:
@@ -83,6 +83,26 @@ class ApiClient {
|
|||||||
return _neoClient.getMyReactions();
|
return _neoClient.getMyReactions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get single user reaction for specific media
|
||||||
|
Future<UserReaction?> 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<String?> 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 ----
|
// ---- Auth ----
|
||||||
Future<void> register(String name, String email, String password) {
|
Future<void> register(String name, String email, String password) {
|
||||||
return _neoClient.register(
|
return _neoClient.register(
|
||||||
|
|||||||
@@ -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/reaction.dart';
|
||||||
import 'package:neomovies_mobile/data/models/user.dart';
|
import 'package:neomovies_mobile/data/models/user.dart';
|
||||||
import 'package:neomovies_mobile/data/models/torrent.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';
|
import 'package:neomovies_mobile/data/models/player/player_response.dart';
|
||||||
|
|
||||||
/// New API client for neomovies-api (Go-based backend)
|
/// New API client for neomovies-api (Go-based backend)
|
||||||
|
|||||||
21
lib/data/models/player/player_response.g.dart
Normal file
21
lib/data/models/player/player_response.g.dart
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'player_response.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
PlayerResponse _$PlayerResponseFromJson(Map<String, dynamic> json) =>
|
||||||
|
PlayerResponse(
|
||||||
|
embedUrl: json['embedUrl'] as String?,
|
||||||
|
playerType: json['playerType'] as String?,
|
||||||
|
error: json['error'] as String?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$PlayerResponseToJson(PlayerResponse instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'embedUrl': instance.embedUrl,
|
||||||
|
'playerType': instance.playerType,
|
||||||
|
'error': instance.error,
|
||||||
|
};
|
||||||
@@ -27,12 +27,8 @@ mixin _$Torrent {
|
|||||||
int? get seeders => throw _privateConstructorUsedError;
|
int? get seeders => throw _privateConstructorUsedError;
|
||||||
int? get size => throw _privateConstructorUsedError;
|
int? get size => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
/// Serializes this Torrent to a JSON map.
|
|
||||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(ignore: true)
|
||||||
/// Create a copy of Torrent
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
$TorrentCopyWith<Torrent> get copyWith => throw _privateConstructorUsedError;
|
$TorrentCopyWith<Torrent> get copyWith => throw _privateConstructorUsedError;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,8 +56,6 @@ class _$TorrentCopyWithImpl<$Res, $Val extends Torrent>
|
|||||||
// ignore: unused_field
|
// ignore: unused_field
|
||||||
final $Res Function($Val) _then;
|
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')
|
@pragma('vm:prefer-inline')
|
||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
@@ -125,8 +119,6 @@ class __$$TorrentImplCopyWithImpl<$Res>
|
|||||||
_$TorrentImpl _value, $Res Function(_$TorrentImpl) _then)
|
_$TorrentImpl _value, $Res Function(_$TorrentImpl) _then)
|
||||||
: super(_value, _then);
|
: super(_value, _then);
|
||||||
|
|
||||||
/// Create a copy of Torrent
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
@@ -211,14 +203,12 @@ class _$TorrentImpl implements _Torrent {
|
|||||||
(identical(other.size, size) || other.size == size));
|
(identical(other.size, size) || other.size == size));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(ignore: true)
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
Object.hash(runtimeType, magnet, title, name, quality, seeders, size);
|
Object.hash(runtimeType, magnet, title, name, quality, seeders, size);
|
||||||
|
|
||||||
/// Create a copy of Torrent
|
@JsonKey(ignore: true)
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
@override
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
_$$TorrentImplCopyWith<_$TorrentImpl> get copyWith =>
|
_$$TorrentImplCopyWith<_$TorrentImpl> get copyWith =>
|
||||||
@@ -255,11 +245,8 @@ abstract class _Torrent implements Torrent {
|
|||||||
int? get seeders;
|
int? get seeders;
|
||||||
@override
|
@override
|
||||||
int? get size;
|
int? get size;
|
||||||
|
|
||||||
/// Create a copy of Torrent
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
@override
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(ignore: true)
|
||||||
_$$TorrentImplCopyWith<_$TorrentImpl> get copyWith =>
|
_$$TorrentImplCopyWith<_$TorrentImpl> get copyWith =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
}
|
}
|
||||||
|
|||||||
29
lib/data/models/torrent/torrent_item.dart
Normal file
29
lib/data/models/torrent/torrent_item.dart
Normal file
@@ -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<String, dynamic> json) =>
|
||||||
|
_$TorrentItemFromJson(json);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => _$TorrentItemToJson(this);
|
||||||
|
}
|
||||||
28
lib/data/models/torrent/torrent_item.g.dart
Normal file
28
lib/data/models/torrent/torrent_item.g.dart
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'torrent_item.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
TorrentItem _$TorrentItemFromJson(Map<String, dynamic> 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<String, dynamic> _$TorrentItemToJson(TorrentItem instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'title': instance.title,
|
||||||
|
'magnetUrl': instance.magnetUrl,
|
||||||
|
'quality': instance.quality,
|
||||||
|
'seeders': instance.seeders,
|
||||||
|
'leechers': instance.leechers,
|
||||||
|
'size': instance.size,
|
||||||
|
'source': instance.source,
|
||||||
|
};
|
||||||
@@ -108,9 +108,6 @@ class _$TorrentStateCopyWithImpl<$Res, $Val extends TorrentState>
|
|||||||
final $Val _value;
|
final $Val _value;
|
||||||
// ignore: unused_field
|
// ignore: unused_field
|
||||||
final $Res Function($Val) _then;
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
/// Create a copy of TorrentState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -127,9 +124,6 @@ class __$$InitialImplCopyWithImpl<$Res>
|
|||||||
__$$InitialImplCopyWithImpl(
|
__$$InitialImplCopyWithImpl(
|
||||||
_$InitialImpl _value, $Res Function(_$InitialImpl) _then)
|
_$InitialImpl _value, $Res Function(_$InitialImpl) _then)
|
||||||
: super(_value, _then);
|
: super(_value, _then);
|
||||||
|
|
||||||
/// Create a copy of TorrentState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -268,9 +262,6 @@ class __$$LoadingImplCopyWithImpl<$Res>
|
|||||||
__$$LoadingImplCopyWithImpl(
|
__$$LoadingImplCopyWithImpl(
|
||||||
_$LoadingImpl _value, $Res Function(_$LoadingImpl) _then)
|
_$LoadingImpl _value, $Res Function(_$LoadingImpl) _then)
|
||||||
: super(_value, _then);
|
: super(_value, _then);
|
||||||
|
|
||||||
/// Create a copy of TorrentState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -419,8 +410,6 @@ class __$$LoadedImplCopyWithImpl<$Res>
|
|||||||
_$LoadedImpl _value, $Res Function(_$LoadedImpl) _then)
|
_$LoadedImpl _value, $Res Function(_$LoadedImpl) _then)
|
||||||
: super(_value, _then);
|
: super(_value, _then);
|
||||||
|
|
||||||
/// Create a copy of TorrentState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
@@ -551,9 +540,7 @@ class _$LoadedImpl implements _Loaded {
|
|||||||
const DeepCollectionEquality().hash(_availableSeasons),
|
const DeepCollectionEquality().hash(_availableSeasons),
|
||||||
selectedQuality);
|
selectedQuality);
|
||||||
|
|
||||||
/// Create a copy of TorrentState
|
@JsonKey(ignore: true)
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
@override
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
_$$LoadedImplCopyWith<_$LoadedImpl> get copyWith =>
|
_$$LoadedImplCopyWith<_$LoadedImpl> get copyWith =>
|
||||||
@@ -678,10 +665,7 @@ abstract class _Loaded implements TorrentState {
|
|||||||
int? get selectedSeason;
|
int? get selectedSeason;
|
||||||
List<int>? get availableSeasons;
|
List<int>? get availableSeasons;
|
||||||
String? get selectedQuality;
|
String? get selectedQuality;
|
||||||
|
@JsonKey(ignore: true)
|
||||||
/// Create a copy of TorrentState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
_$$LoadedImplCopyWith<_$LoadedImpl> get copyWith =>
|
_$$LoadedImplCopyWith<_$LoadedImpl> get copyWith =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
}
|
}
|
||||||
@@ -703,8 +687,6 @@ class __$$ErrorImplCopyWithImpl<$Res>
|
|||||||
_$ErrorImpl _value, $Res Function(_$ErrorImpl) _then)
|
_$ErrorImpl _value, $Res Function(_$ErrorImpl) _then)
|
||||||
: super(_value, _then);
|
: super(_value, _then);
|
||||||
|
|
||||||
/// Create a copy of TorrentState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
@override
|
@override
|
||||||
$Res call({
|
$Res call({
|
||||||
@@ -743,9 +725,7 @@ class _$ErrorImpl implements _Error {
|
|||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType, message);
|
int get hashCode => Object.hash(runtimeType, message);
|
||||||
|
|
||||||
/// Create a copy of TorrentState
|
@JsonKey(ignore: true)
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
@override
|
@override
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
_$$ErrorImplCopyWith<_$ErrorImpl> get copyWith =>
|
_$$ErrorImplCopyWith<_$ErrorImpl> get copyWith =>
|
||||||
@@ -854,10 +834,7 @@ abstract class _Error implements TorrentState {
|
|||||||
const factory _Error({required final String message}) = _$ErrorImpl;
|
const factory _Error({required final String message}) = _$ErrorImpl;
|
||||||
|
|
||||||
String get message;
|
String get message;
|
||||||
|
@JsonKey(ignore: true)
|
||||||
/// Create a copy of TorrentState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
|
||||||
_$$ErrorImplCopyWith<_$ErrorImpl> get copyWith =>
|
_$$ErrorImplCopyWith<_$ErrorImpl> get copyWith =>
|
||||||
throw _privateConstructorUsedError;
|
throw _privateConstructorUsedError;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user