UNPKG

friday-widgets

Version:

Professional embeddable accounting widgets for vertical SaaS platforms. Layer Financial-inspired design with comprehensive financial reporting capabilities.

68 lines 4.34 kB
/** * Friday API Client - Django Backend Integration * * Handles communication with Django Friday backend * Provides partner authentication and multi-tenant business isolation * Layer Financial-compatible interface with Django backend implementation */ import { ApiResponse, PaginatedResponse, Business, Customer, Invoice, Payment, Account, BusinessStats, CreateBusinessRequest, CreateCustomerRequest, CreateInvoiceRequest, CreateAccountRequest, CreatePaymentRequest, PaymentRequest, InvoiceFilters, AccountFilters, PaymentFilters } from './types.js'; export interface FridayAPIConfig { baseURL: string; apiKey: string; businessId?: string; timeout?: number; retryAttempts?: number; } export declare class FridayApiClient { private config; private defaultHeaders; constructor(config: FridayAPIConfig); setBusinessContext(businessId: string): void; getBusinessContext(): string | undefined; private request; getBusinesses(): Promise<ApiResponse<PaginatedResponse<Business>>>; getBusiness(businessId: string): Promise<ApiResponse<Business>>; createBusiness(data: CreateBusinessRequest): Promise<ApiResponse<Business>>; updateBusiness(businessId: string, data: Partial<Business>): Promise<ApiResponse<Business>>; getBusinessStats(businessId: string): Promise<ApiResponse<BusinessStats>>; lookupBusinessByExternalId(externalId: string): Promise<ApiResponse<Business>>; getInvoices(businessId: string, filters?: InvoiceFilters): Promise<ApiResponse<PaginatedResponse<Invoice>>>; getInvoice(invoiceId: string): Promise<ApiResponse<Invoice>>; createInvoice(data: CreateInvoiceRequest): Promise<ApiResponse<Invoice>>; updateInvoice(invoiceId: string, data: Partial<Invoice>): Promise<ApiResponse<Invoice>>; deleteInvoice(invoiceId: string): Promise<ApiResponse<void>>; recordInvoicePayment(invoiceId: string, payment: PaymentRequest): Promise<ApiResponse<Payment>>; sendInvoice(invoiceId: string): Promise<ApiResponse<Invoice>>; getInvoicePayments(invoiceId: string): Promise<ApiResponse<PaginatedResponse<Payment>>>; getCustomers(businessId: string): Promise<ApiResponse<PaginatedResponse<Customer>>>; getCustomer(customerId: string): Promise<ApiResponse<Customer>>; createCustomer(data: CreateCustomerRequest): Promise<ApiResponse<Customer>>; updateCustomer(customerId: string, data: Partial<Customer>): Promise<ApiResponse<Customer>>; archiveCustomer(customerId: string): Promise<ApiResponse<Customer>>; reactivateCustomer(customerId: string): Promise<ApiResponse<Customer>>; getAccounts(businessId: string, filters?: AccountFilters): Promise<ApiResponse<PaginatedResponse<Account>>>; getAccount(accountId: string): Promise<ApiResponse<Account>>; createAccount(data: CreateAccountRequest): Promise<ApiResponse<Account>>; updateAccount(accountId: string, data: Partial<Account>): Promise<ApiResponse<Account>>; deleteAccount(accountId: string): Promise<ApiResponse<void>>; getBankAccounts(businessId: string): Promise<ApiResponse<PaginatedResponse<Account>>>; getAccountHierarchy(businessId: string): Promise<ApiResponse<Account[]>>; syncAccount(accountId: string): Promise<ApiResponse<Account>>; getPayments(businessId: string, filters?: PaymentFilters): Promise<ApiResponse<PaginatedResponse<Payment>>>; getPayment(paymentId: string): Promise<ApiResponse<Payment>>; createPayment(data: CreatePaymentRequest): Promise<ApiResponse<Payment>>; updatePayment(paymentId: string, data: Partial<Payment>): Promise<ApiResponse<Payment>>; completePayment(paymentId: string): Promise<ApiResponse<Payment>>; failPayment(paymentId: string): Promise<ApiResponse<Payment>>; getBalanceSheet(businessId: string, effectiveDate?: string): Promise<ApiResponse<any>>; getPnLData(businessId: string, dateFrom: string, dateTo: string): Promise<ApiResponse<any>>; getCashFlowData(businessId: string, dateFrom: string, dateTo: string): Promise<ApiResponse<any>>; healthCheck(): Promise<ApiResponse<{ status: string; }>>; formatCurrency(amountCents: number, currency?: string): string; formatDate(dateString: string): string; validateBusinessAccess(businessId: string): boolean; private handleApiError; } //# sourceMappingURL=api-client.d.ts.map