Laddro DocsLaddro Docs

TypeScript SDK

TypeScript SDK

Det officiella TypeScript/JavaScript SDK:et för Laddro Career API.

Installera

npm install @laddro/career-sdk

Snabbstart

import { Laddro } from '@laddro/career-sdk'

const client = new Laddro({
  apiKey: process.env.LADDRO_API_KEY!
})

// Lista mallar (publikt, ingen autentisering krävs)
const templates = await client.templates.list()

// Tolka ett CV
const resume = await client.resumes.parse(
  new File([buffer], 'resume.pdf', { type: 'application/pdf' })
)

// Anpassa för ett jobb
const result = await client.tailor.create({
  resumeId: resume.id,
  positionName: 'Senior Frontend Engineer',
  jobDescription: 'We are looking for...'
})

Konfiguration

const client = new Laddro({
  apiKey: 'YOUR_API_KEY',
  baseUrl: 'https://api.laddro.com',  // standard
  timeout: 30_000                      // 30s standard
})

Mallar

// Lista alla mallar
const templates = await client.templates.list()

// Hämta en specifik mall
const template = await client.templates.get('graphite')

CV:n

// Lista CV:n
const resumes = await client.resumes.list()

// Hämta ett CV
const resume = await client.resumes.get('res_abc123')

// Tolka från fil
const parsed = await client.resumes.parse(file)

// Rendera till PDF
const pdf = await client.resumes.render('res_abc123', {
  templateId: 'graphite'
})

Anpassning

// Standardförfrågan
const result = await client.tailor.create({
  resumeId: 'res_abc123',
  positionName: 'Senior Engineer',
  jobDescription: 'We are looking for...'
})

// Streaming
const stream = client.tailor.stream({
  resumeId: 'res_abc123',
  positionName: 'Senior Engineer',
  jobDescription: '...'
})
for await (const event of stream) {
  console.log(event.type, event.section, event.content)
}

Personliga brev

// Generera med streaming
const stream = client.coverLetters.generate({
  resumeId: 'res_abc123',
  positionName: 'Senior Engineer',
  jobDescription: '...',
  stream: true
})
for await (const event of stream) {
  process.stdout.write(event.content)
}

// Rendera till PDF
const pdf = await client.coverLetters.render('cl_abc123', {
  templateId: 'graphite'
})

Exportera

import { writeFileSync } from 'fs'

const pdf = await client.export({
  resumeId: 'res_abc123',
  templateId: 'graphite'
})

writeFileSync('resume.pdf', Buffer.from(pdf))

Inställningar (BYOK)

// Hämta aktuell modell
const settings = await client.settings.get()

// Ställ in anpassad modell
await client.settings.setModel({
  provider: 'anthropic',
  model: 'claude-haiku-4.5',
  apiKey: 'sk-ant-...'
})

// Återställ till standard
await client.settings.resetModel()

Felhantering

import { LaddroError } from '@laddro/career-sdk'

try {
  await client.resumes.get('nonexistent')
} catch (error) {
  if (error instanceof LaddroError) {
    console.log(error.status)   // 404
    console.log(error.message)  // "Resume not found"
  }
}

Källkod

github.com/laddro-app/laddro-career-sdk-ts

On this page