Skip to content

Commit 85a5e51

Browse files
committed
chore: update Ruby SDK to 23.0.0
1 parent 01d0b86 commit 85a5e51

4 files changed

Lines changed: 103 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
```ruby
2+
require 'appwrite'
3+
4+
include Appwrite
5+
6+
client = Client.new
7+
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
8+
.set_project('<YOUR_PROJECT_ID>') # Your project ID
9+
.set_key('<YOUR_API_KEY>') # Your secret API key
10+
11+
project = Project.new(client)
12+
13+
result = project.update_labels(
14+
labels: []
15+
)
16+
```
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
```ruby
2+
require 'appwrite'
3+
4+
include Appwrite
5+
6+
client = Client.new
7+
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
8+
.set_project('<YOUR_PROJECT_ID>') # Your project ID
9+
.set_key('<YOUR_API_KEY>') # Your secret API key
10+
11+
users = Users.new(client)
12+
13+
result = users.update_labels(
14+
user_id: '<USER_ID>',
15+
labels: []
16+
)
17+
```

lib/appwrite/services/project.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,36 @@ def delete_key(key_id:)
178178
)
179179
end
180180

181+
# Update the project labels. Labels can be used to easily filter projects in
182+
# an organization.
183+
#
184+
# @param [Array] labels Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long.
185+
#
186+
# @return [Project]
187+
def update_labels(labels:)
188+
api_path = '/project/labels'
189+
190+
if labels.nil?
191+
raise Appwrite::Exception.new('Missing required parameter: "labels"')
192+
end
193+
194+
api_params = {
195+
labels: labels,
196+
}
197+
198+
api_headers = {
199+
"content-type": 'application/json',
200+
}
201+
202+
@client.call(
203+
method: 'PUT',
204+
path: api_path,
205+
headers: api_headers,
206+
params: api_params,
207+
response_type: Models::Project
208+
)
209+
end
210+
181211
# Get a list of all platforms in the project. This endpoint returns an array
182212
# of all platforms and their configurations.
183213
#

lib/appwrite/services/users.rb

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,46 @@ def create_jwt(user_id:, session_id: nil, duration: nil)
673673
)
674674
end
675675

676+
# Update the user labels by its unique ID.
677+
#
678+
# Labels can be used to grant access to resources. While teams are a way for
679+
# user's to share access to a resource, labels can be defined by the
680+
# developer to grant access without an invitation. See the [Permissions
681+
# docs](https://appwrite.io/docs/permissions) for more info.
682+
#
683+
# @param [String] user_id User ID.
684+
# @param [Array] labels Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long.
685+
#
686+
# @return [User]
687+
def update_labels(user_id:, labels:)
688+
api_path = '/users/{userId}/labels'
689+
.gsub('{userId}', user_id)
690+
691+
if user_id.nil?
692+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
693+
end
694+
695+
if labels.nil?
696+
raise Appwrite::Exception.new('Missing required parameter: "labels"')
697+
end
698+
699+
api_params = {
700+
labels: labels,
701+
}
702+
703+
api_headers = {
704+
"content-type": 'application/json',
705+
}
706+
707+
@client.call(
708+
method: 'PUT',
709+
path: api_path,
710+
headers: api_headers,
711+
params: api_params,
712+
response_type: Models::User
713+
)
714+
end
715+
676716
# Get the user activity logs list by its unique ID.
677717
#
678718
# @param [String] user_id User ID.

0 commit comments

Comments
 (0)