wip: history request groups

This commit is contained in:
DenserMeerkat
2024-07-14 23:16:29 +05:30
parent 78c5fc6a94
commit d5feb0b091
31 changed files with 1284 additions and 71 deletions

View File

@ -0,0 +1,21 @@
import 'package:apidash/consts.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'history_meta_model.freezed.dart';
part 'history_meta_model.g.dart';
@freezed
class HistoryMetaModel with _$HistoryMetaModel {
const factory HistoryMetaModel({
required String historyId,
@Default("") String name,
required String url,
required HTTPVerb method,
required int responseStatus,
required DateTime timeStamp,
}) = _HistoryMetaModel;
factory HistoryMetaModel.fromJson(Map<String, Object?> json) =>
_$HistoryMetaModelFromJson(json);
}

View File

@ -0,0 +1,261 @@
// 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 'history_meta_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');
HistoryMetaModel _$HistoryMetaModelFromJson(Map<String, dynamic> json) {
return _HistoryMetaModel.fromJson(json);
}
/// @nodoc
mixin _$HistoryMetaModel {
String get historyId => throw _privateConstructorUsedError;
String get name => throw _privateConstructorUsedError;
String get url => throw _privateConstructorUsedError;
HTTPVerb get method => throw _privateConstructorUsedError;
int get responseStatus => throw _privateConstructorUsedError;
DateTime get timeStamp => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$HistoryMetaModelCopyWith<HistoryMetaModel> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $HistoryMetaModelCopyWith<$Res> {
factory $HistoryMetaModelCopyWith(
HistoryMetaModel value, $Res Function(HistoryMetaModel) then) =
_$HistoryMetaModelCopyWithImpl<$Res, HistoryMetaModel>;
@useResult
$Res call(
{String historyId,
String name,
String url,
HTTPVerb method,
int responseStatus,
DateTime timeStamp});
}
/// @nodoc
class _$HistoryMetaModelCopyWithImpl<$Res, $Val extends HistoryMetaModel>
implements $HistoryMetaModelCopyWith<$Res> {
_$HistoryMetaModelCopyWithImpl(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? historyId = null,
Object? name = null,
Object? url = null,
Object? method = null,
Object? responseStatus = null,
Object? timeStamp = null,
}) {
return _then(_value.copyWith(
historyId: null == historyId
? _value.historyId
: historyId // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
url: null == url
? _value.url
: url // ignore: cast_nullable_to_non_nullable
as String,
method: null == method
? _value.method
: method // ignore: cast_nullable_to_non_nullable
as HTTPVerb,
responseStatus: null == responseStatus
? _value.responseStatus
: responseStatus // ignore: cast_nullable_to_non_nullable
as int,
timeStamp: null == timeStamp
? _value.timeStamp
: timeStamp // ignore: cast_nullable_to_non_nullable
as DateTime,
) as $Val);
}
}
/// @nodoc
abstract class _$$HistoryMetaModelImplCopyWith<$Res>
implements $HistoryMetaModelCopyWith<$Res> {
factory _$$HistoryMetaModelImplCopyWith(_$HistoryMetaModelImpl value,
$Res Function(_$HistoryMetaModelImpl) then) =
__$$HistoryMetaModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String historyId,
String name,
String url,
HTTPVerb method,
int responseStatus,
DateTime timeStamp});
}
/// @nodoc
class __$$HistoryMetaModelImplCopyWithImpl<$Res>
extends _$HistoryMetaModelCopyWithImpl<$Res, _$HistoryMetaModelImpl>
implements _$$HistoryMetaModelImplCopyWith<$Res> {
__$$HistoryMetaModelImplCopyWithImpl(_$HistoryMetaModelImpl _value,
$Res Function(_$HistoryMetaModelImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? historyId = null,
Object? name = null,
Object? url = null,
Object? method = null,
Object? responseStatus = null,
Object? timeStamp = null,
}) {
return _then(_$HistoryMetaModelImpl(
historyId: null == historyId
? _value.historyId
: historyId // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
url: null == url
? _value.url
: url // ignore: cast_nullable_to_non_nullable
as String,
method: null == method
? _value.method
: method // ignore: cast_nullable_to_non_nullable
as HTTPVerb,
responseStatus: null == responseStatus
? _value.responseStatus
: responseStatus // ignore: cast_nullable_to_non_nullable
as int,
timeStamp: null == timeStamp
? _value.timeStamp
: timeStamp // ignore: cast_nullable_to_non_nullable
as DateTime,
));
}
}
/// @nodoc
@JsonSerializable()
class _$HistoryMetaModelImpl implements _HistoryMetaModel {
const _$HistoryMetaModelImpl(
{required this.historyId,
this.name = "",
required this.url,
required this.method,
required this.responseStatus,
required this.timeStamp});
factory _$HistoryMetaModelImpl.fromJson(Map<String, dynamic> json) =>
_$$HistoryMetaModelImplFromJson(json);
@override
final String historyId;
@override
@JsonKey()
final String name;
@override
final String url;
@override
final HTTPVerb method;
@override
final int responseStatus;
@override
final DateTime timeStamp;
@override
String toString() {
return 'HistoryMetaModel(historyId: $historyId, name: $name, url: $url, method: $method, responseStatus: $responseStatus, timeStamp: $timeStamp)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$HistoryMetaModelImpl &&
(identical(other.historyId, historyId) ||
other.historyId == historyId) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.url, url) || other.url == url) &&
(identical(other.method, method) || other.method == method) &&
(identical(other.responseStatus, responseStatus) ||
other.responseStatus == responseStatus) &&
(identical(other.timeStamp, timeStamp) ||
other.timeStamp == timeStamp));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType, historyId, name, url, method, responseStatus, timeStamp);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$HistoryMetaModelImplCopyWith<_$HistoryMetaModelImpl> get copyWith =>
__$$HistoryMetaModelImplCopyWithImpl<_$HistoryMetaModelImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$HistoryMetaModelImplToJson(
this,
);
}
}
abstract class _HistoryMetaModel implements HistoryMetaModel {
const factory _HistoryMetaModel(
{required final String historyId,
final String name,
required final String url,
required final HTTPVerb method,
required final int responseStatus,
required final DateTime timeStamp}) = _$HistoryMetaModelImpl;
factory _HistoryMetaModel.fromJson(Map<String, dynamic> json) =
_$HistoryMetaModelImpl.fromJson;
@override
String get historyId;
@override
String get name;
@override
String get url;
@override
HTTPVerb get method;
@override
int get responseStatus;
@override
DateTime get timeStamp;
@override
@JsonKey(ignore: true)
_$$HistoryMetaModelImplCopyWith<_$HistoryMetaModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@ -0,0 +1,38 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'history_meta_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$HistoryMetaModelImpl _$$HistoryMetaModelImplFromJson(
Map<String, dynamic> json) =>
_$HistoryMetaModelImpl(
historyId: json['historyId'] as String,
name: json['name'] as String? ?? "",
url: json['url'] as String,
method: $enumDecode(_$HTTPVerbEnumMap, json['method']),
responseStatus: (json['responseStatus'] as num).toInt(),
timeStamp: DateTime.parse(json['timeStamp'] as String),
);
Map<String, dynamic> _$$HistoryMetaModelImplToJson(
_$HistoryMetaModelImpl instance) =>
<String, dynamic>{
'historyId': instance.historyId,
'name': instance.name,
'url': instance.url,
'method': _$HTTPVerbEnumMap[instance.method]!,
'responseStatus': instance.responseStatus,
'timeStamp': instance.timeStamp.toIso8601String(),
};
const _$HTTPVerbEnumMap = {
HTTPVerb.get: 'get',
HTTPVerb.head: 'head',
HTTPVerb.post: 'post',
HTTPVerb.put: 'put',
HTTPVerb.patch: 'patch',
HTTPVerb.delete: 'delete',
};

View File

@ -0,0 +1,23 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'models.dart';
part 'history_request_model.freezed.dart';
part 'history_request_model.g.dart';
@freezed
class HistoryRequestModel with _$HistoryRequestModel {
@JsonSerializable(
explicitToJson: true,
anyMap: true,
)
const factory HistoryRequestModel({
required String historyId,
required HistoryMetaModel metaData,
required HttpRequestModel httpRequestModel,
required HttpResponseModel httpResponseModel,
}) = _HistoryRequestModel;
factory HistoryRequestModel.fromJson(Map<String, Object?> json) =>
_$HistoryRequestModelFromJson(json);
}

View File

@ -0,0 +1,258 @@
// 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 'history_request_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');
HistoryRequestModel _$HistoryRequestModelFromJson(Map<String, dynamic> json) {
return _HistoryRequestModel.fromJson(json);
}
/// @nodoc
mixin _$HistoryRequestModel {
String get historyId => throw _privateConstructorUsedError;
HistoryMetaModel get metaData => throw _privateConstructorUsedError;
HttpRequestModel get httpRequestModel => throw _privateConstructorUsedError;
HttpResponseModel get httpResponseModel => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$HistoryRequestModelCopyWith<HistoryRequestModel> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $HistoryRequestModelCopyWith<$Res> {
factory $HistoryRequestModelCopyWith(
HistoryRequestModel value, $Res Function(HistoryRequestModel) then) =
_$HistoryRequestModelCopyWithImpl<$Res, HistoryRequestModel>;
@useResult
$Res call(
{String historyId,
HistoryMetaModel metaData,
HttpRequestModel httpRequestModel,
HttpResponseModel httpResponseModel});
$HistoryMetaModelCopyWith<$Res> get metaData;
$HttpRequestModelCopyWith<$Res> get httpRequestModel;
$HttpResponseModelCopyWith<$Res> get httpResponseModel;
}
/// @nodoc
class _$HistoryRequestModelCopyWithImpl<$Res, $Val extends HistoryRequestModel>
implements $HistoryRequestModelCopyWith<$Res> {
_$HistoryRequestModelCopyWithImpl(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? historyId = null,
Object? metaData = null,
Object? httpRequestModel = null,
Object? httpResponseModel = null,
}) {
return _then(_value.copyWith(
historyId: null == historyId
? _value.historyId
: historyId // ignore: cast_nullable_to_non_nullable
as String,
metaData: null == metaData
? _value.metaData
: metaData // ignore: cast_nullable_to_non_nullable
as HistoryMetaModel,
httpRequestModel: null == httpRequestModel
? _value.httpRequestModel
: httpRequestModel // ignore: cast_nullable_to_non_nullable
as HttpRequestModel,
httpResponseModel: null == httpResponseModel
? _value.httpResponseModel
: httpResponseModel // ignore: cast_nullable_to_non_nullable
as HttpResponseModel,
) as $Val);
}
@override
@pragma('vm:prefer-inline')
$HistoryMetaModelCopyWith<$Res> get metaData {
return $HistoryMetaModelCopyWith<$Res>(_value.metaData, (value) {
return _then(_value.copyWith(metaData: value) as $Val);
});
}
@override
@pragma('vm:prefer-inline')
$HttpRequestModelCopyWith<$Res> get httpRequestModel {
return $HttpRequestModelCopyWith<$Res>(_value.httpRequestModel, (value) {
return _then(_value.copyWith(httpRequestModel: value) as $Val);
});
}
@override
@pragma('vm:prefer-inline')
$HttpResponseModelCopyWith<$Res> get httpResponseModel {
return $HttpResponseModelCopyWith<$Res>(_value.httpResponseModel, (value) {
return _then(_value.copyWith(httpResponseModel: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$HistoryRequestModelImplCopyWith<$Res>
implements $HistoryRequestModelCopyWith<$Res> {
factory _$$HistoryRequestModelImplCopyWith(_$HistoryRequestModelImpl value,
$Res Function(_$HistoryRequestModelImpl) then) =
__$$HistoryRequestModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{String historyId,
HistoryMetaModel metaData,
HttpRequestModel httpRequestModel,
HttpResponseModel httpResponseModel});
@override
$HistoryMetaModelCopyWith<$Res> get metaData;
@override
$HttpRequestModelCopyWith<$Res> get httpRequestModel;
@override
$HttpResponseModelCopyWith<$Res> get httpResponseModel;
}
/// @nodoc
class __$$HistoryRequestModelImplCopyWithImpl<$Res>
extends _$HistoryRequestModelCopyWithImpl<$Res, _$HistoryRequestModelImpl>
implements _$$HistoryRequestModelImplCopyWith<$Res> {
__$$HistoryRequestModelImplCopyWithImpl(_$HistoryRequestModelImpl _value,
$Res Function(_$HistoryRequestModelImpl) _then)
: super(_value, _then);
@pragma('vm:prefer-inline')
@override
$Res call({
Object? historyId = null,
Object? metaData = null,
Object? httpRequestModel = null,
Object? httpResponseModel = null,
}) {
return _then(_$HistoryRequestModelImpl(
historyId: null == historyId
? _value.historyId
: historyId // ignore: cast_nullable_to_non_nullable
as String,
metaData: null == metaData
? _value.metaData
: metaData // ignore: cast_nullable_to_non_nullable
as HistoryMetaModel,
httpRequestModel: null == httpRequestModel
? _value.httpRequestModel
: httpRequestModel // ignore: cast_nullable_to_non_nullable
as HttpRequestModel,
httpResponseModel: null == httpResponseModel
? _value.httpResponseModel
: httpResponseModel // ignore: cast_nullable_to_non_nullable
as HttpResponseModel,
));
}
}
/// @nodoc
@JsonSerializable(explicitToJson: true, anyMap: true)
class _$HistoryRequestModelImpl implements _HistoryRequestModel {
const _$HistoryRequestModelImpl(
{required this.historyId,
required this.metaData,
required this.httpRequestModel,
required this.httpResponseModel});
factory _$HistoryRequestModelImpl.fromJson(Map<String, dynamic> json) =>
_$$HistoryRequestModelImplFromJson(json);
@override
final String historyId;
@override
final HistoryMetaModel metaData;
@override
final HttpRequestModel httpRequestModel;
@override
final HttpResponseModel httpResponseModel;
@override
String toString() {
return 'HistoryRequestModel(historyId: $historyId, metaData: $metaData, httpRequestModel: $httpRequestModel, httpResponseModel: $httpResponseModel)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$HistoryRequestModelImpl &&
(identical(other.historyId, historyId) ||
other.historyId == historyId) &&
(identical(other.metaData, metaData) ||
other.metaData == metaData) &&
(identical(other.httpRequestModel, httpRequestModel) ||
other.httpRequestModel == httpRequestModel) &&
(identical(other.httpResponseModel, httpResponseModel) ||
other.httpResponseModel == httpResponseModel));
}
@JsonKey(ignore: true)
@override
int get hashCode => Object.hash(
runtimeType, historyId, metaData, httpRequestModel, httpResponseModel);
@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$HistoryRequestModelImplCopyWith<_$HistoryRequestModelImpl> get copyWith =>
__$$HistoryRequestModelImplCopyWithImpl<_$HistoryRequestModelImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$HistoryRequestModelImplToJson(
this,
);
}
}
abstract class _HistoryRequestModel implements HistoryRequestModel {
const factory _HistoryRequestModel(
{required final String historyId,
required final HistoryMetaModel metaData,
required final HttpRequestModel httpRequestModel,
required final HttpResponseModel httpResponseModel}) =
_$HistoryRequestModelImpl;
factory _HistoryRequestModel.fromJson(Map<String, dynamic> json) =
_$HistoryRequestModelImpl.fromJson;
@override
String get historyId;
@override
HistoryMetaModel get metaData;
@override
HttpRequestModel get httpRequestModel;
@override
HttpResponseModel get httpResponseModel;
@override
@JsonKey(ignore: true)
_$$HistoryRequestModelImplCopyWith<_$HistoryRequestModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@ -0,0 +1,27 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'history_request_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$HistoryRequestModelImpl _$$HistoryRequestModelImplFromJson(Map json) =>
_$HistoryRequestModelImpl(
historyId: json['historyId'] as String,
metaData: HistoryMetaModel.fromJson(
Map<String, Object?>.from(json['metaData'] as Map)),
httpRequestModel: HttpRequestModel.fromJson(
Map<String, Object?>.from(json['httpRequestModel'] as Map)),
httpResponseModel: HttpResponseModel.fromJson(
Map<String, Object?>.from(json['httpResponseModel'] as Map)),
);
Map<String, dynamic> _$$HistoryRequestModelImplToJson(
_$HistoryRequestModelImpl instance) =>
<String, dynamic>{
'historyId': instance.historyId,
'metaData': instance.metaData.toJson(),
'httpRequestModel': instance.httpRequestModel.toJson(),
'httpResponseModel': instance.httpResponseModel.toJson(),
};

View File

@ -1,5 +1,7 @@
export 'environment_model.dart';
export 'form_data_model.dart';
export 'history_meta_model.dart';
export 'history_request_model.dart';
export 'http_request_model.dart';
export 'http_response_model.dart';
export 'name_value_model.dart';