mirror of
https://github.com/immich-app/immich.git
synced 2026-02-12 20:08:25 +03:00
add set permission endpoint and UI
This commit is contained in:
1
mobile/openapi/lib/api.dart
generated
1
mobile/openapi/lib/api.dart
generated
@@ -175,6 +175,7 @@ part 'model/server_ping_response.dart';
|
||||
part 'model/server_stats_response_dto.dart';
|
||||
part 'model/server_theme_dto.dart';
|
||||
part 'model/server_version_response_dto.dart';
|
||||
part 'model/set_album_permission_dto.dart';
|
||||
part 'model/shared_link_create_dto.dart';
|
||||
part 'model/shared_link_edit_dto.dart';
|
||||
part 'model/shared_link_response_dto.dart';
|
||||
|
||||
49
mobile/openapi/lib/api/album_api.dart
generated
49
mobile/openapi/lib/api/album_api.dart
generated
@@ -485,6 +485,55 @@ class AlbumApi {
|
||||
}
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'PUT /album/{id}/permission/{userId}' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
///
|
||||
/// * [String] userId (required):
|
||||
///
|
||||
/// * [SetAlbumPermissionDto] setAlbumPermissionDto (required):
|
||||
Future<Response> setAlbumPermissionWithHttpInfo(String id, String userId, SetAlbumPermissionDto setAlbumPermissionDto,) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/album/{id}/permission/{userId}'
|
||||
.replaceAll('{id}', id)
|
||||
.replaceAll('{userId}', userId);
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody = setAlbumPermissionDto;
|
||||
|
||||
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:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
///
|
||||
/// * [String] userId (required):
|
||||
///
|
||||
/// * [SetAlbumPermissionDto] setAlbumPermissionDto (required):
|
||||
Future<void> setAlbumPermission(String id, String userId, SetAlbumPermissionDto setAlbumPermissionDto,) async {
|
||||
final response = await setAlbumPermissionWithHttpInfo(id, userId, setAlbumPermissionDto,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'PATCH /album/{id}' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
|
||||
2
mobile/openapi/lib/api_client.dart
generated
2
mobile/openapi/lib/api_client.dart
generated
@@ -428,6 +428,8 @@ class ApiClient {
|
||||
return ServerThemeDto.fromJson(value);
|
||||
case 'ServerVersionResponseDto':
|
||||
return ServerVersionResponseDto.fromJson(value);
|
||||
case 'SetAlbumPermissionDto':
|
||||
return SetAlbumPermissionDto.fromJson(value);
|
||||
case 'SharedLinkCreateDto':
|
||||
return SharedLinkCreateDto.fromJson(value);
|
||||
case 'SharedLinkEditDto':
|
||||
|
||||
98
mobile/openapi/lib/model/set_album_permission_dto.dart
generated
Normal file
98
mobile/openapi/lib/model/set_album_permission_dto.dart
generated
Normal file
@@ -0,0 +1,98 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// 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 SetAlbumPermissionDto {
|
||||
/// Returns a new [SetAlbumPermissionDto] instance.
|
||||
SetAlbumPermissionDto({
|
||||
required this.readonly,
|
||||
});
|
||||
|
||||
bool readonly;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is SetAlbumPermissionDto &&
|
||||
other.readonly == readonly;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(readonly.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'SetAlbumPermissionDto[readonly=$readonly]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'readonly'] = this.readonly;
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [SetAlbumPermissionDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static SetAlbumPermissionDto? fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return SetAlbumPermissionDto(
|
||||
readonly: mapValueOfType<bool>(json, r'readonly')!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<SetAlbumPermissionDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <SetAlbumPermissionDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = SetAlbumPermissionDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, SetAlbumPermissionDto> mapFromJson(dynamic json) {
|
||||
final map = <String, SetAlbumPermissionDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = SetAlbumPermissionDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of SetAlbumPermissionDto-objects as value to a dart map
|
||||
static Map<String, List<SetAlbumPermissionDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<SetAlbumPermissionDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = SetAlbumPermissionDto.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'readonly',
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user