Class: Cadenya::Resources::WorkspaceAdmin::Members
- Inherits:
-
Object
- Object
- Cadenya::Resources::WorkspaceAdmin::Members
- Defined in:
- lib/cadenya/resources/workspace_admin/members.rb,
sig/cadenya/resources/workspace_admin/members.rbs
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: nil, email: nil, profile_id: nil, request_options: {}) ⇒ Cadenya::Models::WorkspaceMember
Some parameter documentations has been truncated, see Models::WorkspaceAdmin::MemberAddParams for more details.
-
#initialize(client:) ⇒ Members
constructor
private
A new instance of Members.
-
#list(workspace_id: nil, cursor: nil, limit: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::WorkspaceMember>
Lists the members of a workspace.
-
#remove(profile_id, workspace_id: nil, 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.
112 113 114 |
# File 'lib/cadenya/resources/workspace_admin/members.rb', line 112 def initialize(client:) @client = client end |
Instance Method Details
#add(workspace_id: nil, email: nil, profile_id: nil, request_options: {}) ⇒ Cadenya::Models::WorkspaceMember
Some parameter documentations has been truncated, see Models::WorkspaceAdmin::MemberAddParams for more details.
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.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/cadenya/resources/workspace_admin/members.rb', line 66 def add(params = {}) parsed, = Cadenya::WorkspaceAdmin::MemberAddParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do @client.workspace_id end @client.request( method: :post, path: ["v1/account/workspaces/%1$s/members", workspace_id], body: parsed, model: Cadenya::WorkspaceMember, options: ) end |
#list(workspace_id: nil, 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 40 41 42 43 |
# File 'lib/cadenya/resources/workspace_admin/members.rb', line 28 def list(params = {}) parsed, = Cadenya::WorkspaceAdmin::MemberListParams.dump_request(params) query = Cadenya::Internal::Util.encode_query_params(parsed) workspace_id = parsed.delete(:workspace_id) do @client.workspace_id end @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: nil, 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.
95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/cadenya/resources/workspace_admin/members.rb', line 95 def remove(profile_id, params = {}) parsed, = Cadenya::WorkspaceAdmin::MemberRemoveParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do @client.workspace_id end @client.request( method: :delete, path: ["v1/account/workspaces/%1$s/members/%2$s", workspace_id, profile_id], model: NilClass, options: ) end |