123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import 'package:photos/models/collection.dart';
- import 'package:photos/services/file_magic_service.dart';
- class CreateRequest {
- String encryptedKey;
- String keyDecryptionNonce;
- String encryptedName;
- String nameDecryptionNonce;
- CollectionType type;
- CollectionAttributes? attributes;
- MetadataRequest? magicMetadata;
- CreateRequest({
- required this.encryptedKey,
- required this.keyDecryptionNonce,
- required this.encryptedName,
- required this.nameDecryptionNonce,
- required this.type,
- this.attributes,
- this.magicMetadata,
- });
- CreateRequest copyWith({
- String? encryptedKey,
- String? keyDecryptionNonce,
- String? encryptedName,
- String? nameDecryptionNonce,
- CollectionType? type,
- CollectionAttributes? attributes,
- MetadataRequest? magicMetadata,
- }) =>
- CreateRequest(
- encryptedKey: encryptedKey ?? this.encryptedKey,
- keyDecryptionNonce: keyDecryptionNonce ?? this.keyDecryptionNonce,
- encryptedName: encryptedName ?? this.encryptedName,
- nameDecryptionNonce: nameDecryptionNonce ?? this.nameDecryptionNonce,
- type: type ?? this.type,
- attributes: attributes ?? this.attributes,
- magicMetadata: magicMetadata ?? this.magicMetadata,
- );
- Map<String, dynamic> toJson() {
- final map = <String, dynamic>{};
- map['encryptedKey'] = encryptedKey;
- map['keyDecryptionNonce'] = keyDecryptionNonce;
- map['encryptedName'] = encryptedName;
- map['nameDecryptionNonce'] = nameDecryptionNonce;
- map['type'] = Collection.typeToString(type);
- if (attributes != null) {
- map['attributes'] = attributes!.toMap();
- }
- if (magicMetadata != null) {
- map['magicMetadata'] = magicMetadata!.toJson();
- }
- return map;
- }
- }
|