forked from coracle/caravel
Update frontend api
This commit is contained in:
@@ -16,10 +16,96 @@ The api allows the frontend to access the database. Most endpoints are authentic
|
||||
- Uses `makeAuth` to obtain a NIP 98 authorization header.
|
||||
- Calls the backend api and returns the decoded json or throws an `ApiError`.
|
||||
|
||||
## `function get(path: string)`
|
||||
## Plan methods
|
||||
|
||||
- Calls `callApi` with `get`
|
||||
## `function listPlans()`
|
||||
|
||||
## `function post<T>(path: string, body: T)`
|
||||
- Calls `GET /plans`
|
||||
- Returns a list of plans
|
||||
|
||||
- Calls `callApi` with `post` and body
|
||||
## `function getPlan(id: string)`
|
||||
|
||||
- Calls `GET /plans/:id`
|
||||
- Returns a single plan
|
||||
|
||||
## Tenant methods
|
||||
|
||||
## `function listTenants()`
|
||||
|
||||
- Calls `GET /tenants`
|
||||
- Admin only
|
||||
- Returns a list of tenants
|
||||
|
||||
## `function getTenant(pubkey: string)`
|
||||
|
||||
- Calls `GET /tenants/:pubkey`
|
||||
- Admin or matching tenant
|
||||
- Returns a single tenant
|
||||
|
||||
## `function createTenant()`
|
||||
|
||||
- Calls `POST /tenants`
|
||||
- Requires authentication
|
||||
- Creates tenant for the authorized pubkey
|
||||
|
||||
## `function listTenantRelays(pubkey: string)`
|
||||
|
||||
- Calls `GET /tenants/:pubkey/relays`
|
||||
- Admin or matching tenant
|
||||
- Returns relays for the tenant
|
||||
|
||||
## `function listTenantInvoices(pubkey: string)`
|
||||
|
||||
- Calls `GET /tenants/:pubkey/invoices`
|
||||
- Admin or matching tenant
|
||||
- Returns invoices for the tenant
|
||||
|
||||
## `function updateTenantBilling(pubkey: string, billing: { nwc_url: string })`
|
||||
|
||||
- Calls `PUT /tenants/:pubkey/billing`
|
||||
- Admin or matching tenant
|
||||
- Updates billing configuration
|
||||
|
||||
## Relay methods
|
||||
|
||||
## `function listRelays()`
|
||||
|
||||
- Calls `GET /relays`
|
||||
- Admin only
|
||||
- Returns all relays
|
||||
|
||||
## `function getRelay(id: string)`
|
||||
|
||||
- Calls `GET /relays/:id`
|
||||
- Admin or relay owner
|
||||
|
||||
## `function createRelay(input: CreateRelayInput)`
|
||||
|
||||
- Calls `POST /relays`
|
||||
- Admin or matching tenant in payload
|
||||
- Creates a relay
|
||||
|
||||
## `function updateRelay(id: string, input: UpdateRelayInput)`
|
||||
|
||||
- Calls `PUT /relays/:id`
|
||||
- Admin or relay owner
|
||||
- Updates a relay
|
||||
|
||||
## `function deactivateRelay(id: string)`
|
||||
|
||||
- Calls `POST /relays/:id/deactivate`
|
||||
- Admin or relay owner
|
||||
|
||||
## Invoice methods
|
||||
|
||||
## `function listInvoices()`
|
||||
|
||||
- Calls `GET /invoices`
|
||||
- Admin only
|
||||
- Returns all invoices
|
||||
|
||||
## `function getInvoice(id: string)`
|
||||
|
||||
- Calls `GET /invoices/:id`
|
||||
- Admin or invoice owner
|
||||
- Returns a single invoice
|
||||
|
||||
Reference in New Issue
Block a user