chore: cleanup orion api to only include essentials
This commit is contained in:
+1
-24
@@ -106,37 +106,14 @@ func main() {
|
||||
mux.Handle("POST /auth/sign-out", withAuth(h.SignOut))
|
||||
mux.Handle("GET /auth/me", withAuth(h.GetCurrentHuman))
|
||||
|
||||
// Bootstrap startup data
|
||||
mux.Handle("GET /startup", withAuth(h.StartupData))
|
||||
|
||||
// Networks
|
||||
mux.Handle("POST /networks", withAuth(h.CreateNetwork))
|
||||
mux.Handle("GET /networks", withAuth(h.ListNetworks))
|
||||
mux.Handle("GET /networks/{id}", withAuth(h.GetNetwork))
|
||||
mux.Handle("POST /networks/{id}/members", withAuth(h.AddMembersToNetwork))
|
||||
// TODO: what about members who are part of streams visibility within this network?
|
||||
mux.Handle("DELETE /networks/{id}/members/{email}", withAuth(h.RemoveMemberFromNetwork))
|
||||
mux.Handle("PUT /networks/{id}/capacity", withAuth(h.SetOpenStreamCapacity))
|
||||
|
||||
// Streams
|
||||
mux.Handle("POST /networks/{network_id}/streams", withAuth(h.CreateStream))
|
||||
mux.Handle("GET /streams/{id}", withAuth(h.GetStream))
|
||||
mux.Handle("PATCH /streams/{id}", withAuth(h.UpdateStream))
|
||||
mux.Handle("POST /streams/{id}/particles", withAuth(h.CreateStreamParticle))
|
||||
mux.Handle("POST /streams/{id}/open", withAuth(h.OpenStream))
|
||||
mux.Handle("POST /streams/{id}/close", withAuth(h.CloseStream))
|
||||
mux.Handle("POST /streams/{id}/members", withAuth(h.AddMembers))
|
||||
mux.Handle("DELETE /streams/{id}/members", withAuth(h.RemoveMembers))
|
||||
|
||||
// Particles
|
||||
mux.Handle("GET /networks/{network_id}/particles", withAuth(h.ListParticles))
|
||||
mux.Handle("GET /particles/{id}", withAuth(h.GetParticle))
|
||||
mux.Handle("PATCH /particles/{id}", withAuth(h.UpdateParticle))
|
||||
mux.Handle("DELETE /particles/{id}", withAuth(h.DeleteParticle))
|
||||
mux.Handle("POST /particles/{id}/seen", withAuth(h.MarkSeen))
|
||||
mux.Handle("POST /particles/{id}/ack", withAuth(h.AckParticle))
|
||||
mux.Handle("GET /particles/{id}/download", withAuth(h.DownloadParticle))
|
||||
mux.Handle("POST /particles/seen", withAuth(h.MarkSeenBatch))
|
||||
mux.Handle("GET /particles/{id}/download", withAuth(h.DownloadParticleMedia))
|
||||
|
||||
// Depot
|
||||
mux.Handle("POST /depot/upload", withAuth(h.PrepareUpload))
|
||||
|
||||
+3
-311
@@ -51,54 +51,6 @@ Returns the authenticated user.
|
||||
|
||||
---
|
||||
|
||||
## Startup
|
||||
|
||||
### Get Startup Data
|
||||
`GET /startup` (Protected)
|
||||
|
||||
Bootstrap endpoint for initial app load. Returns all networks the user belongs to, with all streams and their particles fully enriched.
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"networks": [
|
||||
{
|
||||
"id": "net-456",
|
||||
"name": "My Team",
|
||||
"admin_human": { "id": "...", "email": "...", "email_prefix": "...", "created_at": "..." },
|
||||
"humans": [{ "id": "...", "email": "...", "email_prefix": "...", "created_at": "..." }],
|
||||
"open_stream_count": 2,
|
||||
"open_stream_capacity": 5,
|
||||
"created_at": "2025-01-15T10:30:00Z",
|
||||
"streams": [
|
||||
{
|
||||
"id": "p-001",
|
||||
"name": "Sprint Planning",
|
||||
"description": "Weekly sync",
|
||||
"status": "open",
|
||||
"members": ["[email protected]"],
|
||||
"particles": [
|
||||
{
|
||||
"id": "p-002",
|
||||
"type": "text",
|
||||
"data": { "content": "Hello" },
|
||||
"created_by_email": "[email protected]",
|
||||
"seen": true,
|
||||
"acks": [],
|
||||
"updated_at": "...",
|
||||
"created_at": "..."
|
||||
}
|
||||
],
|
||||
"unseen_count": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Networks
|
||||
|
||||
### Create Network
|
||||
@@ -136,183 +88,15 @@ Returns a specific network by ID.
|
||||
|
||||
Removes a member by email from the network.
|
||||
|
||||
### Set Open Stream Capacity
|
||||
`PUT /networks/{id}/capacity` (Protected, Admin only)
|
||||
|
||||
**Request Body:**
|
||||
```json
|
||||
{
|
||||
"capacity": 10
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Streams
|
||||
|
||||
Streams are top-level particles of type `stream`. They have dedicated endpoints for creation and management, and contain child particles.
|
||||
|
||||
### Create Stream
|
||||
`POST /networks/{network_id}/streams` (Protected)
|
||||
|
||||
**Request Body:**
|
||||
```json
|
||||
{
|
||||
"name": "Sprint Planning",
|
||||
"description": "Weekly sync",
|
||||
"visibility": "custom",
|
||||
"members": ["[email protected]"]
|
||||
}
|
||||
```
|
||||
|
||||
- `visibility`: `network_all` (default) or `custom`
|
||||
- `members` is required when visibility is `custom`
|
||||
|
||||
**Response:** `201 Created` — returns a [Stream](#stream-1) object.
|
||||
|
||||
### Get Stream
|
||||
`GET /streams/{id}` (Protected)
|
||||
|
||||
Returns a stream with all its child particles, enriched with seen/ack state.
|
||||
|
||||
**Response:** returns a [Stream](#stream-1) object.
|
||||
|
||||
### Update Stream
|
||||
`PATCH /streams/{id}` (Protected)
|
||||
|
||||
Updates a stream's name and/or description. Status is not affected (use the open/close endpoints instead). Only provided fields are updated.
|
||||
|
||||
**Request Body:**
|
||||
```json
|
||||
{
|
||||
"name": "New Name",
|
||||
"description": "New description"
|
||||
}
|
||||
```
|
||||
|
||||
- Both fields are optional — omit a field to leave it unchanged
|
||||
- `name` cannot be empty if provided
|
||||
|
||||
**Response:** returns the updated [Stream](#stream-1) object.
|
||||
|
||||
### Create Stream Particle
|
||||
`POST /streams/{id}/particles` (Protected)
|
||||
|
||||
Creates a child particle inside a stream. Child particles inherit visibility from the stream.
|
||||
|
||||
**Request Body:**
|
||||
```json
|
||||
{
|
||||
"type": "text|media|file|quest|paper",
|
||||
"data": {}
|
||||
}
|
||||
```
|
||||
|
||||
- Cannot create `stream` or `folder` types as children
|
||||
- For `media` and `file` types, `data` must include a valid `object_id` from depot
|
||||
|
||||
**Response:** `201 Created` — returns a [StreamParticle](#streamparticle) object.
|
||||
|
||||
### Open Stream
|
||||
`POST /streams/{id}/open` (Protected)
|
||||
|
||||
Opens a closed stream. Fails with `409` if capacity would be exceeded.
|
||||
|
||||
### Close Stream
|
||||
`POST /streams/{id}/close` (Protected)
|
||||
|
||||
Closes an open stream.
|
||||
|
||||
### Add Members to Stream
|
||||
`POST /streams/{id}/members` (Protected)
|
||||
|
||||
**Request Body:**
|
||||
```json
|
||||
{
|
||||
"emails": ["[email protected]"]
|
||||
}
|
||||
```
|
||||
|
||||
### Remove Members from Stream
|
||||
`DELETE /streams/{id}/members` (Protected)
|
||||
|
||||
**Request Body:**
|
||||
```json
|
||||
{
|
||||
"emails": ["[email protected]"]
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Particles
|
||||
|
||||
### List Particles
|
||||
`GET /networks/{network_id}/particles` (Protected)
|
||||
|
||||
**Query Parameters:**
|
||||
- `parent_id` (optional): Filter by parent particle
|
||||
- `cursor` (optional): Pagination cursor
|
||||
- `direction` (optional): `after` or `before` (default: `after`)
|
||||
- `type` (optional, repeatable): Filter by particle type
|
||||
|
||||
**Response enrichment:**
|
||||
Each particle in the response includes:
|
||||
- `seen` (boolean): Whether the requester has marked this particle as seen
|
||||
- `acks` (array): List of acknowledgments `[{email, acked_at}]`
|
||||
- `unseen_count` (integer, streams only): Count of unseen child particles
|
||||
|
||||
### Get Particle
|
||||
`GET /particles/{id}` (Protected)
|
||||
|
||||
### Update Particle
|
||||
`PATCH /particles/{id}` (Protected)
|
||||
|
||||
**Request Body:**
|
||||
```json
|
||||
{
|
||||
"data": {}
|
||||
}
|
||||
```
|
||||
|
||||
### Delete Particle
|
||||
`DELETE /particles/{id}` (Protected)
|
||||
|
||||
Deletes the particle and all children. If it references a depot object, that is also deleted.
|
||||
|
||||
### Download Particle
|
||||
### Download Particle Object
|
||||
`GET /particles/{id}/download` (Protected)
|
||||
|
||||
For now, the `{id}` should be an object id. Not the particle id.
|
||||
|
||||
Returns a `302` redirect to a signed download URL. Only works for `media` and `file` particles.
|
||||
|
||||
### Mark Seen
|
||||
`POST /particles/{id}/seen` (Protected)
|
||||
|
||||
Marks a particle as seen by the requester. This is private state, only visible to the requester.
|
||||
|
||||
Returns `204 No Content` on success.
|
||||
|
||||
### Mark Seen (Batch)
|
||||
`POST /particles/seen` (Protected)
|
||||
|
||||
Marks multiple particles as seen by the requester.
|
||||
|
||||
**Request Body:**
|
||||
```json
|
||||
{
|
||||
"particle_ids": ["particle_uuid1", "particle_uuid2"]
|
||||
}
|
||||
```
|
||||
|
||||
Returns `204 No Content` on success.
|
||||
|
||||
### Acknowledge Particle
|
||||
`POST /particles/{id}/ack` (Protected)
|
||||
|
||||
Acknowledges a particle. Acknowledgments are public and permanent, visible to all users with access. Also marks the particle as seen.
|
||||
|
||||
Returns `204 No Content` on success.
|
||||
|
||||
---
|
||||
|
||||
## Depot (File Storage)
|
||||
@@ -395,8 +179,6 @@ Confirms that an upload has been completed.
|
||||
| `name` | `string` | Display name of the network. |
|
||||
| `admin_human` | `Human` | The network administrator. |
|
||||
| `humans` | `Human[]` | All members of the network (including admin). |
|
||||
| `open_stream_count` | `integer` | Number of currently open streams. |
|
||||
| `open_stream_capacity` | `integer` | Maximum number of concurrent open streams (default: 5). |
|
||||
| `created_at` | `string` | ISO 8601 timestamp. |
|
||||
|
||||
```json
|
||||
@@ -407,86 +189,10 @@ Confirms that an upload has been completed.
|
||||
"humans": [
|
||||
{ "id": "abc-123", "email": "[email protected]", "email_prefix": "alice", "created_at": "..." }
|
||||
],
|
||||
"open_stream_count": 2,
|
||||
"open_stream_capacity": 5,
|
||||
"created_at": "2025-01-15T10:30:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
### Stream
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `id` | `string` | Unique identifier (this is a particle ID). |
|
||||
| `name` | `string` | Stream name. |
|
||||
| `description` | `string` | Stream description. |
|
||||
| `status` | `string` | `"open"`, `"closed"`, or `"unspecified"`. |
|
||||
| `members` | `string[]` | Emails of stream members. Omitted for `network_all` visibility. |
|
||||
| `particles` | `StreamParticle[]` | Child particles in the stream. |
|
||||
| `unseen_count` | `integer` | Number of unseen child particles for the requester. |
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "p-001",
|
||||
"name": "Sprint Planning",
|
||||
"description": "Weekly sync",
|
||||
"status": "open",
|
||||
"members": ["[email protected]"],
|
||||
"particles": [],
|
||||
"unseen_count": 0
|
||||
}
|
||||
```
|
||||
|
||||
### StreamParticle
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `id` | `string` | Unique identifier. |
|
||||
| `type` | `string` | One of: `media`, `file`, `text`, `quest`, `paper`. |
|
||||
| `data` | `object` | Type-specific payload (see [Particle Data by Type](#particle-data-by-type)). |
|
||||
| `created_by_email` | `string` | Email of the creator. |
|
||||
| `seen` | `boolean` | Whether the requester has seen this particle. |
|
||||
| `acks` | `AckInfo[]` | Acknowledgments from users. |
|
||||
| `updated_at` | `string` | ISO 8601 timestamp. |
|
||||
| `created_at` | `string` | ISO 8601 timestamp. |
|
||||
|
||||
### Particle
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `id` | `string` | Unique identifier. |
|
||||
| `type` | `string` | One of: `stream`, `folder`, `media`, `file`, `text`, `quest`, `paper`. |
|
||||
| `network_id` | `string` | The network this particle belongs to. |
|
||||
| `parent_id` | `string \| null` | Parent particle ID, if nested. |
|
||||
| `created_by_email` | `string` | Email of the creator. |
|
||||
| `visibility` | `string` | `"network_all"`, `"custom"`, or `"inherited"`. |
|
||||
| `stream_status` | `string \| null` | Only on `stream` type: `"open"` or `"closed"`. |
|
||||
| `data` | `object` | Type-specific payload (see [Particle Data by Type](#particle-data-by-type)). |
|
||||
| `download_url` | `string \| null` | Signed download URL. Only on `media`/`file` particles. |
|
||||
| `seen` | `boolean \| null` | Whether the requester has seen this particle. Only in list responses. |
|
||||
| `acks` | `AckInfo[]` | Acknowledgments. Only in list responses. |
|
||||
| `unseen_count` | `integer \| null` | Unseen child count. Only on `stream` particles in list responses. |
|
||||
| `updated_at` | `string` | ISO 8601 timestamp. |
|
||||
| `created_at` | `string` | ISO 8601 timestamp. |
|
||||
|
||||
### AckInfo
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `email` | `string` | Email of the user who acknowledged. |
|
||||
| `acked_at` | `string` | ISO 8601 timestamp of the acknowledgment. |
|
||||
|
||||
### ParticleList
|
||||
|
||||
Returned by `GET /networks/{network_id}/particles`.
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `particles` | `Particle[]` | Array of enriched particle objects. |
|
||||
| `has_more` | `boolean` | Whether more results exist beyond this page. |
|
||||
| `next_cursor` | `string \| null` | Cursor to fetch the next page. |
|
||||
| `prev_cursor` | `string \| null` | Cursor to fetch the previous page. |
|
||||
|
||||
### DepotObject
|
||||
|
||||
Returned by `POST /depot/objects/{id}/confirm`.
|
||||
@@ -591,20 +297,6 @@ The `data` field on a Particle is a JSON object whose schema depends on the part
|
||||
|
||||
---
|
||||
|
||||
## Visibility
|
||||
|
||||
Particles support three visibility modes:
|
||||
|
||||
| Mode | Description |
|
||||
|------|-------------|
|
||||
| `network_all` | Visible to all network members. |
|
||||
| `custom` | Visible only to specified members (requires `members` list). |
|
||||
| `inherited` | Inherits visibility from parent particle. Used for child particles in streams. |
|
||||
|
||||
Root-level particles (streams, folders) use `network_all` or `custom`. Child particles created via `POST /streams/{id}/particles` automatically use `inherited`.
|
||||
|
||||
---
|
||||
|
||||
## Error Responses
|
||||
|
||||
All endpoints return standard HTTP status codes with plain text error bodies:
|
||||
|
||||
+47
-1443
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user