Class: Melaya::CredentialsAPI
- Inherits:
-
Object
- Object
- Melaya::CredentialsAPI
- Defined in:
- lib/melaya/credentials.rb
Overview
Credentials API — store, retrieve, test, and delete secrets and third-party service connections at user scope.
Credentials are envelope-encrypted at rest. Use Melaya::ConnectorsAPI
for project-scoped connector credentials.
Maps to /api/v1/private/credentials/*.
Instance Method Summary collapse
-
#cli_auth_start(body = {}) ⇒ Object
POST /api/v1/private/credentials/cli-auth Start CLI authentication flow (device-code style).
-
#connected_services ⇒ Object
GET /api/v1/private/credentials/services List connected third-party services for the caller.
-
#delete(service) ⇒ Object
DELETE /api/v1/private/credentials/:service Delete a stored credential by service name.
-
#get(service, key: nil) ⇒ Object
GET /api/v1/private/credentials/:service Get a stored credential value by service name.
-
#get_operator_profile ⇒ Object
GET /api/v1/private/credentials/operator-profile Get operator profile (persona config for agent context).
-
#google_oauth_start(body = {}) ⇒ Object
POST /api/v1/private/credentials/google/oauth Start Google OAuth flow for credential storage.
-
#initialize(http) ⇒ CredentialsAPI
constructor
A new instance of CredentialsAPI.
-
#linkedin_connect_cancel ⇒ Object
DELETE /api/v1/private/credentials/linkedin/connect Cancel an in-progress LinkedIn OAuth flow.
-
#linkedin_connect_start(body = {}) ⇒ Object
POST /api/v1/private/credentials/linkedin/connect Start LinkedIn OAuth flow.
-
#linkedin_connect_status ⇒ Object
GET /api/v1/private/credentials/linkedin/connect/status Poll LinkedIn OAuth connection status.
-
#list ⇒ Object
GET /api/v1/private/credentials List all stored credentials (services, OAuth connections, env handles).
-
#list_models(provider: nil, capability: nil) ⇒ Object
GET /api/v1/private/credentials/models List available AI models across all configured providers.
-
#luma_connect_cancel ⇒ Object
DELETE /api/v1/private/credentials/luma/connect Cancel an in-progress Luma OAuth flow.
-
#luma_connect_start(body = {}) ⇒ Object
POST /api/v1/private/credentials/luma/connect Start Luma OAuth flow.
-
#luma_connect_status ⇒ Object
GET /api/v1/private/credentials/luma/connect/status Poll Luma OAuth connection status.
-
#luma_schema(params = {}) ⇒ Object
GET /api/v1/private/credentials/luma/schema Get the Luma event registration form schema.
-
#melaya_accounts ⇒ Object
GET /api/v1/private/credentials/melaya-accounts List Melaya sub-accounts available to the caller.
-
#notebooklm_login(body = {}) ⇒ Object
POST /api/v1/private/credentials/notebooklm/login Store NotebookLM credentials.
-
#notebooklm_status ⇒ Object
GET /api/v1/private/credentials/notebooklm/status Check NotebookLM connection status.
-
#pick_folder_start(body = {}) ⇒ Object
POST /api/v1/private/rag/pick-folder Initiate native folder picker for file ingestion.
-
#pick_folder_status(session_id) ⇒ Object
GET /api/v1/private/rag/pick-folder/:sessionId Poll folder picker result.
-
#rag_ingest_start(body = {}) ⇒ Object
POST /api/v1/private/rag/ingest Start a RAG document ingestion job.
-
#rag_ingest_status(session_id) ⇒ Object
GET /api/v1/private/rag/ingest/:sessionId Poll RAG ingestion job status.
-
#rag_retrieve_start(body = {}) ⇒ Object
POST /api/v1/private/rag/retrieve Start a RAG retrieval query.
-
#rag_retrieve_status(session_id) ⇒ Object
GET /api/v1/private/rag/retrieve/:sessionId Poll RAG retrieval result.
-
#set(service, value:, key: nil, label: nil) ⇒ Object
PUT /api/v1/private/credentials/:service Store or update a credential (envelope-encrypted at rest).
-
#set_operator_profile(profile) ⇒ Object
PUT /api/v1/private/credentials/operator-profile Save operator profile.
-
#telegram_auth_2fa(body = {}) ⇒ Object
POST /api/v1/private/credentials/telegram/auth/2fa Submit Telegram 2FA password.
-
#telegram_auth_code(body = {}) ⇒ Object
POST /api/v1/private/credentials/telegram/auth/code Submit Telegram SMS verification code.
-
#telegram_auth_start(body = {}) ⇒ Object
POST /api/v1/private/credentials/telegram/auth Start Telegram user auth (phone number step).
-
#test(service) ⇒ Object
POST /api/v1/private/credentials/:service/test Test a stored credential (e.g. validate API key against its service).
Constructor Details
#initialize(http) ⇒ CredentialsAPI
Returns a new instance of CredentialsAPI.
17 18 19 |
# File 'lib/melaya/credentials.rb', line 17 def initialize(http) @http = http end |
Instance Method Details
#cli_auth_start(body = {}) ⇒ Object
POST /api/v1/private/credentials/cli-auth Start CLI authentication flow (device-code style).
207 208 209 |
# File 'lib/melaya/credentials.rb', line 207 def cli_auth_start(body = {}) @http.post("/api/v1/private/credentials/cli-auth", body) end |
#connected_services ⇒ Object
GET /api/v1/private/credentials/services List connected third-party services for the caller.
29 30 31 |
# File 'lib/melaya/credentials.rb', line 29 def connected_services @http.get("/api/v1/private/credentials/services") end |
#delete(service) ⇒ Object
DELETE /api/v1/private/credentials/:service Delete a stored credential by service name.
56 57 58 |
# File 'lib/melaya/credentials.rb', line 56 def delete(service) @http.delete("/api/v1/private/credentials/#{enc(service)}") end |
#get(service, key: nil) ⇒ Object
GET /api/v1/private/credentials/:service Get a stored credential value by service name.
37 38 39 40 |
# File 'lib/melaya/credentials.rb', line 37 def get(service, key: nil) params = key ? { "key" => key } : {} @http.get("/api/v1/private/credentials/#{enc(service)}", params) end |
#get_operator_profile ⇒ Object
GET /api/v1/private/credentials/operator-profile Get operator profile (persona config for agent context).
71 72 73 |
# File 'lib/melaya/credentials.rb', line 71 def get_operator_profile @http.get("/api/v1/private/credentials/operator-profile") end |
#google_oauth_start(body = {}) ⇒ Object
POST /api/v1/private/credentials/google/oauth Start Google OAuth flow for credential storage.
199 200 201 |
# File 'lib/melaya/credentials.rb', line 199 def google_oauth_start(body = {}) @http.post("/api/v1/private/credentials/google/oauth", body) end |
#linkedin_connect_cancel ⇒ Object
DELETE /api/v1/private/credentials/linkedin/connect Cancel an in-progress LinkedIn OAuth flow.
158 159 160 |
# File 'lib/melaya/credentials.rb', line 158 def linkedin_connect_cancel @http.delete("/api/v1/private/credentials/linkedin/connect") end |
#linkedin_connect_start(body = {}) ⇒ Object
POST /api/v1/private/credentials/linkedin/connect Start LinkedIn OAuth flow.
152 153 154 |
# File 'lib/melaya/credentials.rb', line 152 def linkedin_connect_start(body = {}) @http.post("/api/v1/private/credentials/linkedin/connect", body) end |
#linkedin_connect_status ⇒ Object
GET /api/v1/private/credentials/linkedin/connect/status Poll LinkedIn OAuth connection status.
164 165 166 |
# File 'lib/melaya/credentials.rb', line 164 def linkedin_connect_status @http.get("/api/v1/private/credentials/linkedin/connect/status") end |
#list ⇒ Object
GET /api/v1/private/credentials List all stored credentials (services, OAuth connections, env handles).
23 24 25 |
# File 'lib/melaya/credentials.rb', line 23 def list @http.get("/api/v1/private/credentials") end |
#list_models(provider: nil, capability: nil) ⇒ Object
GET /api/v1/private/credentials/models List available AI models across all configured providers. Collapses 19+ provider fan-out into a parameterized query.
89 90 91 92 |
# File 'lib/melaya/credentials.rb', line 89 def list_models(provider: nil, capability: nil) @http.get("/api/v1/private/credentials/models", compact("provider" => provider, "capability" => capability)) end |
#luma_connect_cancel ⇒ Object
DELETE /api/v1/private/credentials/luma/connect Cancel an in-progress Luma OAuth flow.
184 185 186 |
# File 'lib/melaya/credentials.rb', line 184 def luma_connect_cancel @http.delete("/api/v1/private/credentials/luma/connect") end |
#luma_connect_start(body = {}) ⇒ Object
POST /api/v1/private/credentials/luma/connect Start Luma OAuth flow.
172 173 174 |
# File 'lib/melaya/credentials.rb', line 172 def luma_connect_start(body = {}) @http.post("/api/v1/private/credentials/luma/connect", body) end |
#luma_connect_status ⇒ Object
GET /api/v1/private/credentials/luma/connect/status Poll Luma OAuth connection status.
178 179 180 |
# File 'lib/melaya/credentials.rb', line 178 def luma_connect_status @http.get("/api/v1/private/credentials/luma/connect/status") end |
#luma_schema(params = {}) ⇒ Object
GET /api/v1/private/credentials/luma/schema Get the Luma event registration form schema.
191 192 193 |
# File 'lib/melaya/credentials.rb', line 191 def luma_schema(params = {}) @http.get("/api/v1/private/credentials/luma/schema", params) end |
#melaya_accounts ⇒ Object
GET /api/v1/private/credentials/melaya-accounts List Melaya sub-accounts available to the caller.
98 99 100 |
# File 'lib/melaya/credentials.rb', line 98 def melaya_accounts @http.get("/api/v1/private/credentials/melaya-accounts") end |
#notebooklm_login(body = {}) ⇒ Object
POST /api/v1/private/credentials/notebooklm/login Store NotebookLM credentials.
215 216 217 |
# File 'lib/melaya/credentials.rb', line 215 def notebooklm_login(body = {}) @http.post("/api/v1/private/credentials/notebooklm/login", body) end |
#notebooklm_status ⇒ Object
GET /api/v1/private/credentials/notebooklm/status Check NotebookLM connection status.
221 222 223 |
# File 'lib/melaya/credentials.rb', line 221 def notebooklm_status @http.get("/api/v1/private/credentials/notebooklm/status") end |
#pick_folder_start(body = {}) ⇒ Object
POST /api/v1/private/rag/pick-folder Initiate native folder picker for file ingestion.
137 138 139 |
# File 'lib/melaya/credentials.rb', line 137 def pick_folder_start(body = {}) @http.post("/api/v1/private/rag/pick-folder", body) end |
#pick_folder_status(session_id) ⇒ Object
GET /api/v1/private/rag/pick-folder/:sessionId Poll folder picker result.
144 145 146 |
# File 'lib/melaya/credentials.rb', line 144 def pick_folder_status(session_id) @http.get("/api/v1/private/rag/pick-folder/#{enc(session_id)}") end |
#rag_ingest_start(body = {}) ⇒ Object
POST /api/v1/private/rag/ingest Start a RAG document ingestion job.
107 108 109 |
# File 'lib/melaya/credentials.rb', line 107 def rag_ingest_start(body = {}) @http.post("/api/v1/private/rag/ingest", body) end |
#rag_ingest_status(session_id) ⇒ Object
GET /api/v1/private/rag/ingest/:sessionId Poll RAG ingestion job status.
114 115 116 |
# File 'lib/melaya/credentials.rb', line 114 def rag_ingest_status(session_id) @http.get("/api/v1/private/rag/ingest/#{enc(session_id)}") end |
#rag_retrieve_start(body = {}) ⇒ Object
POST /api/v1/private/rag/retrieve Start a RAG retrieval query.
121 122 123 |
# File 'lib/melaya/credentials.rb', line 121 def rag_retrieve_start(body = {}) @http.post("/api/v1/private/rag/retrieve", body) end |
#rag_retrieve_status(session_id) ⇒ Object
GET /api/v1/private/rag/retrieve/:sessionId Poll RAG retrieval result.
128 129 130 |
# File 'lib/melaya/credentials.rb', line 128 def rag_retrieve_status(session_id) @http.get("/api/v1/private/rag/retrieve/#{enc(session_id)}") end |
#set(service, value:, key: nil, label: nil) ⇒ Object
PUT /api/v1/private/credentials/:service Store or update a credential (envelope-encrypted at rest).
48 49 50 51 |
# File 'lib/melaya/credentials.rb', line 48 def set(service, value:, key: nil, label: nil) body = compact("value" => value, "key" => key, "label" => label) @http.put("/api/v1/private/credentials/#{enc(service)}", body) end |
#set_operator_profile(profile) ⇒ Object
PUT /api/v1/private/credentials/operator-profile Save operator profile.
78 79 80 |
# File 'lib/melaya/credentials.rb', line 78 def set_operator_profile(profile) @http.put("/api/v1/private/credentials/operator-profile", profile) end |
#telegram_auth_2fa(body = {}) ⇒ Object
POST /api/v1/private/credentials/telegram/auth/2fa Submit Telegram 2FA password.
241 242 243 |
# File 'lib/melaya/credentials.rb', line 241 def telegram_auth_2fa(body = {}) @http.post("/api/v1/private/credentials/telegram/auth/2fa", body) end |
#telegram_auth_code(body = {}) ⇒ Object
POST /api/v1/private/credentials/telegram/auth/code Submit Telegram SMS verification code.
235 236 237 |
# File 'lib/melaya/credentials.rb', line 235 def telegram_auth_code(body = {}) @http.post("/api/v1/private/credentials/telegram/auth/code", body) end |
#telegram_auth_start(body = {}) ⇒ Object
POST /api/v1/private/credentials/telegram/auth Start Telegram user auth (phone number step).
229 230 231 |
# File 'lib/melaya/credentials.rb', line 229 def telegram_auth_start(body = {}) @http.post("/api/v1/private/credentials/telegram/auth", body) end |
#test(service) ⇒ Object
POST /api/v1/private/credentials/:service/test Test a stored credential (e.g. validate API key against its service).
63 64 65 |
# File 'lib/melaya/credentials.rb', line 63 def test(service) @http.post("/api/v1/private/credentials/#{enc(service)}/test") end |