235 lines
5.4 KiB
Protocol Buffer
235 lines
5.4 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package bot;
|
|
|
|
service BotService {
|
|
rpc CreateBot (CreateBotRequest) returns (BotCredentialsResponse);
|
|
rpc RevokeBotToken (RevokeBotTokenRequest) returns (BotCredentialsResponse);
|
|
rpc SetBotWebApp (SetBotWebAppRequest) returns (BotResponse);
|
|
rpc ListMyBots (ListMyBotsRequest) returns (ListBotsResponse);
|
|
rpc GetBot (GetBotRequest) returns (BotResponse);
|
|
rpc UpdateBot (UpdateBotRequest) returns (BotResponse);
|
|
rpc UpdateBotProfile (UpdateBotProfileRequest) returns (BotResponse);
|
|
rpc DeleteBot (DeleteBotRequest) returns (MutationResponse);
|
|
rpc ListAllBots (ListAllBotsRequest) returns (ListBotsResponse);
|
|
rpc SetBotActive (SetBotActiveRequest) returns (BotResponse);
|
|
rpc GetBotMetrics (GetBotMetricsRequest) returns (BotMetricsResponse);
|
|
rpc ValidateBotToken (ValidateBotTokenRequest) returns (ValidatedBotResponse);
|
|
rpc ExecuteBotMethod (ExecuteBotMethodRequest) returns (ExecuteBotMethodResponse);
|
|
rpc ValidateWebAppInitData (ValidateWebAppInitDataRequest) returns (ValidateWebAppInitDataResponse);
|
|
rpc SubmitBotInboundMessage (SubmitBotInboundMessageRequest) returns (SubmitBotInboundMessageResponse);
|
|
rpc SubmitBotCallbackQuery (SubmitBotCallbackQueryRequest) returns (SubmitBotCallbackQueryResponse);
|
|
rpc ListBotChatMessages (ListBotChatMessagesRequest) returns (ListBotChatMessagesResponse);
|
|
}
|
|
|
|
message CreateBotRequest {
|
|
string ownerId = 1;
|
|
string name = 2;
|
|
string username = 3;
|
|
}
|
|
|
|
message RevokeBotTokenRequest {
|
|
string requesterId = 1;
|
|
string botId = 2;
|
|
bool isSuperAdmin = 3;
|
|
}
|
|
|
|
message SetBotWebAppRequest {
|
|
string requesterId = 1;
|
|
string botId = 2;
|
|
optional string webAppUrl = 3;
|
|
bool isSuperAdmin = 4;
|
|
}
|
|
|
|
message ListMyBotsRequest {
|
|
string ownerId = 1;
|
|
}
|
|
|
|
message GetBotRequest {
|
|
string requesterId = 1;
|
|
string botId = 2;
|
|
bool isSuperAdmin = 3;
|
|
}
|
|
|
|
message UpdateBotRequest {
|
|
string requesterId = 1;
|
|
string botId = 2;
|
|
optional string name = 3;
|
|
optional string username = 4;
|
|
bool isSuperAdmin = 5;
|
|
}
|
|
|
|
message UpdateBotProfileRequest {
|
|
string requesterId = 1;
|
|
string botId = 2;
|
|
optional string description = 3;
|
|
optional string aboutText = 4;
|
|
optional string botPicUrl = 5;
|
|
optional string menuButtonJson = 6;
|
|
optional string menuButtonUrl = 7;
|
|
optional string menuButtonText = 8;
|
|
bool isSuperAdmin = 9;
|
|
}
|
|
|
|
message DeleteBotRequest {
|
|
string requesterId = 1;
|
|
string botId = 2;
|
|
bool isSuperAdmin = 3;
|
|
}
|
|
|
|
message ListAllBotsRequest {
|
|
string requesterId = 1;
|
|
bool isSuperAdmin = 2;
|
|
optional string search = 3;
|
|
int32 page = 4;
|
|
int32 limit = 5;
|
|
}
|
|
|
|
message SetBotActiveRequest {
|
|
string requesterId = 1;
|
|
string botId = 2;
|
|
bool isActive = 3;
|
|
bool isSuperAdmin = 4;
|
|
}
|
|
|
|
message GetBotMetricsRequest {
|
|
string requesterId = 1;
|
|
bool isSuperAdmin = 2;
|
|
}
|
|
|
|
message ValidateBotTokenRequest {
|
|
string token = 1;
|
|
}
|
|
|
|
message ExecuteBotMethodRequest {
|
|
string token = 1;
|
|
string method = 2;
|
|
string payloadJson = 3;
|
|
}
|
|
|
|
message ValidateWebAppInitDataRequest {
|
|
string initData = 1;
|
|
string botToken = 2;
|
|
}
|
|
|
|
message BotOwnerResponse {
|
|
string id = 1;
|
|
string displayName = 2;
|
|
optional string username = 3;
|
|
}
|
|
|
|
message BotResponse {
|
|
string id = 1;
|
|
string name = 2;
|
|
string username = 3;
|
|
string tokenPrefix = 4;
|
|
string ownerId = 5;
|
|
optional string webAppUrl = 6;
|
|
bool isActive = 7;
|
|
bool isSystemBot = 8;
|
|
string createdAt = 9;
|
|
string updatedAt = 10;
|
|
optional BotOwnerResponse owner = 11;
|
|
int32 messageCount = 12;
|
|
int32 chatCount = 13;
|
|
optional string description = 14;
|
|
optional string aboutText = 15;
|
|
optional string botPicUrl = 16;
|
|
optional string menuButtonJson = 17;
|
|
}
|
|
|
|
message BotCredentialsResponse {
|
|
BotResponse bot = 1;
|
|
string token = 2;
|
|
}
|
|
|
|
message ListBotsResponse {
|
|
repeated BotResponse bots = 1;
|
|
int32 total = 2;
|
|
}
|
|
|
|
message BotMetricsResponse {
|
|
int32 totalBots = 1;
|
|
int32 activeBots = 2;
|
|
int32 blockedBots = 3;
|
|
int32 totalMessages = 4;
|
|
int32 totalChats = 5;
|
|
}
|
|
|
|
message ValidatedBotResponse {
|
|
string id = 1;
|
|
string name = 2;
|
|
string username = 3;
|
|
string ownerId = 4;
|
|
optional string webAppUrl = 5;
|
|
bool isActive = 6;
|
|
bool isSystemBot = 7;
|
|
}
|
|
|
|
message ExecuteBotMethodResponse {
|
|
string responseJson = 1;
|
|
int32 httpStatus = 2;
|
|
}
|
|
|
|
message ValidateWebAppInitDataResponse {
|
|
bool valid = 1;
|
|
optional string userJson = 2;
|
|
optional string authDate = 3;
|
|
optional string error = 4;
|
|
}
|
|
|
|
message MutationResponse {
|
|
int32 count = 1;
|
|
}
|
|
|
|
message SubmitBotInboundMessageRequest {
|
|
string senderUserId = 1;
|
|
string botRef = 2;
|
|
string text = 3;
|
|
}
|
|
|
|
message SubmitBotInboundMessageResponse {
|
|
int32 updateId = 1;
|
|
int32 messageId = 2;
|
|
string chatId = 3;
|
|
}
|
|
|
|
message SubmitBotCallbackQueryRequest {
|
|
string senderUserId = 1;
|
|
string botRef = 2;
|
|
int32 messageId = 3;
|
|
string callbackData = 4;
|
|
}
|
|
|
|
message SubmitBotCallbackQueryResponse {
|
|
int32 updateId = 1;
|
|
string callbackQueryId = 2;
|
|
int32 messageId = 3;
|
|
}
|
|
|
|
message ListBotChatMessagesRequest {
|
|
string userId = 1;
|
|
string botRef = 2;
|
|
}
|
|
|
|
message BotChatMessageItem {
|
|
string id = 1;
|
|
string direction = 2;
|
|
string text = 3;
|
|
string messageType = 4;
|
|
int32 messageId = 5;
|
|
string createdAt = 6;
|
|
optional string replyMarkupJson = 7;
|
|
}
|
|
|
|
message ListBotChatMessagesResponse {
|
|
repeated BotChatMessageItem messages = 1;
|
|
string botUsername = 2;
|
|
string botDisplayName = 3;
|
|
optional string composerWebAppUrl = 4;
|
|
optional string botId = 5;
|
|
optional string botOwnerId = 6;
|
|
optional string manageWebAppUrl = 7;
|
|
optional string composerMenuButtonJson = 8;
|
|
}
|