syntax = "proto3"; package jwebmail; message MIMEHeader { enum ContentDisposition { CONTENT_DISPOSITION_NONE = 0; CONTENT_DISPOSITION_INLINE = 1; CONTENT_DISPOSITION_ATTACHMENT = 2; } string maintype = 1; string subtype = 2; ContentDisposition contentdispo = 3; optional string file_name = 4; } message MailHeader { message MailAddr { optional string name = 1; string address = 2; } string send_date = 1; repeated MailAddr written_from = 2; optional MailAddr sender = 3; repeated MailAddr reply_to = 4; repeated MailAddr send_to = 5; repeated MailAddr cc = 6; repeated MailAddr bcc = 7; string subject = 8; repeated string comments = 9; repeated string keywords = 10; MIMEHeader mime = 11; } message ListMailHeader { uint64 byte_size = 1; bool unread = 2; string rec_date = 3; string mid = 4; MailHeader header = 5; } message MailBody { message Multipart { optional string preamble = 1; repeated MIMEPart parts = 2; optional string epilogue = 3; } oneof Body { string discrete = 1; Multipart multipart = 2; Mail mail = 3; } } message Mail { MailHeader head = 1; MailBody body = 2; } message MIMEPart { MIMEHeader mime_header = 1; MailBody body = 2; } // Request-Response pairs message ListReq { string folder = 1; int32 start = 2; int32 end = 3; string sort = 4; } message ListResp { repeated ListMailHeader mail_heads = 1; } message StatsReq { string folder = 1; } message StatsResp { uint32 mail_count = 1; uint32 unread_count = 2; uint64 byte_size = 3; } message ShowReq { string folder = 1; string mid = 2; } message ShowResp { Mail mail = 1; } message RawReq { string folder = 1; string mid = 2; optional string path = 3; } message RawResp { MIMEHeader header = 1; bytes body = 2; } message SearchReq { string folder = 1; string pattern = 2; } message SearchResp { repeated ListMailHeader found = 1; } message FoldersReq { } message FoldersResp { repeated string folders = 1; } message MoveReq { string mid = 1; string from_f = 2; string to_f = 3; } message MoveResp { } message RemoveReq { string folder = 1; string mid = 2; } message RemoveResp { } service MailService { rpc List(ListReq) returns (ListResp); rpc Stats(StatsReq) returns (StatsResp); rpc Show(ShowReq) returns (ShowResp); rpc Raw(RawReq) returns (RawResp); rpc Search(SearchReq) returns (SearchResp); rpc Folders(FoldersReq) returns (FoldersResp); rpc Move(MoveReq) returns (MoveResp); rpc Remove(RemoveReq) returns (RemoveResp); }