-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathAttributeRelationship.cs
More file actions
123 lines (105 loc) · 3.83 KB
/
Copy pathAttributeRelationship.cs
File metadata and controls
123 lines (105 loc) · 3.83 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
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 AttributeRelationship
{
[JsonPropertyName("key")]
public string Key { get; private set; }
[JsonPropertyName("type")]
public string Type { get; private set; }
[JsonPropertyName("status")]
public AttributeStatus Status { get; private set; }
[JsonPropertyName("error")]
public string Error { get; private set; }
[JsonPropertyName("required")]
public bool Required { get; private set; }
[JsonPropertyName("array")]
public bool? Array { get; private set; }
[JsonPropertyName("$createdAt")]
public string CreatedAt { get; private set; }
[JsonPropertyName("$updatedAt")]
public string UpdatedAt { get; private set; }
[JsonPropertyName("relatedCollection")]
public string RelatedCollection { get; private set; }
[JsonPropertyName("relationType")]
public string RelationType { get; private set; }
[JsonPropertyName("twoWay")]
public bool TwoWay { get; private set; }
[JsonPropertyName("twoWayKey")]
public string TwoWayKey { get; private set; }
[JsonPropertyName("onDelete")]
public string OnDelete { get; private set; }
[JsonPropertyName("side")]
public string Side { get; private set; }
public AttributeRelationship(
string key,
string type,
AttributeStatus status,
string error,
bool required,
bool? array,
string createdAt,
string updatedAt,
string relatedCollection,
string relationType,
bool twoWay,
string twoWayKey,
string onDelete,
string side
) {
Key = key;
Type = type;
Status = status;
Error = error;
Required = required;
Array = array;
CreatedAt = createdAt;
UpdatedAt = updatedAt;
RelatedCollection = relatedCollection;
RelationType = relationType;
TwoWay = twoWay;
TwoWayKey = twoWayKey;
OnDelete = onDelete;
Side = side;
}
public static AttributeRelationship From(Dictionary<string, object> map) => new AttributeRelationship(
key: map["key"].ToString(),
type: map["type"].ToString(),
status: new AttributeStatus(map["status"].ToString()!),
error: map["error"].ToString(),
required: (bool)map["required"],
array: (bool?)map["array"],
createdAt: map["$createdAt"].ToString(),
updatedAt: map["$updatedAt"].ToString(),
relatedCollection: map["relatedCollection"].ToString(),
relationType: map["relationType"].ToString(),
twoWay: (bool)map["twoWay"],
twoWayKey: map["twoWayKey"].ToString(),
onDelete: map["onDelete"].ToString(),
side: map["side"].ToString()
);
public Dictionary<string, object?> ToMap() => new Dictionary<string, object?>()
{
{ "key", Key },
{ "type", Type },
{ "status", Status.Value },
{ "error", Error },
{ "required", Required },
{ "array", Array },
{ "$createdAt", CreatedAt },
{ "$updatedAt", UpdatedAt },
{ "relatedCollection", RelatedCollection },
{ "relationType", RelationType },
{ "twoWay", TwoWay },
{ "twoWayKey", TwoWayKey },
{ "onDelete", OnDelete },
{ "side", Side }
};
}
}