-
Notifications
You must be signed in to change notification settings - Fork 328
Expand file tree
/
Copy pathendpoints.py
More file actions
55 lines (39 loc) · 2.4 KB
/
Copy pathendpoints.py
File metadata and controls
55 lines (39 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""Endpoint registry for the OpenHome backend.
Paths are relative to ``Config.api_base`` (REST) or ``Config.ws_base`` (WebSocket).
The ``AUTH`` map records how each endpoint authenticates today, so the transport
layer can pick the right credential automatically. See the README for the full
contract table.
"""
from __future__ import annotations
# Auth modes understood by transport.request():
# "apikey_body" — api_key passed in the JSON body (the /api/sdk/* endpoints)
# "xapikey" — X-API-KEY: <api_key> header
# "jwt" — Authorization: Bearer <jwt>, falling back to the api_key
# when no jwt is configured (forward-compatible with the
# planned backend change to accept the api key here too)
GET_PERSONALITIES = "/api/sdk/get_personalities"
VERIFY_API_KEY = "/api/sdk/verify_apikey"
ADD_CAPABILITY = "/api/capabilities/add-capability/"
LIST_CAPABILITIES = "/api/capabilities/get-all-capabilities/"
LIST_INSTALLED_CAPABILITIES = "/api/capabilities/get-installed-capabilities/"
EDIT_PERSONALITY = "/api/personalities/edit-personality/"
# Batch delete: POST with JSON body {"capability_ids": [<id>, ...]} (JWT auth).
DELETE_CAPABILITY = "/api/capabilities/delete-capability/"
def uninstall_capability(capability_id: str | int) -> str:
return f"/api/capabilities/uninstall-capability/{capability_id}/"
def edit_installed_capability(capability_id: str | int) -> str:
return f"/api/capabilities/edit-installed-capability/{capability_id}/"
def download_capability(capability_id: str | int) -> str:
"""Returns the ability's current source as an application/zip (JWT auth)."""
return f"/api/capabilities/get/template-file/{capability_id}/"
def installed_capability_by_capability(capability_id: str | int) -> str:
"""Installed-capability detail: effective (overridden) trigger words +
version/release history for a given capability id (JWT auth)."""
return f"/api/capabilities/get/installed-capability/by-capability/{capability_id}/"
def validate_release_code(release_id: str | int) -> str:
"""In-place update of an existing release's code (JWT auth, multipart, flat zip).
``committed=false`` saves a draft; ``committed=true`` + ``commit_message``
commits a version."""
return f"/api/capabilities/validate/release-code/{release_id}/"
def voice_stream(api_key: str, agent_id: str) -> str:
return f"/websocket/voice-stream/{api_key}/{agent_id}"