Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a03ac79

Browse files
committedOct 8, 2024
feat: multipart
1 parent cb2595d commit a03ac79

12 files changed

+158
-3
lines changed
 

‎Sources/AppwriteEnums/ImageFormat.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ public enum ImageFormat: String, Codable {
66
case gif = "gif"
77
case png = "png"
88
case webp = "webp"
9+
case avif = "avif"
910

1011
public func encode(to encoder: Encoder) throws {
1112
var container = encoder.singleValueContainer()

‎Sources/AppwriteModels/AttributeBoolean.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ public class AttributeBoolean {
2222
/// Is attribute an array?
2323
public let array: Bool?
2424

25+
/// Attribute creation date in ISO 8601 format.
26+
public let createdAt: String
27+
28+
/// Attribute update date in ISO 8601 format.
29+
public let updatedAt: String
30+
2531
/// Default value for attribute when not provided. Cannot be set when attribute is required.
2632
public let `default`: Bool?
2733

@@ -33,6 +39,8 @@ public class AttributeBoolean {
3339
error: String,
3440
`required`: Bool,
3541
array: Bool?,
42+
createdAt: String,
43+
updatedAt: String,
3644
`default`: Bool?
3745
) {
3846
self.key = key
@@ -41,6 +49,8 @@ public class AttributeBoolean {
4149
self.error = error
4250
self.`required` = `required`
4351
self.array = array
52+
self.createdAt = createdAt
53+
self.updatedAt = updatedAt
4454
self.`default` = `default`
4555
}
4656

@@ -52,6 +62,8 @@ public class AttributeBoolean {
5262
"error": error as Any,
5363
"`required`": `required` as Any,
5464
"array": array as Any,
65+
"$createdAt": createdAt as Any,
66+
"$updatedAt": updatedAt as Any,
5567
"`default`": `default` as Any
5668
]
5769
}
@@ -64,6 +76,8 @@ public class AttributeBoolean {
6476
error: map["error"] as! String,
6577
`required`: map["required"] as! Bool,
6678
array: map["array"] as? Bool,
79+
createdAt: map["$createdAt"] as! String,
80+
updatedAt: map["$updatedAt"] as! String,
6781
`default`: map["default"] as? Bool
6882
)
6983
}

‎Sources/AppwriteModels/AttributeDatetime.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ public class AttributeDatetime {
2222
/// Is attribute an array?
2323
public let array: Bool?
2424

25+
/// Attribute creation date in ISO 8601 format.
26+
public let createdAt: String
27+
28+
/// Attribute update date in ISO 8601 format.
29+
public let updatedAt: String
30+
2531
/// ISO 8601 format.
2632
public let format: String
2733

@@ -36,6 +42,8 @@ public class AttributeDatetime {
3642
error: String,
3743
`required`: Bool,
3844
array: Bool?,
45+
createdAt: String,
46+
updatedAt: String,
3947
format: String,
4048
`default`: String?
4149
) {
@@ -45,6 +53,8 @@ public class AttributeDatetime {
4553
self.error = error
4654
self.`required` = `required`
4755
self.array = array
56+
self.createdAt = createdAt
57+
self.updatedAt = updatedAt
4858
self.format = format
4959
self.`default` = `default`
5060
}
@@ -57,6 +67,8 @@ public class AttributeDatetime {
5767
"error": error as Any,
5868
"`required`": `required` as Any,
5969
"array": array as Any,
70+
"$createdAt": createdAt as Any,
71+
"$updatedAt": updatedAt as Any,
6072
"format": format as Any,
6173
"`default`": `default` as Any
6274
]
@@ -70,6 +82,8 @@ public class AttributeDatetime {
7082
error: map["error"] as! String,
7183
`required`: map["required"] as! Bool,
7284
array: map["array"] as? Bool,
85+
createdAt: map["$createdAt"] as! String,
86+
updatedAt: map["$updatedAt"] as! String,
7387
format: map["format"] as! String,
7488
`default`: map["default"] as? String
7589
)

‎Sources/AppwriteModels/AttributeEmail.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ public class AttributeEmail {
2222
/// Is attribute an array?
2323
public let array: Bool?
2424

25+
/// Attribute creation date in ISO 8601 format.
26+
public let createdAt: String
27+
28+
/// Attribute update date in ISO 8601 format.
29+
public let updatedAt: String
30+
2531
/// String format.
2632
public let format: String
2733

@@ -36,6 +42,8 @@ public class AttributeEmail {
3642
error: String,
3743
`required`: Bool,
3844
array: Bool?,
45+
createdAt: String,
46+
updatedAt: String,
3947
format: String,
4048
`default`: String?
4149
) {
@@ -45,6 +53,8 @@ public class AttributeEmail {
4553
self.error = error
4654
self.`required` = `required`
4755
self.array = array
56+
self.createdAt = createdAt
57+
self.updatedAt = updatedAt
4858
self.format = format
4959
self.`default` = `default`
5060
}
@@ -57,6 +67,8 @@ public class AttributeEmail {
5767
"error": error as Any,
5868
"`required`": `required` as Any,
5969
"array": array as Any,
70+
"$createdAt": createdAt as Any,
71+
"$updatedAt": updatedAt as Any,
6072
"format": format as Any,
6173
"`default`": `default` as Any
6274
]
@@ -70,6 +82,8 @@ public class AttributeEmail {
7082
error: map["error"] as! String,
7183
`required`: map["required"] as! Bool,
7284
array: map["array"] as? Bool,
85+
createdAt: map["$createdAt"] as! String,
86+
updatedAt: map["$updatedAt"] as! String,
7387
format: map["format"] as! String,
7488
`default`: map["default"] as? String
7589
)

‎Sources/AppwriteModels/AttributeEnum.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ public class AttributeEnum {
2222
/// Is attribute an array?
2323
public let array: Bool?
2424

25+
/// Attribute creation date in ISO 8601 format.
26+
public let createdAt: String
27+
28+
/// Attribute update date in ISO 8601 format.
29+
public let updatedAt: String
30+
2531
/// Array of elements in enumerated type.
2632
public let elements: [Any]
2733

@@ -39,6 +45,8 @@ public class AttributeEnum {
3945
error: String,
4046
`required`: Bool,
4147
array: Bool?,
48+
createdAt: String,
49+
updatedAt: String,
4250
elements: [Any],
4351
format: String,
4452
`default`: String?
@@ -49,6 +57,8 @@ public class AttributeEnum {
4957
self.error = error
5058
self.`required` = `required`
5159
self.array = array
60+
self.createdAt = createdAt
61+
self.updatedAt = updatedAt
5262
self.elements = elements
5363
self.format = format
5464
self.`default` = `default`
@@ -62,6 +72,8 @@ public class AttributeEnum {
6272
"error": error as Any,
6373
"`required`": `required` as Any,
6474
"array": array as Any,
75+
"$createdAt": createdAt as Any,
76+
"$updatedAt": updatedAt as Any,
6577
"elements": elements as Any,
6678
"format": format as Any,
6779
"`default`": `default` as Any
@@ -76,6 +88,8 @@ public class AttributeEnum {
7688
error: map["error"] as! String,
7789
`required`: map["required"] as! Bool,
7890
array: map["array"] as? Bool,
91+
createdAt: map["$createdAt"] as! String,
92+
updatedAt: map["$updatedAt"] as! String,
7993
elements: map["elements"] as! [Any],
8094
format: map["format"] as! String,
8195
`default`: map["default"] as? String

‎Sources/AppwriteModels/AttributeFloat.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ public class AttributeFloat {
2222
/// Is attribute an array?
2323
public let array: Bool?
2424

25+
/// Attribute creation date in ISO 8601 format.
26+
public let createdAt: String
27+
28+
/// Attribute update date in ISO 8601 format.
29+
public let updatedAt: String
30+
2531
/// Minimum value to enforce for new documents.
2632
public let min: Double?
2733

@@ -39,6 +45,8 @@ public class AttributeFloat {
3945
error: String,
4046
`required`: Bool,
4147
array: Bool?,
48+
createdAt: String,
49+
updatedAt: String,
4250
min: Double?,
4351
max: Double?,
4452
`default`: Double?
@@ -49,6 +57,8 @@ public class AttributeFloat {
4957
self.error = error
5058
self.`required` = `required`
5159
self.array = array
60+
self.createdAt = createdAt
61+
self.updatedAt = updatedAt
5262
self.min = min
5363
self.max = max
5464
self.`default` = `default`
@@ -62,6 +72,8 @@ public class AttributeFloat {
6272
"error": error as Any,
6373
"`required`": `required` as Any,
6474
"array": array as Any,
75+
"$createdAt": createdAt as Any,
76+
"$updatedAt": updatedAt as Any,
6577
"min": min as Any,
6678
"max": max as Any,
6779
"`default`": `default` as Any
@@ -76,6 +88,8 @@ public class AttributeFloat {
7688
error: map["error"] as! String,
7789
`required`: map["required"] as! Bool,
7890
array: map["array"] as? Bool,
91+
createdAt: map["$createdAt"] as! String,
92+
updatedAt: map["$updatedAt"] as! String,
7993
min: map["min"] as? Double,
8094
max: map["max"] as? Double,
8195
`default`: map["default"] as? Double

‎Sources/AppwriteModels/AttributeInteger.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ public class AttributeInteger {
2222
/// Is attribute an array?
2323
public let array: Bool?
2424

25+
/// Attribute creation date in ISO 8601 format.
26+
public let createdAt: String
27+
28+
/// Attribute update date in ISO 8601 format.
29+
public let updatedAt: String
30+
2531
/// Minimum value to enforce for new documents.
2632
public let min: Int?
2733

@@ -39,6 +45,8 @@ public class AttributeInteger {
3945
error: String,
4046
`required`: Bool,
4147
array: Bool?,
48+
createdAt: String,
49+
updatedAt: String,
4250
min: Int?,
4351
max: Int?,
4452
`default`: Int?
@@ -49,6 +57,8 @@ public class AttributeInteger {
4957
self.error = error
5058
self.`required` = `required`
5159
self.array = array
60+
self.createdAt = createdAt
61+
self.updatedAt = updatedAt
5262
self.min = min
5363
self.max = max
5464
self.`default` = `default`
@@ -62,6 +72,8 @@ public class AttributeInteger {
6272
"error": error as Any,
6373
"`required`": `required` as Any,
6474
"array": array as Any,
75+
"$createdAt": createdAt as Any,
76+
"$updatedAt": updatedAt as Any,
6577
"min": min as Any,
6678
"max": max as Any,
6779
"`default`": `default` as Any
@@ -76,6 +88,8 @@ public class AttributeInteger {
7688
error: map["error"] as! String,
7789
`required`: map["required"] as! Bool,
7890
array: map["array"] as? Bool,
91+
createdAt: map["$createdAt"] as! String,
92+
updatedAt: map["$updatedAt"] as! String,
7993
min: map["min"] as? Int,
8094
max: map["max"] as? Int,
8195
`default`: map["default"] as? Int

‎Sources/AppwriteModels/AttributeIp.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ public class AttributeIp {
2222
/// Is attribute an array?
2323
public let array: Bool?
2424

25+
/// Attribute creation date in ISO 8601 format.
26+
public let createdAt: String
27+
28+
/// Attribute update date in ISO 8601 format.
29+
public let updatedAt: String
30+
2531
/// String format.
2632
public let format: String
2733

@@ -36,6 +42,8 @@ public class AttributeIp {
3642
error: String,
3743
`required`: Bool,
3844
array: Bool?,
45+
createdAt: String,
46+
updatedAt: String,
3947
format: String,
4048
`default`: String?
4149
) {
@@ -45,6 +53,8 @@ public class AttributeIp {
4553
self.error = error
4654
self.`required` = `required`
4755
self.array = array
56+
self.createdAt = createdAt
57+
self.updatedAt = updatedAt
4858
self.format = format
4959
self.`default` = `default`
5060
}
@@ -57,6 +67,8 @@ public class AttributeIp {
5767
"error": error as Any,
5868
"`required`": `required` as Any,
5969
"array": array as Any,
70+
"$createdAt": createdAt as Any,
71+
"$updatedAt": updatedAt as Any,
6072
"format": format as Any,
6173
"`default`": `default` as Any
6274
]
@@ -70,6 +82,8 @@ public class AttributeIp {
7082
error: map["error"] as! String,
7183
`required`: map["required"] as! Bool,
7284
array: map["array"] as? Bool,
85+
createdAt: map["$createdAt"] as! String,
86+
updatedAt: map["$updatedAt"] as! String,
7387
format: map["format"] as! String,
7488
`default`: map["default"] as? String
7589
)

‎Sources/AppwriteModels/AttributeRelationship.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ public class AttributeRelationship {
2222
/// Is attribute an array?
2323
public let array: Bool?
2424

25+
/// Attribute creation date in ISO 8601 format.
26+
public let createdAt: String
27+
28+
/// Attribute update date in ISO 8601 format.
29+
public let updatedAt: String
30+
2531
/// The ID of the related collection.
2632
public let relatedCollection: String
2733

@@ -48,6 +54,8 @@ public class AttributeRelationship {
4854
error: String,
4955
`required`: Bool,
5056
array: Bool?,
57+
createdAt: String,
58+
updatedAt: String,
5159
relatedCollection: String,
5260
relationType: String,
5361
twoWay: Bool,
@@ -61,6 +69,8 @@ public class AttributeRelationship {
6169
self.error = error
6270
self.`required` = `required`
6371
self.array = array
72+
self.createdAt = createdAt
73+
self.updatedAt = updatedAt
6474
self.relatedCollection = relatedCollection
6575
self.relationType = relationType
6676
self.twoWay = twoWay
@@ -77,6 +87,8 @@ public class AttributeRelationship {
7787
"error": error as Any,
7888
"`required`": `required` as Any,
7989
"array": array as Any,
90+
"$createdAt": createdAt as Any,
91+
"$updatedAt": updatedAt as Any,
8092
"relatedCollection": relatedCollection as Any,
8193
"relationType": relationType as Any,
8294
"twoWay": twoWay as Any,
@@ -94,6 +106,8 @@ public class AttributeRelationship {
94106
error: map["error"] as! String,
95107
`required`: map["required"] as! Bool,
96108
array: map["array"] as? Bool,
109+
createdAt: map["$createdAt"] as! String,
110+
updatedAt: map["$updatedAt"] as! String,
97111
relatedCollection: map["relatedCollection"] as! String,
98112
relationType: map["relationType"] as! String,
99113
twoWay: map["twoWay"] as! Bool,

‎Sources/AppwriteModels/AttributeString.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ public class AttributeString {
2222
/// Is attribute an array?
2323
public let array: Bool?
2424

25+
/// Attribute creation date in ISO 8601 format.
26+
public let createdAt: String
27+
28+
/// Attribute update date in ISO 8601 format.
29+
public let updatedAt: String
30+
2531
/// Attribute size.
2632
public let size: Int
2733

@@ -36,6 +42,8 @@ public class AttributeString {
3642
error: String,
3743
`required`: Bool,
3844
array: Bool?,
45+
createdAt: String,
46+
updatedAt: String,
3947
size: Int,
4048
`default`: String?
4149
) {
@@ -45,6 +53,8 @@ public class AttributeString {
4553
self.error = error
4654
self.`required` = `required`
4755
self.array = array
56+
self.createdAt = createdAt
57+
self.updatedAt = updatedAt
4858
self.size = size
4959
self.`default` = `default`
5060
}
@@ -57,6 +67,8 @@ public class AttributeString {
5767
"error": error as Any,
5868
"`required`": `required` as Any,
5969
"array": array as Any,
70+
"$createdAt": createdAt as Any,
71+
"$updatedAt": updatedAt as Any,
6072
"size": size as Any,
6173
"`default`": `default` as Any
6274
]
@@ -70,6 +82,8 @@ public class AttributeString {
7082
error: map["error"] as! String,
7183
`required`: map["required"] as! Bool,
7284
array: map["array"] as? Bool,
85+
createdAt: map["$createdAt"] as! String,
86+
updatedAt: map["$updatedAt"] as! String,
7387
size: map["size"] as! Int,
7488
`default`: map["default"] as? String
7589
)

‎Sources/AppwriteModels/AttributeUrl.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ public class AttributeUrl {
2222
/// Is attribute an array?
2323
public let array: Bool?
2424

25+
/// Attribute creation date in ISO 8601 format.
26+
public let createdAt: String
27+
28+
/// Attribute update date in ISO 8601 format.
29+
public let updatedAt: String
30+
2531
/// String format.
2632
public let format: String
2733

@@ -36,6 +42,8 @@ public class AttributeUrl {
3642
error: String,
3743
`required`: Bool,
3844
array: Bool?,
45+
createdAt: String,
46+
updatedAt: String,
3947
format: String,
4048
`default`: String?
4149
) {
@@ -45,6 +53,8 @@ public class AttributeUrl {
4553
self.error = error
4654
self.`required` = `required`
4755
self.array = array
56+
self.createdAt = createdAt
57+
self.updatedAt = updatedAt
4858
self.format = format
4959
self.`default` = `default`
5060
}
@@ -57,6 +67,8 @@ public class AttributeUrl {
5767
"error": error as Any,
5868
"`required`": `required` as Any,
5969
"array": array as Any,
70+
"$createdAt": createdAt as Any,
71+
"$updatedAt": updatedAt as Any,
6072
"format": format as Any,
6173
"`default`": `default` as Any
6274
]
@@ -70,6 +82,8 @@ public class AttributeUrl {
7082
error: map["error"] as! String,
7183
`required`: map["required"] as! Bool,
7284
array: map["array"] as? Bool,
85+
createdAt: map["$createdAt"] as! String,
86+
updatedAt: map["$updatedAt"] as! String,
7387
format: map["format"] as! String,
7488
`default`: map["default"] as? String
7589
)

‎Sources/AppwriteModels/Index.swift

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,31 @@ public class Index {
2222
/// Index orders.
2323
public let orders: [Any]?
2424

25+
/// Index creation date in ISO 8601 format.
26+
public let createdAt: String
27+
28+
/// Index update date in ISO 8601 format.
29+
public let updatedAt: String
30+
2531

2632
init(
2733
key: String,
2834
type: String,
2935
status: String,
3036
error: String,
3137
attributes: [Any],
32-
orders: [Any]?
38+
orders: [Any]?,
39+
createdAt: String,
40+
updatedAt: String
3341
) {
3442
self.key = key
3543
self.type = type
3644
self.status = status
3745
self.error = error
3846
self.attributes = attributes
3947
self.orders = orders
48+
self.createdAt = createdAt
49+
self.updatedAt = updatedAt
4050
}
4151

4252
public func toMap() -> [String: Any] {
@@ -46,7 +56,9 @@ public class Index {
4656
"status": status as Any,
4757
"error": error as Any,
4858
"attributes": attributes as Any,
49-
"orders": orders as Any
59+
"orders": orders as Any,
60+
"$createdAt": createdAt as Any,
61+
"$updatedAt": updatedAt as Any
5062
]
5163
}
5264

@@ -57,7 +69,9 @@ public class Index {
5769
status: map["status"] as! String,
5870
error: map["error"] as! String,
5971
attributes: map["attributes"] as! [Any],
60-
orders: map["orders"] as? [Any]
72+
orders: map["orders"] as? [Any],
73+
createdAt: map["$createdAt"] as! String,
74+
updatedAt: map["$updatedAt"] as! String
6175
)
6276
}
6377
}

0 commit comments

Comments
 (0)
Please sign in to comment.