Skip to content

Commit

Permalink
chore: remove PHP files, update centrifugo API
Browse files Browse the repository at this point in the history
Signed-off-by: Valery Piashchynski <[email protected]>
  • Loading branch information
rustatian committed Mar 17, 2023
1 parent e4a6c95 commit 6bf644d
Show file tree
Hide file tree
Showing 3 changed files with 345 additions and 38 deletions.
323 changes: 320 additions & 3 deletions centrifugo/api/v1/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package centrifugal.centrifugo.api;
option go_package = "centrifugo/api/v1";

service CentrifugoApi {
rpc Batch(BatchRequest) returns (BatchResponse) {}
rpc Publish(PublishRequest) returns (PublishResponse) {}
rpc Broadcast(BroadcastRequest) returns (BroadcastResponse) {}
rpc Subscribe(SubscribeRequest) returns (SubscribeResponse) {}
Expand All @@ -26,6 +27,13 @@ service CentrifugoApi {
rpc UnblockUser(UnblockUserRequest) returns (UnblockUserResponse) {}
rpc RevokeToken(RevokeTokenRequest) returns (RevokeTokenResponse) {}
rpc InvalidateUserTokens(InvalidateUserTokensRequest) returns (InvalidateUserTokensResponse) {}
rpc DeviceRegister(DeviceRegisterRequest) returns (DeviceRegisterResponse) {}
rpc DeviceUpdate(DeviceUpdateRequest) returns (DeviceUpdateResponse) {}
rpc DeviceRemove(DeviceRemoveRequest) returns (DeviceRemoveResponse) {}
rpc DeviceList(DeviceListRequest) returns (DeviceListResponse) {}
rpc PushUserChannelList(PushUserChannelListRequest) returns (PushUserChannelListResponse) {}
rpc PushUserChannelUpdate(PushUserChannelUpdateRequest) returns (PushUserChannelUpdateResponse) {}
rpc SendPushNotification(SendPushNotificationRequest) returns (SendPushNotificationResponse) {}
}

message Command {
Expand All @@ -51,10 +59,46 @@ message Command {
UNBLOCK_USER = 19;
REVOKE_TOKEN = 20;
INVALIDATE_USER_TOKENS = 21;
DEVICE_REGISTER = 22;
DEVICE_UPDATE = 23;
DEVICE_REMOVE = 24;
DEVICE_LIST = 25;
PUSH_USER_CHANNEL_LIST = 26;
PUSH_USER_CHANNEL_UPDATE = 27;
SEND_PUSH_NOTIFICATION = 28;
}
uint32 id = 1;
MethodType method = 2;
bytes params = 3;

PublishRequest publish = 4;
BroadcastRequest broadcast = 5;
SubscribeRequest subscribe = 6;
UnsubscribeRequest unsubscribe = 7;
DisconnectRequest disconnect = 8;
PresenceRequest presence = 9;
PresenceStatsRequest presence_stats = 10;
HistoryRequest history = 11;
HistoryRemoveRequest history_remove = 12;
InfoRequest info = 13;
RPCRequest rpc = 14;
RefreshRequest refresh = 15;
ChannelsRequest channels = 16;
ConnectionsRequest connections = 17;
UpdateUserStatusRequest update_user_status = 18;
GetUserStatusRequest get_user_status = 19;
DeleteUserStatusRequest delete_user_status = 20;
BlockUserRequest block_user = 21;
UnblockUserRequest unblock_user = 22;
RevokeTokenRequest revoke_token = 23;
InvalidateUserTokensRequest invalidate_user_tokens = 24;
DeviceRegisterRequest device_register = 25;
DeviceUpdateRequest device_update = 26;
DeviceRemoveRequest device_remove = 27;
DeviceListRequest device_list = 28;
PushUserChannelListRequest push_user_channel_list = 29;
PushUserChannelUpdateRequest push_user_channel_update = 30;
SendPushNotificationRequest send_push_notification = 31;
}

message Error {
Expand All @@ -66,6 +110,35 @@ message Reply {
uint32 id = 1;
Error error = 2;
bytes result = 3;

PublishResult publish = 4;
BroadcastResult broadcast = 5;
SubscribeResult subscribe = 6;
UnsubscribeResult unsubscribe = 7;
DisconnectResult disconnect = 8;
PresenceResult presence = 9;
PresenceStatsResult presence_stats = 10;
HistoryResult history = 11;
HistoryRemoveResult history_remove = 12;
InfoResult info = 13;
RPCResult rpc = 14;
RefreshResult refresh = 15;
ChannelsResult channels = 16;
ConnectionsResult connections = 17;
UpdateUserStatusResult update_user_status = 18;
GetUserStatusResult get_user_status = 19;
DeleteUserStatusResult delete_user_status = 20;
BlockUserResult block_user = 21;
UnblockUserResult unblock_user = 22;
RevokeTokenResult revoke_token = 23;
InvalidateUserTokensResult invalidate_user_tokens = 24;
DeviceRegisterResult device_register = 25;
DeviceUpdateResult device_update = 26;
DeviceRemoveResult device_remove = 27;
DeviceListResult device_list = 28;
PushUserChannelListResult push_user_channel_list = 29;
PushUserChannelUpdateResult push_user_channel_update = 30;
SendPushNotificationResult send_push_notification = 31;
}

message BoolValue {
Expand All @@ -84,6 +157,14 @@ message SubscribeOptionOverride {
BoolValue force_push_join_leave = 5;
}

message BatchRequest {
repeated Command commands = 1;
}

message BatchResponse {
repeated Reply replies = 1;
}

message PublishRequest {
string channel = 1;
bytes data = 2;
Expand Down Expand Up @@ -227,7 +308,7 @@ message HistoryResponse {
}

message Publication {
// Removed: string uid = 1;
// Removed: string uid =1;
bytes data = 2;
ClientInfo info = 3;
uint64 offset = 4;
Expand Down Expand Up @@ -423,8 +504,7 @@ message BlockUserRequest {
string user = 2;
}

mes
sage BlockUserResult {}
message BlockUserResult {}

message BlockUserResponse {
Error error = 1;
Expand Down Expand Up @@ -466,4 +546,241 @@ message InvalidateUserTokensResult {}
message InvalidateUserTokensResponse {
Error error = 1;
InvalidateUserTokensResult result = 2;
}

message DeviceRegisterRequest {
string id = 1;
string provider = 2;
string token = 3;
string platform = 4;
string user = 5;
map<string, string> meta = 6;
map<string, string> tags = 7;
repeated string channels = 8;
}

message DeviceUpdateRequest {
repeated string ids = 1;
repeated string users = 2;
repeated DeviceProviderTokens provider_tokens = 3;

DeviceUserUpdate user_update = 4;
DeviceMetaUpdate meta_update = 5;
DeviceTagsUpdate tags_update = 6;
DeviceChannelsUpdate channels_update = 7;
}

message DeviceRemoveRequest {
repeated string ids = 1;
repeated string users = 2;
repeated DeviceProviderTokens provider_tokens = 3;
}

message DeviceUserUpdate {
string user = 1;
}

message DeviceMetaUpdate {
map<string, string> meta = 1;
}

message DeviceChannelsUpdate {
string op = 1; // add | remove | set
repeated string channels = 2;
}

message DeviceTagsUpdate {
string op = 1; // add | remove | set
map<string, string> tags = 2;
}

message DeviceProviderTokens {
string provider = 1;
repeated string tokens = 2;
}

message DeviceListRequest {
repeated string ids = 1;
repeated string providers = 2;
repeated DeviceProviderTokens provider_tokens = 3;
repeated string platforms = 4;
repeated string users = 5;
repeated string channels = 6;
string since = 7;
int32 limit = 8;
bool include_channels = 10;
bool include_meta = 11;
bool include_tags = 12;
}

message DeviceChannelListRequest {
repeated string device_ids = 1;
repeated string device_providers = 2;
repeated DeviceProviderTokens device_provider_tokens = 3;
repeated string device_platforms = 4;
repeated string device_users = 5;
repeated string channels = 6;
string since = 8;
int32 limit = 9;
bool include_device = 10;
}

message PushUserChannelListRequest {
repeated string users = 1;
repeated string channels = 2;
string since = 3;
int32 limit = 4;
}

message PushUserChannelUpdateRequest {
string user = 1;
string op = 2; // add | remove | set
repeated string channels = 3;
}

message DeviceRegisterResponse {
Error error = 1;
DeviceRegisterResult result = 2;
}

message DeviceUpdateResponse {
Error error = 1;
DeviceUpdateResult result = 2;
}

message DeviceRemoveResponse {
Error error = 1;
DeviceRemoveResult result = 2;
}

message DeviceListResponse {
Error error = 1;
DeviceListResult result = 2;
}

message DeviceChannelListResponse {
Error error = 1;
DeviceChannelListResult result = 2;
}

message PushUserChannelListResponse {
Error error = 1;
PushUserChannelListResult result = 2;
}

message PushUserChannelUpdateResponse {
Error error = 1;
PushUserChannelUpdateResult result = 2;
}

message DeviceRegisterResult {
Device device = 1;
}

message DeviceUpdateResult {}

message DeviceRemoveResult {}

message DeviceListResult {
repeated Device items = 1;
bool has_more = 2;
}

message Device {
string id = 1;
string platform = 2;
string provider = 3;
string token = 4;
string user = 5;

map<string, string> meta = 6;
repeated string channels = 7;
map<string, string> tags = 8;
}

message DeviceChannelListResult {
repeated DeviceChannel items = 1;
bool has_more = 2;
}

message DeviceChannel {
string id = 1;
string channel = 2;
Device device = 3;
}

message PushUserChannelListResult {
repeated PushUserChannel items = 1;
bool has_more = 2;
}

message PushUserChannelUpdateResult {}

message PushUserChannel {
string id = 1;
string user = 2;
string channel = 3;
}

message DeviceTagListResult {
repeated DeviceTag items = 1;
bool has_more = 2;
}

message DeviceTag {
string id = 1;
string key = 2;
string value = 3;
Device device = 4;
}

message PushRecipient {
repeated string device_ids = 1;
repeated string channels = 2;

repeated string fcm_tokens = 3;
string fcm_topic = 4;
string fcm_condition = 5;

repeated string hms_tokens = 6;
string hms_topic = 7;
string hms_condition = 8;

repeated string apns_tokens = 9;
}

message PushNotification {
FcmPushNotification fcm = 1;
HmsPushNotification hms = 2;
ApnsPushNotification apns = 3;

string uid = 4;
int64 expire_at = 5;
}

message FcmPushNotification {
bytes message = 1;
}

message HmsPushNotification {
bytes message = 1;
}

message ApnsPushNotification {
map<string, string> headers = 1;
bytes payload = 2;
}

message SendPushNotificationRequest {
PushRecipient recipient = 1;
PushNotification notification = 2;
}

message SendPushNotificationResponse {
Error error = 1;
SendPushNotificationResult result = 2;
}

message SendPushNotificationResult {
string uid = 1; // Unique identifier of notification send request (not a FCM message id).
}
Loading

0 comments on commit 6bf644d

Please sign in to comment.