Skip to content

Commit d799804

Browse files
committed
Fix spatial default
1 parent 867b58f commit d799804

23 files changed

+79
-63
lines changed

Sources/Appwrite/Services/Databases.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ open class Databases: Service {
11991199
/// - collectionId: String
12001200
/// - key: String
12011201
/// - required: Bool
1202-
/// - default: String (optional)
1202+
/// - default: [AnyCodable] (optional)
12031203
/// - Throws: Exception if the request fails
12041204
/// - Returns: AppwriteModels.AttributeLine
12051205
///
@@ -1209,7 +1209,7 @@ open class Databases: Service {
12091209
collectionId: String,
12101210
key: String,
12111211
`required`: Bool,
1212-
`default`: String? = nil
1212+
`default`: [AnyCodable]? = nil
12131213
) async throws -> AppwriteModels.AttributeLine {
12141214
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/line"
12151215
.replacingOccurrences(of: "{databaseId}", with: databaseId)
@@ -1247,7 +1247,7 @@ open class Databases: Service {
12471247
/// - collectionId: String
12481248
/// - key: String
12491249
/// - required: Bool
1250-
/// - default: String (optional)
1250+
/// - default: [AnyCodable] (optional)
12511251
/// - newKey: String (optional)
12521252
/// - Throws: Exception if the request fails
12531253
/// - Returns: AppwriteModels.AttributeLine
@@ -1258,7 +1258,7 @@ open class Databases: Service {
12581258
collectionId: String,
12591259
key: String,
12601260
`required`: Bool,
1261-
`default`: String? = nil,
1261+
`default`: [AnyCodable]? = nil,
12621262
newKey: String? = nil
12631263
) async throws -> AppwriteModels.AttributeLine {
12641264
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}"
@@ -1297,7 +1297,7 @@ open class Databases: Service {
12971297
/// - collectionId: String
12981298
/// - key: String
12991299
/// - required: Bool
1300-
/// - default: String (optional)
1300+
/// - default: [AnyCodable] (optional)
13011301
/// - Throws: Exception if the request fails
13021302
/// - Returns: AppwriteModels.AttributePoint
13031303
///
@@ -1307,7 +1307,7 @@ open class Databases: Service {
13071307
collectionId: String,
13081308
key: String,
13091309
`required`: Bool,
1310-
`default`: String? = nil
1310+
`default`: [AnyCodable]? = nil
13111311
) async throws -> AppwriteModels.AttributePoint {
13121312
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/point"
13131313
.replacingOccurrences(of: "{databaseId}", with: databaseId)
@@ -1345,7 +1345,7 @@ open class Databases: Service {
13451345
/// - collectionId: String
13461346
/// - key: String
13471347
/// - required: Bool
1348-
/// - default: String (optional)
1348+
/// - default: [AnyCodable] (optional)
13491349
/// - newKey: String (optional)
13501350
/// - Throws: Exception if the request fails
13511351
/// - Returns: AppwriteModels.AttributePoint
@@ -1356,7 +1356,7 @@ open class Databases: Service {
13561356
collectionId: String,
13571357
key: String,
13581358
`required`: Bool,
1359-
`default`: String? = nil,
1359+
`default`: [AnyCodable]? = nil,
13601360
newKey: String? = nil
13611361
) async throws -> AppwriteModels.AttributePoint {
13621362
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}"
@@ -1395,7 +1395,7 @@ open class Databases: Service {
13951395
/// - collectionId: String
13961396
/// - key: String
13971397
/// - required: Bool
1398-
/// - default: String (optional)
1398+
/// - default: [AnyCodable] (optional)
13991399
/// - Throws: Exception if the request fails
14001400
/// - Returns: AppwriteModels.AttributePolygon
14011401
///
@@ -1405,7 +1405,7 @@ open class Databases: Service {
14051405
collectionId: String,
14061406
key: String,
14071407
`required`: Bool,
1408-
`default`: String? = nil
1408+
`default`: [AnyCodable]? = nil
14091409
) async throws -> AppwriteModels.AttributePolygon {
14101410
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/polygon"
14111411
.replacingOccurrences(of: "{databaseId}", with: databaseId)
@@ -1443,7 +1443,7 @@ open class Databases: Service {
14431443
/// - collectionId: String
14441444
/// - key: String
14451445
/// - required: Bool
1446-
/// - default: String (optional)
1446+
/// - default: [AnyCodable] (optional)
14471447
/// - newKey: String (optional)
14481448
/// - Throws: Exception if the request fails
14491449
/// - Returns: AppwriteModels.AttributePolygon
@@ -1454,7 +1454,7 @@ open class Databases: Service {
14541454
collectionId: String,
14551455
key: String,
14561456
`required`: Bool,
1457-
`default`: String? = nil,
1457+
`default`: [AnyCodable]? = nil,
14581458
newKey: String? = nil
14591459
) async throws -> AppwriteModels.AttributePolygon {
14601460
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}"

Sources/Appwrite/Services/TablesDb.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ open class TablesDB: Service {
11731173
/// - tableId: String
11741174
/// - key: String
11751175
/// - required: Bool
1176-
/// - default: String (optional)
1176+
/// - default: [AnyCodable] (optional)
11771177
/// - Throws: Exception if the request fails
11781178
/// - Returns: AppwriteModels.ColumnLine
11791179
///
@@ -1182,7 +1182,7 @@ open class TablesDB: Service {
11821182
tableId: String,
11831183
key: String,
11841184
`required`: Bool,
1185-
`default`: String? = nil
1185+
`default`: [AnyCodable]? = nil
11861186
) async throws -> AppwriteModels.ColumnLine {
11871187
let apiPath: String = "/tablesdb/{databaseId}/tables/{tableId}/columns/line"
11881188
.replacingOccurrences(of: "{databaseId}", with: databaseId)
@@ -1220,7 +1220,7 @@ open class TablesDB: Service {
12201220
/// - tableId: String
12211221
/// - key: String
12221222
/// - required: Bool
1223-
/// - default: String (optional)
1223+
/// - default: [AnyCodable] (optional)
12241224
/// - newKey: String (optional)
12251225
/// - Throws: Exception if the request fails
12261226
/// - Returns: AppwriteModels.ColumnLine
@@ -1230,7 +1230,7 @@ open class TablesDB: Service {
12301230
tableId: String,
12311231
key: String,
12321232
`required`: Bool,
1233-
`default`: String? = nil,
1233+
`default`: [AnyCodable]? = nil,
12341234
newKey: String? = nil
12351235
) async throws -> AppwriteModels.ColumnLine {
12361236
let apiPath: String = "/tablesdb/{databaseId}/tables/{tableId}/columns/line/{key}"
@@ -1269,7 +1269,7 @@ open class TablesDB: Service {
12691269
/// - tableId: String
12701270
/// - key: String
12711271
/// - required: Bool
1272-
/// - default: String (optional)
1272+
/// - default: [AnyCodable] (optional)
12731273
/// - Throws: Exception if the request fails
12741274
/// - Returns: AppwriteModels.ColumnPoint
12751275
///
@@ -1278,7 +1278,7 @@ open class TablesDB: Service {
12781278
tableId: String,
12791279
key: String,
12801280
`required`: Bool,
1281-
`default`: String? = nil
1281+
`default`: [AnyCodable]? = nil
12821282
) async throws -> AppwriteModels.ColumnPoint {
12831283
let apiPath: String = "/tablesdb/{databaseId}/tables/{tableId}/columns/point"
12841284
.replacingOccurrences(of: "{databaseId}", with: databaseId)
@@ -1316,7 +1316,7 @@ open class TablesDB: Service {
13161316
/// - tableId: String
13171317
/// - key: String
13181318
/// - required: Bool
1319-
/// - default: String (optional)
1319+
/// - default: [AnyCodable] (optional)
13201320
/// - newKey: String (optional)
13211321
/// - Throws: Exception if the request fails
13221322
/// - Returns: AppwriteModels.ColumnPoint
@@ -1326,7 +1326,7 @@ open class TablesDB: Service {
13261326
tableId: String,
13271327
key: String,
13281328
`required`: Bool,
1329-
`default`: String? = nil,
1329+
`default`: [AnyCodable]? = nil,
13301330
newKey: String? = nil
13311331
) async throws -> AppwriteModels.ColumnPoint {
13321332
let apiPath: String = "/tablesdb/{databaseId}/tables/{tableId}/columns/point/{key}"
@@ -1365,7 +1365,7 @@ open class TablesDB: Service {
13651365
/// - tableId: String
13661366
/// - key: String
13671367
/// - required: Bool
1368-
/// - default: String (optional)
1368+
/// - default: [AnyCodable] (optional)
13691369
/// - Throws: Exception if the request fails
13701370
/// - Returns: AppwriteModels.ColumnPolygon
13711371
///
@@ -1374,7 +1374,7 @@ open class TablesDB: Service {
13741374
tableId: String,
13751375
key: String,
13761376
`required`: Bool,
1377-
`default`: String? = nil
1377+
`default`: [AnyCodable]? = nil
13781378
) async throws -> AppwriteModels.ColumnPolygon {
13791379
let apiPath: String = "/tablesdb/{databaseId}/tables/{tableId}/columns/polygon"
13801380
.replacingOccurrences(of: "{databaseId}", with: databaseId)
@@ -1412,7 +1412,7 @@ open class TablesDB: Service {
14121412
/// - tableId: String
14131413
/// - key: String
14141414
/// - required: Bool
1415-
/// - default: String (optional)
1415+
/// - default: [AnyCodable] (optional)
14161416
/// - newKey: String (optional)
14171417
/// - Throws: Exception if the request fails
14181418
/// - Returns: AppwriteModels.ColumnPolygon
@@ -1422,7 +1422,7 @@ open class TablesDB: Service {
14221422
tableId: String,
14231423
key: String,
14241424
`required`: Bool,
1425-
`default`: String? = nil,
1425+
`default`: [AnyCodable]? = nil,
14261426
newKey: String? = nil
14271427
) async throws -> AppwriteModels.ColumnPolygon {
14281428
let apiPath: String = "/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{key}"

Sources/AppwriteModels/AttributeLine.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ open class AttributeLine: Codable {
4141
public let updatedAt: String
4242

4343
/// Default value for attribute when not provided. Cannot be set when attribute is required.
44-
public let `default`: [String: AnyCodable]?
44+
public let `default`: [AnyCodable]?
4545

4646

4747
init(
@@ -53,7 +53,7 @@ open class AttributeLine: Codable {
5353
array: Bool?,
5454
createdAt: String,
5555
updatedAt: String,
56-
`default`: [String: AnyCodable]?
56+
`default`: [AnyCodable]?
5757
) {
5858
self.key = key
5959
self.type = type
@@ -77,7 +77,7 @@ open class AttributeLine: Codable {
7777
self.array = try container.decodeIfPresent(Bool.self, forKey: .array)
7878
self.createdAt = try container.decode(String.self, forKey: .createdAt)
7979
self.updatedAt = try container.decode(String.self, forKey: .updatedAt)
80-
self.`default` = try container.decodeIfPresent([String: AnyCodable].self, forKey: .`default`)
80+
self.`default` = try container.decodeIfPresent([AnyCodable].self, forKey: .`default`)
8181
}
8282

8383
public func encode(to encoder: Encoder) throws {
@@ -118,7 +118,7 @@ open class AttributeLine: Codable {
118118
array: map["array"] as? Bool,
119119
createdAt: map["$createdAt"] as! String,
120120
updatedAt: map["$updatedAt"] as! String,
121-
default: map["default"] as? [String: AnyCodable]
121+
default: (map["default"] as? [Any] ?? []).map { AnyCodable($0) }
122122
)
123123
}
124124
}

Sources/AppwriteModels/AttributePoint.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ open class AttributePoint: Codable {
4141
public let updatedAt: String
4242

4343
/// Default value for attribute when not provided. Cannot be set when attribute is required.
44-
public let `default`: [String: AnyCodable]?
44+
public let `default`: [AnyCodable]?
4545

4646

4747
init(
@@ -53,7 +53,7 @@ open class AttributePoint: Codable {
5353
array: Bool?,
5454
createdAt: String,
5555
updatedAt: String,
56-
`default`: [String: AnyCodable]?
56+
`default`: [AnyCodable]?
5757
) {
5858
self.key = key
5959
self.type = type
@@ -77,7 +77,7 @@ open class AttributePoint: Codable {
7777
self.array = try container.decodeIfPresent(Bool.self, forKey: .array)
7878
self.createdAt = try container.decode(String.self, forKey: .createdAt)
7979
self.updatedAt = try container.decode(String.self, forKey: .updatedAt)
80-
self.`default` = try container.decodeIfPresent([String: AnyCodable].self, forKey: .`default`)
80+
self.`default` = try container.decodeIfPresent([AnyCodable].self, forKey: .`default`)
8181
}
8282

8383
public func encode(to encoder: Encoder) throws {
@@ -118,7 +118,7 @@ open class AttributePoint: Codable {
118118
array: map["array"] as? Bool,
119119
createdAt: map["$createdAt"] as! String,
120120
updatedAt: map["$updatedAt"] as! String,
121-
default: map["default"] as? [String: AnyCodable]
121+
default: (map["default"] as? [Any] ?? []).map { AnyCodable($0) }
122122
)
123123
}
124124
}

Sources/AppwriteModels/AttributePolygon.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ open class AttributePolygon: Codable {
4141
public let updatedAt: String
4242

4343
/// Default value for attribute when not provided. Cannot be set when attribute is required.
44-
public let `default`: [String: AnyCodable]?
44+
public let `default`: [AnyCodable]?
4545

4646

4747
init(
@@ -53,7 +53,7 @@ open class AttributePolygon: Codable {
5353
array: Bool?,
5454
createdAt: String,
5555
updatedAt: String,
56-
`default`: [String: AnyCodable]?
56+
`default`: [AnyCodable]?
5757
) {
5858
self.key = key
5959
self.type = type
@@ -77,7 +77,7 @@ open class AttributePolygon: Codable {
7777
self.array = try container.decodeIfPresent(Bool.self, forKey: .array)
7878
self.createdAt = try container.decode(String.self, forKey: .createdAt)
7979
self.updatedAt = try container.decode(String.self, forKey: .updatedAt)
80-
self.`default` = try container.decodeIfPresent([String: AnyCodable].self, forKey: .`default`)
80+
self.`default` = try container.decodeIfPresent([AnyCodable].self, forKey: .`default`)
8181
}
8282

8383
public func encode(to encoder: Encoder) throws {
@@ -118,7 +118,7 @@ open class AttributePolygon: Codable {
118118
array: map["array"] as? Bool,
119119
createdAt: map["$createdAt"] as! String,
120120
updatedAt: map["$updatedAt"] as! String,
121-
default: map["default"] as? [String: AnyCodable]
121+
default: (map["default"] as? [Any] ?? []).map { AnyCodable($0) }
122122
)
123123
}
124124
}

Sources/AppwriteModels/ColumnLine.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ open class ColumnLine: Codable {
4141
public let updatedAt: String
4242

4343
/// Default value for column when not provided. Cannot be set when column is required.
44-
public let `default`: [String: AnyCodable]?
44+
public let `default`: [AnyCodable]?
4545

4646

4747
init(
@@ -53,7 +53,7 @@ open class ColumnLine: Codable {
5353
array: Bool?,
5454
createdAt: String,
5555
updatedAt: String,
56-
`default`: [String: AnyCodable]?
56+
`default`: [AnyCodable]?
5757
) {
5858
self.key = key
5959
self.type = type
@@ -77,7 +77,7 @@ open class ColumnLine: Codable {
7777
self.array = try container.decodeIfPresent(Bool.self, forKey: .array)
7878
self.createdAt = try container.decode(String.self, forKey: .createdAt)
7979
self.updatedAt = try container.decode(String.self, forKey: .updatedAt)
80-
self.`default` = try container.decodeIfPresent([String: AnyCodable].self, forKey: .`default`)
80+
self.`default` = try container.decodeIfPresent([AnyCodable].self, forKey: .`default`)
8181
}
8282

8383
public func encode(to encoder: Encoder) throws {
@@ -118,7 +118,7 @@ open class ColumnLine: Codable {
118118
array: map["array"] as? Bool,
119119
createdAt: map["$createdAt"] as! String,
120120
updatedAt: map["$updatedAt"] as! String,
121-
default: map["default"] as? [String: AnyCodable]
121+
default: (map["default"] as? [Any] ?? []).map { AnyCodable($0) }
122122
)
123123
}
124124
}

Sources/AppwriteModels/ColumnPoint.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ open class ColumnPoint: Codable {
4141
public let updatedAt: String
4242

4343
/// Default value for column when not provided. Cannot be set when column is required.
44-
public let `default`: [String: AnyCodable]?
44+
public let `default`: [AnyCodable]?
4545

4646

4747
init(
@@ -53,7 +53,7 @@ open class ColumnPoint: Codable {
5353
array: Bool?,
5454
createdAt: String,
5555
updatedAt: String,
56-
`default`: [String: AnyCodable]?
56+
`default`: [AnyCodable]?
5757
) {
5858
self.key = key
5959
self.type = type
@@ -77,7 +77,7 @@ open class ColumnPoint: Codable {
7777
self.array = try container.decodeIfPresent(Bool.self, forKey: .array)
7878
self.createdAt = try container.decode(String.self, forKey: .createdAt)
7979
self.updatedAt = try container.decode(String.self, forKey: .updatedAt)
80-
self.`default` = try container.decodeIfPresent([String: AnyCodable].self, forKey: .`default`)
80+
self.`default` = try container.decodeIfPresent([AnyCodable].self, forKey: .`default`)
8181
}
8282

8383
public func encode(to encoder: Encoder) throws {
@@ -118,7 +118,7 @@ open class ColumnPoint: Codable {
118118
array: map["array"] as? Bool,
119119
createdAt: map["$createdAt"] as! String,
120120
updatedAt: map["$updatedAt"] as! String,
121-
default: map["default"] as? [String: AnyCodable]
121+
default: (map["default"] as? [Any] ?? []).map { AnyCodable($0) }
122122
)
123123
}
124124
}

0 commit comments

Comments
 (0)