]> nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/Signal.java
implement Dbus isRegistered() methods (#729)
[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() throws Error.Failure, Error.InvalidNumber;
91
92 boolean isRegistered(String number) throws Error.Failure, Error.InvalidNumber;
93
94 List<Boolean> isRegistered(List<String> numbers) throws Error.Failure, Error.InvalidNumber;
95
96 void addDevice(String uri) throws Error.InvalidUri;
97
98 void removeDevice(int deviceId) throws Error.Failure;
99
100 List<String> listDevices() throws Error.Failure;
101
102 void updateDeviceName(String deviceName) throws Error.Failure;
103
104 void updateProfile(
105 String name, String about, String aboutEmoji, String avatarPath, boolean removeAvatar
106 ) throws Error.Failure;
107
108 void removePin();
109
110 void setPin(String registrationLockPin);
111
112 String version();
113
114 List<String> listNumbers();
115
116 List<String> getContactNumber(final String name) throws Error.Failure;
117
118 void quitGroup(final byte[] groupId) throws Error.GroupNotFound, Error.Failure, Error.InvalidGroupId;
119
120 boolean isContactBlocked(final String number) throws Error.InvalidNumber;
121
122 boolean isGroupBlocked(final byte[] groupId) throws Error.InvalidGroupId;
123
124 boolean isMember(final byte[] groupId) throws Error.InvalidGroupId;
125
126 byte[] joinGroup(final String groupLink) throws Error.Failure;
127
128 String uploadStickerPack(String stickerPackPath) throws Error.Failure;
129
130 class MessageReceived extends DBusSignal {
131
132 private final long timestamp;
133 private final String sender;
134 private final byte[] groupId;
135 private final String message;
136 private final List<String> attachments;
137
138 public MessageReceived(
139 String objectpath,
140 long timestamp,
141 String sender,
142 byte[] groupId,
143 String message,
144 List<String> attachments
145 ) throws DBusException {
146 super(objectpath, timestamp, sender, groupId, message, attachments);
147 this.timestamp = timestamp;
148 this.sender = sender;
149 this.groupId = groupId;
150 this.message = message;
151 this.attachments = attachments;
152 }
153
154 public long getTimestamp() {
155 return timestamp;
156 }
157
158 public String getSender() {
159 return sender;
160 }
161
162 public byte[] getGroupId() {
163 return groupId;
164 }
165
166 public String getMessage() {
167 return message;
168 }
169
170 public List<String> getAttachments() {
171 return attachments;
172 }
173 }
174
175 class ReceiptReceived extends DBusSignal {
176
177 private final long timestamp;
178 private final String sender;
179
180 public ReceiptReceived(String objectpath, long timestamp, String sender) throws DBusException {
181 super(objectpath, timestamp, sender);
182 this.timestamp = timestamp;
183 this.sender = sender;
184 }
185
186 public long getTimestamp() {
187 return timestamp;
188 }
189
190 public String getSender() {
191 return sender;
192 }
193 }
194
195 class SyncMessageReceived extends DBusSignal {
196
197 private final long timestamp;
198 private final String source;
199 private final String destination;
200 private final byte[] groupId;
201 private final String message;
202 private final List<String> attachments;
203
204 public SyncMessageReceived(
205 String objectpath,
206 long timestamp,
207 String source,
208 String destination,
209 byte[] groupId,
210 String message,
211 List<String> attachments
212 ) throws DBusException {
213 super(objectpath, timestamp, source, destination, groupId, message, attachments);
214 this.timestamp = timestamp;
215 this.source = source;
216 this.destination = destination;
217 this.groupId = groupId;
218 this.message = message;
219 this.attachments = attachments;
220 }
221
222 public long getTimestamp() {
223 return timestamp;
224 }
225
226 public String getSource() {
227 return source;
228 }
229
230 public String getDestination() {
231 return destination;
232 }
233
234 public byte[] getGroupId() {
235 return groupId;
236 }
237
238 public String getMessage() {
239 return message;
240 }
241
242 public List<String> getAttachments() {
243 return attachments;
244 }
245 }
246
247 interface Error {
248
249 class AttachmentInvalid extends DBusExecutionException {
250
251 public AttachmentInvalid(final String message) {
252 super(message);
253 }
254 }
255
256 class InvalidUri extends DBusExecutionException {
257
258 public InvalidUri(final String message) {
259 super(message);
260 }
261 }
262
263 class Failure extends DBusExecutionException {
264
265 public Failure(final String message) {
266 super(message);
267 }
268 }
269
270 class GroupNotFound extends DBusExecutionException {
271
272 public GroupNotFound(final String message) {
273 super(message);
274 }
275 }
276
277 class InvalidGroupId extends DBusExecutionException {
278
279 public InvalidGroupId(final String message) {
280 super(message);
281 }
282 }
283
284 class InvalidNumber extends DBusExecutionException {
285
286 public InvalidNumber(final String message) {
287 super(message);
288 }
289 }
290
291 class UntrustedIdentity extends DBusExecutionException {
292
293 public UntrustedIdentity(final String message) {
294 super(message);
295 }
296 }
297 }
298 }