-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathBucket.cs
More file actions
109 lines (93 loc) · 3.57 KB
/
Bucket.cs
File metadata and controls
109 lines (93 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;
using Appwrite.Enums;
using Appwrite.Extensions;
namespace Appwrite.Models
{
public class Bucket
{
[JsonPropertyName("$id")]
public string Id { get; private set; }
[JsonPropertyName("$createdAt")]
public string CreatedAt { get; private set; }
[JsonPropertyName("$updatedAt")]
public string UpdatedAt { get; private set; }
[JsonPropertyName("$permissions")]
public List<string> Permissions { get; private set; }
[JsonPropertyName("fileSecurity")]
public bool FileSecurity { get; private set; }
[JsonPropertyName("name")]
public string Name { get; private set; }
[JsonPropertyName("enabled")]
public bool Enabled { get; private set; }
[JsonPropertyName("maximumFileSize")]
public long MaximumFileSize { get; private set; }
[JsonPropertyName("allowedFileExtensions")]
public List<string> AllowedFileExtensions { get; private set; }
[JsonPropertyName("compression")]
public string Compression { get; private set; }
[JsonPropertyName("encryption")]
public bool Encryption { get; private set; }
[JsonPropertyName("antivirus")]
public bool Antivirus { get; private set; }
public Bucket(
string id,
string createdAt,
string updatedAt,
List<string> permissions,
bool fileSecurity,
string name,
bool enabled,
long maximumFileSize,
List<string> allowedFileExtensions,
string compression,
bool encryption,
bool antivirus
) {
Id = id;
CreatedAt = createdAt;
UpdatedAt = updatedAt;
Permissions = permissions;
FileSecurity = fileSecurity;
Name = name;
Enabled = enabled;
MaximumFileSize = maximumFileSize;
AllowedFileExtensions = allowedFileExtensions;
Compression = compression;
Encryption = encryption;
Antivirus = antivirus;
}
public static Bucket From(Dictionary<string, object> map) => new Bucket(
id: map["$id"].ToString(),
createdAt: map["$createdAt"].ToString(),
updatedAt: map["$updatedAt"].ToString(),
permissions: map["$permissions"].ConvertToList<string>(),
fileSecurity: (bool)map["fileSecurity"],
name: map["name"].ToString(),
enabled: (bool)map["enabled"],
maximumFileSize: Convert.ToInt64(map["maximumFileSize"]),
allowedFileExtensions: map["allowedFileExtensions"].ConvertToList<string>(),
compression: map["compression"].ToString(),
encryption: (bool)map["encryption"],
antivirus: (bool)map["antivirus"]
);
public Dictionary<string, object?> ToMap() => new Dictionary<string, object?>()
{
{ "$id", Id },
{ "$createdAt", CreatedAt },
{ "$updatedAt", UpdatedAt },
{ "$permissions", Permissions },
{ "fileSecurity", FileSecurity },
{ "name", Name },
{ "enabled", Enabled },
{ "maximumFileSize", MaximumFileSize },
{ "allowedFileExtensions", AllowedFileExtensions },
{ "compression", Compression },
{ "encryption", Encryption },
{ "antivirus", Antivirus }
};
}
}