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