Automate issuer overlay creation from ticker searches
This commit is contained in:
23
lib/api.ts
23
lib/api.ts
@@ -31,6 +31,7 @@ import type {
|
||||
Task,
|
||||
TaskStatus,
|
||||
TaskTimeline,
|
||||
TickerAutomationSource,
|
||||
User,
|
||||
WatchlistItem
|
||||
} from './types';
|
||||
@@ -147,7 +148,7 @@ async function requestJson<T>(input: {
|
||||
return payload as T;
|
||||
}
|
||||
|
||||
export async function getMe() {
|
||||
async function getMe() {
|
||||
const result = await client.api.me.get();
|
||||
return await unwrapData<{ user: User }>(result, 'Unable to fetch session');
|
||||
}
|
||||
@@ -202,7 +203,7 @@ export async function listResearchJournal(ticker: string) {
|
||||
return await unwrapData<{ entries: ResearchJournalEntry[] }>(result, 'Unable to fetch research journal');
|
||||
}
|
||||
|
||||
export async function createResearchJournalEntry(input: {
|
||||
async function createResearchJournalEntry(input: {
|
||||
ticker: string;
|
||||
accessionNumber?: string;
|
||||
entryType: ResearchJournalEntryType;
|
||||
@@ -422,7 +423,7 @@ export async function getResearchPacket(ticker: string) {
|
||||
}, 'Unable to fetch research packet');
|
||||
}
|
||||
|
||||
export async function updateResearchJournalEntry(id: number, input: {
|
||||
async function updateResearchJournalEntry(id: number, input: {
|
||||
title?: string;
|
||||
bodyMarkdown?: string;
|
||||
metadata?: Record<string, unknown>;
|
||||
@@ -434,7 +435,7 @@ export async function updateResearchJournalEntry(id: number, input: {
|
||||
}, 'Unable to update journal entry');
|
||||
}
|
||||
|
||||
export async function deleteResearchJournalEntry(id: number) {
|
||||
async function deleteResearchJournalEntry(id: number) {
|
||||
const result = await client.api.research.journal[id].delete();
|
||||
return await unwrapData<{ success: boolean }>(result, 'Unable to delete journal entry');
|
||||
}
|
||||
@@ -570,6 +571,20 @@ export async function getCompanyAnalysis(ticker: string, options?: { refresh?: b
|
||||
return await unwrapData<{ analysis: CompanyAnalysis }>(result, 'Unable to fetch company analysis');
|
||||
}
|
||||
|
||||
export async function ensureTickerAutomation(input: {
|
||||
ticker: string;
|
||||
source: TickerAutomationSource;
|
||||
}) {
|
||||
return await requestJson<{ queued: boolean; task: Task | null }>({
|
||||
path: '/api/tickers/ensure',
|
||||
method: 'POST',
|
||||
body: {
|
||||
ticker: input.ticker.trim().toUpperCase(),
|
||||
source: input.source
|
||||
}
|
||||
}, 'Unable to ensure ticker automation');
|
||||
}
|
||||
|
||||
export async function getCompanyFinancialStatements(input: {
|
||||
ticker: string;
|
||||
surfaceKind: FinancialSurfaceKind;
|
||||
|
||||
Reference in New Issue
Block a user