feat(feed): Dio, retrofit and freezed model stump

This commit is contained in:
2024-06-27 16:50:23 +03:00
parent b1508c3553
commit 58a7ca933d
13 changed files with 481 additions and 76 deletions

View File

@@ -0,0 +1,16 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'blog_post_create_credentials_model.freezed.dart';
part 'blog_post_create_credentials_model.g.dart';
@freezed
class BlogPostCreateCredentialsModel with _$BlogPostCreateCredentialsModel {
const factory BlogPostCreateCredentialsModel({
required String title,
required String description,
@JsonKey(name: 'youtube_url') required String youtubeUrl,
@Default('active') String status,
}) = _BlogPostCreateCredentialsModel;
factory BlogPostCreateCredentialsModel.fromJson(Map<String, Object?> json) =>
_$BlogPostCreateCredentialsModelFromJson(json);
}

View File

@@ -0,0 +1,235 @@
// 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 'blog_post_create_credentials_model.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');
BlogPostCreateCredentialsModel _$BlogPostCreateCredentialsModelFromJson(
Map<String, dynamic> json) {
return _BlogPostCreateCredentialsModel.fromJson(json);
}
/// @nodoc
mixin _$BlogPostCreateCredentialsModel {
String get title => throw _privateConstructorUsedError;
String get description => throw _privateConstructorUsedError;
@JsonKey(name: 'youtube_url')
String get youtubeUrl => throw _privateConstructorUsedError;
String get status => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$BlogPostCreateCredentialsModelCopyWith<BlogPostCreateCredentialsModel>
get copyWith => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $BlogPostCreateCredentialsModelCopyWith<$Res> {
factory $BlogPostCreateCredentialsModelCopyWith(
BlogPostCreateCredentialsModel value,
$Res Function(BlogPostCreateCredentialsModel) then) =
_$BlogPostCreateCredentialsModelCopyWithImpl<$Res,
BlogPostCreateCredentialsModel>;
@useResult
$Res call(
{String title,
String description,
@JsonKey(name: 'youtube_url') String youtubeUrl,
String status});
}
/// @nodoc
class _$BlogPostCreateCredentialsModelCopyWithImpl<$Res,
$Val extends BlogPostCreateCredentialsModel>
implements $BlogPostCreateCredentialsModelCopyWith<$Res> {
_$BlogPostCreateCredentialsModelCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
@pragma('vm:prefer-inline')
@override
$Res call({
Object? title = null,
Object? description = null,
Object? youtubeUrl = null,
Object? status = null,
}) {
return _then(_value.copyWith(
title: null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
description: null == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String,
youtubeUrl: null == youtubeUrl
? _value.youtubeUrl
: youtubeUrl // ignore: cast_nullable_to_non_nullable
as String,
status: null == status
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$BlogPostCreateCredentialsModelImplCopyWith<$Res>
implements $BlogPostCreateCredentialsModelCopyWith<$Res> {
factory _$$BlogPostCreateCredentialsModelImplCopyWith(
_$BlogPostCreateCredentialsModelImpl value,
$Res Function(_$BlogPostCreateCredentialsModelImpl) then) =
__$$BlogPostCreateCredentialsModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String title,
String description,
@JsonKey(name: 'youtube_url') String youtubeUrl,
String status});
}
/// @nodoc
class __$$BlogPostCreateCredentialsModelImplCopyWithImpl<$Res>
extends _$BlogPostCreateCredentialsModelCopyWithImpl<$Res,
_$BlogPostCreateCredentialsModelImpl>
implements _$$BlogPostCreateCredentialsModelImplCopyWith<$Res> {
__$$BlogPostCreateCredentialsModelImplCopyWithImpl(
_$BlogPostCreateCredentialsModelImpl _value,
$Res Function(_$BlogPostCreateCredentialsModelImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? title = null,
Object? description = null,
Object? youtubeUrl = null,
Object? status = null,
}) {
return _then(_$BlogPostCreateCredentialsModelImpl(
title: null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
description: null == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String,
youtubeUrl: null == youtubeUrl
? _value.youtubeUrl
: youtubeUrl // ignore: cast_nullable_to_non_nullable
as String,
status: null == status
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
@JsonSerializable()
class _$BlogPostCreateCredentialsModelImpl
implements _BlogPostCreateCredentialsModel {
const _$BlogPostCreateCredentialsModelImpl(
{required this.title,
required this.description,
@JsonKey(name: 'youtube_url') required this.youtubeUrl,
this.status = 'active'});
factory _$BlogPostCreateCredentialsModelImpl.fromJson(
Map<String, dynamic> json) =>
_$$BlogPostCreateCredentialsModelImplFromJson(json);
@override
final String title;
@override
final String description;
@override
@JsonKey(name: 'youtube_url')
final String youtubeUrl;
@override
@JsonKey()
final String status;
@override
String toString() {
return 'BlogPostCreateCredentialsModel(title: $title, description: $description, youtubeUrl: $youtubeUrl, status: $status)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$BlogPostCreateCredentialsModelImpl &&
(identical(other.title, title) || other.title == title) &&
(identical(other.description, description) ||
other.description == description) &&
(identical(other.youtubeUrl, youtubeUrl) ||
other.youtubeUrl == youtubeUrl) &&
(identical(other.status, status) || other.status == status));
}
@JsonKey(ignore: true)
@override
int get hashCode =>
Object.hash(runtimeType, title, description, youtubeUrl, status);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$BlogPostCreateCredentialsModelImplCopyWith<
_$BlogPostCreateCredentialsModelImpl>
get copyWith => __$$BlogPostCreateCredentialsModelImplCopyWithImpl<
_$BlogPostCreateCredentialsModelImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$BlogPostCreateCredentialsModelImplToJson(
this,
);
}
}
abstract class _BlogPostCreateCredentialsModel
implements BlogPostCreateCredentialsModel {
const factory _BlogPostCreateCredentialsModel(
{required final String title,
required final String description,
@JsonKey(name: 'youtube_url') required final String youtubeUrl,
final String status}) = _$BlogPostCreateCredentialsModelImpl;
factory _BlogPostCreateCredentialsModel.fromJson(Map<String, dynamic> json) =
_$BlogPostCreateCredentialsModelImpl.fromJson;
@override
String get title;
@override
String get description;
@override
@JsonKey(name: 'youtube_url')
String get youtubeUrl;
@override
String get status;
@override
@JsonKey(ignore: true)
_$$BlogPostCreateCredentialsModelImplCopyWith<
_$BlogPostCreateCredentialsModelImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -0,0 +1,25 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'blog_post_create_credentials_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$BlogPostCreateCredentialsModelImpl
_$$BlogPostCreateCredentialsModelImplFromJson(Map<String, dynamic> json) =>
_$BlogPostCreateCredentialsModelImpl(
title: json['title'] as String,
description: json['description'] as String,
youtubeUrl: json['youtube_url'] as String,
status: json['status'] as String? ?? 'active',
);
Map<String, dynamic> _$$BlogPostCreateCredentialsModelImplToJson(
_$BlogPostCreateCredentialsModelImpl instance) =>
<String, dynamic>{
'title': instance.title,
'description': instance.description,
'youtube_url': instance.youtubeUrl,
'status': instance.status,
};