feat: API 인증 시스템 구현 및 로그인 화면 연동
- AuthService, AuthRemoteDataSource 구현 - JWT 토큰 관리 (SecureStorage 사용) - 로그인 화면 API 연동 및 에러 처리 - freezed 패키지로 Auth 관련 DTO 모델 생성 - 의존성 주입 설정 업데이트
This commit is contained in:
18
lib/data/models/auth/auth_user.dart
Normal file
18
lib/data/models/auth/auth_user.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'auth_user.freezed.dart';
|
||||
part 'auth_user.g.dart';
|
||||
|
||||
@freezed
|
||||
class AuthUser with _$AuthUser {
|
||||
const factory AuthUser({
|
||||
required int id,
|
||||
required String email,
|
||||
@JsonKey(name: 'first_name') required String firstName,
|
||||
@JsonKey(name: 'last_name') required String lastName,
|
||||
required String role,
|
||||
}) = _AuthUser;
|
||||
|
||||
factory AuthUser.fromJson(Map<String, dynamic> json) =>
|
||||
_$AuthUserFromJson(json);
|
||||
}
|
||||
256
lib/data/models/auth/auth_user.freezed.dart
Normal file
256
lib/data/models/auth/auth_user.freezed.dart
Normal file
@@ -0,0 +1,256 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// 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 'auth_user.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
AuthUser _$AuthUserFromJson(Map<String, dynamic> json) {
|
||||
return _AuthUser.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$AuthUser {
|
||||
int get id => throw _privateConstructorUsedError;
|
||||
String get email => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'first_name')
|
||||
String get firstName => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'last_name')
|
||||
String get lastName => throw _privateConstructorUsedError;
|
||||
String get role => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this AuthUser to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of AuthUser
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$AuthUserCopyWith<AuthUser> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $AuthUserCopyWith<$Res> {
|
||||
factory $AuthUserCopyWith(AuthUser value, $Res Function(AuthUser) then) =
|
||||
_$AuthUserCopyWithImpl<$Res, AuthUser>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
String email,
|
||||
@JsonKey(name: 'first_name') String firstName,
|
||||
@JsonKey(name: 'last_name') String lastName,
|
||||
String role});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$AuthUserCopyWithImpl<$Res, $Val extends AuthUser>
|
||||
implements $AuthUserCopyWith<$Res> {
|
||||
_$AuthUserCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of AuthUser
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? email = null,
|
||||
Object? firstName = null,
|
||||
Object? lastName = null,
|
||||
Object? role = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
email: null == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
firstName: null == firstName
|
||||
? _value.firstName
|
||||
: firstName // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
lastName: null == lastName
|
||||
? _value.lastName
|
||||
: lastName // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
role: null == role
|
||||
? _value.role
|
||||
: role // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$AuthUserImplCopyWith<$Res>
|
||||
implements $AuthUserCopyWith<$Res> {
|
||||
factory _$$AuthUserImplCopyWith(
|
||||
_$AuthUserImpl value, $Res Function(_$AuthUserImpl) then) =
|
||||
__$$AuthUserImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{int id,
|
||||
String email,
|
||||
@JsonKey(name: 'first_name') String firstName,
|
||||
@JsonKey(name: 'last_name') String lastName,
|
||||
String role});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$AuthUserImplCopyWithImpl<$Res>
|
||||
extends _$AuthUserCopyWithImpl<$Res, _$AuthUserImpl>
|
||||
implements _$$AuthUserImplCopyWith<$Res> {
|
||||
__$$AuthUserImplCopyWithImpl(
|
||||
_$AuthUserImpl _value, $Res Function(_$AuthUserImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of AuthUser
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? email = null,
|
||||
Object? firstName = null,
|
||||
Object? lastName = null,
|
||||
Object? role = null,
|
||||
}) {
|
||||
return _then(_$AuthUserImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
email: null == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
firstName: null == firstName
|
||||
? _value.firstName
|
||||
: firstName // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
lastName: null == lastName
|
||||
? _value.lastName
|
||||
: lastName // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
role: null == role
|
||||
? _value.role
|
||||
: role // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$AuthUserImpl implements _AuthUser {
|
||||
const _$AuthUserImpl(
|
||||
{required this.id,
|
||||
required this.email,
|
||||
@JsonKey(name: 'first_name') required this.firstName,
|
||||
@JsonKey(name: 'last_name') required this.lastName,
|
||||
required this.role});
|
||||
|
||||
factory _$AuthUserImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$AuthUserImplFromJson(json);
|
||||
|
||||
@override
|
||||
final int id;
|
||||
@override
|
||||
final String email;
|
||||
@override
|
||||
@JsonKey(name: 'first_name')
|
||||
final String firstName;
|
||||
@override
|
||||
@JsonKey(name: 'last_name')
|
||||
final String lastName;
|
||||
@override
|
||||
final String role;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'AuthUser(id: $id, email: $email, firstName: $firstName, lastName: $lastName, role: $role)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$AuthUserImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.email, email) || other.email == email) &&
|
||||
(identical(other.firstName, firstName) ||
|
||||
other.firstName == firstName) &&
|
||||
(identical(other.lastName, lastName) ||
|
||||
other.lastName == lastName) &&
|
||||
(identical(other.role, role) || other.role == role));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, id, email, firstName, lastName, role);
|
||||
|
||||
/// Create a copy of AuthUser
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$AuthUserImplCopyWith<_$AuthUserImpl> get copyWith =>
|
||||
__$$AuthUserImplCopyWithImpl<_$AuthUserImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$AuthUserImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _AuthUser implements AuthUser {
|
||||
const factory _AuthUser(
|
||||
{required final int id,
|
||||
required final String email,
|
||||
@JsonKey(name: 'first_name') required final String firstName,
|
||||
@JsonKey(name: 'last_name') required final String lastName,
|
||||
required final String role}) = _$AuthUserImpl;
|
||||
|
||||
factory _AuthUser.fromJson(Map<String, dynamic> json) =
|
||||
_$AuthUserImpl.fromJson;
|
||||
|
||||
@override
|
||||
int get id;
|
||||
@override
|
||||
String get email;
|
||||
@override
|
||||
@JsonKey(name: 'first_name')
|
||||
String get firstName;
|
||||
@override
|
||||
@JsonKey(name: 'last_name')
|
||||
String get lastName;
|
||||
@override
|
||||
String get role;
|
||||
|
||||
/// Create a copy of AuthUser
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$AuthUserImplCopyWith<_$AuthUserImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
25
lib/data/models/auth/auth_user.g.dart
Normal file
25
lib/data/models/auth/auth_user.g.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'auth_user.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$AuthUserImpl _$$AuthUserImplFromJson(Map<String, dynamic> json) =>
|
||||
_$AuthUserImpl(
|
||||
id: (json['id'] as num).toInt(),
|
||||
email: json['email'] as String,
|
||||
firstName: json['first_name'] as String,
|
||||
lastName: json['last_name'] as String,
|
||||
role: json['role'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$AuthUserImplToJson(_$AuthUserImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'email': instance.email,
|
||||
'first_name': instance.firstName,
|
||||
'last_name': instance.lastName,
|
||||
'role': instance.role,
|
||||
};
|
||||
15
lib/data/models/auth/login_request.dart
Normal file
15
lib/data/models/auth/login_request.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'login_request.freezed.dart';
|
||||
part 'login_request.g.dart';
|
||||
|
||||
@freezed
|
||||
class LoginRequest with _$LoginRequest {
|
||||
const factory LoginRequest({
|
||||
required String email,
|
||||
required String password,
|
||||
}) = _LoginRequest;
|
||||
|
||||
factory LoginRequest.fromJson(Map<String, dynamic> json) =>
|
||||
_$LoginRequestFromJson(json);
|
||||
}
|
||||
183
lib/data/models/auth/login_request.freezed.dart
Normal file
183
lib/data/models/auth/login_request.freezed.dart
Normal file
@@ -0,0 +1,183 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// 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 'login_request.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
LoginRequest _$LoginRequestFromJson(Map<String, dynamic> json) {
|
||||
return _LoginRequest.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LoginRequest {
|
||||
String get email => throw _privateConstructorUsedError;
|
||||
String get password => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this LoginRequest to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of LoginRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$LoginRequestCopyWith<LoginRequest> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $LoginRequestCopyWith<$Res> {
|
||||
factory $LoginRequestCopyWith(
|
||||
LoginRequest value, $Res Function(LoginRequest) then) =
|
||||
_$LoginRequestCopyWithImpl<$Res, LoginRequest>;
|
||||
@useResult
|
||||
$Res call({String email, String password});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$LoginRequestCopyWithImpl<$Res, $Val extends LoginRequest>
|
||||
implements $LoginRequestCopyWith<$Res> {
|
||||
_$LoginRequestCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of LoginRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? email = null,
|
||||
Object? password = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
email: null == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
password: null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LoginRequestImplCopyWith<$Res>
|
||||
implements $LoginRequestCopyWith<$Res> {
|
||||
factory _$$LoginRequestImplCopyWith(
|
||||
_$LoginRequestImpl value, $Res Function(_$LoginRequestImpl) then) =
|
||||
__$$LoginRequestImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String email, String password});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LoginRequestImplCopyWithImpl<$Res>
|
||||
extends _$LoginRequestCopyWithImpl<$Res, _$LoginRequestImpl>
|
||||
implements _$$LoginRequestImplCopyWith<$Res> {
|
||||
__$$LoginRequestImplCopyWithImpl(
|
||||
_$LoginRequestImpl _value, $Res Function(_$LoginRequestImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of LoginRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? email = null,
|
||||
Object? password = null,
|
||||
}) {
|
||||
return _then(_$LoginRequestImpl(
|
||||
email: null == email
|
||||
? _value.email
|
||||
: email // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
password: null == password
|
||||
? _value.password
|
||||
: password // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$LoginRequestImpl implements _LoginRequest {
|
||||
const _$LoginRequestImpl({required this.email, required this.password});
|
||||
|
||||
factory _$LoginRequestImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$LoginRequestImplFromJson(json);
|
||||
|
||||
@override
|
||||
final String email;
|
||||
@override
|
||||
final String password;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LoginRequest(email: $email, password: $password)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$LoginRequestImpl &&
|
||||
(identical(other.email, email) || other.email == email) &&
|
||||
(identical(other.password, password) ||
|
||||
other.password == password));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, email, password);
|
||||
|
||||
/// Create a copy of LoginRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$LoginRequestImplCopyWith<_$LoginRequestImpl> get copyWith =>
|
||||
__$$LoginRequestImplCopyWithImpl<_$LoginRequestImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$LoginRequestImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _LoginRequest implements LoginRequest {
|
||||
const factory _LoginRequest(
|
||||
{required final String email,
|
||||
required final String password}) = _$LoginRequestImpl;
|
||||
|
||||
factory _LoginRequest.fromJson(Map<String, dynamic> json) =
|
||||
_$LoginRequestImpl.fromJson;
|
||||
|
||||
@override
|
||||
String get email;
|
||||
@override
|
||||
String get password;
|
||||
|
||||
/// Create a copy of LoginRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$LoginRequestImplCopyWith<_$LoginRequestImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
19
lib/data/models/auth/login_request.g.dart
Normal file
19
lib/data/models/auth/login_request.g.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'login_request.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$LoginRequestImpl _$$LoginRequestImplFromJson(Map<String, dynamic> json) =>
|
||||
_$LoginRequestImpl(
|
||||
email: json['email'] as String,
|
||||
password: json['password'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$LoginRequestImplToJson(_$LoginRequestImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'email': instance.email,
|
||||
'password': instance.password,
|
||||
};
|
||||
19
lib/data/models/auth/login_response.dart
Normal file
19
lib/data/models/auth/login_response.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'auth_user.dart';
|
||||
|
||||
part 'login_response.freezed.dart';
|
||||
part 'login_response.g.dart';
|
||||
|
||||
@freezed
|
||||
class LoginResponse with _$LoginResponse {
|
||||
const factory LoginResponse({
|
||||
@JsonKey(name: 'access_token') required String accessToken,
|
||||
@JsonKey(name: 'refresh_token') required String refreshToken,
|
||||
@JsonKey(name: 'token_type') required String tokenType,
|
||||
@JsonKey(name: 'expires_in') required int expiresIn,
|
||||
required AuthUser user,
|
||||
}) = _LoginResponse;
|
||||
|
||||
factory LoginResponse.fromJson(Map<String, dynamic> json) =>
|
||||
_$LoginResponseFromJson(json);
|
||||
}
|
||||
280
lib/data/models/auth/login_response.freezed.dart
Normal file
280
lib/data/models/auth/login_response.freezed.dart
Normal file
@@ -0,0 +1,280 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// 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 'login_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
LoginResponse _$LoginResponseFromJson(Map<String, dynamic> json) {
|
||||
return _LoginResponse.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LoginResponse {
|
||||
@JsonKey(name: 'access_token')
|
||||
String get accessToken => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'refresh_token')
|
||||
String get refreshToken => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'token_type')
|
||||
String get tokenType => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'expires_in')
|
||||
int get expiresIn => throw _privateConstructorUsedError;
|
||||
AuthUser get user => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this LoginResponse to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of LoginResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$LoginResponseCopyWith<LoginResponse> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $LoginResponseCopyWith<$Res> {
|
||||
factory $LoginResponseCopyWith(
|
||||
LoginResponse value, $Res Function(LoginResponse) then) =
|
||||
_$LoginResponseCopyWithImpl<$Res, LoginResponse>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'access_token') String accessToken,
|
||||
@JsonKey(name: 'refresh_token') String refreshToken,
|
||||
@JsonKey(name: 'token_type') String tokenType,
|
||||
@JsonKey(name: 'expires_in') int expiresIn,
|
||||
AuthUser user});
|
||||
|
||||
$AuthUserCopyWith<$Res> get user;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$LoginResponseCopyWithImpl<$Res, $Val extends LoginResponse>
|
||||
implements $LoginResponseCopyWith<$Res> {
|
||||
_$LoginResponseCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of LoginResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? accessToken = null,
|
||||
Object? refreshToken = null,
|
||||
Object? tokenType = null,
|
||||
Object? expiresIn = null,
|
||||
Object? user = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
accessToken: null == accessToken
|
||||
? _value.accessToken
|
||||
: accessToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
refreshToken: null == refreshToken
|
||||
? _value.refreshToken
|
||||
: refreshToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
tokenType: null == tokenType
|
||||
? _value.tokenType
|
||||
: tokenType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
expiresIn: null == expiresIn
|
||||
? _value.expiresIn
|
||||
: expiresIn // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
user: null == user
|
||||
? _value.user
|
||||
: user // ignore: cast_nullable_to_non_nullable
|
||||
as AuthUser,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
/// Create a copy of LoginResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$AuthUserCopyWith<$Res> get user {
|
||||
return $AuthUserCopyWith<$Res>(_value.user, (value) {
|
||||
return _then(_value.copyWith(user: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LoginResponseImplCopyWith<$Res>
|
||||
implements $LoginResponseCopyWith<$Res> {
|
||||
factory _$$LoginResponseImplCopyWith(
|
||||
_$LoginResponseImpl value, $Res Function(_$LoginResponseImpl) then) =
|
||||
__$$LoginResponseImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'access_token') String accessToken,
|
||||
@JsonKey(name: 'refresh_token') String refreshToken,
|
||||
@JsonKey(name: 'token_type') String tokenType,
|
||||
@JsonKey(name: 'expires_in') int expiresIn,
|
||||
AuthUser user});
|
||||
|
||||
@override
|
||||
$AuthUserCopyWith<$Res> get user;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LoginResponseImplCopyWithImpl<$Res>
|
||||
extends _$LoginResponseCopyWithImpl<$Res, _$LoginResponseImpl>
|
||||
implements _$$LoginResponseImplCopyWith<$Res> {
|
||||
__$$LoginResponseImplCopyWithImpl(
|
||||
_$LoginResponseImpl _value, $Res Function(_$LoginResponseImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of LoginResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? accessToken = null,
|
||||
Object? refreshToken = null,
|
||||
Object? tokenType = null,
|
||||
Object? expiresIn = null,
|
||||
Object? user = null,
|
||||
}) {
|
||||
return _then(_$LoginResponseImpl(
|
||||
accessToken: null == accessToken
|
||||
? _value.accessToken
|
||||
: accessToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
refreshToken: null == refreshToken
|
||||
? _value.refreshToken
|
||||
: refreshToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
tokenType: null == tokenType
|
||||
? _value.tokenType
|
||||
: tokenType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
expiresIn: null == expiresIn
|
||||
? _value.expiresIn
|
||||
: expiresIn // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
user: null == user
|
||||
? _value.user
|
||||
: user // ignore: cast_nullable_to_non_nullable
|
||||
as AuthUser,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$LoginResponseImpl implements _LoginResponse {
|
||||
const _$LoginResponseImpl(
|
||||
{@JsonKey(name: 'access_token') required this.accessToken,
|
||||
@JsonKey(name: 'refresh_token') required this.refreshToken,
|
||||
@JsonKey(name: 'token_type') required this.tokenType,
|
||||
@JsonKey(name: 'expires_in') required this.expiresIn,
|
||||
required this.user});
|
||||
|
||||
factory _$LoginResponseImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$LoginResponseImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'access_token')
|
||||
final String accessToken;
|
||||
@override
|
||||
@JsonKey(name: 'refresh_token')
|
||||
final String refreshToken;
|
||||
@override
|
||||
@JsonKey(name: 'token_type')
|
||||
final String tokenType;
|
||||
@override
|
||||
@JsonKey(name: 'expires_in')
|
||||
final int expiresIn;
|
||||
@override
|
||||
final AuthUser user;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LoginResponse(accessToken: $accessToken, refreshToken: $refreshToken, tokenType: $tokenType, expiresIn: $expiresIn, user: $user)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$LoginResponseImpl &&
|
||||
(identical(other.accessToken, accessToken) ||
|
||||
other.accessToken == accessToken) &&
|
||||
(identical(other.refreshToken, refreshToken) ||
|
||||
other.refreshToken == refreshToken) &&
|
||||
(identical(other.tokenType, tokenType) ||
|
||||
other.tokenType == tokenType) &&
|
||||
(identical(other.expiresIn, expiresIn) ||
|
||||
other.expiresIn == expiresIn) &&
|
||||
(identical(other.user, user) || other.user == user));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType, accessToken, refreshToken, tokenType, expiresIn, user);
|
||||
|
||||
/// Create a copy of LoginResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$LoginResponseImplCopyWith<_$LoginResponseImpl> get copyWith =>
|
||||
__$$LoginResponseImplCopyWithImpl<_$LoginResponseImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$LoginResponseImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _LoginResponse implements LoginResponse {
|
||||
const factory _LoginResponse(
|
||||
{@JsonKey(name: 'access_token') required final String accessToken,
|
||||
@JsonKey(name: 'refresh_token') required final String refreshToken,
|
||||
@JsonKey(name: 'token_type') required final String tokenType,
|
||||
@JsonKey(name: 'expires_in') required final int expiresIn,
|
||||
required final AuthUser user}) = _$LoginResponseImpl;
|
||||
|
||||
factory _LoginResponse.fromJson(Map<String, dynamic> json) =
|
||||
_$LoginResponseImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'access_token')
|
||||
String get accessToken;
|
||||
@override
|
||||
@JsonKey(name: 'refresh_token')
|
||||
String get refreshToken;
|
||||
@override
|
||||
@JsonKey(name: 'token_type')
|
||||
String get tokenType;
|
||||
@override
|
||||
@JsonKey(name: 'expires_in')
|
||||
int get expiresIn;
|
||||
@override
|
||||
AuthUser get user;
|
||||
|
||||
/// Create a copy of LoginResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$LoginResponseImplCopyWith<_$LoginResponseImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
25
lib/data/models/auth/login_response.g.dart
Normal file
25
lib/data/models/auth/login_response.g.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'login_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$LoginResponseImpl _$$LoginResponseImplFromJson(Map<String, dynamic> json) =>
|
||||
_$LoginResponseImpl(
|
||||
accessToken: json['access_token'] as String,
|
||||
refreshToken: json['refresh_token'] as String,
|
||||
tokenType: json['token_type'] as String,
|
||||
expiresIn: (json['expires_in'] as num).toInt(),
|
||||
user: AuthUser.fromJson(json['user'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$LoginResponseImplToJson(_$LoginResponseImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'access_token': instance.accessToken,
|
||||
'refresh_token': instance.refreshToken,
|
||||
'token_type': instance.tokenType,
|
||||
'expires_in': instance.expiresIn,
|
||||
'user': instance.user,
|
||||
};
|
||||
14
lib/data/models/auth/logout_request.dart
Normal file
14
lib/data/models/auth/logout_request.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'logout_request.freezed.dart';
|
||||
part 'logout_request.g.dart';
|
||||
|
||||
@freezed
|
||||
class LogoutRequest with _$LogoutRequest {
|
||||
const factory LogoutRequest({
|
||||
@JsonKey(name: 'refresh_token') required String refreshToken,
|
||||
}) = _LogoutRequest;
|
||||
|
||||
factory LogoutRequest.fromJson(Map<String, dynamic> json) =>
|
||||
_$LogoutRequestFromJson(json);
|
||||
}
|
||||
171
lib/data/models/auth/logout_request.freezed.dart
Normal file
171
lib/data/models/auth/logout_request.freezed.dart
Normal file
@@ -0,0 +1,171 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// 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 'logout_request.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
LogoutRequest _$LogoutRequestFromJson(Map<String, dynamic> json) {
|
||||
return _LogoutRequest.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LogoutRequest {
|
||||
@JsonKey(name: 'refresh_token')
|
||||
String get refreshToken => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this LogoutRequest to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of LogoutRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$LogoutRequestCopyWith<LogoutRequest> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $LogoutRequestCopyWith<$Res> {
|
||||
factory $LogoutRequestCopyWith(
|
||||
LogoutRequest value, $Res Function(LogoutRequest) then) =
|
||||
_$LogoutRequestCopyWithImpl<$Res, LogoutRequest>;
|
||||
@useResult
|
||||
$Res call({@JsonKey(name: 'refresh_token') String refreshToken});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$LogoutRequestCopyWithImpl<$Res, $Val extends LogoutRequest>
|
||||
implements $LogoutRequestCopyWith<$Res> {
|
||||
_$LogoutRequestCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of LogoutRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? refreshToken = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
refreshToken: null == refreshToken
|
||||
? _value.refreshToken
|
||||
: refreshToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$LogoutRequestImplCopyWith<$Res>
|
||||
implements $LogoutRequestCopyWith<$Res> {
|
||||
factory _$$LogoutRequestImplCopyWith(
|
||||
_$LogoutRequestImpl value, $Res Function(_$LogoutRequestImpl) then) =
|
||||
__$$LogoutRequestImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({@JsonKey(name: 'refresh_token') String refreshToken});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$LogoutRequestImplCopyWithImpl<$Res>
|
||||
extends _$LogoutRequestCopyWithImpl<$Res, _$LogoutRequestImpl>
|
||||
implements _$$LogoutRequestImplCopyWith<$Res> {
|
||||
__$$LogoutRequestImplCopyWithImpl(
|
||||
_$LogoutRequestImpl _value, $Res Function(_$LogoutRequestImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of LogoutRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? refreshToken = null,
|
||||
}) {
|
||||
return _then(_$LogoutRequestImpl(
|
||||
refreshToken: null == refreshToken
|
||||
? _value.refreshToken
|
||||
: refreshToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$LogoutRequestImpl implements _LogoutRequest {
|
||||
const _$LogoutRequestImpl(
|
||||
{@JsonKey(name: 'refresh_token') required this.refreshToken});
|
||||
|
||||
factory _$LogoutRequestImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$LogoutRequestImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'refresh_token')
|
||||
final String refreshToken;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LogoutRequest(refreshToken: $refreshToken)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$LogoutRequestImpl &&
|
||||
(identical(other.refreshToken, refreshToken) ||
|
||||
other.refreshToken == refreshToken));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, refreshToken);
|
||||
|
||||
/// Create a copy of LogoutRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$LogoutRequestImplCopyWith<_$LogoutRequestImpl> get copyWith =>
|
||||
__$$LogoutRequestImplCopyWithImpl<_$LogoutRequestImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$LogoutRequestImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _LogoutRequest implements LogoutRequest {
|
||||
const factory _LogoutRequest(
|
||||
{@JsonKey(name: 'refresh_token')
|
||||
required final String refreshToken}) = _$LogoutRequestImpl;
|
||||
|
||||
factory _LogoutRequest.fromJson(Map<String, dynamic> json) =
|
||||
_$LogoutRequestImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'refresh_token')
|
||||
String get refreshToken;
|
||||
|
||||
/// Create a copy of LogoutRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$LogoutRequestImplCopyWith<_$LogoutRequestImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
17
lib/data/models/auth/logout_request.g.dart
Normal file
17
lib/data/models/auth/logout_request.g.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'logout_request.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$LogoutRequestImpl _$$LogoutRequestImplFromJson(Map<String, dynamic> json) =>
|
||||
_$LogoutRequestImpl(
|
||||
refreshToken: json['refresh_token'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$LogoutRequestImplToJson(_$LogoutRequestImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'refresh_token': instance.refreshToken,
|
||||
};
|
||||
14
lib/data/models/auth/refresh_token_request.dart
Normal file
14
lib/data/models/auth/refresh_token_request.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'refresh_token_request.freezed.dart';
|
||||
part 'refresh_token_request.g.dart';
|
||||
|
||||
@freezed
|
||||
class RefreshTokenRequest with _$RefreshTokenRequest {
|
||||
const factory RefreshTokenRequest({
|
||||
@JsonKey(name: 'refresh_token') required String refreshToken,
|
||||
}) = _RefreshTokenRequest;
|
||||
|
||||
factory RefreshTokenRequest.fromJson(Map<String, dynamic> json) =>
|
||||
_$RefreshTokenRequestFromJson(json);
|
||||
}
|
||||
172
lib/data/models/auth/refresh_token_request.freezed.dart
Normal file
172
lib/data/models/auth/refresh_token_request.freezed.dart
Normal file
@@ -0,0 +1,172 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// 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 'refresh_token_request.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
RefreshTokenRequest _$RefreshTokenRequestFromJson(Map<String, dynamic> json) {
|
||||
return _RefreshTokenRequest.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$RefreshTokenRequest {
|
||||
@JsonKey(name: 'refresh_token')
|
||||
String get refreshToken => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this RefreshTokenRequest to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of RefreshTokenRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$RefreshTokenRequestCopyWith<RefreshTokenRequest> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $RefreshTokenRequestCopyWith<$Res> {
|
||||
factory $RefreshTokenRequestCopyWith(
|
||||
RefreshTokenRequest value, $Res Function(RefreshTokenRequest) then) =
|
||||
_$RefreshTokenRequestCopyWithImpl<$Res, RefreshTokenRequest>;
|
||||
@useResult
|
||||
$Res call({@JsonKey(name: 'refresh_token') String refreshToken});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$RefreshTokenRequestCopyWithImpl<$Res, $Val extends RefreshTokenRequest>
|
||||
implements $RefreshTokenRequestCopyWith<$Res> {
|
||||
_$RefreshTokenRequestCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of RefreshTokenRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? refreshToken = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
refreshToken: null == refreshToken
|
||||
? _value.refreshToken
|
||||
: refreshToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$RefreshTokenRequestImplCopyWith<$Res>
|
||||
implements $RefreshTokenRequestCopyWith<$Res> {
|
||||
factory _$$RefreshTokenRequestImplCopyWith(_$RefreshTokenRequestImpl value,
|
||||
$Res Function(_$RefreshTokenRequestImpl) then) =
|
||||
__$$RefreshTokenRequestImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({@JsonKey(name: 'refresh_token') String refreshToken});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$RefreshTokenRequestImplCopyWithImpl<$Res>
|
||||
extends _$RefreshTokenRequestCopyWithImpl<$Res, _$RefreshTokenRequestImpl>
|
||||
implements _$$RefreshTokenRequestImplCopyWith<$Res> {
|
||||
__$$RefreshTokenRequestImplCopyWithImpl(_$RefreshTokenRequestImpl _value,
|
||||
$Res Function(_$RefreshTokenRequestImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of RefreshTokenRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? refreshToken = null,
|
||||
}) {
|
||||
return _then(_$RefreshTokenRequestImpl(
|
||||
refreshToken: null == refreshToken
|
||||
? _value.refreshToken
|
||||
: refreshToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$RefreshTokenRequestImpl implements _RefreshTokenRequest {
|
||||
const _$RefreshTokenRequestImpl(
|
||||
{@JsonKey(name: 'refresh_token') required this.refreshToken});
|
||||
|
||||
factory _$RefreshTokenRequestImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$RefreshTokenRequestImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'refresh_token')
|
||||
final String refreshToken;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RefreshTokenRequest(refreshToken: $refreshToken)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$RefreshTokenRequestImpl &&
|
||||
(identical(other.refreshToken, refreshToken) ||
|
||||
other.refreshToken == refreshToken));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, refreshToken);
|
||||
|
||||
/// Create a copy of RefreshTokenRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$RefreshTokenRequestImplCopyWith<_$RefreshTokenRequestImpl> get copyWith =>
|
||||
__$$RefreshTokenRequestImplCopyWithImpl<_$RefreshTokenRequestImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$RefreshTokenRequestImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _RefreshTokenRequest implements RefreshTokenRequest {
|
||||
const factory _RefreshTokenRequest(
|
||||
{@JsonKey(name: 'refresh_token')
|
||||
required final String refreshToken}) = _$RefreshTokenRequestImpl;
|
||||
|
||||
factory _RefreshTokenRequest.fromJson(Map<String, dynamic> json) =
|
||||
_$RefreshTokenRequestImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'refresh_token')
|
||||
String get refreshToken;
|
||||
|
||||
/// Create a copy of RefreshTokenRequest
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$RefreshTokenRequestImplCopyWith<_$RefreshTokenRequestImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
19
lib/data/models/auth/refresh_token_request.g.dart
Normal file
19
lib/data/models/auth/refresh_token_request.g.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'refresh_token_request.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$RefreshTokenRequestImpl _$$RefreshTokenRequestImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$RefreshTokenRequestImpl(
|
||||
refreshToken: json['refresh_token'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$RefreshTokenRequestImplToJson(
|
||||
_$RefreshTokenRequestImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'refresh_token': instance.refreshToken,
|
||||
};
|
||||
17
lib/data/models/auth/token_response.dart
Normal file
17
lib/data/models/auth/token_response.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'token_response.freezed.dart';
|
||||
part 'token_response.g.dart';
|
||||
|
||||
@freezed
|
||||
class TokenResponse with _$TokenResponse {
|
||||
const factory TokenResponse({
|
||||
@JsonKey(name: 'access_token') required String accessToken,
|
||||
@JsonKey(name: 'refresh_token') required String refreshToken,
|
||||
@JsonKey(name: 'token_type') required String tokenType,
|
||||
@JsonKey(name: 'expires_in') required int expiresIn,
|
||||
}) = _TokenResponse;
|
||||
|
||||
factory TokenResponse.fromJson(Map<String, dynamic> json) =>
|
||||
_$TokenResponseFromJson(json);
|
||||
}
|
||||
246
lib/data/models/auth/token_response.freezed.dart
Normal file
246
lib/data/models/auth/token_response.freezed.dart
Normal file
@@ -0,0 +1,246 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// 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 'token_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
TokenResponse _$TokenResponseFromJson(Map<String, dynamic> json) {
|
||||
return _TokenResponse.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$TokenResponse {
|
||||
@JsonKey(name: 'access_token')
|
||||
String get accessToken => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'refresh_token')
|
||||
String get refreshToken => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'token_type')
|
||||
String get tokenType => throw _privateConstructorUsedError;
|
||||
@JsonKey(name: 'expires_in')
|
||||
int get expiresIn => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this TokenResponse to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of TokenResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$TokenResponseCopyWith<TokenResponse> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $TokenResponseCopyWith<$Res> {
|
||||
factory $TokenResponseCopyWith(
|
||||
TokenResponse value, $Res Function(TokenResponse) then) =
|
||||
_$TokenResponseCopyWithImpl<$Res, TokenResponse>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'access_token') String accessToken,
|
||||
@JsonKey(name: 'refresh_token') String refreshToken,
|
||||
@JsonKey(name: 'token_type') String tokenType,
|
||||
@JsonKey(name: 'expires_in') int expiresIn});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$TokenResponseCopyWithImpl<$Res, $Val extends TokenResponse>
|
||||
implements $TokenResponseCopyWith<$Res> {
|
||||
_$TokenResponseCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of TokenResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? accessToken = null,
|
||||
Object? refreshToken = null,
|
||||
Object? tokenType = null,
|
||||
Object? expiresIn = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
accessToken: null == accessToken
|
||||
? _value.accessToken
|
||||
: accessToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
refreshToken: null == refreshToken
|
||||
? _value.refreshToken
|
||||
: refreshToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
tokenType: null == tokenType
|
||||
? _value.tokenType
|
||||
: tokenType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
expiresIn: null == expiresIn
|
||||
? _value.expiresIn
|
||||
: expiresIn // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$TokenResponseImplCopyWith<$Res>
|
||||
implements $TokenResponseCopyWith<$Res> {
|
||||
factory _$$TokenResponseImplCopyWith(
|
||||
_$TokenResponseImpl value, $Res Function(_$TokenResponseImpl) then) =
|
||||
__$$TokenResponseImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{@JsonKey(name: 'access_token') String accessToken,
|
||||
@JsonKey(name: 'refresh_token') String refreshToken,
|
||||
@JsonKey(name: 'token_type') String tokenType,
|
||||
@JsonKey(name: 'expires_in') int expiresIn});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$TokenResponseImplCopyWithImpl<$Res>
|
||||
extends _$TokenResponseCopyWithImpl<$Res, _$TokenResponseImpl>
|
||||
implements _$$TokenResponseImplCopyWith<$Res> {
|
||||
__$$TokenResponseImplCopyWithImpl(
|
||||
_$TokenResponseImpl _value, $Res Function(_$TokenResponseImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of TokenResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? accessToken = null,
|
||||
Object? refreshToken = null,
|
||||
Object? tokenType = null,
|
||||
Object? expiresIn = null,
|
||||
}) {
|
||||
return _then(_$TokenResponseImpl(
|
||||
accessToken: null == accessToken
|
||||
? _value.accessToken
|
||||
: accessToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
refreshToken: null == refreshToken
|
||||
? _value.refreshToken
|
||||
: refreshToken // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
tokenType: null == tokenType
|
||||
? _value.tokenType
|
||||
: tokenType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
expiresIn: null == expiresIn
|
||||
? _value.expiresIn
|
||||
: expiresIn // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$TokenResponseImpl implements _TokenResponse {
|
||||
const _$TokenResponseImpl(
|
||||
{@JsonKey(name: 'access_token') required this.accessToken,
|
||||
@JsonKey(name: 'refresh_token') required this.refreshToken,
|
||||
@JsonKey(name: 'token_type') required this.tokenType,
|
||||
@JsonKey(name: 'expires_in') required this.expiresIn});
|
||||
|
||||
factory _$TokenResponseImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$TokenResponseImplFromJson(json);
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'access_token')
|
||||
final String accessToken;
|
||||
@override
|
||||
@JsonKey(name: 'refresh_token')
|
||||
final String refreshToken;
|
||||
@override
|
||||
@JsonKey(name: 'token_type')
|
||||
final String tokenType;
|
||||
@override
|
||||
@JsonKey(name: 'expires_in')
|
||||
final int expiresIn;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'TokenResponse(accessToken: $accessToken, refreshToken: $refreshToken, tokenType: $tokenType, expiresIn: $expiresIn)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$TokenResponseImpl &&
|
||||
(identical(other.accessToken, accessToken) ||
|
||||
other.accessToken == accessToken) &&
|
||||
(identical(other.refreshToken, refreshToken) ||
|
||||
other.refreshToken == refreshToken) &&
|
||||
(identical(other.tokenType, tokenType) ||
|
||||
other.tokenType == tokenType) &&
|
||||
(identical(other.expiresIn, expiresIn) ||
|
||||
other.expiresIn == expiresIn));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, accessToken, refreshToken, tokenType, expiresIn);
|
||||
|
||||
/// Create a copy of TokenResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$TokenResponseImplCopyWith<_$TokenResponseImpl> get copyWith =>
|
||||
__$$TokenResponseImplCopyWithImpl<_$TokenResponseImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$TokenResponseImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _TokenResponse implements TokenResponse {
|
||||
const factory _TokenResponse(
|
||||
{@JsonKey(name: 'access_token') required final String accessToken,
|
||||
@JsonKey(name: 'refresh_token') required final String refreshToken,
|
||||
@JsonKey(name: 'token_type') required final String tokenType,
|
||||
@JsonKey(name: 'expires_in') required final int expiresIn}) =
|
||||
_$TokenResponseImpl;
|
||||
|
||||
factory _TokenResponse.fromJson(Map<String, dynamic> json) =
|
||||
_$TokenResponseImpl.fromJson;
|
||||
|
||||
@override
|
||||
@JsonKey(name: 'access_token')
|
||||
String get accessToken;
|
||||
@override
|
||||
@JsonKey(name: 'refresh_token')
|
||||
String get refreshToken;
|
||||
@override
|
||||
@JsonKey(name: 'token_type')
|
||||
String get tokenType;
|
||||
@override
|
||||
@JsonKey(name: 'expires_in')
|
||||
int get expiresIn;
|
||||
|
||||
/// Create a copy of TokenResponse
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$TokenResponseImplCopyWith<_$TokenResponseImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
23
lib/data/models/auth/token_response.g.dart
Normal file
23
lib/data/models/auth/token_response.g.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'token_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$TokenResponseImpl _$$TokenResponseImplFromJson(Map<String, dynamic> json) =>
|
||||
_$TokenResponseImpl(
|
||||
accessToken: json['access_token'] as String,
|
||||
refreshToken: json['refresh_token'] as String,
|
||||
tokenType: json['token_type'] as String,
|
||||
expiresIn: (json['expires_in'] as num).toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$TokenResponseImplToJson(_$TokenResponseImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'access_token': instance.accessToken,
|
||||
'refresh_token': instance.refreshToken,
|
||||
'token_type': instance.tokenType,
|
||||
'expires_in': instance.expiresIn,
|
||||
};
|
||||
Reference in New Issue
Block a user