fromJson static method
Implementation
static APIRequestEntity fromJson(Map<String, dynamic> json) {
return APIRequestEntity(
id: json['id'] as ID,
requestName: json['name'] as String,
projectID: json['project_id'] as ProjectID,
authorization: json['authorization'] != null
? ApiRequestAuthorizationEntity.fromJson(json['authorization'])
: const ApiRequestNoneAuthorizationEntity(),
requestType: EnumToString.fromString(
APIRequestMethods.values, json['request_type']) as APIRequestMethods,
baseUrl: json['url'] as String,
paths: (json['paths'] as List<dynamic>)
.map((e) => ApiRequestMapEntity.fromJson(e as Map<String, dynamic>))
.toList(),
headers: (json['headers'] as List<dynamic>)
.map((e) => ApiRequestMapEntity.fromJson(e as Map<String, dynamic>))
.toList(),
urlParams: (json['url_params'] as List<dynamic>)
.map((e) => ApiRequestMapEntity.fromJson(e as Map<String, dynamic>))
.toList(),
body: (json['body'] as List<dynamic>)
.map((e) => ApiRequestMapEntity.fromJson(e as Map<String, dynamic>))
.toList(),
returnEntity: json['return_entity'] != null
? QueryReturnEntity.fromJson(json['return_entity'])
: const QueryReturnEntity(
modelID: null,
returnType: ApiRequestReturnTypes.model,
),
acceptedStatusCodeRange: json['accepted_status_code_range'] != null
? RangeValues(
(json['accepted_status_code_range'] as List<dynamic>)
.first
.toDouble(),
(json['accepted_status_code_range'] as List<dynamic>)
.last
.toDouble(),
)
: const RangeValues(200, 299),
errorMessage: json['error_message'] as String? ?? '',
repositoryID: json['repository_id'] as ID?,
errorJsonPath: json['error_json_path'] as String? ?? '',
);
}