You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-08-09 23:17:29 +02:00
feat(server): user and server license endpoints (#10682)
* feat: user license endpoints * feat: server license endpoints * chore: pr feedback * chore: add more test cases * chore: add prod license public keys * chore: open-api generation
This commit is contained in:
4
mobile/openapi/lib/api.dart
generated
4
mobile/openapi/lib/api.dart
generated
@@ -49,6 +49,7 @@ part 'api/o_auth_api.dart';
|
||||
part 'api/partners_api.dart';
|
||||
part 'api/people_api.dart';
|
||||
part 'api/search_api.dart';
|
||||
part 'api/server_api.dart';
|
||||
part 'api/server_info_api.dart';
|
||||
part 'api/sessions_api.dart';
|
||||
part 'api/shared_links_api.dart';
|
||||
@@ -144,6 +145,8 @@ part 'model/job_settings_dto.dart';
|
||||
part 'model/job_status_dto.dart';
|
||||
part 'model/library_response_dto.dart';
|
||||
part 'model/library_stats_response_dto.dart';
|
||||
part 'model/license_key_dto.dart';
|
||||
part 'model/license_response_dto.dart';
|
||||
part 'model/log_level.dart';
|
||||
part 'model/login_credential_dto.dart';
|
||||
part 'model/login_response_dto.dart';
|
||||
@@ -248,6 +251,7 @@ part 'model/user_admin_delete_dto.dart';
|
||||
part 'model/user_admin_response_dto.dart';
|
||||
part 'model/user_admin_update_dto.dart';
|
||||
part 'model/user_avatar_color.dart';
|
||||
part 'model/user_license.dart';
|
||||
part 'model/user_preferences_response_dto.dart';
|
||||
part 'model/user_preferences_update_dto.dart';
|
||||
part 'model/user_response_dto.dart';
|
||||
|
139
mobile/openapi/lib/api/server_api.dart
generated
Normal file
139
mobile/openapi/lib/api/server_api.dart
generated
Normal file
@@ -0,0 +1,139 @@
|
||||
//
|
||||
// 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 ServerApi {
|
||||
ServerApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
|
||||
|
||||
final ApiClient apiClient;
|
||||
|
||||
/// Performs an HTTP 'DELETE /server/license' operation and returns the [Response].
|
||||
Future<Response> deleteServerLicenseWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/server/license';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'DELETE',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> deleteServerLicense() async {
|
||||
final response = await deleteServerLicenseWithHttpInfo();
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'GET /server/license' operation and returns the [Response].
|
||||
Future<Response> getServerLicenseWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/server/license';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
Future<Object?> getServerLicense() async {
|
||||
final response = await getServerLicenseWithHttpInfo();
|
||||
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), 'Object',) as Object;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'PUT /server/license' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [LicenseKeyDto] licenseKeyDto (required):
|
||||
Future<Response> setServerLicenseWithHttpInfo(LicenseKeyDto licenseKeyDto,) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/server/license';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody = licenseKeyDto;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'PUT',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [LicenseKeyDto] licenseKeyDto (required):
|
||||
Future<LicenseResponseDto?> setServerLicense(LicenseKeyDto licenseKeyDto,) async {
|
||||
final response = await setServerLicenseWithHttpInfo(licenseKeyDto,);
|
||||
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), 'LicenseResponseDto',) as LicenseResponseDto;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
121
mobile/openapi/lib/api/users_api.dart
generated
121
mobile/openapi/lib/api/users_api.dart
generated
@@ -106,6 +106,39 @@ class UsersApi {
|
||||
}
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'DELETE /users/me/license' operation and returns the [Response].
|
||||
Future<Response> deleteUserLicenseWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/users/me/license';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'DELETE',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> deleteUserLicense() async {
|
||||
final response = await deleteUserLicenseWithHttpInfo();
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'GET /users/me/preferences' operation and returns the [Response].
|
||||
Future<Response> getMyPreferencesWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
@@ -284,6 +317,47 @@ class UsersApi {
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'GET /users/me/license' operation and returns the [Response].
|
||||
Future<Response> getUserLicenseWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/users/me/license';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
Future<LicenseResponseDto?> getUserLicense() async {
|
||||
final response = await getUserLicenseWithHttpInfo();
|
||||
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), 'LicenseResponseDto',) as LicenseResponseDto;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'GET /users' operation and returns the [Response].
|
||||
Future<Response> searchUsersWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
@@ -328,6 +402,53 @@ class UsersApi {
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'PUT /users/me/license' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [LicenseKeyDto] licenseKeyDto (required):
|
||||
Future<Response> setUserLicenseWithHttpInfo(LicenseKeyDto licenseKeyDto,) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/users/me/license';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody = licenseKeyDto;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'PUT',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [LicenseKeyDto] licenseKeyDto (required):
|
||||
Future<LicenseResponseDto?> setUserLicense(LicenseKeyDto licenseKeyDto,) async {
|
||||
final response = await setUserLicenseWithHttpInfo(licenseKeyDto,);
|
||||
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), 'LicenseResponseDto',) as LicenseResponseDto;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'PUT /users/me/preferences' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
|
6
mobile/openapi/lib/api_client.dart
generated
6
mobile/openapi/lib/api_client.dart
generated
@@ -348,6 +348,10 @@ class ApiClient {
|
||||
return LibraryResponseDto.fromJson(value);
|
||||
case 'LibraryStatsResponseDto':
|
||||
return LibraryStatsResponseDto.fromJson(value);
|
||||
case 'LicenseKeyDto':
|
||||
return LicenseKeyDto.fromJson(value);
|
||||
case 'LicenseResponseDto':
|
||||
return LicenseResponseDto.fromJson(value);
|
||||
case 'LogLevel':
|
||||
return LogLevelTypeTransformer().decode(value);
|
||||
case 'LoginCredentialDto':
|
||||
@@ -556,6 +560,8 @@ class ApiClient {
|
||||
return UserAdminUpdateDto.fromJson(value);
|
||||
case 'UserAvatarColor':
|
||||
return UserAvatarColorTypeTransformer().decode(value);
|
||||
case 'UserLicense':
|
||||
return UserLicense.fromJson(value);
|
||||
case 'UserPreferencesResponseDto':
|
||||
return UserPreferencesResponseDto.fromJson(value);
|
||||
case 'UserPreferencesUpdateDto':
|
||||
|
106
mobile/openapi/lib/model/license_key_dto.dart
generated
Normal file
106
mobile/openapi/lib/model/license_key_dto.dart
generated
Normal 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 LicenseKeyDto {
|
||||
/// Returns a new [LicenseKeyDto] instance.
|
||||
LicenseKeyDto({
|
||||
required this.activationKey,
|
||||
required this.licenseKey,
|
||||
});
|
||||
|
||||
String activationKey;
|
||||
|
||||
String licenseKey;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is LicenseKeyDto &&
|
||||
other.activationKey == activationKey &&
|
||||
other.licenseKey == licenseKey;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(activationKey.hashCode) +
|
||||
(licenseKey.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'LicenseKeyDto[activationKey=$activationKey, licenseKey=$licenseKey]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'activationKey'] = this.activationKey;
|
||||
json[r'licenseKey'] = this.licenseKey;
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [LicenseKeyDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static LicenseKeyDto? fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return LicenseKeyDto(
|
||||
activationKey: mapValueOfType<String>(json, r'activationKey')!,
|
||||
licenseKey: mapValueOfType<String>(json, r'licenseKey')!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<LicenseKeyDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <LicenseKeyDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = LicenseKeyDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, LicenseKeyDto> mapFromJson(dynamic json) {
|
||||
final map = <String, LicenseKeyDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = LicenseKeyDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of LicenseKeyDto-objects as value to a dart map
|
||||
static Map<String, List<LicenseKeyDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<LicenseKeyDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = LicenseKeyDto.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'activationKey',
|
||||
'licenseKey',
|
||||
};
|
||||
}
|
||||
|
114
mobile/openapi/lib/model/license_response_dto.dart
generated
Normal file
114
mobile/openapi/lib/model/license_response_dto.dart
generated
Normal file
@@ -0,0 +1,114 @@
|
||||
//
|
||||
// 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 LicenseResponseDto {
|
||||
/// Returns a new [LicenseResponseDto] instance.
|
||||
LicenseResponseDto({
|
||||
required this.activatedAt,
|
||||
required this.activationKey,
|
||||
required this.licenseKey,
|
||||
});
|
||||
|
||||
DateTime activatedAt;
|
||||
|
||||
String activationKey;
|
||||
|
||||
String licenseKey;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is LicenseResponseDto &&
|
||||
other.activatedAt == activatedAt &&
|
||||
other.activationKey == activationKey &&
|
||||
other.licenseKey == licenseKey;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(activatedAt.hashCode) +
|
||||
(activationKey.hashCode) +
|
||||
(licenseKey.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'LicenseResponseDto[activatedAt=$activatedAt, activationKey=$activationKey, licenseKey=$licenseKey]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'activatedAt'] = this.activatedAt.toUtc().toIso8601String();
|
||||
json[r'activationKey'] = this.activationKey;
|
||||
json[r'licenseKey'] = this.licenseKey;
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [LicenseResponseDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static LicenseResponseDto? fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return LicenseResponseDto(
|
||||
activatedAt: mapDateTime(json, r'activatedAt', r'')!,
|
||||
activationKey: mapValueOfType<String>(json, r'activationKey')!,
|
||||
licenseKey: mapValueOfType<String>(json, r'licenseKey')!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<LicenseResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <LicenseResponseDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = LicenseResponseDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, LicenseResponseDto> mapFromJson(dynamic json) {
|
||||
final map = <String, LicenseResponseDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = LicenseResponseDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of LicenseResponseDto-objects as value to a dart map
|
||||
static Map<String, List<LicenseResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<LicenseResponseDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = LicenseResponseDto.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'activatedAt',
|
||||
'activationKey',
|
||||
'licenseKey',
|
||||
};
|
||||
}
|
||||
|
@@ -21,6 +21,7 @@ class ServerAboutResponseDto {
|
||||
this.ffmpeg,
|
||||
this.imagemagick,
|
||||
this.libvips,
|
||||
required this.licensed,
|
||||
this.nodejs,
|
||||
this.repository,
|
||||
this.repositoryUrl,
|
||||
@@ -95,6 +96,8 @@ class ServerAboutResponseDto {
|
||||
///
|
||||
String? libvips;
|
||||
|
||||
bool licensed;
|
||||
|
||||
///
|
||||
/// 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
|
||||
@@ -157,6 +160,7 @@ class ServerAboutResponseDto {
|
||||
other.ffmpeg == ffmpeg &&
|
||||
other.imagemagick == imagemagick &&
|
||||
other.libvips == libvips &&
|
||||
other.licensed == licensed &&
|
||||
other.nodejs == nodejs &&
|
||||
other.repository == repository &&
|
||||
other.repositoryUrl == repositoryUrl &&
|
||||
@@ -177,6 +181,7 @@ class ServerAboutResponseDto {
|
||||
(ffmpeg == null ? 0 : ffmpeg!.hashCode) +
|
||||
(imagemagick == null ? 0 : imagemagick!.hashCode) +
|
||||
(libvips == null ? 0 : libvips!.hashCode) +
|
||||
(licensed.hashCode) +
|
||||
(nodejs == null ? 0 : nodejs!.hashCode) +
|
||||
(repository == null ? 0 : repository!.hashCode) +
|
||||
(repositoryUrl == null ? 0 : repositoryUrl!.hashCode) +
|
||||
@@ -187,7 +192,7 @@ class ServerAboutResponseDto {
|
||||
(versionUrl.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'ServerAboutResponseDto[build=$build, buildImage=$buildImage, buildImageUrl=$buildImageUrl, buildUrl=$buildUrl, exiftool=$exiftool, ffmpeg=$ffmpeg, imagemagick=$imagemagick, libvips=$libvips, nodejs=$nodejs, repository=$repository, repositoryUrl=$repositoryUrl, sourceCommit=$sourceCommit, sourceRef=$sourceRef, sourceUrl=$sourceUrl, version=$version, versionUrl=$versionUrl]';
|
||||
String toString() => 'ServerAboutResponseDto[build=$build, buildImage=$buildImage, buildImageUrl=$buildImageUrl, buildUrl=$buildUrl, exiftool=$exiftool, ffmpeg=$ffmpeg, imagemagick=$imagemagick, libvips=$libvips, licensed=$licensed, nodejs=$nodejs, repository=$repository, repositoryUrl=$repositoryUrl, sourceCommit=$sourceCommit, sourceRef=$sourceRef, sourceUrl=$sourceUrl, version=$version, versionUrl=$versionUrl]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@@ -231,6 +236,7 @@ class ServerAboutResponseDto {
|
||||
} else {
|
||||
// json[r'libvips'] = null;
|
||||
}
|
||||
json[r'licensed'] = this.licensed;
|
||||
if (this.nodejs != null) {
|
||||
json[r'nodejs'] = this.nodejs;
|
||||
} else {
|
||||
@@ -282,6 +288,7 @@ class ServerAboutResponseDto {
|
||||
ffmpeg: mapValueOfType<String>(json, r'ffmpeg'),
|
||||
imagemagick: mapValueOfType<String>(json, r'imagemagick'),
|
||||
libvips: mapValueOfType<String>(json, r'libvips'),
|
||||
licensed: mapValueOfType<bool>(json, r'licensed')!,
|
||||
nodejs: mapValueOfType<String>(json, r'nodejs'),
|
||||
repository: mapValueOfType<String>(json, r'repository'),
|
||||
repositoryUrl: mapValueOfType<String>(json, r'repositoryUrl'),
|
||||
@@ -337,6 +344,7 @@ class ServerAboutResponseDto {
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'licensed',
|
||||
'version',
|
||||
'versionUrl',
|
||||
};
|
||||
|
@@ -19,6 +19,7 @@ class UserAdminResponseDto {
|
||||
required this.email,
|
||||
required this.id,
|
||||
required this.isAdmin,
|
||||
required this.license,
|
||||
required this.name,
|
||||
required this.oauthId,
|
||||
required this.profileImagePath,
|
||||
@@ -42,6 +43,8 @@ class UserAdminResponseDto {
|
||||
|
||||
bool isAdmin;
|
||||
|
||||
UserLicense? license;
|
||||
|
||||
String name;
|
||||
|
||||
String oauthId;
|
||||
@@ -68,6 +71,7 @@ class UserAdminResponseDto {
|
||||
other.email == email &&
|
||||
other.id == id &&
|
||||
other.isAdmin == isAdmin &&
|
||||
other.license == license &&
|
||||
other.name == name &&
|
||||
other.oauthId == oauthId &&
|
||||
other.profileImagePath == profileImagePath &&
|
||||
@@ -87,6 +91,7 @@ class UserAdminResponseDto {
|
||||
(email.hashCode) +
|
||||
(id.hashCode) +
|
||||
(isAdmin.hashCode) +
|
||||
(license == null ? 0 : license!.hashCode) +
|
||||
(name.hashCode) +
|
||||
(oauthId.hashCode) +
|
||||
(profileImagePath.hashCode) +
|
||||
@@ -98,7 +103,7 @@ class UserAdminResponseDto {
|
||||
(updatedAt.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'UserAdminResponseDto[avatarColor=$avatarColor, createdAt=$createdAt, deletedAt=$deletedAt, email=$email, id=$id, isAdmin=$isAdmin, name=$name, oauthId=$oauthId, profileImagePath=$profileImagePath, quotaSizeInBytes=$quotaSizeInBytes, quotaUsageInBytes=$quotaUsageInBytes, shouldChangePassword=$shouldChangePassword, status=$status, storageLabel=$storageLabel, updatedAt=$updatedAt]';
|
||||
String toString() => 'UserAdminResponseDto[avatarColor=$avatarColor, createdAt=$createdAt, deletedAt=$deletedAt, email=$email, id=$id, isAdmin=$isAdmin, license=$license, name=$name, oauthId=$oauthId, profileImagePath=$profileImagePath, quotaSizeInBytes=$quotaSizeInBytes, quotaUsageInBytes=$quotaUsageInBytes, shouldChangePassword=$shouldChangePassword, status=$status, storageLabel=$storageLabel, updatedAt=$updatedAt]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@@ -112,6 +117,11 @@ class UserAdminResponseDto {
|
||||
json[r'email'] = this.email;
|
||||
json[r'id'] = this.id;
|
||||
json[r'isAdmin'] = this.isAdmin;
|
||||
if (this.license != null) {
|
||||
json[r'license'] = this.license;
|
||||
} else {
|
||||
// json[r'license'] = null;
|
||||
}
|
||||
json[r'name'] = this.name;
|
||||
json[r'oauthId'] = this.oauthId;
|
||||
json[r'profileImagePath'] = this.profileImagePath;
|
||||
@@ -150,6 +160,7 @@ class UserAdminResponseDto {
|
||||
email: mapValueOfType<String>(json, r'email')!,
|
||||
id: mapValueOfType<String>(json, r'id')!,
|
||||
isAdmin: mapValueOfType<bool>(json, r'isAdmin')!,
|
||||
license: UserLicense.fromJson(json[r'license']),
|
||||
name: mapValueOfType<String>(json, r'name')!,
|
||||
oauthId: mapValueOfType<String>(json, r'oauthId')!,
|
||||
profileImagePath: mapValueOfType<String>(json, r'profileImagePath')!,
|
||||
@@ -212,6 +223,7 @@ class UserAdminResponseDto {
|
||||
'email',
|
||||
'id',
|
||||
'isAdmin',
|
||||
'license',
|
||||
'name',
|
||||
'oauthId',
|
||||
'profileImagePath',
|
||||
|
114
mobile/openapi/lib/model/user_license.dart
generated
Normal file
114
mobile/openapi/lib/model/user_license.dart
generated
Normal file
@@ -0,0 +1,114 @@
|
||||
//
|
||||
// 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 UserLicense {
|
||||
/// Returns a new [UserLicense] instance.
|
||||
UserLicense({
|
||||
required this.activatedAt,
|
||||
required this.activationKey,
|
||||
required this.licenseKey,
|
||||
});
|
||||
|
||||
DateTime activatedAt;
|
||||
|
||||
String activationKey;
|
||||
|
||||
String licenseKey;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is UserLicense &&
|
||||
other.activatedAt == activatedAt &&
|
||||
other.activationKey == activationKey &&
|
||||
other.licenseKey == licenseKey;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(activatedAt.hashCode) +
|
||||
(activationKey.hashCode) +
|
||||
(licenseKey.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'UserLicense[activatedAt=$activatedAt, activationKey=$activationKey, licenseKey=$licenseKey]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'activatedAt'] = this.activatedAt.toUtc().toIso8601String();
|
||||
json[r'activationKey'] = this.activationKey;
|
||||
json[r'licenseKey'] = this.licenseKey;
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [UserLicense] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static UserLicense? fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return UserLicense(
|
||||
activatedAt: mapDateTime(json, r'activatedAt', r'')!,
|
||||
activationKey: mapValueOfType<String>(json, r'activationKey')!,
|
||||
licenseKey: mapValueOfType<String>(json, r'licenseKey')!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<UserLicense> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <UserLicense>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = UserLicense.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, UserLicense> mapFromJson(dynamic json) {
|
||||
final map = <String, UserLicense>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = UserLicense.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of UserLicense-objects as value to a dart map
|
||||
static Map<String, List<UserLicense>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<UserLicense>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = UserLicense.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'activatedAt',
|
||||
'activationKey',
|
||||
'licenseKey',
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user