Skip to content

Commit 573eb00

Browse files
committed
Add time between queries
1 parent 3ef704f commit 573eb00

27 files changed

+1558
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Add the package to your `Package.swift` dependencies:
3333

3434
```swift
3535
dependencies: [
36-
.package(url: "git@github.com:appwrite/sdk-for-swift.git", from: "11.0.0"),
36+
.package(url: "git@github.com:appwrite/sdk-for-swift.git", from: "11.1.0"),
3737
],
3838
```
3939

Sources/Appwrite/Client.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ open class Client {
2121
"x-sdk-name": "Swift",
2222
"x-sdk-platform": "server",
2323
"x-sdk-language": "swift",
24-
"x-sdk-version": "11.0.0",
24+
"x-sdk-version": "11.1.0",
2525
"x-appwrite-response-format": "1.8.0"
2626
]
2727

Sources/Appwrite/Query.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,13 @@ public struct Query : Codable, CustomStringConvertible {
354354
).description
355355
}
356356

357+
public static func createdBetween(_ start: String, _ end: String) -> String {
358+
return Query(
359+
method: "createdBetween",
360+
values: [start, end]
361+
).description
362+
}
363+
357364
public static func updatedBefore(_ value: String) -> String {
358365
return Query(
359366
method: "updatedBefore",
@@ -368,6 +375,13 @@ public struct Query : Codable, CustomStringConvertible {
368375
).description
369376
}
370377

378+
public static func updatedBetween(_ start: String, _ end: String) -> String {
379+
return Query(
380+
method: "updatedBetween",
381+
values: [start, end]
382+
).description
383+
}
384+
371385
public static func or(_ queries: [String]) -> String {
372386
let decoder = JSONDecoder()
373387
let decodedQueries = queries.compactMap { queryStr -> Query? in

Sources/Appwrite/Services/Account.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,7 +1548,7 @@ open class Account: Service {
15481548
/// - Throws: Exception if the request fails
15491549
/// - Returns: AppwriteModels.Session
15501550
///
1551-
@available(*, deprecated, message: "This API has been deprecated.")
1551+
@available(*, deprecated, message: "This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.")
15521552
open func updateMagicURLSession(
15531553
userId: String,
15541554
secret: String
@@ -1588,7 +1588,7 @@ open class Account: Service {
15881588
/// - Throws: Exception if the request fails
15891589
/// - Returns: AppwriteModels.Session
15901590
///
1591-
@available(*, deprecated, message: "This API has been deprecated.")
1591+
@available(*, deprecated, message: "This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.")
15921592
open func updatePhoneSession(
15931593
userId: String,
15941594
secret: String

Sources/Appwrite/Services/Databases.swift

Lines changed: 295 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ open class Databases: Service {
5656
/// - Throws: Exception if the request fails
5757
/// - Returns: AppwriteModels.Database
5858
///
59-
@available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `TablesDB.createDatabase` instead.")
59+
@available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `TablesDB.create` instead.")
6060
open func create(
6161
databaseId: String,
6262
name: String,
@@ -1191,6 +1191,300 @@ open class Databases: Service {
11911191
)
11921192
}
11931193

1194+
///
1195+
/// Create a geometric line attribute.
1196+
///
1197+
/// - Parameters:
1198+
/// - databaseId: String
1199+
/// - collectionId: String
1200+
/// - key: String
1201+
/// - required: Bool
1202+
/// - default: String (optional)
1203+
/// - Throws: Exception if the request fails
1204+
/// - Returns: AppwriteModels.AttributeLine
1205+
///
1206+
@available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `TablesDB.createLineColumn` instead.")
1207+
open func createLineAttribute(
1208+
databaseId: String,
1209+
collectionId: String,
1210+
key: String,
1211+
`required`: Bool,
1212+
`default`: String? = nil
1213+
) async throws -> AppwriteModels.AttributeLine {
1214+
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/line"
1215+
.replacingOccurrences(of: "{databaseId}", with: databaseId)
1216+
.replacingOccurrences(of: "{collectionId}", with: collectionId)
1217+
1218+
let apiParams: [String: Any?] = [
1219+
"key": key,
1220+
"required": `required`,
1221+
"default": `default`
1222+
]
1223+
1224+
let apiHeaders: [String: String] = [
1225+
"content-type": "application/json"
1226+
]
1227+
1228+
let converter: (Any) -> AppwriteModels.AttributeLine = { response in
1229+
return AppwriteModels.AttributeLine.from(map: response as! [String: Any])
1230+
}
1231+
1232+
return try await client.call(
1233+
method: "POST",
1234+
path: apiPath,
1235+
headers: apiHeaders,
1236+
params: apiParams,
1237+
converter: converter
1238+
)
1239+
}
1240+
1241+
///
1242+
/// Update a line attribute. Changing the `default` value will not update
1243+
/// already existing documents.
1244+
///
1245+
/// - Parameters:
1246+
/// - databaseId: String
1247+
/// - collectionId: String
1248+
/// - key: String
1249+
/// - required: Bool
1250+
/// - default: String (optional)
1251+
/// - newKey: String (optional)
1252+
/// - Throws: Exception if the request fails
1253+
/// - Returns: AppwriteModels.AttributeLine
1254+
///
1255+
@available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `TablesDB.updateLineColumn` instead.")
1256+
open func updateLineAttribute(
1257+
databaseId: String,
1258+
collectionId: String,
1259+
key: String,
1260+
`required`: Bool,
1261+
`default`: String? = nil,
1262+
newKey: String? = nil
1263+
) async throws -> AppwriteModels.AttributeLine {
1264+
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}"
1265+
.replacingOccurrences(of: "{databaseId}", with: databaseId)
1266+
.replacingOccurrences(of: "{collectionId}", with: collectionId)
1267+
.replacingOccurrences(of: "{key}", with: key)
1268+
1269+
let apiParams: [String: Any?] = [
1270+
"required": `required`,
1271+
"default": `default`,
1272+
"newKey": newKey
1273+
]
1274+
1275+
let apiHeaders: [String: String] = [
1276+
"content-type": "application/json"
1277+
]
1278+
1279+
let converter: (Any) -> AppwriteModels.AttributeLine = { response in
1280+
return AppwriteModels.AttributeLine.from(map: response as! [String: Any])
1281+
}
1282+
1283+
return try await client.call(
1284+
method: "PATCH",
1285+
path: apiPath,
1286+
headers: apiHeaders,
1287+
params: apiParams,
1288+
converter: converter
1289+
)
1290+
}
1291+
1292+
///
1293+
/// Create a geometric 2d point attribute.
1294+
///
1295+
/// - Parameters:
1296+
/// - databaseId: String
1297+
/// - collectionId: String
1298+
/// - key: String
1299+
/// - required: Bool
1300+
/// - default: String (optional)
1301+
/// - Throws: Exception if the request fails
1302+
/// - Returns: AppwriteModels.AttributePoint
1303+
///
1304+
@available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `TablesDB.createPointColumn` instead.")
1305+
open func createPointAttribute(
1306+
databaseId: String,
1307+
collectionId: String,
1308+
key: String,
1309+
`required`: Bool,
1310+
`default`: String? = nil
1311+
) async throws -> AppwriteModels.AttributePoint {
1312+
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/point"
1313+
.replacingOccurrences(of: "{databaseId}", with: databaseId)
1314+
.replacingOccurrences(of: "{collectionId}", with: collectionId)
1315+
1316+
let apiParams: [String: Any?] = [
1317+
"key": key,
1318+
"required": `required`,
1319+
"default": `default`
1320+
]
1321+
1322+
let apiHeaders: [String: String] = [
1323+
"content-type": "application/json"
1324+
]
1325+
1326+
let converter: (Any) -> AppwriteModels.AttributePoint = { response in
1327+
return AppwriteModels.AttributePoint.from(map: response as! [String: Any])
1328+
}
1329+
1330+
return try await client.call(
1331+
method: "POST",
1332+
path: apiPath,
1333+
headers: apiHeaders,
1334+
params: apiParams,
1335+
converter: converter
1336+
)
1337+
}
1338+
1339+
///
1340+
/// Update a point attribute. Changing the `default` value will not update
1341+
/// already existing documents.
1342+
///
1343+
/// - Parameters:
1344+
/// - databaseId: String
1345+
/// - collectionId: String
1346+
/// - key: String
1347+
/// - required: Bool
1348+
/// - default: String (optional)
1349+
/// - newKey: String (optional)
1350+
/// - Throws: Exception if the request fails
1351+
/// - Returns: AppwriteModels.AttributePoint
1352+
///
1353+
@available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `TablesDB.updatePointColumn` instead.")
1354+
open func updatePointAttribute(
1355+
databaseId: String,
1356+
collectionId: String,
1357+
key: String,
1358+
`required`: Bool,
1359+
`default`: String? = nil,
1360+
newKey: String? = nil
1361+
) async throws -> AppwriteModels.AttributePoint {
1362+
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}"
1363+
.replacingOccurrences(of: "{databaseId}", with: databaseId)
1364+
.replacingOccurrences(of: "{collectionId}", with: collectionId)
1365+
.replacingOccurrences(of: "{key}", with: key)
1366+
1367+
let apiParams: [String: Any?] = [
1368+
"required": `required`,
1369+
"default": `default`,
1370+
"newKey": newKey
1371+
]
1372+
1373+
let apiHeaders: [String: String] = [
1374+
"content-type": "application/json"
1375+
]
1376+
1377+
let converter: (Any) -> AppwriteModels.AttributePoint = { response in
1378+
return AppwriteModels.AttributePoint.from(map: response as! [String: Any])
1379+
}
1380+
1381+
return try await client.call(
1382+
method: "PATCH",
1383+
path: apiPath,
1384+
headers: apiHeaders,
1385+
params: apiParams,
1386+
converter: converter
1387+
)
1388+
}
1389+
1390+
///
1391+
/// Create a geometric polygon attribute.
1392+
///
1393+
/// - Parameters:
1394+
/// - databaseId: String
1395+
/// - collectionId: String
1396+
/// - key: String
1397+
/// - required: Bool
1398+
/// - default: String (optional)
1399+
/// - Throws: Exception if the request fails
1400+
/// - Returns: AppwriteModels.AttributePolygon
1401+
///
1402+
@available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `TablesDB.createPolygonColumn` instead.")
1403+
open func createPolygonAttribute(
1404+
databaseId: String,
1405+
collectionId: String,
1406+
key: String,
1407+
`required`: Bool,
1408+
`default`: String? = nil
1409+
) async throws -> AppwriteModels.AttributePolygon {
1410+
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/polygon"
1411+
.replacingOccurrences(of: "{databaseId}", with: databaseId)
1412+
.replacingOccurrences(of: "{collectionId}", with: collectionId)
1413+
1414+
let apiParams: [String: Any?] = [
1415+
"key": key,
1416+
"required": `required`,
1417+
"default": `default`
1418+
]
1419+
1420+
let apiHeaders: [String: String] = [
1421+
"content-type": "application/json"
1422+
]
1423+
1424+
let converter: (Any) -> AppwriteModels.AttributePolygon = { response in
1425+
return AppwriteModels.AttributePolygon.from(map: response as! [String: Any])
1426+
}
1427+
1428+
return try await client.call(
1429+
method: "POST",
1430+
path: apiPath,
1431+
headers: apiHeaders,
1432+
params: apiParams,
1433+
converter: converter
1434+
)
1435+
}
1436+
1437+
///
1438+
/// Update a polygon attribute. Changing the `default` value will not update
1439+
/// already existing documents.
1440+
///
1441+
/// - Parameters:
1442+
/// - databaseId: String
1443+
/// - collectionId: String
1444+
/// - key: String
1445+
/// - required: Bool
1446+
/// - default: String (optional)
1447+
/// - newKey: String (optional)
1448+
/// - Throws: Exception if the request fails
1449+
/// - Returns: AppwriteModels.AttributePolygon
1450+
///
1451+
@available(*, deprecated, message: "This API has been deprecated since 1.8.0. Please use `TablesDB.updatePolygonColumn` instead.")
1452+
open func updatePolygonAttribute(
1453+
databaseId: String,
1454+
collectionId: String,
1455+
key: String,
1456+
`required`: Bool,
1457+
`default`: String? = nil,
1458+
newKey: String? = nil
1459+
) async throws -> AppwriteModels.AttributePolygon {
1460+
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}"
1461+
.replacingOccurrences(of: "{databaseId}", with: databaseId)
1462+
.replacingOccurrences(of: "{collectionId}", with: collectionId)
1463+
.replacingOccurrences(of: "{key}", with: key)
1464+
1465+
let apiParams: [String: Any?] = [
1466+
"required": `required`,
1467+
"default": `default`,
1468+
"newKey": newKey
1469+
]
1470+
1471+
let apiHeaders: [String: String] = [
1472+
"content-type": "application/json"
1473+
]
1474+
1475+
let converter: (Any) -> AppwriteModels.AttributePolygon = { response in
1476+
return AppwriteModels.AttributePolygon.from(map: response as! [String: Any])
1477+
}
1478+
1479+
return try await client.call(
1480+
method: "PATCH",
1481+
path: apiPath,
1482+
headers: apiHeaders,
1483+
params: apiParams,
1484+
converter: converter
1485+
)
1486+
}
1487+
11941488
///
11951489
/// Create relationship attribute. [Learn more about relationship
11961490
/// attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes).

0 commit comments

Comments
 (0)