]> nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/Signal.java
Remove redundant public modifiers from interface
[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 long sendMessageReaction(
25 String emoji, boolean remove, String targetAuthor, long targetSentTimestamp, String recipient
26 ) throws Error.InvalidNumber, Error.Failure;
27
28 long sendMessageReaction(
29 String emoji, boolean remove, String targetAuthor, long targetSentTimestamp, List<String> recipients
30 ) throws Error.InvalidNumber, Error.Failure;
31
32 long sendNoteToSelfMessage(
33 String message, List<String> attachments
34 ) throws Error.AttachmentInvalid, Error.Failure;
35
36 void sendEndSessionMessage(List<String> recipients) throws Error.Failure, Error.InvalidNumber, Error.UntrustedIdentity;
37
38 long sendGroupMessage(
39 String message, List<String> attachments, byte[] groupId
40 ) throws Error.GroupNotFound, Error.Failure, Error.AttachmentInvalid;
41
42 long sendGroupMessageReaction(
43 String emoji, boolean remove, String targetAuthor, long targetSentTimestamp, byte[] groupId
44 ) throws Error.GroupNotFound, Error.Failure, Error.InvalidNumber;
45
46 String getContactName(String number) throws Error.InvalidNumber;
47
48 void setContactName(String number, String name) throws Error.InvalidNumber;
49
50 void setContactBlocked(String number, boolean blocked) throws Error.InvalidNumber;
51
52 void setGroupBlocked(byte[] groupId, boolean blocked) throws Error.GroupNotFound;
53
54 List<byte[]> getGroupIds();
55
56 String getGroupName(byte[] groupId);
57
58 List<String> getGroupMembers(byte[] groupId);
59
60 byte[] updateGroup(
61 byte[] groupId, String name, List<String> members, String avatar
62 ) throws Error.AttachmentInvalid, Error.Failure, Error.InvalidNumber, Error.GroupNotFound;
63
64 boolean isRegistered();
65
66 void updateProfile(
67 String name, String about, String aboutEmoji, String avatarPath, boolean removeAvatar
68 ) throws Error.Failure;
69
70 String version();
71
72 List<String> listNumbers();
73
74 List<String> getContactNumber(final String name) throws Error.Failure;
75
76 void quitGroup(final byte[] groupId) throws Error.GroupNotFound, Error.Failure;
77
78 boolean isContactBlocked(final String number);
79
80 boolean isGroupBlocked(final byte[] groupId);
81
82 boolean isMember(final byte[] groupId);
83
84 void joinGroup(final String groupLink) throws Error.Failure;
85
86 class MessageReceived extends DBusSignal {
87
88 private final long timestamp;
89 private final String sender;
90 private final byte[] groupId;
91 private final String message;
92 private final List<String> attachments;
93
94 public MessageReceived(
95 String objectpath,
96 long timestamp,
97 String sender,
98 byte[] groupId,
99 String message,
100 List<String> attachments
101 ) throws DBusException {
102 super(objectpath, timestamp, sender, groupId, message, attachments);
103 this.timestamp = timestamp;
104 this.sender = sender;
105 this.groupId = groupId;
106 this.message = message;
107 this.attachments = attachments;
108 }
109
110 public long getTimestamp() {
111 return timestamp;
112 }
113
114 public String getSender() {
115 return sender;
116 }
117
118 public byte[] getGroupId() {
119 return groupId;
120 }
121
122 public String getMessage() {
123 return message;
124 }
125
126 public List<String> getAttachments() {
127 return attachments;
128 }
129 }
130
131 class ReceiptReceived extends DBusSignal {
132
133 private final long timestamp;
134 private final String sender;
135
136 public ReceiptReceived(String objectpath, long timestamp, String sender) throws DBusException {
137 super(objectpath, timestamp, sender);
138 this.timestamp = timestamp;
139 this.sender = sender;
140 }
141
142 public long getTimestamp() {
143 return timestamp;
144 }
145
146 public String getSender() {
147 return sender;
148 }
149 }
150
151 class SyncMessageReceived extends DBusSignal {
152
153 private final long timestamp;
154 private final String source;
155 private final String destination;
156 private final byte[] groupId;
157 private final String message;
158 private final List<String> attachments;
159
160 public SyncMessageReceived(
161 String objectpath,
162 long timestamp,
163 String source,
164 String destination,
165 byte[] groupId,
166 String message,
167 List<String> attachments
168 ) throws DBusException {
169 super(objectpath, timestamp, source, destination, groupId, message, attachments);
170 this.timestamp = timestamp;
171 this.source = source;
172 this.destination = destination;
173 this.groupId = groupId;
174 this.message = message;
175 this.attachments = attachments;
176 }
177
178 public long getTimestamp() {
179 return timestamp;
180 }
181
182 public String getSource() {
183 return source;
184 }
185
186 public String getDestination() {
187 return destination;
188 }
189
190 public byte[] getGroupId() {
191 return groupId;
192 }
193
194 public String getMessage() {
195 return message;
196 }
197
198 public List<String> getAttachments() {
199 return attachments;
200 }
201 }
202
203 interface Error {
204
205 class AttachmentInvalid extends DBusExecutionException {
206
207 public AttachmentInvalid(final String message) {
208 super(message);
209 }
210 }
211
212 class Failure extends DBusExecutionException {
213
214 public Failure(final String message) {
215 super(message);
216 }
217 }
218
219 class GroupNotFound extends DBusExecutionException {
220
221 public GroupNotFound(final String message) {
222 super(message);
223 }
224 }
225
226 class InvalidNumber extends DBusExecutionException {
227
228 public InvalidNumber(final String message) {
229 super(message);
230 }
231 }
232
233 class UntrustedIdentity extends DBusExecutionException {
234
235 public UntrustedIdentity(final String message) {
236 super(message);
237 }
238 }
239 }
240 }