summaryrefslogtreecommitdiff
path: root/src/jwebmail/model/jwebmail.proto
blob: e4cba3baaf3b7fc0410dc36ba04913efcc1dce05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
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 {
}

message AddFolderReq {
  string name = 1;
}

message AddFolderResp {
  int32 status = 1;
}

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);
  rpc AddFolder(AddFolderReq) returns (AddFolderResp);
}