Examples
Patterns for common integrations, each one a call a team key can make.
Every example runs on a server with ADEN_API_KEY and ADEN_TEAM_ID set.
A key never works from a browser: for a public website, read the
site feed instead.
import { createAdenClient } from '@adenspace/sdk'
export const aden = createAdenClient({ apiKey: process.env.ADEN_API_KEY })
export const teamId = String(process.env.ADEN_TEAM_ID)Sync tracks into a dashboard
const { data: res, error } = await aden.api.v1.tracks.get({
query: { teamId, limit: 100 },
})
if (error) throw error
const rows = res.data.map((track) => ({
id: track.id,
title: track.title,
status: track.status,
cover: track.cover_url_medium ?? track.cover_url,
}))
await pushToDashboard(rows)res.total counts every track in the team, so limit: 1 is enough for a
"128 tracks" figure.
Open a task from CI
Needs a Read & write key.
const trackId = Number(process.env.TRACK_ID)
const { error } = await aden.api.v1.todos.post({
todo: 'Masters are in: check them before distribution',
trackId,
deadline: new Date(Date.now() + 2 * 86_400_000).toISOString(),
})
if (error) throw errorMirror contacts into Notion
const { data: res } = await aden.api.v1.contacts.get({ query: { teamId } })
for (const contact of res?.data ?? []) {
await notion.pages.create({
parent: { database_id: NOTION_DB },
properties: {
Name: {
title: [
{
text: {
content: [contact.first_name, contact.last_name]
.filter(Boolean)
.join(' '),
},
},
],
},
Email: { email: contact.email },
},
})
}Upcoming shows in a newsletter
const { data: res } = await aden.api.v1.events.get({ query: { teamId } })
const today = new Date().toISOString().slice(0, 10)
const upcoming = (res?.data ?? []).filter((event) => event.date >= today)Raycast extension
Raycast runs your code locally, not in a browser, so a key works there. Ask for it as a password preference.
import { createAdenClient } from '@adenspace/sdk'
import { getPreferenceValues } from '@raycast/api'
const { apiKey, teamId } = getPreferenceValues<{
apiKey: string
teamId: string
}>()
const aden = createAdenClient({ apiKey })
export default async function Command() {
const { data } = await aden.api.v1.tracks.get({
query: { teamId, limit: 25 },
})
// Render data.data in Raycast UI…
}An app people sign in to
Use the person's Supabase session instead of a key. It reaches every team they belong to, not just one:
export const aden = createAdenClient({
baseUrl: 'https://aden.space',
getToken: async () => {
const { data } = await supabase.auth.getSession()
return data.session?.access_token ?? null
},
})Polling with useApiReachable
See React hooks for client-side reachability detection.
Was this helpful?