protobufs/transactions.proto

77 lines
1.4 KiB
Protocol Buffer
Raw Normal View History

2022-07-17 01:09:09 +00:00
syntax = "proto3";
2022-07-17 08:42:58 +00:00
option go_package = "git.itzana.me/strafesnet/go-grpc/transactions";
2022-07-17 01:09:09 +00:00
package transactions;
2022-07-17 06:23:42 +00:00
import "users.proto";
2022-07-17 01:09:09 +00:00
import "google/protobuf/struct.proto";
service TransactionsService {
rpc Create(TransactionCreate) returns (IdMessage);
rpc Update(TransactionUpdate) returns (NullResponse);
rpc Delete(IdMessage) returns (NullResponse);
rpc Balance(UserIdMessage) returns (BalanceResponse);
rpc Get(IdMessage) returns (TransactionItem);
rpc List(ListRequest) returns (TransactionList);
}
message TransactionCreate {
string ID = 1;
int64 UserID = 2;
int64 Value = 3;
int32 StateID = 4;
google.protobuf.Struct Data = 5;
2022-07-17 01:09:09 +00:00
}
message TransactionUpdate {
string ID = 1;
optional int64 Value = 2;
2024-07-15 21:43:31 +00:00
optional int32 StateID = 3;
2022-07-17 01:09:09 +00:00
optional google.protobuf.Struct Data = 4;
}
message TransactionItem {
string ID = 1;
users.UserResponse User = 2;
int64 Value = 3;
int32 StateID = 4;
int64 Created = 5;
int64 Updated = 6;
google.protobuf.Struct Data = 7;
}
message TransactionFilter {
optional int64 UserID = 1;
optional int32 StateID = 2;
}
message ListRequest {
TransactionFilter Filter = 1;
Pagination Page = 2;
}
message Pagination {
int32 Size = 1;
int32 Number = 2;
}
message TransactionList {
repeated TransactionItem Transactions = 1;
}
message BalanceResponse {
int64 Balance = 1;
}
message IdMessage {
string ID = 1;
}
message UserIdMessage {
int64 UserID = 1;
}
message NullResponse {
}