]> nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/Signal.java
implement Dbus updateAccount and listDevices (#730)
[signal-cli] / src / main / java / org / asamk / Signal.java
1 package org.asamk;
2
3 import org.freedesktop.dbus.exceptions.DBusException;
4 import org.freedesktop.dbus.exceptions.DBusExecutionException;
5 import org.freedesktop.dbus.interfaces.DBusInterface;
6 import org.freedesktop.dbus.messages.DBusSignal;
7
8 import java.util.List;
9
10 /**
11 * DBus interface for the org.asamk.Signal service.
12 * Including emitted Signals and returned Errors.
13 */
14 public interface Signal extends DBusInterface {
15
16 long sendMessage(
17 String message, List<String> attachments, String recipient
18 ) throws Error.AttachmentInvalid, Error.Failure, Error.InvalidNumber, Error.UntrustedIdentity;
19
20 long sendMessage(
21 String message, List<String> attachments, List<String> recipients
22 ) throws Error.AttachmentInvalid, Error.Failure, Error.InvalidNumber, Error.UntrustedIdentity;
23
24 void sendTyping(
25 String recipient, boolean stop
26 ) throws Error.Failure, Error.GroupNotFound, Error.UntrustedIdentity;
27
28 void sendReadReceipt(
29 String recipient, List<Long> targetSentTimestamp
30 ) throws Error.Failure, Error.UntrustedIdentity;
31
32 long sendRemoteDeleteMessage(
33 long targetSentTimestamp, String recipient
34 ) throws Error.Failure, Error.InvalidNumber;
35
36 long sendRemoteDeleteMessage(
37 long targetSentTimestamp, List<String> recipients
38 ) throws Error.Failure, Error.InvalidNumber;
39
40 long sendGroupRemoteDeleteMessage(
41 long targetSentTimestamp, byte[] groupId
42 ) throws Error.Failure, Error.GroupNotFound, Error.InvalidGroupId;
43
44 long sendMessageReaction(
45 String emoji, boolean remove, String targetAuthor, long targetSentTimestamp, String recipient
46 ) throws Error.InvalidNumber, Error.Failure;
47
48 long sendMessageReaction(
49 String emoji, boolean remove, String targetAuthor, long targetSentTimestamp, List<String> recipients
50 ) throws Error.InvalidNumber, Error.Failure;
51
52 void sendContacts() throws Error.Failure;
53
54 void sendSyncRequest() throws Error.Failure;
55
56 long sendNoteToSelfMessage(
57 String message, List<String> attachments
58 ) throws Error.AttachmentInvalid, Error.Failure;
59
60 void sendEndSessionMessage(List<String> recipients) throws Error.Failure, Error.InvalidNumber, Error.UntrustedIdentity;
61
62 long sendGroupMessage(
63 String message, List<String> attachments, byte[] groupId
64 ) throws Error.GroupNotFound, Error.Failure, Error.AttachmentInvalid, Error.InvalidGroupId;
65
66 long sendGroupMessageReaction(
67 String emoji, boolean remove, String targetAuthor, long targetSentTimestamp, byte[] groupId
68 ) throws Error.GroupNotFound, Error.Failure, Error.InvalidNumber, Error.InvalidGroupId;
69
70 String getContactName(String number) throws Error.InvalidNumber;
71
72 void setContactName(String number, String name) throws Error.InvalidNumber;
73
74 void setExpirationTimer(final String number, final int expiration) throws Error.Failure;
75
76 void setContactBlocked(String number, boolean blocked) throws Error.InvalidNumber;
77
78 void setGroupBlocked(byte[] groupId, boolean blocked) throws Error.GroupNotFound, Error.InvalidGroupId;
79
80 List<byte[]> getGroupIds();
81
82 String getGroupName(byte[] groupId) throws Error.InvalidGroupId;
83
84 List<String> getGroupMembers(byte[] groupId) throws Error.InvalidGroupId;
85
86 byte[] updateGroup(
87 byte[] groupId, String name, List<String> members, String avatar
88 ) throws Error.AttachmentInvalid, Error.Failure, Error.InvalidNumber, Error.GroupNotFound, Error.InvalidGroupId;
89
90 boolean isRegistered();
91
92 void addDevice(String uri) throws Error.InvalidUri;
93
94 void removeDevice(int deviceId) throws Error.Failure;
95
96 List<String> listDevices() throws Error.Failure;
97
98 void updateDeviceName(String deviceName) throws Error.Failure;
99
100 void updateProfile(
101 String name, String about, String aboutEmoji, String avatarPath, boolean removeAvatar
102 ) throws Error.Failure;
103
104 void removePin();
105
106 void setPin(String registrationLockPin);
107
108 String version();
109
110 List<String> listNumbers();
111
112 List<String> getContactNumber(final String name) throws Error.Failure;
113
114 void quitGroup(final byte[] groupId) throws Error.GroupNotFound, Error.Failure, Error.InvalidGroupId;
115
116 boolean isContactBlocked(final String number) throws Error.InvalidNumber;
117
118 boolean isGroupBlocked(final byte[] groupId) throws Error.InvalidGroupId;
119
120 boolean isMember(final byte[] groupId) throws Error.InvalidGroupId;
121
122 byte[] joinGroup(final String groupLink) throws Error.Failure;
123
124 String uploadStickerPack(String stickerPackPath) throws Error.Failure;
125
126 class MessageReceived extends DBusSignal {
127
128 private final long timestamp;
129 private final String sender;
130 private final byte[] groupId;
131 private final String message;
132 private final List<String> attachments;
133
134 public MessageReceived(
135 String objectpath,
136 long timestamp,
137 String sender,
138 byte[] groupId,
139 String message,
140 List<String> attachments
141 ) throws DBusException {
142 super(objectpath, timestamp, sender, groupId, message, attachments);
143 this.timestamp = timestamp;
144 this.sender = sender;
145 this.groupId = groupId;
146 this.message = message;
147 this.attachments = attachments;
148 }
149
150 public long getTimestamp() {
151 return timestamp;
152 }
153
154 public String getSender() {
155 return sender;
156 }
157
158 public byte[] getGroupId() {
159 return groupId;
160 }
161
162 public String getMessage() {
163 return message;
164 }
165
166 public List<String> getAttachments() {
167 return attachments;
168 }
169 }
170
171 class ReceiptReceived extends DBusSignal {
172
173 private final long timestamp;
174 private final String sender;
175
176 public ReceiptReceived(String objectpath, long timestamp, String sender) throws DBusException {
177 super(objectpath, timestamp, sender);
178 this.timestamp = timestamp;
179 this.sender = sender;
180 }
181
182 public long getTimestamp() {
183 return timestamp;
184 }
185
186 public String getSender() {
187 return sender;
188 }
189 }
190
191 class SyncMessageReceived extends DBusSignal {
192
193 private final long timestamp;
194 private final String source;
195 private final String destination;
196 private final byte[] groupId;
197 private final String message;
198 private final List<String> attachments;
199
200 public SyncMessageReceived(
201 String objectpath,
202 long timestamp,
203 String source,
204 String destination,
205 byte[] groupId,
206 String message,
207 List<String> attachments
208 ) throws DBusException {
209 super(objectpath, timestamp, source, destination, groupId, message, attachments);
210 this.timestamp = timestamp;
211 this.source = source;
212 this.destination = destination;
213 this.groupId = groupId;
214 this.message = message;
215 this.attachments = attachments;
216 }
217
218 public long getTimestamp() {
219 return timestamp;
220 }
221
222 public String getSource() {
223 return source;
224 }
225
226 public String getDestination() {
227 return destination;
228 }
229
230 public byte[] getGroupId() {
231 return groupId;
232 }
233
234 public String getMessage() {
235 return message;
236 }
237
238 public List<String> getAttachments() {
239 return attachments;
240 }
241 }
242
243 interface Error {
244
245 class AttachmentInvalid extends DBusExecutionException {
246
247 public AttachmentInvalid(final String message) {
248 super(message);
249 }
250 }
251
252 class InvalidUri extends DBusExecutionException {
253
254 public InvalidUri(final String message) {
255 super(message);
256 }
257 }
258
259 class Failure extends DBusExecutionException {
260
261 public Failure(final String message) {
262 super(message);
263 }
264 }
265
266 class GroupNotFound extends DBusExecutionException {
267
268 public GroupNotFound(final String message) {
269 super(message);
270 }
271 }
272
273 class InvalidGroupId extends DBusExecutionException {
274
275 public InvalidGroupId(final String message) {
276 super(message);
277 }
278 }
279
280 class InvalidNumber extends DBusExecutionException {
281
282 public InvalidNumber(final String message) {
283 super(message);
284 }
285 }
286
287 class UntrustedIdentity extends DBusExecutionException {
288
289 public UntrustedIdentity(final String message) {
290 super(message);
291 }
292 }
293 }
294 }