Class: ElevenlabsClient::Admin::WorkspaceResources
- Inherits:
-
Object
- Object
- ElevenlabsClient::Admin::WorkspaceResources
- Defined in:
- lib/elevenlabs_client/endpoints/admin/workspace_resources.rb
Instance Method Summary collapse
-
#get_resource(resource_id:, resource_type:) ⇒ Object
GET /v1/workspace/resources/:resource_id params: resource_type (required).
-
#initialize(client) ⇒ WorkspaceResources
constructor
A new instance of WorkspaceResources.
-
#share(resource_id:, role:, resource_type:, user_email: nil, group_id: nil, workspace_api_key_id: nil) ⇒ Object
POST /v1/workspace/resources/:resource_id/share body: role (required), resource_type (required), optional: user_email, group_id, workspace_api_key_id.
-
#unshare(resource_id:, resource_type:, user_email: nil, group_id: nil, workspace_api_key_id: nil) ⇒ Object
POST /v1/workspace/resources/:resource_id/unshare body: resource_type (required), optional: user_email, group_id, workspace_api_key_id.
Constructor Details
#initialize(client) ⇒ WorkspaceResources
Returns a new instance of WorkspaceResources.
6 7 8 |
# File 'lib/elevenlabs_client/endpoints/admin/workspace_resources.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#get_resource(resource_id:, resource_type:) ⇒ Object
GET /v1/workspace/resources/:resource_id params: resource_type (required)
12 13 14 15 16 |
# File 'lib/elevenlabs_client/endpoints/admin/workspace_resources.rb', line 12 def get_resource(resource_id:, resource_type:) raise ArgumentError, "resource_id is required" if resource_id.nil? || resource_id.to_s.strip.empty? raise ArgumentError, "resource_type is required" if resource_type.nil? || resource_type.to_s.strip.empty? @client.get("/v1/workspace/resources/#{resource_id}", { resource_type: resource_type }) end |
#share(resource_id:, role:, resource_type:, user_email: nil, group_id: nil, workspace_api_key_id: nil) ⇒ Object
POST /v1/workspace/resources/:resource_id/share body: role (required), resource_type (required), optional: user_email, group_id, workspace_api_key_id
20 21 22 23 24 25 26 27 28 |
# File 'lib/elevenlabs_client/endpoints/admin/workspace_resources.rb', line 20 def share(resource_id:, role:, resource_type:, user_email: nil, group_id: nil, workspace_api_key_id: nil) validate_resource!(resource_id, resource_type) raise ArgumentError, "role is required" if role.nil? || role.to_s.strip.empty? body = { role: role, resource_type: resource_type } body[:user_email] = user_email if user_email body[:group_id] = group_id if group_id body[:workspace_api_key_id] = workspace_api_key_id if workspace_api_key_id @client.post("/v1/workspace/resources/#{resource_id}/share", body) end |
#unshare(resource_id:, resource_type:, user_email: nil, group_id: nil, workspace_api_key_id: nil) ⇒ Object
POST /v1/workspace/resources/:resource_id/unshare body: resource_type (required), optional: user_email, group_id, workspace_api_key_id
32 33 34 35 36 37 38 39 |
# File 'lib/elevenlabs_client/endpoints/admin/workspace_resources.rb', line 32 def unshare(resource_id:, resource_type:, user_email: nil, group_id: nil, workspace_api_key_id: nil) validate_resource!(resource_id, resource_type) body = { resource_type: resource_type } body[:user_email] = user_email if user_email body[:group_id] = group_id if group_id body[:workspace_api_key_id] = workspace_api_key_id if workspace_api_key_id @client.post("/v1/workspace/resources/#{resource_id}/unshare", body) end |