Skip to content

Commit c1bf6e2

Browse files
authored
Merge pull request #11 from appwrite/dev
fix: patch updates for appwrite 1.4.1
2 parents 0a4beb5 + 2396301 commit c1bf6e2

File tree

13 files changed

+1039
-991
lines changed

13 files changed

+1039
-991
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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-1.4.0-blue.svg?style=flat-square)
5+
![Version](https://img.shields.io/badge/api%20version-1.4.1-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)
@@ -33,7 +33,7 @@ Add the package to your `Package.swift` dependencies:
3333

3434
```swift
3535
dependencies: [
36-
.package(url: "[email protected]:appwrite/sdk-for-swift.git", from: "3.0.0"),
36+
.package(url: "[email protected]:appwrite/sdk-for-swift.git", from: "3.0.1"),
3737
],
3838
```
3939

Sources/Appwrite/Client.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ open class Client {
2323
"x-sdk-name": "Swift",
2424
"x-sdk-platform": "server",
2525
"x-sdk-language": "swift",
26-
"x-sdk-version": "3.0.0",
26+
"x-sdk-version": "3.0.1",
2727
"X-Appwrite-Response-Format": "1.4.0"
2828
]
2929

@@ -414,7 +414,7 @@ open class Client {
414414
converter: { return $0 as! [String: Any] }
415415
)
416416
let chunksUploaded = map["chunksUploaded"] as! Int
417-
offset = min(size, (chunksUploaded * Client.chunkSize))
417+
offset = chunksUploaded * Client.chunkSize
418418
} catch {
419419
// File does not exist yet, swallow exception
420420
}
@@ -425,7 +425,7 @@ open class Client {
425425
?? (input.data as! ByteBuffer).getSlice(at: offset, length: Int(size - offset))
426426

427427
params[paramName] = InputFile.fromBuffer(slice!, filename: input.filename, mimeType: input.mimeType)
428-
headers["content-range"] = "bytes \(offset)-\(min((offset + Client.chunkSize) - 1, size))/\(size)"
428+
headers["content-range"] = "bytes \(offset)-\(min((offset + Client.chunkSize) - 1, size - 1))/\(size)"
429429

430430
result = try await call(
431431
method: "POST",

Sources/Appwrite/Role.swift

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,82 @@
1+
/// Helper class to generate role strings for `Permission`.
12
public class Role {
3+
4+
/// Grants access to anyone.
5+
///
6+
/// This includes authenticated and unauthenticated users.
27
public static func any() -> String {
38
return "any"
49
}
510

11+
/// Grants access to a specific user by user ID.
12+
///
13+
/// You can optionally pass verified or unverified for
14+
/// `status` to target specific types of users.
15+
///
16+
/// @param String id
17+
/// @param String status
18+
/// @return String
619
public static func user(_ id: String, _ status: String = "") -> String {
720
if(status.isEmpty) {
821
return "user:\(id)"
922
}
1023
return "user:\(id)/\(status)"
1124
}
1225

26+
/// Grants access to any authenticated or anonymous user.
27+
///
28+
/// You can optionally pass verified or unverified for
29+
/// `status` to target specific types of users.
30+
///
31+
/// @param String status
32+
/// @return String
1333
public static func users(_ status: String = "") -> String {
1434
if(status.isEmpty) {
1535
return "users"
1636
}
1737
return "users/\(status)"
1838
}
1939

40+
/// Grants access to any guest user without a session.
41+
///
42+
/// Authenticated users don't have access to this role.
43+
///
44+
/// @return String
2045
public static func guests() -> String {
2146
return "guests"
2247
}
2348

49+
/// Grants access to a team by team ID.
50+
///
51+
/// You can optionally pass a role for `role` to target
52+
/// team members with the specified role.
53+
///
54+
/// @param String id
55+
/// @param String role
56+
/// @return String
2457
public static func team(_ id: String, _ role: String = "") -> String {
2558
if(role.isEmpty) {
2659
return "team:\(id)"
2760
}
2861
return "team:\(id)/\(role)"
2962
}
3063

64+
/// Grants access to a specific member of a team.
65+
///
66+
/// When the member is removed from the team, they will
67+
/// no longer have access.
68+
///
69+
/// @param String id
70+
/// @return String
3171
public static func member(_ id: String) -> String {
3272
return "member:\(id)"
3373
}
74+
75+
/// Grants access to a user with the specified label.
76+
///
77+
/// @param String name
78+
/// @return String
79+
public static func label(_ name: String) -> String {
80+
return "label:\(name)"
81+
}
3482
}

0 commit comments

Comments
 (0)