The Coline App SDK: apps, tools, file types and surfaces that run inside Coline workspaces, and public websites with Coline Sites. TypeScript, with an in-memory test workspace. MIT.
| 7 | - `ColineApiClient` |
| 8 | High-level wrapper for common Coline platform operations. |
| 9 | - `createAppPlatformClient` |
| 10 | Raw generated OpenAPI client for the current app-platform surface. |
| 11 | - `ColineApp` |
| 12 | Manifest/file type/app-definition builder for app authors. |
| 13 | - Generated OpenAPI artifacts |
| 14 | - `openapi/app-platform-v1.json` |
| 15 | - `src/generated/app-platform-v1.ts` |
| 16 |
| 17 | ## Regenerate the OpenAPI client/types |
| 18 |
| 19 | From the repo root: |
| 20 |
| 21 | ```bash |
| 22 | pnpm sdk:generate:openapi |
| 23 | ``` |
| 24 |
| 25 | Or from the package: |
| 26 |
| 27 | ```bash |
| 28 | pnpm --filter @colineapp/sdk generate:openapi |
| 29 | ``` |
| 30 |
| 31 | ## Quickstart |
| 32 |
| 33 | ```ts |
| 34 | import { ColineApiClient } from "@colineapp/sdk"; |
| 35 |
| 36 | const coline = new ColineApiClient({ |
| 37 | baseUrl: "https://coline.app", |
| 38 | apiKey: process.env["COLINE_API_KEY"], |
| 39 | }); |
| 40 |
| 41 | const apps = await coline.listApps(); |
| 42 | console.log(apps.apps); |
| 43 | ``` |
| 44 |
| 45 | ## Raw generated client |
| 46 |
| 47 | Use the generated client if you want spec-driven methods directly: |
| 48 |
| 49 | ```ts |
| 50 | import { createAppPlatformClient } from "@colineapp/sdk"; |
| 51 |
| 52 | const client = createAppPlatformClient({ |
| 53 | baseUrl: "https://coline.app", |
| 54 | apiKey: process.env["COLINE_API_KEY"], |
| 55 | }); |
| 56 |
| 57 | const { data, error } = await client.GET("/api/v1/apps"); |
| 58 | if (error) throw error; |
| 59 | console.log(data.data.apps); |
| 60 | ``` |
| 61 |
| 62 | ## Typed app registration |
| 63 |
| 64 | ```ts |
| 65 | import { ColineApiClient } from "@colineapp/sdk"; |
| 66 |
| 67 | const client = new ColineApiClient({ |
| 68 | baseUrl: "https://coline.app", |
| 69 | apiKey: process.env["COLINE_API_KEY"], |
| 70 | }); |
| 71 |
| 72 | await client.registerApp({ |
| 73 | version: "0.1.0", |
| 74 | manifest: { |
| 75 | key: "com.example.notes", |
| 76 | name: "Example Notes", |
| 77 | permissions: ["app.home.read", "files.read", "files.write"], |
| 78 | notificationChannels: [], |
| 79 | hosting: { |
| 80 | mode: "external", |
| 81 | baseUrl: "https://notes.example.com", |
| 82 | }, |
| 83 | }, |
| 84 | fileTypes: [ |
| 85 | { |
| 86 | typeKey: "com.example.notes.note", |
| 87 | name: "Note", |
| 88 | storage: "coline_document", |
| 89 | indexable: true, |
| 90 | homeRenderMode: "cached", |
| 91 | }, |
| 92 | ], |
| 93 | }); |
| 94 | ``` |
| 95 |