cake_crm/api/main.proto

188 lines
3.3 KiB
Protocol Buffer

syntax = "proto3";
package crabs.crm;
import "google/api/annotations.proto";
import "google/api/httpbody.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option go_package = "pkg/proto";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {};
service CRM {
rpc GetCatalog(GetCatalogReq) returns (CatalogRsp) {
option (google.api.http) = {
get: "/catalog"
};
}
rpc GetPositions(GetPositionsReq) returns (PositionsRsp) {
option (google.api.http) = {
get: "/positions/{id}"
};
}
rpc GetProduct(GetProductReq) returns (ProductRsp) {
option (google.api.http) = {
get: "/products/{id}"
};
}
rpc GetBreadcrumbs(GetBreadcrumbsReq) returns (BreadcrumbsRsp) {
option (google.api.http) = {
get: "/products/{id}/breadcrumbs"
};
}
rpc Order(OrderReq) returns (OrderRsp) {
option (google.api.http) = {
post: "/orders"
body: "order"
};
}
rpc GetCart(CartReq) returns (CartRsp) {
option (google.api.http) = {
post: "/cart"
body: "items"
};
}
rpc GetImage(GetImageReq) returns (google.api.HttpBody) {
option (google.api.http) = {
get: "/images/{name}"
};
}
rpc Search(SearchReq) returns (PositionsRsp) {
option (google.api.http) = {
get: "/search"
};
}
}
message GetCatalogReq {}
message CatalogRsp {
repeated Category categories = 1;
}
message Category {
int64 id = 1;
string name = 2;
string uri = 3;
repeated Category children = 4;
}
message GetPositionsReq {
int64 id = 1;
}
message PositionsRsp {
repeated Product products = 1;
}
message Product {
int64 id = 1;
string article = 2;
string name = 3;
string uri = 4;
repeated string images = 5;
string description = 6;
repeated GroupedProduct grouped_products = 7;
string unit = 8;
double inventory = 9;
repeated Variant variants = 10;
repeated Characteristic characteristics = 11;
int64 category = 12;
repeated Label labels = 13;
}
message GroupedProduct {
string name = 1;
string uri = 2;
string image = 3;
}
message Variant {
int64 price = 1;
repeated Property properties = 2;
bool active = 3;
}
message Property {
string name = 1;
string value = 2;
}
message Characteristic {
string name = 1;
string value = 2;
}
message Label {
string name = 1;
}
message GetProductReq {
int64 id = 1;
}
message ProductRsp {
Product product = 1;
}
message GetBreadcrumbsReq {
int64 id = 1;
}
message BreadcrumbsRsp {
repeated Category categories = 1;
}
message OrderReq {
Order order = 1;
}
message OrderRsp {}
message Order {
string name = 2;
string phone = 3;
repeated OrderItem items = 1;
}
message OrderItem {
int64 product_id = 1;
int64 count = 2;
}
message CartItem {
int64 id = 1;
string article = 2;
string name = 3;
string uri = 4;
repeated string images = 5;
string unit = 8;
double inventory = 9;
int64 count = 10;
int64 amount = 11;
int64 amountOld = 12;
int64 discount = 13;
repeated Variant variants = 14;
repeated Label labels = 15;
}
message CartReq {
repeated OrderItem items = 1;
}
message CartRsp {
repeated CartItem items = 1;
int64 amount = 2;
int64 amountOld = 3;
int64 discount = 4;
}
message GetImageReq {
string name = 1;
}
message SearchReq {
string text = 1;
}