Class: Cadenya::Resources::WorkspaceAdmin::Members
- Inherits:
-
Object
- Object
- Cadenya::Resources::WorkspaceAdmin::Members
- Defined in:
- lib/cadenya/resources/workspace_admin/members.rb
Overview
Administer workspaces across the account: create and archive workspaces and manage their membership. These operations are account-scoped and require the admin role (a token whose profile holds the WorkOS admin role); they live under /v1/account/workspaces rather than the workspace-scoped /v1/workspaces tree so an admin can manage any workspace in the account, including ones they are not themselves a member of.
Instance Method Summary collapse
-
#add(workspace_id, email: nil, profile_id: nil, request_options: {}) ⇒ Cadenya::Models::WorkspaceMember
Grants a profile access to the workspace by creating (or reactivating) the actor that links the profile to the workspace.
-
#initialize(client:) ⇒ Members
constructor
private
A new instance of Members.
-
#list(workspace_id, cursor: nil, limit: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::WorkspaceMember>
Lists the members of a workspace.
-
#remove(profile_id, workspace_id:, request_options: {}) ⇒ nil
Revokes a member’s access by deactivating their actor; the member is immediately cut off.
Constructor Details
#initialize(client:) ⇒ Members
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Members.
101 102 103 |
# File 'lib/cadenya/resources/workspace_admin/members.rb', line 101 def initialize(client:) @client = client end |
Instance Method Details
#add(workspace_id, email: nil, profile_id: nil, request_options: {}) ⇒ Cadenya::Models::WorkspaceMember
Grants a profile access to the workspace by creating (or reactivating) the actor that links the profile to the workspace. Accepts either an existing profile_id or an email to resolve-or-invite. Idempotent for an already-active member. Admin only.
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/cadenya/resources/workspace_admin/members.rb', line 59 def add(workspace_id, params = {}) parsed, = Cadenya::WorkspaceAdmin::MemberAddParams.dump_request(params) @client.request( method: :post, path: ["v1/account/workspaces/%1$s/members", workspace_id], body: parsed, model: Cadenya::WorkspaceMember, options: ) end |
#list(workspace_id, cursor: nil, limit: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::WorkspaceMember>
Lists the members of a workspace. Admin only.
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/cadenya/resources/workspace_admin/members.rb', line 28 def list(workspace_id, params = {}) parsed, = Cadenya::WorkspaceAdmin::MemberListParams.dump_request(params) query = Cadenya::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["v1/account/workspaces/%1$s/members", workspace_id], query: query, page: Cadenya::Internal::CursorPagination, model: Cadenya::WorkspaceMember, options: ) end |
#remove(profile_id, workspace_id:, request_options: {}) ⇒ nil
Revokes a member’s access by deactivating their actor; the member is immediately cut off. The underlying profile is not deleted. Admin only.
84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/cadenya/resources/workspace_admin/members.rb', line 84 def remove(profile_id, params) parsed, = Cadenya::WorkspaceAdmin::MemberRemoveParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["v1/account/workspaces/%1$s/members/%2$s", workspace_id, profile_id], model: NilClass, options: ) end |