mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 18:57:05 +08:00
add postmancollection model
This commit is contained in:
1
packages/postman/lib/models/models.dart
Normal file
1
packages/postman/lib/models/models.dart
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export 'postman_collection.dart';
|
||||||
141
packages/postman/lib/models/postman_collection.dart
Normal file
141
packages/postman/lib/models/postman_collection.dart
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
// To parse this JSON data, do
|
||||||
|
//
|
||||||
|
// final postmanCollection = postmanCollectionFromJson(jsonString);
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
part 'postman_collection.freezed.dart';
|
||||||
|
part 'postman_collection.g.dart';
|
||||||
|
|
||||||
|
PostmanCollection postmanCollectionFromJsonStr(String str) =>
|
||||||
|
PostmanCollection.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String postmanCollectionToJsonStr(PostmanCollection data) =>
|
||||||
|
json.encode(data.toJson());
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class PostmanCollection with _$PostmanCollection {
|
||||||
|
const factory PostmanCollection({
|
||||||
|
Info? info,
|
||||||
|
List<Item>? item,
|
||||||
|
}) = _PostmanCollection;
|
||||||
|
|
||||||
|
factory PostmanCollection.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$PostmanCollectionFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class Info with _$Info {
|
||||||
|
const factory Info({
|
||||||
|
String? postmanId,
|
||||||
|
String? name,
|
||||||
|
String? schema,
|
||||||
|
String? exporterId,
|
||||||
|
}) = _Info;
|
||||||
|
|
||||||
|
factory Info.fromJson(Map<String, dynamic> json) => _$InfoFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class Item with _$Item {
|
||||||
|
const factory Item({
|
||||||
|
String? name,
|
||||||
|
Request? request,
|
||||||
|
List<dynamic>? response,
|
||||||
|
}) = _Item;
|
||||||
|
|
||||||
|
factory Item.fromJson(Map<String, dynamic> json) => _$ItemFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class Request with _$Request {
|
||||||
|
const factory Request({
|
||||||
|
String? method,
|
||||||
|
List<Header>? header,
|
||||||
|
Body? body,
|
||||||
|
Url? url,
|
||||||
|
}) = _Request;
|
||||||
|
|
||||||
|
factory Request.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$RequestFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class Header with _$Header {
|
||||||
|
const factory Header({
|
||||||
|
String? key,
|
||||||
|
String? value,
|
||||||
|
String? type,
|
||||||
|
bool? disabled,
|
||||||
|
}) = _Header;
|
||||||
|
|
||||||
|
factory Header.fromJson(Map<String, dynamic> json) => _$HeaderFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class Url with _$Url {
|
||||||
|
const factory Url({
|
||||||
|
String? raw,
|
||||||
|
String? protocol,
|
||||||
|
List<String>? host,
|
||||||
|
List<String>? path,
|
||||||
|
List<Query>? query,
|
||||||
|
}) = _Url;
|
||||||
|
|
||||||
|
factory Url.fromJson(Map<String, dynamic> json) => _$UrlFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class Query with _$Query {
|
||||||
|
const factory Query({
|
||||||
|
String? key,
|
||||||
|
String? value,
|
||||||
|
bool? disabled,
|
||||||
|
}) = _Query;
|
||||||
|
|
||||||
|
factory Query.fromJson(Map<String, dynamic> json) => _$QueryFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class Body with _$Body {
|
||||||
|
const factory Body({
|
||||||
|
String? mode,
|
||||||
|
String? raw,
|
||||||
|
Options? options,
|
||||||
|
List<Formdatum>? formdata,
|
||||||
|
}) = _Body;
|
||||||
|
|
||||||
|
factory Body.fromJson(Map<String, dynamic> json) => _$BodyFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class Options with _$Options {
|
||||||
|
const factory Options({
|
||||||
|
Raw? raw,
|
||||||
|
}) = _Options;
|
||||||
|
|
||||||
|
factory Options.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$OptionsFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class Raw with _$Raw {
|
||||||
|
const factory Raw({
|
||||||
|
String? language,
|
||||||
|
}) = _Raw;
|
||||||
|
|
||||||
|
factory Raw.fromJson(Map<String, dynamic> json) => _$RawFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class Formdatum with _$Formdatum {
|
||||||
|
const factory Formdatum({
|
||||||
|
String? key,
|
||||||
|
String? value,
|
||||||
|
String? type,
|
||||||
|
String? src,
|
||||||
|
}) = _Formdatum;
|
||||||
|
|
||||||
|
factory Formdatum.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$FormdatumFromJson(json);
|
||||||
|
}
|
||||||
2232
packages/postman/lib/models/postman_collection.freezed.dart
Normal file
2232
packages/postman/lib/models/postman_collection.freezed.dart
Normal file
File diff suppressed because it is too large
Load Diff
178
packages/postman/lib/models/postman_collection.g.dart
Normal file
178
packages/postman/lib/models/postman_collection.g.dart
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'postman_collection.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_$PostmanCollectionImpl _$$PostmanCollectionImplFromJson(
|
||||||
|
Map<String, dynamic> json) =>
|
||||||
|
_$PostmanCollectionImpl(
|
||||||
|
info: json['info'] == null
|
||||||
|
? null
|
||||||
|
: Info.fromJson(json['info'] as Map<String, dynamic>),
|
||||||
|
item: (json['item'] as List<dynamic>?)
|
||||||
|
?.map((e) => Item.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$PostmanCollectionImplToJson(
|
||||||
|
_$PostmanCollectionImpl instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'info': instance.info,
|
||||||
|
'item': instance.item,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$InfoImpl _$$InfoImplFromJson(Map<String, dynamic> json) => _$InfoImpl(
|
||||||
|
postmanId: json['postmanId'] as String?,
|
||||||
|
name: json['name'] as String?,
|
||||||
|
schema: json['schema'] as String?,
|
||||||
|
exporterId: json['exporterId'] as String?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$InfoImplToJson(_$InfoImpl instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'postmanId': instance.postmanId,
|
||||||
|
'name': instance.name,
|
||||||
|
'schema': instance.schema,
|
||||||
|
'exporterId': instance.exporterId,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$ItemImpl _$$ItemImplFromJson(Map<String, dynamic> json) => _$ItemImpl(
|
||||||
|
name: json['name'] as String?,
|
||||||
|
request: json['request'] == null
|
||||||
|
? null
|
||||||
|
: Request.fromJson(json['request'] as Map<String, dynamic>),
|
||||||
|
response: json['response'] as List<dynamic>?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$ItemImplToJson(_$ItemImpl instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'name': instance.name,
|
||||||
|
'request': instance.request,
|
||||||
|
'response': instance.response,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$RequestImpl _$$RequestImplFromJson(Map<String, dynamic> json) =>
|
||||||
|
_$RequestImpl(
|
||||||
|
method: json['method'] as String?,
|
||||||
|
header: (json['header'] as List<dynamic>?)
|
||||||
|
?.map((e) => Header.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
body: json['body'] == null
|
||||||
|
? null
|
||||||
|
: Body.fromJson(json['body'] as Map<String, dynamic>),
|
||||||
|
url: json['url'] == null
|
||||||
|
? null
|
||||||
|
: Url.fromJson(json['url'] as Map<String, dynamic>),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$RequestImplToJson(_$RequestImpl instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'method': instance.method,
|
||||||
|
'header': instance.header,
|
||||||
|
'body': instance.body,
|
||||||
|
'url': instance.url,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$HeaderImpl _$$HeaderImplFromJson(Map<String, dynamic> json) => _$HeaderImpl(
|
||||||
|
key: json['key'] as String?,
|
||||||
|
value: json['value'] as String?,
|
||||||
|
type: json['type'] as String?,
|
||||||
|
disabled: json['disabled'] as bool?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$HeaderImplToJson(_$HeaderImpl instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'key': instance.key,
|
||||||
|
'value': instance.value,
|
||||||
|
'type': instance.type,
|
||||||
|
'disabled': instance.disabled,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$UrlImpl _$$UrlImplFromJson(Map<String, dynamic> json) => _$UrlImpl(
|
||||||
|
raw: json['raw'] as String?,
|
||||||
|
protocol: json['protocol'] as String?,
|
||||||
|
host: (json['host'] as List<dynamic>?)?.map((e) => e as String).toList(),
|
||||||
|
path: (json['path'] as List<dynamic>?)?.map((e) => e as String).toList(),
|
||||||
|
query: (json['query'] as List<dynamic>?)
|
||||||
|
?.map((e) => Query.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$UrlImplToJson(_$UrlImpl instance) => <String, dynamic>{
|
||||||
|
'raw': instance.raw,
|
||||||
|
'protocol': instance.protocol,
|
||||||
|
'host': instance.host,
|
||||||
|
'path': instance.path,
|
||||||
|
'query': instance.query,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$QueryImpl _$$QueryImplFromJson(Map<String, dynamic> json) => _$QueryImpl(
|
||||||
|
key: json['key'] as String?,
|
||||||
|
value: json['value'] as String?,
|
||||||
|
disabled: json['disabled'] as bool?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$QueryImplToJson(_$QueryImpl instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'key': instance.key,
|
||||||
|
'value': instance.value,
|
||||||
|
'disabled': instance.disabled,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$BodyImpl _$$BodyImplFromJson(Map<String, dynamic> json) => _$BodyImpl(
|
||||||
|
mode: json['mode'] as String?,
|
||||||
|
raw: json['raw'] as String?,
|
||||||
|
options: json['options'] == null
|
||||||
|
? null
|
||||||
|
: Options.fromJson(json['options'] as Map<String, dynamic>),
|
||||||
|
formdata: (json['formdata'] as List<dynamic>?)
|
||||||
|
?.map((e) => Formdatum.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$BodyImplToJson(_$BodyImpl instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'mode': instance.mode,
|
||||||
|
'raw': instance.raw,
|
||||||
|
'options': instance.options,
|
||||||
|
'formdata': instance.formdata,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$OptionsImpl _$$OptionsImplFromJson(Map<String, dynamic> json) =>
|
||||||
|
_$OptionsImpl(
|
||||||
|
raw: json['raw'] == null
|
||||||
|
? null
|
||||||
|
: Raw.fromJson(json['raw'] as Map<String, dynamic>),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$OptionsImplToJson(_$OptionsImpl instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'raw': instance.raw,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$RawImpl _$$RawImplFromJson(Map<String, dynamic> json) => _$RawImpl(
|
||||||
|
language: json['language'] as String?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$RawImplToJson(_$RawImpl instance) => <String, dynamic>{
|
||||||
|
'language': instance.language,
|
||||||
|
};
|
||||||
|
|
||||||
|
_$FormdatumImpl _$$FormdatumImplFromJson(Map<String, dynamic> json) =>
|
||||||
|
_$FormdatumImpl(
|
||||||
|
key: json['key'] as String?,
|
||||||
|
value: json['value'] as String?,
|
||||||
|
type: json['type'] as String?,
|
||||||
|
src: json['src'] as String?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$FormdatumImplToJson(_$FormdatumImpl instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'key': instance.key,
|
||||||
|
'value': instance.value,
|
||||||
|
'type': instance.type,
|
||||||
|
'src': instance.src,
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user