Initial commit
This commit is contained in:
255
example.proto
Normal file
255
example.proto
Normal file
@@ -0,0 +1,255 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package promo;
|
||||
|
||||
option go_package = "./;pb";
|
||||
option php_namespace = "GRPC";
|
||||
option php_metadata_namespace = "GRPC\\GPBMetadata";
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
service PromoService {
|
||||
// ListProductsPromotion проверяет наличие акционных цен по товарам
|
||||
rpc ListProductsPromotion(ListProductsPromotionRequest) returns (ListProductsPromotionResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/ListProductsPromotion"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// GetPromotionsDetails возвращает общую информацию по акциям
|
||||
rpc GetPromotionsDetails(GetPromotionsDetailsRequest) returns (GetPromotionsDetailsResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/GetPromotionsDetails"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// ListPromotionsV0 список активных акций
|
||||
// возвращает список активных акций в порядке приоритета
|
||||
// для кажого типа акции может вернуться максимум 2 акции среди которых нужно выбрать первую,
|
||||
// которая подходит для текущего типа пользователя.
|
||||
// Метод сделан для переходного периода, пока сайт не может получать тип пользователя
|
||||
rpc ListPromotionsV0(ListPromotionsV0Request) returns (ListPromotionsV0Response) {
|
||||
option deprecated = true;
|
||||
option (google.api.http) = {
|
||||
post: "/ListPromotionsV0"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// ListPromotionsV1 список активных акций
|
||||
// возвращает по одной самой приоритетной акции каждого типа в порядке приоритета
|
||||
rpc ListPromotionsV1(ListPromotionsV1Request) returns (ListPromotionsV1Response) {
|
||||
option (google.api.http) = {
|
||||
post: "/ListPromotionsV1"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// GetPromotionDetails получает общую информацию об акции
|
||||
rpc GetPromotionDetails(GetPromotionDetailsRequest) returns (GetPromotionDetailsResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/GetPromotionDetails"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// GetPromotionRubrics возвращает список рубрик, в которых есть акционные товары
|
||||
rpc GetPromotionRubrics(GetPromotionRubricsRequest) returns (GetPromotionRubricsResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/GetPromotionRubrics"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// GetPromotionID возвращает ID акции по ее UUID
|
||||
rpc GetPromotionID(GetPromotionIDRequest) returns (GetPromotionIDResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/GetPromotionID"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// ListPromotion листинг акции
|
||||
rpc ListPromotion(ListPromotionRequest) returns (ListPromotionResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/ListPromotion"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message Product {
|
||||
string id = 1;
|
||||
Price promotion_price = 2;
|
||||
// availability_quantity - минимальное из 2х значений:
|
||||
// "лимит в заказе" или "максимальное количество товара которое может быть продано по акционной цене"
|
||||
float availability_quantity = 3;
|
||||
// order_limit - максимальное количество товара в заказе
|
||||
int32 order_limit = 4;
|
||||
// is_upload_to_feed - выгружать ли товар в фиды
|
||||
bool is_upload_to_feed = 5;
|
||||
}
|
||||
|
||||
message Price {
|
||||
int64 rubles = 1;
|
||||
}
|
||||
|
||||
enum OrderBy {
|
||||
ORDER_BY_UNSPECIFIED = 0;
|
||||
ORDER_BY_PROMO_PRICE = 1;
|
||||
ORDER_BY_DISCOUNT = 2;
|
||||
ORDER_BY_POPULARITY = 3;
|
||||
ORDER_BY_RATING = 4;
|
||||
ORDER_BY_REVIEWS = 5;
|
||||
}
|
||||
|
||||
enum OrderDirection {
|
||||
ORDER_DIRECTION_UNSPECIFIED = 0;
|
||||
ORDER_DIRECTION_ASC = 1;
|
||||
ORDER_DIRECTION_DESC = 2;
|
||||
}
|
||||
|
||||
message ListProductsPromotionRequest {
|
||||
repeated string product_ids = 1;
|
||||
string locality_id = 2;
|
||||
UserType user_type = 3;
|
||||
bool disable_cache = 4;
|
||||
}
|
||||
|
||||
message ListProductsPromotionResponse {
|
||||
repeated PromotionProducts promotion_products = 1;
|
||||
}
|
||||
|
||||
message PromotionProducts {
|
||||
repeated Product products = 1;
|
||||
PromotionDetails promotion_details = 2;
|
||||
}
|
||||
|
||||
message Nameplate {
|
||||
string title = 1;
|
||||
string hint_description = 2;
|
||||
string color = 3;
|
||||
string text_color = 4;
|
||||
}
|
||||
|
||||
message Meta {
|
||||
string title = 1;
|
||||
string description = 2;
|
||||
string keywords = 3;
|
||||
}
|
||||
|
||||
enum PromotionType {
|
||||
PROMOTION_TYPE_UNSPECIFIED = 0;
|
||||
PROMOTION_TYPE_BLACK_FRIDAY = 1;
|
||||
PROMOTION_TYPE_PRODUCT_OF_THE_MONTH = 2;
|
||||
PROMOTION_TYPE_SALE_IN_THE_STORE = 3;
|
||||
PROMOTION_TYPE_SUPER_PRICE = 4;
|
||||
}
|
||||
|
||||
message GetPromotionsDetailsRequest {
|
||||
repeated int32 promotion_ids = 1;
|
||||
}
|
||||
|
||||
message GetPromotionsDetailsResponse {
|
||||
repeated PromotionDetails promotion_details = 1;
|
||||
}
|
||||
|
||||
message PromotionDetails {
|
||||
int32 id = 1;
|
||||
string uuid = 2;
|
||||
string slug = 3;
|
||||
PromotionClientType client_type = 4;
|
||||
string name = 5;
|
||||
string title = 6;
|
||||
Nameplate nameplate = 7;
|
||||
Meta meta = 8;
|
||||
PromotionType type = 100;
|
||||
string description = 9;
|
||||
string frameColor = 10;
|
||||
}
|
||||
|
||||
// PromotionClientType свойство акции определяющие контрагентов для которых действует акция
|
||||
// PROMOTION_CLIENT_TYPE_ALL - акция подходит для любого клиента
|
||||
// PROMOTION_CLIENT_TYPE_B2C - акция подходит только для b2c
|
||||
// PROMOTION_CLIENT_TYPE_B2B - акция подходит только для b2b
|
||||
enum PromotionClientType {
|
||||
PROMOTION_CLIENT_TYPE_UNSPECIFIED = 0;
|
||||
PROMOTION_CLIENT_TYPE_ALL = 1;
|
||||
PROMOTION_CLIENT_TYPE_B2C = 2;
|
||||
PROMOTION_CLIENT_TYPE_B2B = 3;
|
||||
}
|
||||
|
||||
message ListPromotionsV0Request {
|
||||
string locality_id = 1;
|
||||
}
|
||||
|
||||
message ListPromotionsV0Response {
|
||||
repeated PromotionDetails promotion_details = 1;
|
||||
}
|
||||
|
||||
message ListPromotionsV1Request {
|
||||
string locality_id = 1;
|
||||
UserType user_type = 2;
|
||||
}
|
||||
|
||||
message ListPromotionsV1Response {
|
||||
repeated PromotionDetails promotion_details = 1;
|
||||
}
|
||||
|
||||
// UserType тип пользователя который делает запрос
|
||||
enum UserType {
|
||||
USER_TYPE_UNSPECIFIED = 0;
|
||||
USER_TYPE_B2C = 1;
|
||||
USER_TYPE_B2B = 2;
|
||||
}
|
||||
|
||||
message GetPromotionDetailsRequest {
|
||||
string locality_id = 1;
|
||||
UserType user_type = 2;
|
||||
string promotion_slug = 3;
|
||||
}
|
||||
|
||||
message GetPromotionDetailsResponse {
|
||||
PromotionDetails promotion_details = 1;
|
||||
}
|
||||
|
||||
message GetPromotionRubricsRequest {
|
||||
string promotion_slug = 1;
|
||||
string locality_id = 2;
|
||||
UserType user_type = 3;
|
||||
}
|
||||
|
||||
message GetPromotionRubricsResponse {
|
||||
repeated string rubric_ids = 1;
|
||||
}
|
||||
|
||||
message GetPromotionIDRequest {
|
||||
string uuid = 1;
|
||||
}
|
||||
|
||||
message GetPromotionIDResponse {
|
||||
int32 promotion_id = 1;
|
||||
}
|
||||
|
||||
message ListPromotionRequest {
|
||||
string locality_id = 1;
|
||||
UserType user_type = 2;
|
||||
string promotion_slug = 3;
|
||||
|
||||
string rubric_id = 4;
|
||||
OrderBy order_by = 7;
|
||||
OrderDirection order_direction = 8;
|
||||
|
||||
int64 page_number = 9;
|
||||
|
||||
bool disable_cache = 10;
|
||||
|
||||
int32 limit = 11;
|
||||
}
|
||||
|
||||
message ListPromotionResponse {
|
||||
repeated Product products = 1;
|
||||
int64 total_products = 2;
|
||||
}
|
||||
Reference in New Issue
Block a user