mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-12 03:05:14 +00:00
137 lines
2.4 KiB
Protocol Buffer
137 lines
2.4 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package user;
|
|
|
|
option go_package = "./proto;user";
|
|
|
|
service User {
|
|
rpc Create(CreateRequest) returns (CreateResponse) {}
|
|
rpc Read(ReadRequest) returns (ReadResponse) {}
|
|
rpc Update(UpdateRequest) returns (UpdateResponse) {}
|
|
rpc Delete(DeleteRequest) returns (DeleteResponse) {}
|
|
rpc UpdatePassword(UpdatePasswordRequest) returns (UpdatePasswordResponse) {}
|
|
rpc Login(LoginRequest) returns (LoginResponse) {}
|
|
rpc Logout(LogoutRequest) returns (LogoutResponse) {}
|
|
rpc ReadSession(ReadSessionRequest) returns(ReadSessionResponse) {}
|
|
}
|
|
|
|
message Account {
|
|
// unique account id
|
|
string id = 1;
|
|
// alphanumeric username
|
|
string username = 2;
|
|
// an email address
|
|
string email = 3;
|
|
// unix timestamp
|
|
int64 created = 4;
|
|
// unix timestamp
|
|
int64 updated = 5;
|
|
}
|
|
|
|
message Session {
|
|
// the session id
|
|
string id = 1;
|
|
// account username
|
|
string username = 2;
|
|
// account email
|
|
string email = 3;
|
|
// unix timestamp
|
|
int64 created = 4;
|
|
// unix timestamp
|
|
int64 expires = 5;
|
|
}
|
|
|
|
// Create a new user account
|
|
message CreateRequest {
|
|
// the acccount id
|
|
string id = 1;
|
|
// the username
|
|
string username = 2;
|
|
// the email address
|
|
string email = 3;
|
|
// the user password
|
|
string password = 4;
|
|
}
|
|
|
|
message CreateResponse {
|
|
}
|
|
|
|
// Delete an account by id
|
|
message DeleteRequest {
|
|
// the account id
|
|
string id = 1;
|
|
}
|
|
|
|
message DeleteResponse {
|
|
}
|
|
|
|
// Read an account by id
|
|
message ReadRequest {
|
|
// the account id
|
|
string id = 1;
|
|
string username = 2;
|
|
string email = 3;
|
|
}
|
|
|
|
message ReadResponse {
|
|
Account account = 1;
|
|
}
|
|
|
|
// Update the account username or email
|
|
message UpdateRequest {
|
|
// the account id
|
|
string id = 1;
|
|
// the new username
|
|
string username = 2;
|
|
// the new email address
|
|
string email = 3;
|
|
}
|
|
|
|
message UpdateResponse {
|
|
}
|
|
|
|
// Update the account password
|
|
message UpdatePasswordRequest {
|
|
// the account id
|
|
string userId = 1;
|
|
// the old password
|
|
string oldPassword = 2;
|
|
// the new password
|
|
string newPassword = 3;
|
|
// confirm new password
|
|
string confirm_password = 4;
|
|
}
|
|
|
|
message UpdatePasswordResponse {
|
|
}
|
|
|
|
// Read a session by id
|
|
message ReadSessionRequest {
|
|
string sessionId = 1;
|
|
}
|
|
|
|
message ReadSessionResponse {
|
|
Session session = 1;
|
|
}
|
|
|
|
|
|
// Login a user account
|
|
message LoginRequest {
|
|
string username = 1;
|
|
string email = 2;
|
|
string password = 3;
|
|
}
|
|
|
|
message LoginResponse {
|
|
Session session = 1;
|
|
}
|
|
|
|
// Logout a user account
|
|
message LogoutRequest {
|
|
string sessionId = 1;
|
|
}
|
|
|
|
message LogoutResponse {
|
|
}
|
|
|