Aden
SDK

Examples

Real-world patterns for common integrations.

Post-release automation

After CI uploads a master to your storage, mark the track as released and notify the team chat.

scripts/release.ts
import { createAdenClient } from '@adenspace/sdk'

const aden = createAdenClient({ apiKey: process.env.ADEN_API_KEY })

const trackId = Number(process.env.TRACK_ID)

const { data: track, error } = await aden.api.v1
    .tracks({ id: trackId })
    .patch({ status: 'released' })

if (error) throw error

console.log(`Released: ${track.title}`)

Sync tracks into a dashboard

Fetch the team's tracks, transform them, and push into an internal tool.

const { data: tracks } = await aden.api.v1.tracks.get({
    query: { limit: 100 },
})

const rows = (tracks ?? []).map((track) => ({
    id: track.id,
    title: track.title,
    status: track.status,
    cover: track.cover_url_medium ?? track.cover_url,
    updated: track.updated_at,
}))

await pushToDashboard(rows)

Mirror a team into Notion

const { data: team } = await aden.api.v1.teams({ id: 123 }).get()
const { data: contacts } = await aden.api.v1.contacts.get({
    query: { teamId: 123 },
})

await notion.databases.update({
    database_id: NOTION_DB,
    title: [{ text: { content: team?.name ?? 'Unknown' } }],
})

for (const contact of contacts ?? []) {
    await notion.pages.create({
        parent: { database_id: NOTION_DB },
        properties: {
            Name: { title: [{ text: { content: contact.name } }] },
            Role: { select: { name: contact.role ?? 'collaborator' } },
        },
    })
}

Post a chat message from a webhook

Perfect for CI failures, masters-ready notifications, or dropping external events into a team thread.

app/api/webhooks/ci/route.ts
import { aden } from '@/lib/aden'

export async function POST(req: Request) {
    const body = await req.json()

    await aden.api.v1.chat.messages.post({
        threadId: CI_THREAD_ID,
        content: `Build ${body.status} for ${body.sha.slice(0, 7)}`,
    })

    return new Response('ok')
}

Electron desktop app

The Aden desktop app uses the SDK exactly like a browser client — pass the Supabase session token from the renderer:

apps/desktop/main/aden.ts
import { createAdenClient } from '@adenspace/sdk'

export const aden = createAdenClient({
    baseUrl: 'https://www.aden.space',
    getToken: async () => getSessionFromRenderer(),
})

Raycast extension

src/search-tracks.tsx
import { createAdenClient } from '@adenspace/sdk'
import { getPreferenceValues } from '@raycast/api'

const { apiKey } = getPreferenceValues<{ apiKey: string }>()
const aden = createAdenClient({ apiKey })

export default async function Command() {
    const { data } = await aden.api.v1.tracks.get({ query: { limit: 25 } })
    // Render results in Raycast UI…
}

Polling with useApiReachable

See React hooks for client-side reachability detection.

On this page