|
| 1 | + |
| 2 | +using System; |
| 3 | +using System.Linq; |
| 4 | +using System.Collections.Generic; |
| 5 | +using System.Text.Json; |
| 6 | +using System.Text.Json.Serialization; |
| 7 | + |
| 8 | +namespace Appwrite.Models |
| 9 | +{ |
| 10 | + public class AttributePolygon |
| 11 | + { |
| 12 | + [JsonPropertyName("key")] |
| 13 | + public string Key { get; private set; } |
| 14 | + |
| 15 | + [JsonPropertyName("type")] |
| 16 | + public string Type { get; private set; } |
| 17 | + |
| 18 | + [JsonPropertyName("status")] |
| 19 | + public string Status { get; private set; } |
| 20 | + |
| 21 | + [JsonPropertyName("error")] |
| 22 | + public string Error { get; private set; } |
| 23 | + |
| 24 | + [JsonPropertyName("required")] |
| 25 | + public bool Required { get; private set; } |
| 26 | + |
| 27 | + [JsonPropertyName("array")] |
| 28 | + public bool? Array { get; private set; } |
| 29 | + |
| 30 | + [JsonPropertyName("$createdAt")] |
| 31 | + public string CreatedAt { get; private set; } |
| 32 | + |
| 33 | + [JsonPropertyName("$updatedAt")] |
| 34 | + public string UpdatedAt { get; private set; } |
| 35 | + |
| 36 | + [JsonPropertyName("default")] |
| 37 | + public List<object>? Default { get; private set; } |
| 38 | + |
| 39 | + public AttributePolygon( |
| 40 | + string key, |
| 41 | + string type, |
| 42 | + string status, |
| 43 | + string error, |
| 44 | + bool required, |
| 45 | + bool? array, |
| 46 | + string createdAt, |
| 47 | + string updatedAt, |
| 48 | + List<object>? xdefault |
| 49 | + ) { |
| 50 | + Key = key; |
| 51 | + Type = type; |
| 52 | + Status = status; |
| 53 | + Error = error; |
| 54 | + Required = required; |
| 55 | + Array = array; |
| 56 | + CreatedAt = createdAt; |
| 57 | + UpdatedAt = updatedAt; |
| 58 | + Default = xdefault; |
| 59 | + } |
| 60 | + |
| 61 | + public static AttributePolygon From(Dictionary<string, object> map) => new AttributePolygon( |
| 62 | + key: map["key"].ToString(), |
| 63 | + type: map["type"].ToString(), |
| 64 | + status: map["status"].ToString(), |
| 65 | + error: map["error"].ToString(), |
| 66 | + required: (bool)map["required"], |
| 67 | + array: (bool?)map["array"], |
| 68 | + createdAt: map["$createdAt"].ToString(), |
| 69 | + updatedAt: map["$updatedAt"].ToString(), |
| 70 | + xdefault: map["default"] is JsonElement jsonArrayProp9 ? jsonArrayProp9.Deserialize<List<object>>()! : (List<object>)map["default"] |
| 71 | + ); |
| 72 | + |
| 73 | + public Dictionary<string, object?> ToMap() => new Dictionary<string, object?>() |
| 74 | + { |
| 75 | + { "key", Key }, |
| 76 | + { "type", Type }, |
| 77 | + { "status", Status }, |
| 78 | + { "error", Error }, |
| 79 | + { "required", Required }, |
| 80 | + { "array", Array }, |
| 81 | + { "$createdAt", CreatedAt }, |
| 82 | + { "$updatedAt", UpdatedAt }, |
| 83 | + { "default", Default } |
| 84 | + }; |
| 85 | + } |
| 86 | +} |
0 commit comments