Skip to content

Commit 297e1ed

Browse files
committed
update twitter link
1 parent 91c0c17 commit 297e1ed

31 files changed

+1039
-233
lines changed

README.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# Appwrite Swift SDK
22

3-
![Cocoapods](https://img.shields.io/cocoapods/v/Appwrite.svg?color=green&style=flat-square)
43
![Swift Package Manager](https://img.shields.io/github/v/release/appwrite/sdk-for-swift.svg?color=green&style=flat-square)
54
![License](https://img.shields.io/github/license/appwrite/sdk-for-swift.svg?style=flat-square)
65
![Version](https://img.shields.io/badge/api%20version-0.11.0-blue.svg?style=flat-square)
76
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
8-
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite_io?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite_io)
7+
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
98
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
109

1110
**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).**
@@ -22,18 +21,12 @@ Appwrite is an open-source backend as a service server that abstract and simplif
2221

2322
The Appwrite Swift SDK is available via multiple package managers, including Swift Package Manager. In order to use the Appwrite Swift SDK from Xcode, select File > Swift Packages > **Add Package Dependency**
2423

25-
>>IMAGE<<
26-
2724
In the dialog that appears, enter the Appwrite Swift SDK [package URL](git@github.com:appwrite/sdk-for-swift.git) and click **Next**.
2825

2926
Once the repository information is loaded, add your version rules and click **Next** again.
3027

31-
>>IMAGE<<
32-
3328
On the final screen, make sure you see `Appwrite` as a product selected for your target:
3429

35-
>>IMAGE<<
36-
3730
### Swift Package Manager
3831

3932
Add the package to your `Package.swift` dependencies:
@@ -56,12 +49,6 @@ Then add it to your target:
5649
),
5750
```
5851

59-
### Cocoapods
60-
61-
```ruby
62-
pod '', git: 'git@github.com:appwrite/sdk-for-swift.git', tag: '0.1.0'
63-
```
64-
6552

6653
## Contribution
6754

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
import AsyncHTTPClient
22
import Foundation
3+
import NIO
4+
import NIOHTTP1
35

46
extension HTTPClient.Request {
57
public mutating func addDomainCookies() {
6-
let cookieJson = UserDefaults.standard.string(forKey: "\(url.host!)-cookies")
8+
headers.addDomainCookies(for: url.host!)
9+
}
10+
}
11+
12+
extension HTTPHeaders {
13+
public mutating func addDomainCookies(for domain: String) {
14+
let cookieJson = UserDefaults.standard.string(forKey: "\(domain)-cookies")
715
let cookies: [HTTPClient.Cookie?]? = try? cookieJson?.fromJson(to: [HTTPClient.Cookie].self)
816
?? [(try? cookieJson?.fromJson(to: HTTPClient.Cookie.self))]
917

1018
if let authCookie = cookies?.first(where: { $0?.name.starts(with: "a_session_") == true } ) {
11-
headers.add(name: "cookie", value: "\(authCookie!.name)=\(authCookie!.value)")
19+
add(name: "cookie", value: "\(authCookie!.name)=\(authCookie!.value)")
1220
}
1321
}
1422
}

Sources/Appwrite/Models/Query.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ public class Query {
2828
buildQueryWhere(attribute, is: "contains", to: value)
2929
}
3030

31+
public static func search(_ attribute: String, value: String) -> String {
32+
buildQueryWhere(attribute, is: "search", to: value)
33+
}
34+
3135
public static func buildQueryWhere(_ attribute: String, is oper: String, to value: Any) -> String {
3236
switch value {
3337
case let value as Array<Any>:
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
2+
/// AttributeBoolean
3+
public class AttributeBoolean {
4+
5+
/// Attribute Key.
6+
public let key: String
7+
8+
/// Attribute type.
9+
public let type: String
10+
11+
/// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
12+
public let status: String
13+
14+
/// Is attribute required?
15+
public let xrequired: Bool
16+
17+
/// Is attribute an array?
18+
public let array: Bool?
19+
20+
/// Default value for attribute when not provided. Cannot be set when attribute is required.
21+
public let xdefault: Bool?
22+
23+
init(
24+
key: String,
25+
type: String,
26+
status: String,
27+
xrequired: Bool,
28+
array: Bool? = ,
29+
xdefault: Bool? =
30+
) {
31+
self.key = key
32+
self.type = type
33+
self.status = status
34+
self.xrequired = xrequired
35+
self.array = array
36+
self.xdefault = xdefault
37+
}
38+
39+
public static func from(map: [String: Any]) -> AttributeBoolean {
40+
return AttributeBoolean(
41+
key: map["key"] as! String,
42+
type: map["type"] as! String,
43+
status: map["status"] as! String,
44+
xrequired: map["required"] as! Bool,
45+
array: map["array"] as? Bool,
46+
xdefault: map["default"] as? Bool
47+
)
48+
}
49+
50+
public func toMap() -> [String: Any] {
51+
return [
52+
"key": key as Any,
53+
"type": type as Any,
54+
"status": status as Any,
55+
"xrequired": xrequired as Any,
56+
"array": array as Any,
57+
"xdefault": xdefault as Any
58+
]
59+
}
60+
61+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
2+
/// AttributeEmail
3+
public class AttributeEmail {
4+
5+
/// Attribute Key.
6+
public let key: String
7+
8+
/// Attribute type.
9+
public let type: String
10+
11+
/// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
12+
public let status: String
13+
14+
/// Is attribute required?
15+
public let xrequired: Bool
16+
17+
/// Is attribute an array?
18+
public let array: Bool?
19+
20+
/// String format.
21+
public let format: String
22+
23+
/// Default value for attribute when not provided. Cannot be set when attribute is required.
24+
public let xdefault: String?
25+
26+
init(
27+
key: String,
28+
type: String,
29+
status: String,
30+
xrequired: Bool,
31+
array: Bool? = ,
32+
format: String,
33+
xdefault: String? =
34+
) {
35+
self.key = key
36+
self.type = type
37+
self.status = status
38+
self.xrequired = xrequired
39+
self.array = array
40+
self.format = format
41+
self.xdefault = xdefault
42+
}
43+
44+
public static func from(map: [String: Any]) -> AttributeEmail {
45+
return AttributeEmail(
46+
key: map["key"] as! String,
47+
type: map["type"] as! String,
48+
status: map["status"] as! String,
49+
xrequired: map["required"] as! Bool,
50+
array: map["array"] as? Bool,
51+
format: map["format"] as! String,
52+
xdefault: map["default"] as? String
53+
)
54+
}
55+
56+
public func toMap() -> [String: Any] {
57+
return [
58+
"key": key as Any,
59+
"type": type as Any,
60+
"status": status as Any,
61+
"xrequired": xrequired as Any,
62+
"array": array as Any,
63+
"format": format as Any,
64+
"xdefault": xdefault as Any
65+
]
66+
}
67+
68+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
2+
/// AttributeEnum
3+
public class AttributeEnum {
4+
5+
/// Attribute Key.
6+
public let key: String
7+
8+
/// Attribute type.
9+
public let type: String
10+
11+
/// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
12+
public let status: String
13+
14+
/// Is attribute required?
15+
public let xrequired: Bool
16+
17+
/// Is attribute an array?
18+
public let array: Bool?
19+
20+
/// Array of elements in enumerated type.
21+
public let elements: [Any]
22+
23+
/// String format.
24+
public let format: String
25+
26+
/// Default value for attribute when not provided. Cannot be set when attribute is required.
27+
public let xdefault: String?
28+
29+
init(
30+
key: String,
31+
type: String,
32+
status: String,
33+
xrequired: Bool,
34+
array: Bool? = ,
35+
elements: [Any],
36+
format: String,
37+
xdefault: String? =
38+
) {
39+
self.key = key
40+
self.type = type
41+
self.status = status
42+
self.xrequired = xrequired
43+
self.array = array
44+
self.elements = elements
45+
self.format = format
46+
self.xdefault = xdefault
47+
}
48+
49+
public static func from(map: [String: Any]) -> AttributeEnum {
50+
return AttributeEnum(
51+
key: map["key"] as! String,
52+
type: map["type"] as! String,
53+
status: map["status"] as! String,
54+
xrequired: map["required"] as! Bool,
55+
array: map["array"] as? Bool,
56+
elements: map["elements"] as! [Any],
57+
format: map["format"] as! String,
58+
xdefault: map["default"] as? String
59+
)
60+
}
61+
62+
public func toMap() -> [String: Any] {
63+
return [
64+
"key": key as Any,
65+
"type": type as Any,
66+
"status": status as Any,
67+
"xrequired": xrequired as Any,
68+
"array": array as Any,
69+
"elements": elements as Any,
70+
"format": format as Any,
71+
"xdefault": xdefault as Any
72+
]
73+
}
74+
75+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
2+
/// AttributeFloat
3+
public class AttributeFloat {
4+
5+
/// Attribute Key.
6+
public let key: String
7+
8+
/// Attribute type.
9+
public let type: String
10+
11+
/// Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
12+
public let status: String
13+
14+
/// Is attribute required?
15+
public let xrequired: Bool
16+
17+
/// Is attribute an array?
18+
public let array: Bool?
19+
20+
/// Minimum value to enforce for new documents.
21+
public let min: Double?
22+
23+
/// Maximum value to enforce for new documents.
24+
public let max: Double?
25+
26+
/// Default value for attribute when not provided. Cannot be set when attribute is required.
27+
public let xdefault: Double?
28+
29+
init(
30+
key: String,
31+
type: String,
32+
status: String,
33+
xrequired: Bool,
34+
array: Bool? = ,
35+
min: Double? = ,
36+
max: Double? = ,
37+
xdefault: Double? =
38+
) {
39+
self.key = key
40+
self.type = type
41+
self.status = status
42+
self.xrequired = xrequired
43+
self.array = array
44+
self.min = min
45+
self.max = max
46+
self.xdefault = xdefault
47+
}
48+
49+
public static func from(map: [String: Any]) -> AttributeFloat {
50+
return AttributeFloat(
51+
key: map["key"] as! String,
52+
type: map["type"] as! String,
53+
status: map["status"] as! String,
54+
xrequired: map["required"] as! Bool,
55+
array: map["array"] as? Bool,
56+
min: map["min"] as? Double,
57+
max: map["max"] as? Double,
58+
xdefault: map["default"] as? Double
59+
)
60+
}
61+
62+
public func toMap() -> [String: Any] {
63+
return [
64+
"key": key as Any,
65+
"type": type as Any,
66+
"status": status as Any,
67+
"xrequired": xrequired as Any,
68+
"array": array as Any,
69+
"min": min as Any,
70+
"max": max as Any,
71+
"xdefault": xdefault as Any
72+
]
73+
}
74+
75+
}

0 commit comments

Comments
 (0)