diff --git a/apps/web/src/api/index.ts b/apps/web/src/api/index.ts index a8ff8e4..fb534e6 100644 --- a/apps/web/src/api/index.ts +++ b/apps/web/src/api/index.ts @@ -6,13 +6,21 @@ import type { Application, Approval, Artifact, + BatchScoringResponse, CoverLetterResponse, CritiqueComment, + CvImportConfirmResponse, + CvImportResponse, CvSection, + DemoSeedResponse, + InterviewPrepResponse, JobPosting, + PostingsFetchResponse, Profile, RenderCvResponse, - ScoreResponse + ScoreResponse, + TaskRun, + TodayResponse } from '@/types' const API_BASE: string = @@ -154,17 +162,77 @@ export function outboxSend(approvalId: string, payload: Record) }) } +// --- Telemetry --- + +export function getTelemetryTasks(): Promise { + return request('/telemetry/tasks') +} + +// --- v1.0 additions (api-contract-v2.md) --- + +export function importCv(filename: string, contentBase64: string): Promise { + return request('/cv/import', { + method: 'POST', + body: JSON.stringify({ filename, content_base64: contentBase64 }) + }) +} + +export function confirmCvImport(drafts: CvImportResponse['drafts']): Promise { + return request('/cv/import/confirm', { + method: 'POST', + body: JSON.stringify({ drafts }) + }) +} + +export function fetchPostings(query: string, region?: string): Promise { + const body: Record = { query } + if (region) body.region = region + return request('/postings/fetch', { + method: 'POST', + body: JSON.stringify(body) + }) +} + +export function batchScore(applicationIds: string[]): Promise { + return request('/scoring/batch', { + method: 'POST', + body: JSON.stringify({ application_ids: applicationIds }) + }) +} + +export function getToday(): Promise { + return request('/today') +} + +export function interviewPrep(applicationId: string): Promise { + return request(`/applications/${applicationId}/interview-prep`, { + method: 'POST' + }) +} + +export function seedDemo(): Promise { + return request('/concierge/seed-demo', { method: 'POST' }) +} + // Re-export types for convenience export type { AiAssistResponse, Application, Approval, Artifact, + BatchScoringResponse, CoverLetterResponse, CritiqueComment, + CvImportConfirmResponse, + CvImportResponse, CvSection, + DemoSeedResponse, + InterviewPrepResponse, JobPosting, + PostingsFetchResponse, Profile, RenderCvResponse, - ScoreResponse + ScoreResponse, + TaskRun, + TodayResponse } \ No newline at end of file diff --git a/apps/web/src/types/index.ts b/apps/web/src/types/index.ts index 14ff0f5..de93125 100644 --- a/apps/web/src/types/index.ts +++ b/apps/web/src/types/index.ts @@ -125,4 +125,87 @@ export interface AiAssistResponse { export interface ApiError { error: { code: string; message: string } +} + +// --- v1.0 additions (api-contract-v2.md) --- + +export interface CvDraft { + kind: CvSectionKind + title: string + org: string + location: string + start_date: string + end_date: string | null + bullets: string[] + tags: string[] +} + +export interface CvImportResponse { + drafts: CvDraft[] +} + +export interface CvImportConfirmResponse { + created: number + sections: CvSection[] +} + +export interface PostingsFetchResponse { + new: number + dupes: number +} + +export interface BatchScoringResult { + application_id: string + score: number + rationale: Record + red_flags: string[] +} + +export interface BatchScoringResponse { + results: BatchScoringResult[] +} + +export interface TodayDigestItem { + application_id: string + title: string + company: string + score: number +} + +export interface TodayNudge { + application_id: string + days_since_sent: number + suggestion: string +} + +export interface TodayResponse { + digest: TodayDigestItem[] + nudges: TodayNudge[] + pending_approvals: number +} + +export interface InterviewPrepResponse { + artifact_id: string + content: string +} + +export interface DemoSeedResponse { + profile: string + postings: number + applications: number + sections: number +} + +export interface TaskRun { + id: string + task_type: string + model: string + tokens_in: number + tokens_out: number + cost: number | null + created_at: string +} + +export interface RedFlagsMap { + [applicationId: string]: string[] } \ No newline at end of file