Skip to content

Commit dc0849e

Browse files
Merge pull request #29 from appwrite/dev
Fix build
2 parents 846134d + 1bbe5ef commit dc0849e

Some content is hidden

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

41 files changed

+649
-20
lines changed

Package.swift

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ let package = Package(
1313
products: [
1414
.library(
1515
name: "Appwrite",
16-
targets: ["Appwrite", "AppwriteModels"]
16+
targets: ["Appwrite", "AppwriteModels", "JSONCodable"]
1717
),
1818
],
1919
dependencies: [
@@ -26,11 +26,18 @@ let package = Package(
2626
dependencies: [
2727
.product(name: "AsyncHTTPClient", package: "async-http-client"),
2828
.product(name: "NIOWebSocket", package: "swift-nio"),
29-
"AppwriteModels"
29+
"AppwriteModels",
30+
"JSONCodable"
3031
]
3132
),
3233
.target(
33-
name: "AppwriteModels"
34+
name: "AppwriteModels",
35+
dependencies: [
36+
"JSONCodable"
37+
]
38+
),
39+
.target(
40+
name: "JSONCodable"
3441
),
3542
.testTarget(
3643
name: "AppwriteTests",

README.md

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

3232
```swift
3333
dependencies: [
34-
.package(url: "[email protected]:appwrite/sdk-for-apple.git", from: "1.2.1"),
34+
.package(url: "[email protected]:appwrite/sdk-for-apple.git", from: "1.2.2"),
3535
],
3636
```
3737

Sources/Appwrite/Client.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ open class Client {
2323
"x-sdk-name": "Apple",
2424
"x-sdk-platform": "client",
2525
"x-sdk-language": "apple",
26-
"x-sdk-version": "1.2.1",
26+
"x-sdk-version": "1.2.2",
2727
"X-Appwrite-Response-Format": "1.0.0"
2828
]
2929

Sources/Appwrite/Services/Account.swift

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import AsyncHTTPClient
22
import Foundation
33
import NIO
4+
import JSONCodable
45
import AppwriteModels
56

67
/// The Account service allows you to authenticate and manage a user account.
@@ -130,7 +131,7 @@ open class Account: Service {
130131
userId: userId,
131132
email: email,
132133
password: password,
133-
name: name
134+
name: name,
134135
nestedType: [String: AnyCodable].self
135136
)
136137
}
@@ -204,7 +205,7 @@ open class Account: Service {
204205
) async throws -> AppwriteModels.Account<[String: AnyCodable]> {
205206
return try await updateEmail(
206207
email: email,
207-
password: password
208+
password: password,
208209
nestedType: [String: AnyCodable].self
209210
)
210211
}
@@ -329,7 +330,7 @@ open class Account: Service {
329330
name: String
330331
) async throws -> AppwriteModels.Account<[String: AnyCodable]> {
331332
return try await updateName(
332-
name: name
333+
name: name,
333334
nestedType: [String: AnyCodable].self
334335
)
335336
}
@@ -393,7 +394,7 @@ open class Account: Service {
393394
) async throws -> AppwriteModels.Account<[String: AnyCodable]> {
394395
return try await updatePassword(
395396
password: password,
396-
oldPassword: oldPassword
397+
oldPassword: oldPassword,
397398
nestedType: [String: AnyCodable].self
398399
)
399400
}
@@ -461,7 +462,7 @@ open class Account: Service {
461462
) async throws -> AppwriteModels.Account<[String: AnyCodable]> {
462463
return try await updatePhone(
463464
phone: phone,
464-
password: password
465+
password: password,
465466
nestedType: [String: AnyCodable].self
466467
)
467468
}
@@ -525,7 +526,7 @@ open class Account: Service {
525526
/// @return array
526527
///
527528
open func updatePrefs<T>(
528-
prefs: T,
529+
prefs: Any,
529530
nestedType: T.Type
530531
) async throws -> AppwriteModels.Account<T> {
531532
let path: String = "/account/prefs"
@@ -566,7 +567,7 @@ open class Account: Service {
566567
prefs: Any
567568
) async throws -> AppwriteModels.Account<[String: AnyCodable]> {
568569
return try await updatePrefs(
569-
prefs: prefs
570+
prefs: prefs,
570571
nestedType: [String: AnyCodable].self
571572
)
572573
}

Sources/Appwrite/Services/Avatars.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import AsyncHTTPClient
22
import Foundation
33
import NIO
4+
import JSONCodable
45
import AppwriteModels
56

67
/// The Avatars service aims to help you complete everyday tasks related to your app image, icons, and avatars.

Sources/Appwrite/Services/Databases.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import AsyncHTTPClient
22
import Foundation
33
import NIO
4+
import JSONCodable
45
import AppwriteModels
56

67
/// The Databases service allows you to create structured collections of documents, query and filter lists of documents
@@ -69,7 +70,7 @@ open class Databases: Service {
6970
return try await listDocuments(
7071
databaseId: databaseId,
7172
collectionId: collectionId,
72-
queries: queries
73+
queries: queries,
7374
nestedType: [String: AnyCodable].self
7475
)
7576
}
@@ -94,7 +95,7 @@ open class Databases: Service {
9495
databaseId: String,
9596
collectionId: String,
9697
documentId: String,
97-
data: T,
98+
data: Any,
9899
permissions: [String]? = nil,
99100
nestedType: T.Type
100101
) async throws -> AppwriteModels.Document<T> {
@@ -153,7 +154,7 @@ open class Databases: Service {
153154
collectionId: collectionId,
154155
documentId: documentId,
155156
data: data,
156-
permissions: permissions
157+
permissions: permissions,
157158
nestedType: [String: AnyCodable].self
158159
)
159160
}
@@ -220,7 +221,7 @@ open class Databases: Service {
220221
return try await getDocument(
221222
databaseId: databaseId,
222223
collectionId: collectionId,
223-
documentId: documentId
224+
documentId: documentId,
224225
nestedType: [String: AnyCodable].self
225226
)
226227
}
@@ -243,7 +244,7 @@ open class Databases: Service {
243244
databaseId: String,
244245
collectionId: String,
245246
documentId: String,
246-
data: T? = nil,
247+
data: Any? = nil,
247248
permissions: [String]? = nil,
248249
nestedType: T.Type
249250
) async throws -> AppwriteModels.Document<T> {
@@ -300,7 +301,7 @@ open class Databases: Service {
300301
collectionId: collectionId,
301302
documentId: documentId,
302303
data: data,
303-
permissions: permissions
304+
permissions: permissions,
304305
nestedType: [String: AnyCodable].self
305306
)
306307
}

Sources/Appwrite/Services/Functions.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import AsyncHTTPClient
22
import Foundation
33
import NIO
4+
import JSONCodable
45
import AppwriteModels
56

67
/// The Functions Service allows you view, create and manage your Cloud Functions.

Sources/Appwrite/Services/Graphql.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import AsyncHTTPClient
22
import Foundation
33
import NIO
4+
import JSONCodable
45
import AppwriteModels
56

67
/// The GraphQL API allows you to query and mutate your Appwrite server using GraphQL.
@@ -16,7 +17,7 @@ open class Graphql: Service {
1617
/// @return array
1718
///
1819
open func query(
19-
query: T
20+
query: Any
2021
) async throws -> Any {
2122
let path: String = "/graphql"
2223

@@ -52,7 +53,7 @@ open class Graphql: Service {
5253
/// @return array
5354
///
5455
open func mutation(
55-
query: T
56+
query: Any
5657
) async throws -> Any {
5758
let path: String = "/graphql/mutation"
5859

Sources/Appwrite/Services/Locale.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import AsyncHTTPClient
22
import Foundation
33
import NIO
4+
import JSONCodable
45
import AppwriteModels
56

67
/// The Locale service allows you to customize your app based on your users&#039; location.

Sources/Appwrite/Services/Storage.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import AsyncHTTPClient
22
import Foundation
33
import NIO
4+
import JSONCodable
45
import AppwriteModels
56

67
/// The Storage service allows you to manage your project files.

Sources/Appwrite/Services/Teams.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import AsyncHTTPClient
22
import Foundation
33
import NIO
4+
import JSONCodable
45
import AppwriteModels
56

67
/// The Teams service allows you to group users of your project and to enable them to share read and write access to your project resources

Sources/AppwriteModels/Account.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Account
45
public class Account<T : Codable> {

Sources/AppwriteModels/Continent.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Continent
45
public class Continent {

Sources/AppwriteModels/ContinentList.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Continents List
45
public class ContinentList {

Sources/AppwriteModels/Country.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Country
45
public class Country {

Sources/AppwriteModels/CountryList.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Countries List
45
public class CountryList {

Sources/AppwriteModels/Currency.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Currency
45
public class Currency {

Sources/AppwriteModels/CurrencyList.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Currencies List
45
public class CurrencyList {

Sources/AppwriteModels/Document.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Document
45
public class Document<T : Codable> {

Sources/AppwriteModels/DocumentList.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Documents List
45
public class DocumentList<T : Codable> {

Sources/AppwriteModels/Execution.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Execution
45
public class Execution {

Sources/AppwriteModels/ExecutionList.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Executions List
45
public class ExecutionList {

Sources/AppwriteModels/File.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// File
45
public class File {

Sources/AppwriteModels/FileList.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Files List
45
public class FileList {

Sources/AppwriteModels/Jwt.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// JWT
45
public class Jwt {

Sources/AppwriteModels/Language.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Language
45
public class Language {

Sources/AppwriteModels/LanguageList.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Languages List
45
public class LanguageList {

Sources/AppwriteModels/Locale.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Locale
45
public class Locale {

Sources/AppwriteModels/Log.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Log
45
public class Log {

Sources/AppwriteModels/LogList.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Logs List
45
public class LogList {

Sources/AppwriteModels/Membership.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Membership
45
public class Membership {

Sources/AppwriteModels/MembershipList.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Memberships List
45
public class MembershipList {

Sources/AppwriteModels/Phone.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Phone
45
public class Phone {

Sources/AppwriteModels/PhoneList.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Phones List
45
public class PhoneList {

Sources/AppwriteModels/Preferences.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Preferences
45
public class Preferences<T : Codable> {

Sources/AppwriteModels/Session.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import JSONCodable
23

34
/// Session
45
public class Session {

0 commit comments

Comments
 (0)