// Bank — Retail banking: customers, accounts, cards, nearly eight thousand transactions, transfers and FX rates. // sondahub (https://sondahub.com): served over gRPC-Web and Connect at https://api.sondahub.com/grpc. // Writes are simulated: answered as a real server would, kept only in the x-sondahub-session token you send back. syntax = "proto3"; package sondahub.bank.v1; import "google/protobuf/struct.proto"; service BankService { // A page of customers: page, limit, sort, q and filter (field → value, with the REST operator suffixes: price_lt → 20). rpc ListCustomers(ListCustomersRequest) returns (ListCustomersResponse); // One customer by id. rpc GetCustomer(GetCustomerRequest) returns (Customer); // Create a customer (simulated, kept in your session token). id and the timestamps are set by the server. rpc CreateCustomer(Customer) returns (Customer); // Change the fields set in customer (simulated). rpc UpdateCustomer(UpdateCustomerRequest) returns (Customer); // Delete one (simulated); answers what was removed. rpc DeleteCustomer(DeleteCustomerRequest) returns (Customer); // A page of accounts: page, limit, sort, q and filter (field → value, with the REST operator suffixes: price_lt → 20). rpc ListAccounts(ListAccountsRequest) returns (ListAccountsResponse); // One account by id. rpc GetAccount(GetAccountRequest) returns (Account); // Create a account (simulated, kept in your session token). id and the timestamps are set by the server. rpc CreateAccount(Account) returns (Account); // Change the fields set in account (simulated). rpc UpdateAccount(UpdateAccountRequest) returns (Account); // Delete one (simulated); answers what was removed. rpc DeleteAccount(DeleteAccountRequest) returns (Account); // A page of cards: page, limit, sort, q and filter (field → value, with the REST operator suffixes: price_lt → 20). rpc ListCards(ListCardsRequest) returns (ListCardsResponse); // One card by id. rpc GetCard(GetCardRequest) returns (Card); // Create a card (simulated, kept in your session token). id and the timestamps are set by the server. rpc CreateCard(Card) returns (Card); // Change the fields set in card (simulated). rpc UpdateCard(UpdateCardRequest) returns (Card); // Delete one (simulated); answers what was removed. rpc DeleteCard(DeleteCardRequest) returns (Card); // A page of transactions: page, limit, sort, q and filter (field → value, with the REST operator suffixes: price_lt → 20). rpc ListTransactions(ListTransactionsRequest) returns (ListTransactionsResponse); // One transaction by id. rpc GetTransaction(GetTransactionRequest) returns (Transaction); // Create a transaction (simulated, kept in your session token). id and the timestamps are set by the server. rpc CreateTransaction(Transaction) returns (Transaction); // Change the fields set in transaction (simulated). rpc UpdateTransaction(UpdateTransactionRequest) returns (Transaction); // Delete one (simulated); answers what was removed. rpc DeleteTransaction(DeleteTransactionRequest) returns (Transaction); // A page of transfers: page, limit, sort, q and filter (field → value, with the REST operator suffixes: price_lt → 20). rpc ListTransfers(ListTransfersRequest) returns (ListTransfersResponse); // One transfer by id. rpc GetTransfer(GetTransferRequest) returns (Transfer); // Create a transfer (simulated, kept in your session token). id and the timestamps are set by the server. rpc CreateTransfer(Transfer) returns (Transfer); // Change the fields set in transfer (simulated). rpc UpdateTransfer(UpdateTransferRequest) returns (Transfer); // Delete one (simulated); answers what was removed. rpc DeleteTransfer(DeleteTransferRequest) returns (Transfer); // A page of fx rates: page, limit, sort, q and filter (field → value, with the REST operator suffixes: price_lt → 20). rpc ListFxRates(ListFxRatesRequest) returns (ListFxRatesResponse); // One fx rate by id. rpc GetFxRate(GetFxRateRequest) returns (FxRate); // Create a fx rate (simulated, kept in your session token). id and the timestamps are set by the server. rpc CreateFxRate(FxRate) returns (FxRate); // Change the fields set in fx_rate (simulated). rpc UpdateFxRate(UpdateFxRateRequest) returns (FxRate); // Delete one (simulated); answers what was removed. rpc DeleteFxRate(DeleteFxRateRequest) returns (FxRate); // The API's live activity as a server stream, each topic at its own pace: fx (every 1 s), transactions (every 3 s). max_events ends the stream (default 10, at most 120). rpc Watch(WatchRequest) returns (stream Event); } message Customer { // Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. int64 id = 1; // When the record was created (ISO 8601, UTC). optional string created_at = 2; // When the record last changed. optional string updated_at = 3; optional string name = 4; optional string email = 5; optional string phone = 6; optional string date_of_birth = 7; google.protobuf.Value address = 8; optional string segment = 9; optional string kyc_status = 10; optional int64 risk_score = 11; } message ListCustomersRequest { int32 page = 1; int32 limit = 2; string sort = 3; string q = 4; map filter = 5; } message ListCustomersResponse { repeated Customer data = 1; int32 page = 2; int32 limit = 3; int32 total = 4; int32 pages = 5; } message UpdateCustomerRequest { int64 id = 1; Customer customer = 2; } message GetCustomerRequest { int64 id = 1; } message DeleteCustomerRequest { int64 id = 1; } message Account { // Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. int64 id = 1; // When the record was created (ISO 8601, UTC). optional string created_at = 2; // When the record last changed. optional string updated_at = 3; // Unique account number. optional string number = 4; optional string iban = 5; optional int64 customer_id = 6; optional string type = 7; optional string nickname = 8; optional string currency = 9; // Current balance. Negative on credit and loan accounts means money owed. optional double balance = 10; // Balance minus holds, or credit left. optional double available = 11; // Credit accounts only. optional double credit_limit = 12; // Annual, percent. optional double interest_rate = 13; optional string status = 14; optional string opened_at = 15; } message ListAccountsRequest { int32 page = 1; int32 limit = 2; string sort = 3; string q = 4; map filter = 5; } message ListAccountsResponse { repeated Account data = 1; int32 page = 2; int32 limit = 3; int32 total = 4; int32 pages = 5; } message UpdateAccountRequest { int64 id = 1; Account account = 2; } message GetAccountRequest { int64 id = 1; } message DeleteAccountRequest { int64 id = 1; } message Card { // Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. int64 id = 1; // When the record was created (ISO 8601, UTC). optional string created_at = 2; // When the record last changed. optional string updated_at = 3; optional int64 account_id = 4; optional int64 customer_id = 5; optional string brand = 6; optional string type = 7; optional string masked_number = 8; optional string last4 = 9; optional string holder_name = 10; optional string expires = 11; optional string status = 12; optional bool contactless = 13; optional double daily_limit = 14; } message ListCardsRequest { int32 page = 1; int32 limit = 2; string sort = 3; string q = 4; map filter = 5; } message ListCardsResponse { repeated Card data = 1; int32 page = 2; int32 limit = 3; int32 total = 4; int32 pages = 5; } message UpdateCardRequest { int64 id = 1; Card card = 2; } message GetCardRequest { int64 id = 1; } message DeleteCardRequest { int64 id = 1; } message Transaction { // Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. int64 id = 1; // When the record was created (ISO 8601, UTC). optional string created_at = 2; // When the record last changed. optional string updated_at = 3; optional int64 account_id = 4; // Unique. optional string reference = 5; optional string type = 6; optional double amount = 7; optional string currency = 8; optional double balance_after = 9; optional string description = 10; optional string merchant = 11; optional string category = 12; optional string status = 13; optional int64 card_id = 14; google.protobuf.Value counterparty = 15; optional string booked_at = 16; optional string value_date = 17; } message ListTransactionsRequest { int32 page = 1; int32 limit = 2; string sort = 3; string q = 4; map filter = 5; } message ListTransactionsResponse { repeated Transaction data = 1; int32 page = 2; int32 limit = 3; int32 total = 4; int32 pages = 5; } message UpdateTransactionRequest { int64 id = 1; Transaction transaction = 2; } message GetTransactionRequest { int64 id = 1; } message DeleteTransactionRequest { int64 id = 1; } message Transfer { // Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. int64 id = 1; // When the record was created (ISO 8601, UTC). optional string created_at = 2; // When the record last changed. optional string updated_at = 3; optional int64 from_account_id = 4; optional int64 to_account_id = 5; optional double amount = 6; optional string currency = 7; optional string description = 8; optional string status = 9; optional int64 debit_transaction_id = 10; optional int64 credit_transaction_id = 11; optional string scheduled_for = 12; optional string executed_at = 13; } message ListTransfersRequest { int32 page = 1; int32 limit = 2; string sort = 3; string q = 4; map filter = 5; } message ListTransfersResponse { repeated Transfer data = 1; int32 page = 2; int32 limit = 3; int32 total = 4; int32 pages = 5; } message UpdateTransferRequest { int64 id = 1; Transfer transfer = 2; } message GetTransferRequest { int64 id = 1; } message DeleteTransferRequest { int64 id = 1; } message FxRate { // Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. int64 id = 1; // When the record was created (ISO 8601, UTC). optional string created_at = 2; // When the record last changed. optional string updated_at = 3; optional string pair = 4; optional string base = 5; optional string quote = 6; optional double rate = 7; optional double bid = 8; optional double ask = 9; optional double change_24h_pct = 10; optional string as_of = 11; } message ListFxRatesRequest { int32 page = 1; int32 limit = 2; string sort = 3; string q = 4; map filter = 5; } message ListFxRatesResponse { repeated FxRate data = 1; int32 page = 2; int32 limit = 3; int32 total = 4; int32 pages = 5; } message UpdateFxRateRequest { int64 id = 1; FxRate fx_rate = 2; } message GetFxRateRequest { int64 id = 1; } message DeleteFxRateRequest { int64 id = 1; } message WatchRequest { repeated string topics = 1; int32 max_events = 2; } message Event { string topic = 1; string api = 2; string ts = 3; google.protobuf.Struct data = 4; }