split-expense-ynab-venmo-shared
Version:
Shared library code the app Expo+Firebase app 'Split Expense: YNAB + Venmo'
88 lines (84 loc) • 2.84 kB
TypeScript
import * as ynab from 'ynab';
import { Account, SaveTransaction } from 'ynab';
import { z } from 'zod';
type YNABConfig = z.infer<typeof YNABEnvVarsSchema>;
declare class YNABClient {
#private;
constructor(config: YNABConfig);
getDefaultBudget(): Promise<ynab.BudgetSummary>;
getAccounts(): Promise<Account[]>;
getCategoryGroups(): Promise<ynab.CategoryGroupWithCategories[]>;
getCategoriesFlat(): Promise<ynab.Category[]>;
addTransactions(transactions: TransactionDetails[]): Promise<void>;
createTransaction(transactionDetails: TransactionDetails): SaveTransaction;
}
declare const YNABEnvVarsSchema: z.ZodObject<{
YNAB_API_TOKEN: z.ZodString;
DEFAULT_BUDGET_ID: z.ZodString;
}, "strip", z.ZodTypeAny, {
YNAB_API_TOKEN: string;
DEFAULT_BUDGET_ID: string;
}, {
YNAB_API_TOKEN: string;
DEFAULT_BUDGET_ID: string;
}>;
declare const YNAB_ENV_VARS: ("YNAB_API_TOKEN" | "DEFAULT_BUDGET_ID")[];
declare const TransactionDetailsSchema: z.ZodObject<{
accountId: z.ZodString;
cents: z.ZodNumber;
payeeName: z.ZodString;
memo: z.ZodOptional<z.ZodString>;
categoryId: z.ZodString;
}, "strip", z.ZodTypeAny, {
memo?: string | undefined;
accountId: string;
cents: number;
payeeName: string;
categoryId: string;
}, {
memo?: string | undefined;
accountId: string;
cents: number;
payeeName: string;
categoryId: string;
}>;
type TransactionDetails = z.infer<typeof TransactionDetailsSchema>;
declare class VenmoClient {
#private;
constructor(config: VenmoConfig);
requestPayment(details: PaymentDetails): Promise<void>;
}
declare const VenmoEnvVarsSchema: z.ZodObject<{
DEFAULT_VENMO_CHARGEE_ID: z.ZodString;
VENMO_API_ACCESS_TOKEN: z.ZodString;
}, "strip", z.ZodTypeAny, {
DEFAULT_VENMO_CHARGEE_ID: string;
VENMO_API_ACCESS_TOKEN: string;
}, {
DEFAULT_VENMO_CHARGEE_ID: string;
VENMO_API_ACCESS_TOKEN: string;
}>;
declare const VENMO_ENV_VAR_NAMES: ("DEFAULT_VENMO_CHARGEE_ID" | "VENMO_API_ACCESS_TOKEN")[];
declare const VenmoConfigSchema: z.ZodObject<{
accessToken: z.ZodString;
defaultChargeeId: z.ZodString;
}, "strip", z.ZodTypeAny, {
accessToken: string;
defaultChargeeId: string;
}, {
accessToken: string;
defaultChargeeId: string;
}>;
type VenmoConfig = z.infer<typeof VenmoConfigSchema>;
declare const PaymentDetailsSchema: z.ZodObject<{
cents: z.ZodNumber;
note: z.ZodString;
}, "strip", z.ZodTypeAny, {
cents: number;
note: string;
}, {
cents: number;
note: string;
}>;
type PaymentDetails = z.infer<typeof PaymentDetailsSchema>;
export { PaymentDetails, PaymentDetailsSchema, TransactionDetails, TransactionDetailsSchema, VENMO_ENV_VAR_NAMES, VenmoClient, VenmoConfigSchema, VenmoEnvVarsSchema, YNABClient, YNABEnvVarsSchema, YNAB_ENV_VARS };