Skip to content

Commit 10cad62

Browse files
committed
Document ConferencesRequest, MessagesRequest and SendMessageRequest
1 parent 9ec758a commit 10cad62

8 files changed

Lines changed: 187 additions & 8 deletions

File tree

library/src/main/java/com/proxerme/library/connection/messenger/entity/Conference.java

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
import com.proxerme.library.interfaces.TimeItem;
1313

1414
/**
15-
* TODO: Describe class
15+
* Class representing a single conference. This might be a group chat or a conversation with a
16+
* single user (indicated by {@link #isGroup()}.
1617
*
1718
* @author Ruben Gees
1819
*/
@@ -55,6 +56,21 @@ public Conference[] newArray(int size) {
5556
Conference() {
5657
}
5758

59+
/**
60+
* The constructor.
61+
*
62+
* @param id The id of this conference.
63+
* @param topic The topic.
64+
* @param customTopic A custom topic set by a user.
65+
* @param participantAmount The amount of participants in this conference.
66+
* @param imageType The type of the image. This is "avatar" in most cases.
67+
* @param imageId The id of the image.
68+
* @param isGroup Indicator if this is a group chat.
69+
* @param isRead Indicator if this conference has been read by the current user.
70+
* @param time The time of the last message in this conference.
71+
* @param unreadMessageAmount The amount of unread messages for the current user.
72+
* @param lastReadMessageId The id of the last read message of the current user.
73+
*/
5874
public Conference(@NonNull String id, @NonNull String topic, @NonNull String customTopic,
5975
@IntRange(from = 2) int participantAmount, @Nullable String imageType,
6076
@Nullable String imageId, boolean isGroup, boolean isRead, long time,
@@ -90,11 +106,21 @@ protected Conference(Parcel in) {
90106
this.unreadMessageAmount = in.readInt();
91107
}
92108

109+
/**
110+
* Returns the id of the last read message.
111+
*
112+
* @return The id.
113+
*/
93114
@NonNull
94115
public String getLastReadMessageId() {
95116
return lastReadMessageId;
96117
}
97118

119+
/**
120+
* Returns the type of the image. Might be empty if there is no image.
121+
*
122+
* @return The image type.
123+
*/
98124
@NonNull
99125
public String getImageType() {
100126
String[] split = image.split(":");
@@ -106,6 +132,11 @@ public String getImageType() {
106132
}
107133
}
108134

135+
/**
136+
* Returns the id of the image. Might be empty if there is no image.
137+
*
138+
* @return The id.
139+
*/
109140
@Override
110141
@NonNull
111142
public String getImageId() {
@@ -118,40 +149,80 @@ public String getImageId() {
118149
}
119150
}
120151

152+
/**
153+
* Returns if this message has been read.
154+
*
155+
* @return True, if read.
156+
*/
121157
public boolean isRead() {
122158
return isRead;
123159
}
124160

161+
/**
162+
* Returns the custom topic for this conference. Might be empty.
163+
*
164+
* @return The custom topic.
165+
*/
125166
@NonNull
126167
public String getCustomTopic() {
127168
return customTopic;
128169
}
129170

171+
/**
172+
* Returns the amount of participants in this conference.
173+
*
174+
* @return The amount.
175+
*/
130176
@IntRange(from = 2)
131177
public int getParticipantAmount() {
132178
return participantAmount;
133179
}
134180

181+
/**
182+
* Returns the topic of this conference.
183+
*
184+
* @return The topic.
185+
*/
135186
@NonNull
136187
public String getTopic() {
137188
return topic;
138189
}
139190

191+
/**
192+
* Returns the id of this conference.
193+
*
194+
* @return The id.
195+
*/
140196
@Override
141197
@NonNull
142198
public String getId() {
143199
return id;
144200
}
145201

202+
/**
203+
* Returns the time of the last message in this conference.
204+
*
205+
* @return The time.
206+
*/
146207
@Override
147208
public long getTime() {
148209
return time;
149210
}
150211

212+
/**
213+
* Returns if this conference is a group chat.
214+
*
215+
* @return True, if it is a group chat.
216+
*/
151217
public boolean isGroup() {
152218
return isGroup;
153219
}
154220

221+
/**
222+
* Returns the amount of unread messages.
223+
*
224+
* @return The amount of unread messages.
225+
*/
155226
@IntRange(from = 0)
156227
public int getUnreadMessageAmount() {
157228
return unreadMessageAmount;

library/src/main/java/com/proxerme/library/connection/messenger/entity/Message.java

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import com.proxerme.library.interfaces.TimeItem;
1010

1111
/**
12-
* TODO: Describe class
12+
* Class that represents a single message.
1313
*
1414
* @author Ruben Gees
1515
*/
@@ -48,6 +48,19 @@ public Message[] newArray(int size) {
4848
Message() {
4949
}
5050

51+
/**
52+
* The constructor.
53+
*
54+
* @param id The id of this message.
55+
* @param conferenceId The id of the conference this message belongs to.
56+
* @param userId The id of the user, who sent this message.
57+
* @param username The username of the user, who sent this message.
58+
* @param message The contents of the message.
59+
* @param action The action of this message. This might be something like "addUser". Might be
60+
* empty if there is no action.
61+
* @param time The time this message was sent.
62+
* @param device The device this message was sent from. In most cases "default".
63+
*/
5164
public Message(@NonNull String id, @NonNull String conferenceId, @NonNull String userId,
5265
@NonNull String username, @NonNull String message, @NonNull String action,
5366
long time, @NonNull String device) {
@@ -72,42 +85,74 @@ protected Message(Parcel in) {
7285
this.device = in.readString();
7386
}
7487

88+
/**
89+
* Returns the id of this message.
90+
* @return The id.
91+
*/
7592
@NonNull
7693
@Override
7794
public String getId() {
7895
return id;
7996
}
8097

98+
/**
99+
* Returns the id of the conference this message belongs to.
100+
* @return The id.
101+
*/
81102
@NonNull
82103
public String getConferenceId() {
83104
return conferenceId;
84105
}
85106

107+
/**
108+
* Returns the id of the user.
109+
* @return The id.
110+
*/
86111
@NonNull
87112
public String getUserId() {
88113
return userId;
89114
}
90115

116+
/**
117+
* Returns the username of the user.
118+
* @return The username.
119+
*/
91120
@NonNull
92121
public String getUsername() {
93122
return username;
94123
}
95124

125+
/**
126+
* Returns the actual contents of this message.
127+
* @return The contents of this message.
128+
*/
96129
@NonNull
97130
public String getMessage() {
98131
return message;
99132
}
100133

134+
/**
135+
* Returns the action of this message. Might be empty.
136+
* @return The action.
137+
*/
101138
@NonNull
102139
public String getAction() {
103140
return action;
104141
}
105142

143+
/**
144+
* Returns the time of this message.
145+
* @return The time.
146+
*/
106147
@Override
107148
public long getTime() {
108149
return time;
109150
}
110151

152+
/**
153+
* Returns the device this message was sent from.
154+
* @return The device.
155+
*/
111156
@NonNull
112157
public String getDevice() {
113158
return device;

library/src/main/java/com/proxerme/library/connection/messenger/request/ConferencesRequest.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
import static com.proxerme.library.info.ProxerTag.MESSENGER_CONFERENCES;
1515

1616
/**
17-
* TODO: Describe class
17+
* Request for the conferences of the user. The user must be logged in for this API to return data.
18+
* This API uses pagination.
1819
*
1920
* @author Ruben Gees
2021
*/
@@ -29,10 +30,21 @@ public class ConferencesRequest extends ProxerRequest<ConferencesResult> {
2930
private int page;
3031
private String type;
3132

33+
/**
34+
* The constructor.
35+
*
36+
* @param page The page to load.
37+
*/
3238
public ConferencesRequest(@IntRange(from = 0) int page) {
3339
this.page = page;
3440
}
3541

42+
/**
43+
* The type to load.
44+
*
45+
* @param type The type.
46+
* @return This Request.
47+
*/
3648
public ConferencesRequest withType(@Nullable @ConferenceType String type) {
3749
this.type = type;
3850

library/src/main/java/com/proxerme/library/connection/messenger/request/MessagesRequest.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,17 @@
1111
import static com.proxerme.library.info.ProxerTag.MESSENGER_MESSAGES;
1212

1313
/**
14-
* TODO: Describe class
14+
* Request for loading messages. There are 4 different cases associated with the conferenceId and
15+
* messageId:
16+
* <p>
17+
* 1) conferenceId = "0" and messageId = "0". The latest messages of the user are loaded.
18+
* 2) conferenceId = "0" and messageId = X. The messages before the specified id are loaded.
19+
* 3) conferenceId = X and messageId = "0". The latest messages in the specified conference are
20+
* loaded.
21+
* 4) conferenceId = X and messageId = X. The messages before the specified messageId in the
22+
* specified conference are loaded.
23+
* <p>
24+
* This API requires the user to be logged in.
1525
*
1626
* @author Ruben Gees
1727
*/
@@ -26,6 +36,12 @@ public class MessagesRequest extends ProxerRequest<MessagesResult> {
2636
private String conferenceId;
2737
private String messageId;
2838

39+
/**
40+
* The constructor.
41+
*
42+
* @param conferenceId The id of the conference to load from.
43+
* @param messageId The id of the message to load previous messages from.
44+
*/
2945
public MessagesRequest(@NonNull String conferenceId, @NonNull String messageId) {
3046
this.conferenceId = conferenceId;
3147
this.messageId = messageId;

library/src/main/java/com/proxerme/library/connection/messenger/request/SendMessageRequest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import com.proxerme.library.info.ProxerUrlHolder;
1111

1212
/**
13-
* TODO: Describe class
13+
* Request for sending a single message. This API requires the user to be logged in.
1414
*
1515
* @author Ruben Gees
1616
*/
@@ -25,6 +25,12 @@ public class SendMessageRequest extends ProxerRequest<SendMessageResult> {
2525
private String conferenceId;
2626
private String text;
2727

28+
/**
29+
* The constructor.
30+
*
31+
* @param conferenceId The conference to send the message to.
32+
* @param text The contents of the message.
33+
*/
2834
public SendMessageRequest(@NonNull String conferenceId, @NonNull String text) {
2935
this.conferenceId = conferenceId;
3036
this.text = text;

library/src/main/java/com/proxerme/library/connection/messenger/result/ConferencesResult.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import com.proxerme.library.interfaces.ProxerResult;
88

99
/**
10-
* TODO: Describe class
10+
* Result of a {@link com.proxerme.library.connection.messenger.request.ConferencesRequest}.
1111
*
1212
* @author Ruben Gees
1313
*/
@@ -20,10 +20,19 @@ public class ConferencesResult implements ProxerResult<Conference[]> {
2020
ConferencesResult() {
2121
}
2222

23+
/**
24+
* The constructor.
25+
*
26+
* @param item The array of received conferences.
27+
*/
2328
public ConferencesResult(@NonNull Conference[] item) {
2429
this.item = item;
2530
}
2631

32+
/**
33+
* Returns the array of retrieved conferences.
34+
* @return The array of conferences.
35+
*/
2736
@Override
2837
public Conference[] getItem() {
2938
return item;

library/src/main/java/com/proxerme/library/connection/messenger/result/MessagesResult.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import com.proxerme.library.interfaces.ProxerResult;
88

99
/**
10-
* TODO: Describe class
10+
* Result of a {@link com.proxerme.library.connection.messenger.request.MessagesRequest}.
1111
*
1212
* @author Ruben Gees
1313
*/
@@ -20,10 +20,19 @@ public class MessagesResult implements ProxerResult<Message[]> {
2020
MessagesResult() {
2121
}
2222

23+
/**
24+
* The constructor.
25+
*
26+
* @param item The array of retrieved messages.
27+
*/
2328
public MessagesResult(@NonNull Message[] item) {
2429
this.item = item;
2530
}
2631

32+
/**
33+
* Returns the array of retrieved messages.
34+
* @return The array of messages.
35+
*/
2736
@Override
2837
@NonNull
2938
public Message[] getItem() {

0 commit comments

Comments
 (0)