Skip to content

Commit f3ed63d

Browse files
authored
Merge pull request #100 from appwrite/dev
2 parents 3df582f + 0875ee5 commit f3ed63d

3 files changed

Lines changed: 23 additions & 38 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
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 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-apple/releases).**
10+
**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-apple/releases).**
1111

1212
Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Apple SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
1313

Sources/Appwrite/Channel.swift

Lines changed: 20 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@ public class RealtimeChannel<T> {
3030
self.segments = segments
3131
}
3232

33-
/// Internal helper to transition to next state with segment and ID
34-
internal func next<N>(_ segment: String, _ id: String = "*") -> RealtimeChannel<N> {
35-
return RealtimeChannel<N>(segments + [segment, normalize(id)])
33+
/// Internal helper to transition to next state with segment and optional ID
34+
internal func next<N>(_ segment: String, _ id: String? = nil) -> RealtimeChannel<N> {
35+
if let id = id {
36+
return RealtimeChannel<N>(segments + [segment, normalize(id)])
37+
}
38+
39+
return RealtimeChannel<N>(segments + [segment])
3640
}
3741

3842
/// Internal helper for terminal actions (no ID segment)
@@ -67,6 +71,10 @@ public enum Channel {
6771
return RealtimeChannel<_Func>(["functions", normalize(id)])
6872
}
6973

74+
public static func execution(_ id: String = "*") -> RealtimeChannel<_Execution> {
75+
return RealtimeChannel<_Execution>(["executions", normalize(id)])
76+
}
77+
7078
public static func team(_ id: String = "*") -> RealtimeChannel<_Team> {
7179
return RealtimeChannel<_Team>(["teams", normalize(id)])
7280
}
@@ -75,9 +83,8 @@ public enum Channel {
7583
return RealtimeChannel<_Membership>(["memberships", normalize(id)])
7684
}
7785

78-
public static func account(_ userId: String = "") -> String {
79-
let id = normalize(userId)
80-
return id == "*" ? "account" : "account.\(id)"
86+
public static func account() -> String {
87+
return "account"
8188
}
8289

8390
// Global events
@@ -93,14 +100,14 @@ public enum Channel {
93100

94101
/// Only available on RealtimeChannel<_Database>
95102
extension RealtimeChannel where T == _Database {
96-
public func collection(_ id: String = "*") -> RealtimeChannel<_Collection> {
97-
return self.next("collections", id)
103+
public func collection(_ id: String? = nil) -> RealtimeChannel<_Collection> {
104+
return self.next("collections", id ?? "*")
98105
}
99106
}
100107

101108
/// Only available on RealtimeChannel<_Collection>
102109
extension RealtimeChannel where T == _Collection {
103-
public func document(_ id: String = "*") -> RealtimeChannel<_Document> {
110+
public func document(_ id: String? = nil) -> RealtimeChannel<_Document> {
104111
return self.next("documents", id)
105112
}
106113
}
@@ -109,14 +116,14 @@ extension RealtimeChannel where T == _Collection {
109116

110117
/// Only available on RealtimeChannel<_TablesDB>
111118
extension RealtimeChannel where T == _TablesDB {
112-
public func table(_ id: String = "*") -> RealtimeChannel<_Table> {
113-
return self.next("tables", id)
119+
public func table(_ id: String? = nil) -> RealtimeChannel<_Table> {
120+
return self.next("tables", id ?? "*")
114121
}
115122
}
116123

117124
/// Only available on RealtimeChannel<_Table>
118125
extension RealtimeChannel where T == _Table {
119-
public func row(_ id: String = "*") -> RealtimeChannel<_Row> {
126+
public func row(_ id: String? = nil) -> RealtimeChannel<_Row> {
120127
return self.next("rows", id)
121128
}
122129
}
@@ -125,20 +132,11 @@ extension RealtimeChannel where T == _Table {
125132

126133
/// Only available on RealtimeChannel<_Bucket>
127134
extension RealtimeChannel where T == _Bucket {
128-
public func file(_ id: String = "*") -> RealtimeChannel<_File> {
135+
public func file(_ id: String? = nil) -> RealtimeChannel<_File> {
129136
return self.next("files", id)
130137
}
131138
}
132139

133-
// MARK: - FUNCTION ROUTE
134-
135-
/// Only available on RealtimeChannel<_Func>
136-
extension RealtimeChannel where T == _Func {
137-
public func execution(_ id: String = "*") -> RealtimeChannel<_Execution> {
138-
return self.next("executions", id)
139-
}
140-
}
141-
142140
// MARK: - TERMINAL ACTIONS
143141
// Restricted to actionable types (_Document, _Row, _File, _Execution, _Team, _Membership)
144142

@@ -187,21 +185,6 @@ extension RealtimeChannel where T == _File {
187185
}
188186
}
189187

190-
/// Only available on RealtimeChannel<_Execution>
191-
extension RealtimeChannel where T == _Execution {
192-
public func create() -> RealtimeChannel<_Resolved> {
193-
return self.resolve("create")
194-
}
195-
196-
public func update() -> RealtimeChannel<_Resolved> {
197-
return self.resolve("update")
198-
}
199-
200-
public func delete() -> RealtimeChannel<_Resolved> {
201-
return self.resolve("delete")
202-
}
203-
}
204-
205188
/// Only available on RealtimeChannel<_Team>
206189
extension RealtimeChannel where T == _Team {
207190
public func create() -> RealtimeChannel<_Resolved> {

Sources/AppwriteEnums/OAuthProvider.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public enum OAuthProvider: String, CustomStringConvertible {
4040
case yandex = "yandex"
4141
case zoho = "zoho"
4242
case zoom = "zoom"
43+
case githubImagine = "githubImagine"
44+
case googleImagine = "googleImagine"
4345

4446
public var description: String {
4547
return rawValue

0 commit comments

Comments
 (0)