Remove Auth and AuthResponse protobuf messages

This commit is contained in:
Max Brunsfeld 2021-08-19 17:24:54 -07:00
parent a4882169c2
commit 467512eedd
3 changed files with 27 additions and 50 deletions

View file

@ -8,31 +8,29 @@ message Envelope {
oneof payload {
Ping ping = 4;
Pong pong = 5;
Auth auth = 6;
AuthResponse auth_response = 7;
ShareWorktree share_worktree = 8;
ShareWorktreeResponse share_worktree_response = 9;
OpenWorktree open_worktree = 10;
OpenWorktreeResponse open_worktree_response = 11;
UpdateWorktree update_worktree = 12;
CloseWorktree close_worktree = 13;
OpenBuffer open_buffer = 14;
OpenBufferResponse open_buffer_response = 15;
CloseBuffer close_buffer = 16;
UpdateBuffer update_buffer = 17;
SaveBuffer save_buffer = 18;
BufferSaved buffer_saved = 19;
AddPeer add_peer = 20;
RemovePeer remove_peer = 21;
GetChannels get_channels = 22;
GetChannelsResponse get_channels_response = 23;
GetUsers get_users = 24;
GetUsersResponse get_users_response = 25;
JoinChannel join_channel = 26;
JoinChannelResponse join_channel_response = 27;
LeaveChannel leave_channel = 28;
SendChannelMessage send_channel_message = 29;
ChannelMessageSent channel_message_sent = 30;
ShareWorktree share_worktree = 6;
ShareWorktreeResponse share_worktree_response = 7;
OpenWorktree open_worktree = 8;
OpenWorktreeResponse open_worktree_response = 9;
UpdateWorktree update_worktree = 10;
CloseWorktree close_worktree = 11;
OpenBuffer open_buffer = 12;
OpenBufferResponse open_buffer_response = 13;
CloseBuffer close_buffer = 14;
UpdateBuffer update_buffer = 15;
SaveBuffer save_buffer = 16;
BufferSaved buffer_saved = 17;
AddPeer add_peer = 18;
RemovePeer remove_peer = 19;
GetChannels get_channels = 20;
GetChannelsResponse get_channels_response = 21;
GetUsers get_users = 22;
GetUsersResponse get_users_response = 23;
JoinChannel join_channel = 24;
JoinChannelResponse join_channel_response = 25;
LeaveChannel leave_channel = 26;
SendChannelMessage send_channel_message = 27;
ChannelMessageSent channel_message_sent = 28;
}
}
@ -46,15 +44,6 @@ message Pong {
int32 id = 2;
}
message Auth {
int32 user_id = 1;
string access_token = 2;
}
message AuthResponse {
bool credentials_valid = 1;
}
message ShareWorktree {
Worktree worktree = 1;
}

View file

@ -514,13 +514,7 @@ mod tests {
smol::spawn(async move { incoming.next().await }).detach();
let err = client
.request(
connection_id,
proto::Auth {
user_id: 42,
access_token: "token".to_string(),
},
)
.request(connection_id, proto::Ping { id: 42 })
.await
.unwrap_err();
assert_eq!(err.to_string(), "connection was closed");

View file

@ -126,8 +126,6 @@ macro_rules! entity_messages {
messages!(
AddPeer,
Auth,
AuthResponse,
BufferSaved,
ChannelMessageSent,
CloseBuffer,
@ -148,6 +146,7 @@ messages!(
RemovePeer,
SaveBuffer,
SendChannelMessage,
SendChannelMessageResponse,
ShareWorktree,
ShareWorktreeResponse,
UpdateBuffer,
@ -155,7 +154,6 @@ messages!(
);
request_messages!(
(Auth, AuthResponse),
(GetChannels, GetChannelsResponse),
(GetUsers, GetUsersResponse),
(JoinChannel, JoinChannelResponse),
@ -164,6 +162,7 @@ request_messages!(
(Ping, Pong),
(SaveBuffer, BufferSaved),
(ShareWorktree, ShareWorktreeResponse),
(SendChannelMessage, SendChannelMessageResponse),
);
entity_messages!(
@ -259,12 +258,7 @@ mod tests {
fn test_round_trip_message() {
smol::block_on(async {
let stream = test::Channel::new();
let message1 = Auth {
user_id: 5,
access_token: "the-access-token".into(),
}
.into_envelope(3, None, None);
let message1 = Ping { id: 5 }.into_envelope(3, None, None);
let message2 = OpenBuffer {
worktree_id: 0,
path: "some/path".to_string(),