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