gRPC API Reference
Overview
| Thuộc tính | Giá trị |
|---|---|
| Proto file | server/proto/mymo/v1/mymo.proto |
| Services | 7 |
| Total RPCs | 23 |
| Transport | gRPC-Web qua HTTP/1.1 |
| Auth | JWT Bearer token (trừ AuthService) |
AuthService
Public Service
AuthService không yêu cầu JWT token.
| RPC | Request | Response | Mô tả |
|---|---|---|---|
| Validate | {key: string} | {token: string, email: string} | Xác thực license key |
ConfigService
| RPC | Request | Response | Mô tả |
|---|---|---|---|
| GetConfig | {} | {config?: UserConfig} | Lấy config hiện tại |
| UpsertConfig | {currency?: string} | {} | Tạo/cập nhật config |
| UpdateCash | {delta: int64} | {} | Cộng/trừ tổng tài sản |
| DeleteConfig | {} | {} | Xóa config (reset onboarding) |
CategoryService
| RPC | Request | Response | Mô tả |
|---|---|---|---|
| ListCategories | {} | {categories: Category[]} | Danh sách tất cả danh mục |
| CreateCategory | {name: string, tier: int32} | {id: int64} | Tạo danh mục mới |
| StandardizeCategories | {existingCategories: [{name, tier}]} | {} | AI chuẩn hóa tên |
TransactionService
| RPC | Request | Response | Mô tả |
|---|---|---|---|
| ListTransactions | {limit: int64} | {transactions: Transaction[]} | Giao dịch gần nhất |
| CreateTransaction | {amount: int64, date: string, categoryId: int64, note: string} | {} | Tạo giao dịch |
| UpdateTransaction | {id: int64, amount: int64, date: string, categoryId: int64, note: string} | {} | Cập nhật |
| DeleteTransaction | {id: int64} | {} | Xóa |
| GetMonthTransactions | {year: int32, month: int32} | {transactions: TransactionWithCategory[]} | Theo tháng |
| GetMonthTierTotals | {year: int32, month: int32} | {tierTotals: [{tier, total}]} | Tổng tier/tháng |
RecurringService
| RPC | Request | Response | Mô tả |
|---|---|---|---|
| ListRecurring | {} | {recurring: RecurringExpense[]} | Danh sách |
| CreateRecurring | {name, amount: int64, frequency, dayOfMonth?: int64, categoryId?: int64} | {} | Tạo |
| UpdateRecurring | {id: int64, name?, amount?, frequency?, dayOfMonth?, categoryId?} | {} | Cập nhật |
| DeleteRecurring | {id: int64} | {} | Xóa |
| CatchupRecurring | {} | {} | Tạo transactions cho quá hạn |
OnboardingService
| RPC | Request | Response | Mô tả |
|---|---|---|---|
| Onboard | {recurring: [], oneTime: [], totalCash: int64} | {} | Setup ban đầu |
AiService
| RPC | Request | Response | Mô tả |
|---|---|---|---|
| ParseSpend | {text: string} | {amount: int64, name: string, categoryId?: int64} | Parse 1 khoản chi |
| ParseSpending | {text: string} | {items: ParsedItem[]} | Parse nhiều khoản |
| ParseIncome | {text: string} | {amount: int64, note: string} | Parse khoản thu |
Type Conversion
int64 / bigint
Proto int64 → TypeScript bigint. Composables phải convert:
ts
// Đọc: bigint → number
const cash = Number(res.config.totalCash)
// Ghi: number → bigint
await client.updateCash({ delta: BigInt(amount) })Proto fields dùng camelCase (totalCash), composables map sang snake_case (total_cash).