UNPKG

splitwise

Version:

A TypeScript SDK for the Splitwise API.

48 lines 1.78 kB
/** * Splitwise notification type values. * * The API returns notification.type as a small integer. The mapping below was * derived from the Rust SDK (pbar1/splitwise-rs), which appears to be the * most thoroughly enumerated reference. Splitwise's official OpenAPI spec * doesn't enumerate the values. * * **Note:** Splitwise may add new notification types without warning. Treat * `Notification.type` as `number` and use these constants for comparison; * unknown values should be handled gracefully (e.g. fall through to a default * branch in a switch). */ export declare const NotificationType: { readonly ExpenseAdded: 0; readonly ExpenseUpdated: 1; readonly ExpenseDeleted: 2; readonly CommentAdded: 3; readonly AddedToGroup: 4; readonly RemovedFromGroup: 5; readonly GroupDeleted: 6; readonly GroupSettingsChanged: 7; readonly AddedAsFriend: 8; readonly RemovedAsFriend: 9; readonly News: 10; readonly DebtSimplification: 11; readonly GroupUndeleted: 12; readonly ExpenseUndeleted: 13; readonly GroupCurrencyConversion: 14; readonly FriendCurrencyConversion: 15; }; /** Union of all known notification type IDs. */ export type NotificationTypeId = (typeof NotificationType)[keyof typeof NotificationType]; /** * Returns the snake_case name for a notification type id, or `undefined` if * the id is unknown. Useful for logging and switch-style branching: * * @example * ```ts * switch (notificationTypeName(notification.type)) { * case 'expense_added': ... * case 'comment_added': ... * default: ... // including unknown future values * } * ``` */ export declare function notificationTypeName(typeId: number): string | undefined; //# sourceMappingURL=notification-types.d.ts.map