syntax = "proto3"; option go_package = "github.com/traP-jp/plutus/api/protobuf;cornucopia"; option java_multiple_files = true; option java_package = "jp.trap.plutus.api"; option java_outer_classname = "Plutus"; package plutus; import "google/protobuf/timestamp.proto"; service CornucopiaService { rpc CreateAccount (CreateAccountRequest) returns (CreateAccountResponse) {} rpc GetAccount (GetAccountRequest) returns (GetAccountResponse) {} rpc GetAccounts (GetAccountsRequest) returns (GetAccountsResponse) {} rpc ListAccounts (ListAccountsRequest) returns (ListAccountsResponse) {} rpc Transfer (TransferRequest) returns (TransferResponse) {} rpc GetJournalEntries (GetJournalEntriesRequest) returns (GetJournalEntriesResponse) {} } message CreateAccountRequest { bool can_overdraft = 1; } message CreateAccountResponse { string account_id = 1; int64 balance = 2; bool can_overdraft = 3; } message GetAccountRequest { string account_id = 1; } message GetAccountResponse { string account_id = 1; int64 balance = 2; bool can_overdraft = 3; } message GetAccountsRequest { repeated string account_ids = 1; } message GetAccountsResponse { repeated Account accounts = 1; } message ListAccountsRequest { int32 limit = 1; int32 offset = 2; optional int64 min_balance = 3; optional int64 max_balance = 4; optional bool can_overdraft = 5; SortField sort_field = 6; SortOrder sort_order = 7; } enum SortField { SORT_FIELD_UNSPECIFIED = 0; SORT_FIELD_ACCOUNT_ID = 1; SORT_FIELD_BALANCE = 2; } enum SortOrder { SORT_ORDER_UNSPECIFIED = 0; SORT_ORDER_ASC = 1; SORT_ORDER_DESC = 2; } message ListAccountsResponse { repeated Account accounts = 1; int32 total_count = 2; } message Account { string account_id = 1; int64 balance = 2; bool can_overdraft = 3; } message TransferRequest { string from_account_id = 1; string to_account_id = 2; int64 amount = 3; string description = 4; string idempotency_key = 5; } message TransferResponse { string journal_entry_id = 1; google.protobuf.Timestamp created_at = 2; } message GetJournalEntriesRequest { string account_id = 1; int32 limit = 2; int32 offset = 3; } message GetJournalEntriesResponse { repeated JournalEntry journal_entries = 1; } message JournalEntry { string journal_entry_id = 1; string from_account_id = 2; string to_account_id = 3; int64 amount = 4; string description = 5; google.protobuf.Timestamp created_at = 6; }