Skip to content

Commit c913f82

Browse files
committed
feat(version): support 0.12.0
1 parent 6404dcc commit c913f82

File tree

89 files changed

+2505
-343
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+2505
-343
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2021 Appwrite (https://appwrite.io) and individual contributors.
1+
Copyright (c) 2022 Appwrite (https://appwrite.io) and individual contributors.
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
![Swift Package Manager](https://img.shields.io/github/v/release/appwrite/sdk-for-swift.svg?color=green&style=flat-square)
44
![License](https://img.shields.io/github/license/appwrite/sdk-for-swift.svg?style=flat-square)
5-
![Version](https://img.shields.io/badge/api%20version-0.11.0-blue.svg?style=flat-square)
5+
![Version](https://img.shields.io/badge/api%20version-0.12.0-blue.svg?style=flat-square)
66
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
77
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
88
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
99

10-
**This SDK is compatible with Appwrite server version 0.11.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-swift/releases).**
10+
**This SDK is compatible with Appwrite server version 0.12.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-swift/releases).**
1111

1212
> This is the Swift SDK for integrating with Appwrite from your Swift server-side code. If you're looking for the Apple SDK you should check [appwrite/sdk-for-apple](https://github.com/appwrite/sdk-for-apple)
1313

Sources/Appwrite/Client.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ open class Client {
1313

1414
// MARK: Properties
1515

16-
open var endPoint = "https://appwrite.io/v1"
16+
open var endPoint = "https://HOSTNAME/v1"
1717

1818
open var endPointRealtime: String? = nil
1919

2020
open var headers: [String: String] = [
2121
"content-type": "",
22-
"x-sdk-version": "appwrite:swift:0.1.0", "X-Appwrite-Response-Format": "0.11.0"
22+
"x-sdk-version": "appwrite:swift:0.1.0", "X-Appwrite-Response-Format": "0.12.0"
2323
]
2424

2525
open var config: [String: String] = [:]

Sources/Appwrite/Models/Query.swift

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
public class Query {
2+
3+
public static func equal(_ attribute: String, value: Any) -> String {
4+
buildQueryWhere(attribute, is: "equal", to: value)
5+
}
6+
7+
public static func notEqual(_ attribute: String, value: Any) -> String {
8+
buildQueryWhere(attribute, is: "notEqual", to: value)
9+
}
10+
11+
public static func lesser(_ attribute: String, value: Any) -> String {
12+
buildQueryWhere(attribute, is: "lesser", to: value)
13+
}
14+
15+
public static func lesserEqual(attribute: String, value: Any) -> String {
16+
buildQueryWhere(attribute, is: "lesserEqual", to: value)
17+
}
18+
19+
public static func greater(_ attribute: String, value: Any) -> String {
20+
buildQueryWhere(attribute, is: "greater", to: value)
21+
}
22+
23+
public static func greaterEqual(_ attribute: String, value: Any) -> String {
24+
buildQueryWhere(attribute, is: "greaterEqual", to: value)
25+
}
26+
27+
public static func search(_ attribute: String, value: String) -> String {
28+
buildQueryWhere(attribute, is: "search", to: value)
29+
}
30+
31+
public static func buildQueryWhere(_ attribute: String, is oper: String, to value: Any) -> String {
32+
switch value {
33+
case let value as Array<Any>:
34+
return "\(attribute).\(oper)(\(value.map { parseValues($0) }.joined(separator: ",") ))"
35+
default:
36+
return "\(attribute).\(oper)(\(parseValues(value)))"
37+
}
38+
}
39+
40+
private static func parseValues(_ value: Any) -> String {
41+
switch value {
42+
case let value as String:
43+
return "\"\(value)\""
44+
default:
45+
return "\(value)"
46+
}
47+
}
48+
}

Sources/Appwrite/Services/Account.swift

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,13 @@ open class Account: Service {
7373
/// Update Account Email
7474
///
7575
/// Update currently logged in user account email address. After changing user
76-
/// address, user confirmation status is being reset and a new confirmation
77-
/// mail is sent. For security measures, user password is required to complete
78-
/// this request.
76+
/// address, the user confirmation status will get reset. A new confirmation
77+
/// email is not sent automatically however you can use the send confirmation
78+
/// email endpoint again to send the confirmation email. For security measures,
79+
/// user password is required to complete this request.
7980
/// This endpoint can also be used to convert an anonymous account to a normal
8081
/// one, by passing an email address and a new password.
82+
///
8183
///
8284
/// @param String email
8385
/// @param String password
@@ -120,15 +122,22 @@ open class Account: Service {
120122
/// Get currently logged in user list of latest security activity logs. Each
121123
/// log returns user IP address, location and date and time of log.
122124
///
125+
/// @param Int limit
126+
/// @param Int offset
123127
/// @throws Exception
124128
/// @return array
125129
///
126130
open func getLogs(
131+
limit: Int? = nil,
132+
offset: Int? = nil,
127133
completion: ((Result<AppwriteModels.LogList, AppwriteError>) -> Void)? = nil
128134
) {
129135
let path: String = "/account/logs"
130136

131-
let params: [String: Any?] = [:]
137+
let params: [String: Any?] = [
138+
"limit": limit,
139+
"offset": offset
140+
]
132141

133142
let headers: [String: String] = [
134143
"content-type": "application/json"

0 commit comments

Comments
 (0)