feat: editor endpoints

This commit is contained in:
Jason Rasmussen
2024-08-08 12:47:02 -04:00
parent 11f41099c3
commit 82f05e9ca9
25 changed files with 1566 additions and 5 deletions
+9
View File
@@ -38,6 +38,7 @@ part 'api/authentication_api.dart';
part 'api/deprecated_api.dart';
part 'api/download_api.dart';
part 'api/duplicates_api.dart';
part 'api/editor_api.dart';
part 'api/faces_api.dart';
part 'api/file_reports_api.dart';
part 'api/jobs_api.dart';
@@ -125,6 +126,14 @@ part 'model/download_response_dto.dart';
part 'model/download_update.dart';
part 'model/duplicate_detection_config.dart';
part 'model/duplicate_response_dto.dart';
part 'model/editor_action_adjust.dart';
part 'model/editor_action_blur.dart';
part 'model/editor_action_crop.dart';
part 'model/editor_action_rotate.dart';
part 'model/editor_action_type.dart';
part 'model/editor_create_asset_dto.dart';
part 'model/editor_create_asset_dto_edits_inner.dart';
part 'model/editor_crop_region.dart';
part 'model/email_notifications_response.dart';
part 'model/email_notifications_update.dart';
part 'model/entity_type.dart';
+65
View File
@@ -0,0 +1,65 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.18
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class EditorApi {
EditorApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
final ApiClient apiClient;
/// Performs an HTTP 'POST /editor' operation and returns the [Response].
/// Parameters:
///
/// * [EditorCreateAssetDto] editorCreateAssetDto (required):
Future<Response> createAssetFromEditsWithHttpInfo(EditorCreateAssetDto editorCreateAssetDto,) async {
// ignore: prefer_const_declarations
final path = r'/editor';
// ignore: prefer_final_locals
Object? postBody = editorCreateAssetDto;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>['application/json'];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Parameters:
///
/// * [EditorCreateAssetDto] editorCreateAssetDto (required):
Future<AssetResponseDto?> createAssetFromEdits(EditorCreateAssetDto editorCreateAssetDto,) async {
final response = await createAssetFromEditsWithHttpInfo(editorCreateAssetDto,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetResponseDto',) as AssetResponseDto;
}
return null;
}
}
+16
View File
@@ -308,6 +308,22 @@ class ApiClient {
return DuplicateDetectionConfig.fromJson(value);
case 'DuplicateResponseDto':
return DuplicateResponseDto.fromJson(value);
case 'EditorActionAdjust':
return EditorActionAdjust.fromJson(value);
case 'EditorActionBlur':
return EditorActionBlur.fromJson(value);
case 'EditorActionCrop':
return EditorActionCrop.fromJson(value);
case 'EditorActionRotate':
return EditorActionRotate.fromJson(value);
case 'EditorActionType':
return EditorActionTypeTypeTransformer().decode(value);
case 'EditorCreateAssetDto':
return EditorCreateAssetDto.fromJson(value);
case 'EditorCreateAssetDtoEditsInner':
return EditorCreateAssetDtoEditsInner.fromJson(value);
case 'EditorCropRegion':
return EditorCropRegion.fromJson(value);
case 'EmailNotificationsResponse':
return EmailNotificationsResponse.fromJson(value);
case 'EmailNotificationsUpdate':
+3
View File
@@ -82,6 +82,9 @@ String parameterToString(dynamic value) {
if (value is Colorspace) {
return ColorspaceTypeTransformer().encode(value).toString();
}
if (value is EditorActionType) {
return EditorActionTypeTypeTransformer().encode(value).toString();
}
if (value is EntityType) {
return EntityTypeTypeTransformer().encode(value).toString();
}
+130
View File
@@ -0,0 +1,130 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.18
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class EditorActionAdjust {
/// Returns a new [EditorActionAdjust] instance.
EditorActionAdjust({
required this.action,
required this.brightness,
required this.hue,
required this.lightness,
required this.saturation,
});
EditorActionType action;
int brightness;
int hue;
int lightness;
int saturation;
@override
bool operator ==(Object other) => identical(this, other) || other is EditorActionAdjust &&
other.action == action &&
other.brightness == brightness &&
other.hue == hue &&
other.lightness == lightness &&
other.saturation == saturation;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(action.hashCode) +
(brightness.hashCode) +
(hue.hashCode) +
(lightness.hashCode) +
(saturation.hashCode);
@override
String toString() => 'EditorActionAdjust[action=$action, brightness=$brightness, hue=$hue, lightness=$lightness, saturation=$saturation]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'action'] = this.action;
json[r'brightness'] = this.brightness;
json[r'hue'] = this.hue;
json[r'lightness'] = this.lightness;
json[r'saturation'] = this.saturation;
return json;
}
/// Returns a new [EditorActionAdjust] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static EditorActionAdjust? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return EditorActionAdjust(
action: EditorActionType.fromJson(json[r'action'])!,
brightness: mapValueOfType<int>(json, r'brightness')!,
hue: mapValueOfType<int>(json, r'hue')!,
lightness: mapValueOfType<int>(json, r'lightness')!,
saturation: mapValueOfType<int>(json, r'saturation')!,
);
}
return null;
}
static List<EditorActionAdjust> listFromJson(dynamic json, {bool growable = false,}) {
final result = <EditorActionAdjust>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = EditorActionAdjust.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, EditorActionAdjust> mapFromJson(dynamic json) {
final map = <String, EditorActionAdjust>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = EditorActionAdjust.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of EditorActionAdjust-objects as value to a dart map
static Map<String, List<EditorActionAdjust>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<EditorActionAdjust>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = EditorActionAdjust.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'action',
'brightness',
'hue',
'lightness',
'saturation',
};
}
+98
View File
@@ -0,0 +1,98 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.18
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class EditorActionBlur {
/// Returns a new [EditorActionBlur] instance.
EditorActionBlur({
required this.action,
});
EditorActionType action;
@override
bool operator ==(Object other) => identical(this, other) || other is EditorActionBlur &&
other.action == action;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(action.hashCode);
@override
String toString() => 'EditorActionBlur[action=$action]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'action'] = this.action;
return json;
}
/// Returns a new [EditorActionBlur] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static EditorActionBlur? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return EditorActionBlur(
action: EditorActionType.fromJson(json[r'action'])!,
);
}
return null;
}
static List<EditorActionBlur> listFromJson(dynamic json, {bool growable = false,}) {
final result = <EditorActionBlur>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = EditorActionBlur.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, EditorActionBlur> mapFromJson(dynamic json) {
final map = <String, EditorActionBlur>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = EditorActionBlur.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of EditorActionBlur-objects as value to a dart map
static Map<String, List<EditorActionBlur>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<EditorActionBlur>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = EditorActionBlur.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'action',
};
}
+106
View File
@@ -0,0 +1,106 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.18
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class EditorActionCrop {
/// Returns a new [EditorActionCrop] instance.
EditorActionCrop({
required this.action,
required this.region,
});
EditorActionType action;
EditorCropRegion region;
@override
bool operator ==(Object other) => identical(this, other) || other is EditorActionCrop &&
other.action == action &&
other.region == region;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(action.hashCode) +
(region.hashCode);
@override
String toString() => 'EditorActionCrop[action=$action, region=$region]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'action'] = this.action;
json[r'region'] = this.region;
return json;
}
/// Returns a new [EditorActionCrop] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static EditorActionCrop? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return EditorActionCrop(
action: EditorActionType.fromJson(json[r'action'])!,
region: EditorCropRegion.fromJson(json[r'region'])!,
);
}
return null;
}
static List<EditorActionCrop> listFromJson(dynamic json, {bool growable = false,}) {
final result = <EditorActionCrop>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = EditorActionCrop.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, EditorActionCrop> mapFromJson(dynamic json) {
final map = <String, EditorActionCrop>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = EditorActionCrop.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of EditorActionCrop-objects as value to a dart map
static Map<String, List<EditorActionCrop>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<EditorActionCrop>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = EditorActionCrop.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'action',
'region',
};
}
+106
View File
@@ -0,0 +1,106 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.18
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class EditorActionRotate {
/// Returns a new [EditorActionRotate] instance.
EditorActionRotate({
required this.action,
required this.angle,
});
EditorActionType action;
int angle;
@override
bool operator ==(Object other) => identical(this, other) || other is EditorActionRotate &&
other.action == action &&
other.angle == angle;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(action.hashCode) +
(angle.hashCode);
@override
String toString() => 'EditorActionRotate[action=$action, angle=$angle]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'action'] = this.action;
json[r'angle'] = this.angle;
return json;
}
/// Returns a new [EditorActionRotate] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static EditorActionRotate? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return EditorActionRotate(
action: EditorActionType.fromJson(json[r'action'])!,
angle: mapValueOfType<int>(json, r'angle')!,
);
}
return null;
}
static List<EditorActionRotate> listFromJson(dynamic json, {bool growable = false,}) {
final result = <EditorActionRotate>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = EditorActionRotate.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, EditorActionRotate> mapFromJson(dynamic json) {
final map = <String, EditorActionRotate>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = EditorActionRotate.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of EditorActionRotate-objects as value to a dart map
static Map<String, List<EditorActionRotate>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<EditorActionRotate>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = EditorActionRotate.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'action',
'angle',
};
}
+91
View File
@@ -0,0 +1,91 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.18
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class EditorActionType {
/// Instantiate a new enum with the provided [value].
const EditorActionType._(this.value);
/// The underlying value of this enum member.
final String value;
@override
String toString() => value;
String toJson() => value;
static const crop = EditorActionType._(r'crop');
static const rotate = EditorActionType._(r'rotate');
static const blur = EditorActionType._(r'blur');
static const adjust = EditorActionType._(r'adjust');
/// List of all possible values in this [enum][EditorActionType].
static const values = <EditorActionType>[
crop,
rotate,
blur,
adjust,
];
static EditorActionType? fromJson(dynamic value) => EditorActionTypeTypeTransformer().decode(value);
static List<EditorActionType> listFromJson(dynamic json, {bool growable = false,}) {
final result = <EditorActionType>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = EditorActionType.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
}
/// Transformation class that can [encode] an instance of [EditorActionType] to String,
/// and [decode] dynamic data back to [EditorActionType].
class EditorActionTypeTypeTransformer {
factory EditorActionTypeTypeTransformer() => _instance ??= const EditorActionTypeTypeTransformer._();
const EditorActionTypeTypeTransformer._();
String encode(EditorActionType data) => data.value;
/// Decodes a [dynamic value][data] to a EditorActionType.
///
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
///
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
/// and users are still using an old app with the old code.
EditorActionType? decode(dynamic data, {bool allowNull = true}) {
if (data != null) {
switch (data) {
case r'crop': return EditorActionType.crop;
case r'rotate': return EditorActionType.rotate;
case r'blur': return EditorActionType.blur;
case r'adjust': return EditorActionType.adjust;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');
}
}
}
return null;
}
/// Singleton [EditorActionTypeTypeTransformer] instance.
static EditorActionTypeTypeTransformer? _instance;
}
+126
View File
@@ -0,0 +1,126 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.18
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class EditorCreateAssetDto {
/// Returns a new [EditorCreateAssetDto] instance.
EditorCreateAssetDto({
this.edits = const [],
required this.id,
this.stack,
});
/// list of edits
List<EditorCreateAssetDtoEditsInner> edits;
/// Source asset id
String id;
/// Stack the edit and the original
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
bool? stack;
@override
bool operator ==(Object other) => identical(this, other) || other is EditorCreateAssetDto &&
_deepEquality.equals(other.edits, edits) &&
other.id == id &&
other.stack == stack;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(edits.hashCode) +
(id.hashCode) +
(stack == null ? 0 : stack!.hashCode);
@override
String toString() => 'EditorCreateAssetDto[edits=$edits, id=$id, stack=$stack]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'edits'] = this.edits;
json[r'id'] = this.id;
if (this.stack != null) {
json[r'stack'] = this.stack;
} else {
// json[r'stack'] = null;
}
return json;
}
/// Returns a new [EditorCreateAssetDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static EditorCreateAssetDto? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return EditorCreateAssetDto(
edits: EditorCreateAssetDtoEditsInner.listFromJson(json[r'edits']),
id: mapValueOfType<String>(json, r'id')!,
stack: mapValueOfType<bool>(json, r'stack'),
);
}
return null;
}
static List<EditorCreateAssetDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <EditorCreateAssetDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = EditorCreateAssetDto.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, EditorCreateAssetDto> mapFromJson(dynamic json) {
final map = <String, EditorCreateAssetDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = EditorCreateAssetDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of EditorCreateAssetDto-objects as value to a dart map
static Map<String, List<EditorCreateAssetDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<EditorCreateAssetDto>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = EditorCreateAssetDto.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'edits',
'id',
};
}
@@ -0,0 +1,146 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.18
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class EditorCreateAssetDtoEditsInner {
/// Returns a new [EditorCreateAssetDtoEditsInner] instance.
EditorCreateAssetDtoEditsInner({
required this.action,
required this.region,
required this.angle,
required this.brightness,
required this.hue,
required this.lightness,
required this.saturation,
});
EditorActionType action;
EditorCropRegion region;
int angle;
int brightness;
int hue;
int lightness;
int saturation;
@override
bool operator ==(Object other) => identical(this, other) || other is EditorCreateAssetDtoEditsInner &&
other.action == action &&
other.region == region &&
other.angle == angle &&
other.brightness == brightness &&
other.hue == hue &&
other.lightness == lightness &&
other.saturation == saturation;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(action.hashCode) +
(region.hashCode) +
(angle.hashCode) +
(brightness.hashCode) +
(hue.hashCode) +
(lightness.hashCode) +
(saturation.hashCode);
@override
String toString() => 'EditorCreateAssetDtoEditsInner[action=$action, region=$region, angle=$angle, brightness=$brightness, hue=$hue, lightness=$lightness, saturation=$saturation]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'action'] = this.action;
json[r'region'] = this.region;
json[r'angle'] = this.angle;
json[r'brightness'] = this.brightness;
json[r'hue'] = this.hue;
json[r'lightness'] = this.lightness;
json[r'saturation'] = this.saturation;
return json;
}
/// Returns a new [EditorCreateAssetDtoEditsInner] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static EditorCreateAssetDtoEditsInner? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return EditorCreateAssetDtoEditsInner(
action: EditorActionType.fromJson(json[r'action'])!,
region: EditorCropRegion.fromJson(json[r'region'])!,
angle: mapValueOfType<int>(json, r'angle')!,
brightness: mapValueOfType<int>(json, r'brightness')!,
hue: mapValueOfType<int>(json, r'hue')!,
lightness: mapValueOfType<int>(json, r'lightness')!,
saturation: mapValueOfType<int>(json, r'saturation')!,
);
}
return null;
}
static List<EditorCreateAssetDtoEditsInner> listFromJson(dynamic json, {bool growable = false,}) {
final result = <EditorCreateAssetDtoEditsInner>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = EditorCreateAssetDtoEditsInner.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, EditorCreateAssetDtoEditsInner> mapFromJson(dynamic json) {
final map = <String, EditorCreateAssetDtoEditsInner>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = EditorCreateAssetDtoEditsInner.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of EditorCreateAssetDtoEditsInner-objects as value to a dart map
static Map<String, List<EditorCreateAssetDtoEditsInner>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<EditorCreateAssetDtoEditsInner>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = EditorCreateAssetDtoEditsInner.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'action',
'region',
'angle',
'brightness',
'hue',
'lightness',
'saturation',
};
}
+122
View File
@@ -0,0 +1,122 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.18
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class EditorCropRegion {
/// Returns a new [EditorCropRegion] instance.
EditorCropRegion({
required this.height,
required this.left,
required this.top,
required this.width,
});
int height;
int left;
int top;
int width;
@override
bool operator ==(Object other) => identical(this, other) || other is EditorCropRegion &&
other.height == height &&
other.left == left &&
other.top == top &&
other.width == width;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(height.hashCode) +
(left.hashCode) +
(top.hashCode) +
(width.hashCode);
@override
String toString() => 'EditorCropRegion[height=$height, left=$left, top=$top, width=$width]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'height'] = this.height;
json[r'left'] = this.left;
json[r'top'] = this.top;
json[r'width'] = this.width;
return json;
}
/// Returns a new [EditorCropRegion] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static EditorCropRegion? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return EditorCropRegion(
height: mapValueOfType<int>(json, r'height')!,
left: mapValueOfType<int>(json, r'left')!,
top: mapValueOfType<int>(json, r'top')!,
width: mapValueOfType<int>(json, r'width')!,
);
}
return null;
}
static List<EditorCropRegion> listFromJson(dynamic json, {bool growable = false,}) {
final result = <EditorCropRegion>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = EditorCropRegion.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, EditorCropRegion> mapFromJson(dynamic json) {
final map = <String, EditorCropRegion>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = EditorCropRegion.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of EditorCropRegion-objects as value to a dart map
static Map<String, List<EditorCropRegion>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<EditorCropRegion>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = EditorCropRegion.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'height',
'left',
'top',
'width',
};
}