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) {} rpc VerifyEmail(VerifyEmailRequest) returns(VerifyEmailResponse) {} rpc SendVerificationEmail(SendVerificationEmailRequest) returns (SendVerificationEmailResponse) {} } 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; bool verified = 6; int64 verificationDate = 7; // Store any custom data you want about your users in this fields. map profile = 8; } message Session { // the session id string id = 1; // 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 { Account account = 1; } // 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 { } message VerifyEmailRequest{ string token = 1; } message VerifyEmailResponse{ } // Send a verification email // to the user being signed up. Email from will be 'support@m3o.com', // but you can provide the title and contents. // Use $micro_verification_link template variable in the content. message SendVerificationEmailRequest{ string email = 1; string subject = 2; // Example: 'Hi there, welcome onboard! Use the link below to verify your email: $micro_verification_link' // The variable will be replaced with an actual url that will look similar to this: // 'https://user.m3o.com/user/verify?token=a-verification-token&rediretUrl=your-redir-url' // HTML emails are not available currently. string textContent = 3; string redirectUrl = 4; // While the from email address can't be changed, // the from name (ie. sender name) can. string fromName = 5; } message SendVerificationEmailResponse{}