Skip to content

Commit

Permalink
Merge pull request #24 from appwrite/dev
Browse files Browse the repository at this point in the history
Update attributes
  • Loading branch information
abnegate authored Sep 10, 2024
2 parents afb72a1 + f8f7c32 commit f75ad97
Show file tree
Hide file tree
Showing 103 changed files with 109 additions and 577 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Add the package to your `Package.swift` dependencies:

```swift
dependencies: [
.package(url: "[email protected]:appwrite/sdk-for-swift.git", from: "6.0.0"),
.package(url: "[email protected]:appwrite/sdk-for-swift.git", from: "6.1.0"),
],
```

Expand Down
2 changes: 1 addition & 1 deletion Sources/Appwrite/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ open class Client {
"x-sdk-name": "Swift",
"x-sdk-platform": "server",
"x-sdk-language": "swift",
"x-sdk-version": "6.0.0",
"x-sdk-version": "6.1.0",
"x-appwrite-response-format": "1.6.0"
]

Expand Down
73 changes: 53 additions & 20 deletions Sources/Appwrite/Services/Databases.swift
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ open class Databases: Service {
/// @param String key
/// @param Bool required
/// @param Bool default
/// @param String newKey
/// @throws Exception
/// @return array
///
Expand All @@ -520,7 +521,8 @@ open class Databases: Service {
collectionId: String,
key: String,
`required`: Bool,
`default`: Bool? = nil
`default`: Bool? = nil,
newKey: String? = nil
) async throws -> AppwriteModels.AttributeBoolean {
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}"
.replacingOccurrences(of: "{databaseId}", with: databaseId)
Expand All @@ -529,7 +531,8 @@ open class Databases: Service {

let apiParams: [String: Any?] = [
"required": `required`,
"default": `default`
"default": `default`,
"newKey": newKey
]

let apiHeaders: [String: String] = [
Expand Down Expand Up @@ -610,6 +613,7 @@ open class Databases: Service {
/// @param String key
/// @param Bool required
/// @param String default
/// @param String newKey
/// @throws Exception
/// @return array
///
Expand All @@ -618,7 +622,8 @@ open class Databases: Service {
collectionId: String,
key: String,
`required`: Bool,
`default`: String? = nil
`default`: String? = nil,
newKey: String? = nil
) async throws -> AppwriteModels.AttributeDatetime {
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}"
.replacingOccurrences(of: "{databaseId}", with: databaseId)
Expand All @@ -627,7 +632,8 @@ open class Databases: Service {

let apiParams: [String: Any?] = [
"required": `required`,
"default": `default`
"default": `default`,
"newKey": newKey
]

let apiHeaders: [String: String] = [
Expand Down Expand Up @@ -710,6 +716,7 @@ open class Databases: Service {
/// @param String key
/// @param Bool required
/// @param String default
/// @param String newKey
/// @throws Exception
/// @return array
///
Expand All @@ -718,7 +725,8 @@ open class Databases: Service {
collectionId: String,
key: String,
`required`: Bool,
`default`: String? = nil
`default`: String? = nil,
newKey: String? = nil
) async throws -> AppwriteModels.AttributeEmail {
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}"
.replacingOccurrences(of: "{databaseId}", with: databaseId)
Expand All @@ -727,7 +735,8 @@ open class Databases: Service {

let apiParams: [String: Any?] = [
"required": `required`,
"default": `default`
"default": `default`,
"newKey": newKey
]

let apiHeaders: [String: String] = [
Expand Down Expand Up @@ -815,6 +824,7 @@ open class Databases: Service {
/// @param [String] elements
/// @param Bool required
/// @param String default
/// @param String newKey
/// @throws Exception
/// @return array
///
Expand All @@ -824,7 +834,8 @@ open class Databases: Service {
key: String,
elements: [String],
`required`: Bool,
`default`: String? = nil
`default`: String? = nil,
newKey: String? = nil
) async throws -> AppwriteModels.AttributeEnum {
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}"
.replacingOccurrences(of: "{databaseId}", with: databaseId)
Expand All @@ -834,7 +845,8 @@ open class Databases: Service {
let apiParams: [String: Any?] = [
"elements": elements,
"required": `required`,
"default": `default`
"default": `default`,
"newKey": newKey
]

let apiHeaders: [String: String] = [
Expand Down Expand Up @@ -926,6 +938,7 @@ open class Databases: Service {
/// @param Double min
/// @param Double max
/// @param Double default
/// @param String newKey
/// @throws Exception
/// @return array
///
Expand All @@ -936,7 +949,8 @@ open class Databases: Service {
`required`: Bool,
min: Double,
max: Double,
`default`: Double? = nil
`default`: Double? = nil,
newKey: String? = nil
) async throws -> AppwriteModels.AttributeFloat {
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}"
.replacingOccurrences(of: "{databaseId}", with: databaseId)
Expand All @@ -947,7 +961,8 @@ open class Databases: Service {
"required": `required`,
"min": min,
"max": max,
"default": `default`
"default": `default`,
"newKey": newKey
]

let apiHeaders: [String: String] = [
Expand Down Expand Up @@ -1039,6 +1054,7 @@ open class Databases: Service {
/// @param Int min
/// @param Int max
/// @param Int default
/// @param String newKey
/// @throws Exception
/// @return array
///
Expand All @@ -1049,7 +1065,8 @@ open class Databases: Service {
`required`: Bool,
min: Int,
max: Int,
`default`: Int? = nil
`default`: Int? = nil,
newKey: String? = nil
) async throws -> AppwriteModels.AttributeInteger {
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}"
.replacingOccurrences(of: "{databaseId}", with: databaseId)
Expand All @@ -1060,7 +1077,8 @@ open class Databases: Service {
"required": `required`,
"min": min,
"max": max,
"default": `default`
"default": `default`,
"newKey": newKey
]

let apiHeaders: [String: String] = [
Expand Down Expand Up @@ -1143,6 +1161,7 @@ open class Databases: Service {
/// @param String key
/// @param Bool required
/// @param String default
/// @param String newKey
/// @throws Exception
/// @return array
///
Expand All @@ -1151,7 +1170,8 @@ open class Databases: Service {
collectionId: String,
key: String,
`required`: Bool,
`default`: String? = nil
`default`: String? = nil,
newKey: String? = nil
) async throws -> AppwriteModels.AttributeIp {
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}"
.replacingOccurrences(of: "{databaseId}", with: databaseId)
Expand All @@ -1160,7 +1180,8 @@ open class Databases: Service {

let apiParams: [String: Any?] = [
"required": `required`,
"default": `default`
"default": `default`,
"newKey": newKey
]

let apiHeaders: [String: String] = [
Expand Down Expand Up @@ -1307,6 +1328,8 @@ open class Databases: Service {
/// @param String key
/// @param Bool required
/// @param String default
/// @param Int size
/// @param String newKey
/// @throws Exception
/// @return array
///
Expand All @@ -1315,7 +1338,9 @@ open class Databases: Service {
collectionId: String,
key: String,
`required`: Bool,
`default`: String? = nil
`default`: String? = nil,
size: Int? = nil,
newKey: String? = nil
) async throws -> AppwriteModels.AttributeString {
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}"
.replacingOccurrences(of: "{databaseId}", with: databaseId)
Expand All @@ -1324,7 +1349,9 @@ open class Databases: Service {

let apiParams: [String: Any?] = [
"required": `required`,
"default": `default`
"default": `default`,
"size": size,
"newKey": newKey
]

let apiHeaders: [String: String] = [
Expand Down Expand Up @@ -1407,6 +1434,7 @@ open class Databases: Service {
/// @param String key
/// @param Bool required
/// @param String default
/// @param String newKey
/// @throws Exception
/// @return array
///
Expand All @@ -1415,7 +1443,8 @@ open class Databases: Service {
collectionId: String,
key: String,
`required`: Bool,
`default`: String? = nil
`default`: String? = nil,
newKey: String? = nil
) async throws -> AppwriteModels.AttributeUrl {
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}"
.replacingOccurrences(of: "{databaseId}", with: databaseId)
Expand All @@ -1424,7 +1453,8 @@ open class Databases: Service {

let apiParams: [String: Any?] = [
"required": `required`,
"default": `default`
"default": `default`,
"newKey": newKey
]

let apiHeaders: [String: String] = [
Expand Down Expand Up @@ -1523,22 +1553,25 @@ open class Databases: Service {
/// @param String collectionId
/// @param String key
/// @param AppwriteEnums.RelationMutate onDelete
/// @param String newKey
/// @throws Exception
/// @return array
///
open func updateRelationshipAttribute(
databaseId: String,
collectionId: String,
key: String,
onDelete: AppwriteEnums.RelationMutate? = nil
onDelete: AppwriteEnums.RelationMutate? = nil,
newKey: String? = nil
) async throws -> AppwriteModels.AttributeRelationship {
let apiPath: String = "/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship"
.replacingOccurrences(of: "{databaseId}", with: databaseId)
.replacingOccurrences(of: "{collectionId}", with: collectionId)
.replacingOccurrences(of: "{key}", with: key)

let apiParams: [String: Any?] = [
"onDelete": onDelete
"onDelete": onDelete,
"newKey": newKey
]

let apiHeaders: [String: String] = [
Expand Down
4 changes: 0 additions & 4 deletions Sources/AppwriteModels/AlgoArgon2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,16 @@ public class AlgoArgon2 {
/// Algo type.
public let type: String


/// Memory used to compute hash.
public let memoryCost: Int


/// Amount of time consumed to compute hash
public let timeCost: Int


/// Number of threads used to compute hash.
public let threads: Int



init(
type: String,
memoryCost: Int,
Expand Down
1 change: 0 additions & 1 deletion Sources/AppwriteModels/AlgoBcrypt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public class AlgoBcrypt {
public let type: String



init(
type: String
) {
Expand Down
1 change: 0 additions & 1 deletion Sources/AppwriteModels/AlgoMd5.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public class AlgoMd5 {
public let type: String



init(
type: String
) {
Expand Down
1 change: 0 additions & 1 deletion Sources/AppwriteModels/AlgoPhpass.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public class AlgoPhpass {
public let type: String



init(
type: String
) {
Expand Down
5 changes: 0 additions & 5 deletions Sources/AppwriteModels/AlgoScrypt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,19 @@ public class AlgoScrypt {
/// Algo type.
public let type: String


/// CPU complexity of computed hash.
public let costCpu: Int


/// Memory complexity of computed hash.
public let costMemory: Int


/// Parallelization of computed hash.
public let costParallel: Int


/// Length used to compute hash.
public let length: Int



init(
type: String,
costCpu: Int,
Expand Down
4 changes: 0 additions & 4 deletions Sources/AppwriteModels/AlgoScryptModified.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,16 @@ public class AlgoScryptModified {
/// Algo type.
public let type: String


/// Salt used to compute hash.
public let salt: String


/// Separator used to compute hash.
public let saltSeparator: String


/// Key used to compute hash.
public let signerKey: String



init(
type: String,
salt: String,
Expand Down
1 change: 0 additions & 1 deletion Sources/AppwriteModels/AlgoSha.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public class AlgoSha {
public let type: String



init(
type: String
) {
Expand Down
Loading

0 comments on commit f75ad97

Please sign in to comment.