diff --git a/bankdemo/v1/api/business/bank_demo.proto b/bankdemo/v1/api/business/bank_demo.proto index ab652d7..895eff3 100644 --- a/bankdemo/v1/api/business/bank_demo.proto +++ b/bankdemo/v1/api/business/bank_demo.proto @@ -28,5 +28,7 @@ message GetClientListResponse { // Service BankDemo service BankDemo { // Get client list - rpc GetClientList(GetClientListRequest) returns (GetClientListResponse); + rpc GetClientList(GetClientListRequest) returns (GetClientListResponse) { + option deprecated = true; + }; } \ No newline at end of file diff --git a/bankdemo/v2/api/business/bank_demo.proto b/bankdemo/v2/api/business/bank_demo.proto new file mode 100644 index 0000000..815359a --- /dev/null +++ b/bankdemo/v2/api/business/bank_demo.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; + +package com.arvgord.api.grpc.bankdemo.v2; + +import "bankdemo/v2/messages/client_list_item.proto"; +import "bankdemo/v2/messages/extracting_strategy.proto"; +import "bankdemo/v2/messages/page_request.proto"; +import "google/protobuf/wrappers.proto"; + +// Get client list request +message GetClientListRequest { + // Current page + PageRequest page_request = 1; + // Extracting strategy + ExtractingStrategy extracting_strategy = 2; +} + +// Get client list response +message GetClientListResponse { + // Clients + repeated ClientListItem clients = 1; + // Total number of clients + google.protobuf.Int64Value total_clients = 2; + // Total number of pages + google.protobuf.Int32Value total_pages = 3; +} + +// Service BankDemo +service BankDemo { + // Get client list + rpc GetClientList(GetClientListRequest) returns (GetClientListResponse); +} \ No newline at end of file diff --git a/bankdemo/v2/messages/address.proto b/bankdemo/v2/messages/address.proto new file mode 100644 index 0000000..c0ef156 --- /dev/null +++ b/bankdemo/v2/messages/address.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; + +package com.arvgord.api.grpc.bankdemo.v2; + +import "google/protobuf/wrappers.proto"; + +// Address of client +message Address { + // Client city + google.protobuf.StringValue city = 1; + // Client street + google.protobuf.StringValue street = 2; + // Client house + google.protobuf.StringValue house = 3; + // Client postal code + google.protobuf.StringValue postal_code = 4; +} \ No newline at end of file diff --git a/bankdemo/v2/messages/client_list_item.proto b/bankdemo/v2/messages/client_list_item.proto new file mode 100644 index 0000000..3efecc9 --- /dev/null +++ b/bankdemo/v2/messages/client_list_item.proto @@ -0,0 +1,35 @@ +syntax = "proto3"; + +package com.arvgord.api.grpc.bankdemo.v2; + +import "bankdemo/v2/messages/address.proto"; +import "bankdemo/v2/messages/client_name.proto"; +import "google/protobuf/wrappers.proto"; + +// Message with client info +message ClientListItem { + // Client name + ClientName client_name = 1; + // Client address + Address client_address = 2; + // Total number of client accounts + google.protobuf.Int32Value total_accounts = 3; + // Balance on all client accounts + google.protobuf.StringValue total_accounts_balance = 4; + // Total number of client deposits + google.protobuf.Int32Value total_deposits = 5; + // Amount of all client deposits + google.protobuf.StringValue total_deposits_amount = 6; + // Average rate of all client deposits + google.protobuf.StringValue avg_deposits_rate = 7; + // Total number of client loans + google.protobuf.Int32Value total_loans = 8; + // Amount of all client loans + google.protobuf.StringValue total_loans_amount = 9; + // Average rate of all client loans + google.protobuf.StringValue avg_loans_rate = 10; + // Total number of client transfers + google.protobuf.Int32Value total_transfers = 11; + // Amount of all client transfers + google.protobuf.StringValue total_transfers_amount = 12; +} \ No newline at end of file diff --git a/bankdemo/v2/messages/client_name.proto b/bankdemo/v2/messages/client_name.proto new file mode 100644 index 0000000..e8406a2 --- /dev/null +++ b/bankdemo/v2/messages/client_name.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +package com.arvgord.api.grpc.bankdemo.v2; + +import "google/protobuf/wrappers.proto"; + +// Client name +message ClientName { + // Client first name + google.protobuf.StringValue first_name = 1; + // Client middle name + google.protobuf.StringValue middle_name = 2; + // Client last name + google.protobuf.StringValue last_name =3; +} \ No newline at end of file diff --git a/bankdemo/v2/messages/extracting_strategy.proto b/bankdemo/v2/messages/extracting_strategy.proto new file mode 100644 index 0000000..8591b65 --- /dev/null +++ b/bankdemo/v2/messages/extracting_strategy.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; + +package com.arvgord.api.grpc.bankdemo.v2; + +// How to extract clients info from DB +enum ExtractingStrategy { + // Extracting strategy not specified + EXTRACTING_STRATEGY_UNSPECIFIED = 0; + // Lazy extraction + EXTRACTING_STRATEGY_LAZY = 1; + // Eager extraction + EXTRACTING_STRATEGY_EAGER = 2; + // Extract by batch + EXTRACTING_STRATEGY_BATCH = 3; + // Extract with the help of criteria api + EXTRACTING_STRATEGY_CRITERIA = 4; + // Lazy extraction with entity graph + EXTRACTING_STRATEGY_ENTITY_GRAPH = 5; + // Lazy extraction with entity graph pageable + EXTRACTING_STRATEGY_ENTITY_GRAPH_PAGEABLE = 6; + // Lazy extraction with entity graph pageable except some fields + EXTRACTING_STRATEGY_ENTITY_GRAPH_PAGEABLE_SKIP_FIELDS = 7; +} \ No newline at end of file diff --git a/bankdemo/v2/messages/page_request.proto b/bankdemo/v2/messages/page_request.proto new file mode 100644 index 0000000..5ffb1ca --- /dev/null +++ b/bankdemo/v2/messages/page_request.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +package com.arvgord.api.grpc.bankdemo.v2; + +import "google/protobuf/wrappers.proto"; + +// Page +message PageRequest { + // Number of clients on page + google.protobuf.Int32Value page = 1; + // Page size + google.protobuf.Int32Value size = 2; +} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 0d7f5cf..3382ca9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,7 @@ plugins { } group = "com.arvgord" -version = "0.0.2" +version = "1.0.0" repositories { mavenCentral() diff --git a/proto.lock b/proto.lock index d87950e..2c0795a 100644 --- a/proto.lock +++ b/proto.lock @@ -48,7 +48,13 @@ { "name": "GetClientList", "in_type": "GetClientListRequest", - "out_type": "GetClientListResponse" + "out_type": "GetClientListResponse", + "options": [ + { + "name": "deprecated", + "value": "true" + } + ] } ] } @@ -313,6 +319,315 @@ "name": "com.arvgord.api.grpc.bankdemo.v1" } } + }, + { + "protopath": "v2:/:api:/:business:/:bank_demo.proto", + "def": { + "messages": [ + { + "name": "GetClientListRequest", + "fields": [ + { + "id": 1, + "name": "page_request", + "type": "PageRequest" + }, + { + "id": 2, + "name": "extracting_strategy", + "type": "ExtractingStrategy" + } + ] + }, + { + "name": "GetClientListResponse", + "fields": [ + { + "id": 1, + "name": "clients", + "type": "ClientListItem", + "is_repeated": true + }, + { + "id": 2, + "name": "total_clients", + "type": "google.protobuf.Int64Value" + }, + { + "id": 3, + "name": "total_pages", + "type": "google.protobuf.Int32Value" + } + ] + } + ], + "services": [ + { + "name": "BankDemo", + "rpcs": [ + { + "name": "GetClientList", + "in_type": "GetClientListRequest", + "out_type": "GetClientListResponse" + } + ] + } + ], + "imports": [ + { + "path": "bankdemo/v2/messages/client_list_item.proto" + }, + { + "path": "bankdemo/v2/messages/extracting_strategy.proto" + }, + { + "path": "bankdemo/v2/messages/page_request.proto" + }, + { + "path": "google/protobuf/wrappers.proto" + } + ], + "package": { + "name": "com.arvgord.api.grpc.bankdemo.v2" + } + } + }, + { + "protopath": "v2:/:messages:/:address.proto", + "def": { + "messages": [ + { + "name": "Address", + "fields": [ + { + "id": 1, + "name": "city", + "type": "google.protobuf.StringValue" + }, + { + "id": 2, + "name": "street", + "type": "google.protobuf.StringValue" + }, + { + "id": 3, + "name": "house", + "type": "google.protobuf.StringValue" + }, + { + "id": 4, + "name": "postal_code", + "type": "google.protobuf.StringValue" + } + ] + } + ], + "imports": [ + { + "path": "google/protobuf/wrappers.proto" + } + ], + "package": { + "name": "com.arvgord.api.grpc.bankdemo.v2" + } + } + }, + { + "protopath": "v2:/:messages:/:client_list_item.proto", + "def": { + "messages": [ + { + "name": "ClientListItem", + "fields": [ + { + "id": 1, + "name": "client_name", + "type": "ClientName" + }, + { + "id": 2, + "name": "client_address", + "type": "Address" + }, + { + "id": 3, + "name": "total_accounts", + "type": "google.protobuf.Int32Value" + }, + { + "id": 4, + "name": "total_accounts_balance", + "type": "google.protobuf.StringValue" + }, + { + "id": 5, + "name": "total_deposits", + "type": "google.protobuf.Int32Value" + }, + { + "id": 6, + "name": "total_deposits_amount", + "type": "google.protobuf.StringValue" + }, + { + "id": 7, + "name": "avg_deposits_rate", + "type": "google.protobuf.StringValue" + }, + { + "id": 8, + "name": "total_loans", + "type": "google.protobuf.Int32Value" + }, + { + "id": 9, + "name": "total_loans_amount", + "type": "google.protobuf.StringValue" + }, + { + "id": 10, + "name": "avg_loans_rate", + "type": "google.protobuf.StringValue" + }, + { + "id": 11, + "name": "total_transfers", + "type": "google.protobuf.Int32Value" + }, + { + "id": 12, + "name": "total_transfers_amount", + "type": "google.protobuf.StringValue" + } + ] + } + ], + "imports": [ + { + "path": "bankdemo/v2/messages/address.proto" + }, + { + "path": "bankdemo/v2/messages/client_name.proto" + }, + { + "path": "google/protobuf/wrappers.proto" + } + ], + "package": { + "name": "com.arvgord.api.grpc.bankdemo.v2" + } + } + }, + { + "protopath": "v2:/:messages:/:client_name.proto", + "def": { + "messages": [ + { + "name": "ClientName", + "fields": [ + { + "id": 1, + "name": "first_name", + "type": "google.protobuf.StringValue" + }, + { + "id": 2, + "name": "middle_name", + "type": "google.protobuf.StringValue" + }, + { + "id": 3, + "name": "last_name", + "type": "google.protobuf.StringValue" + } + ] + } + ], + "imports": [ + { + "path": "google/protobuf/wrappers.proto" + } + ], + "package": { + "name": "com.arvgord.api.grpc.bankdemo.v2" + } + } + }, + { + "protopath": "v2:/:messages:/:extracting_strategy.proto", + "def": { + "enums": [ + { + "name": "ExtractingStrategy", + "enum_fields": [ + { + "name": "EXTRACTING_STRATEGY_UNSPECIFIED" + }, + { + "name": "EXTRACTING_STRATEGY_LAZY", + "integer": 1 + }, + { + "name": "EXTRACTING_STRATEGY_EAGER", + "integer": 2 + }, + { + "name": "EXTRACTING_STRATEGY_BATCH", + "integer": 3 + }, + { + "name": "EXTRACTING_STRATEGY_CRITERIA", + "integer": 4 + }, + { + "name": "EXTRACTING_STRATEGY_ENTITY_GRAPH", + "integer": 5 + }, + { + "name": "EXTRACTING_STRATEGY_ENTITY_GRAPH_PAGEABLE", + "integer": 6 + }, + { + "name": "EXTRACTING_STRATEGY_ENTITY_GRAPH_PAGEABLE_SKIP_FIELDS", + "integer": 7 + } + ] + } + ], + "package": { + "name": "com.arvgord.api.grpc.bankdemo.v2" + } + } + }, + { + "protopath": "v2:/:messages:/:page_request.proto", + "def": { + "messages": [ + { + "name": "PageRequest", + "fields": [ + { + "id": 1, + "name": "page", + "type": "google.protobuf.Int32Value" + }, + { + "id": 2, + "name": "size", + "type": "google.protobuf.Int32Value" + } + ] + } + ], + "imports": [ + { + "path": "google/protobuf/wrappers.proto" + } + ], + "package": { + "name": "com.arvgord.api.grpc.bankdemo.v2" + } + } } ] } \ No newline at end of file