001// Generated by delombok at Fri Oct 11 21:56:29 CEST 2019
002/**
003 * Copyright (c) 2010-2019 Mark Allen, Norbert Bartels.
004 *
005 * Permission is hereby granted, free of charge, to any person obtaining a copy
006 * of this software and associated documentation files (the "Software"), to deal
007 * in the Software without restriction, including without limitation the rights
008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
009 * copies of the Software, and to permit persons to whom the Software is
010 * furnished to do so, subject to the following conditions:
011 *
012 * The above copyright notice and this permission notice shall be included in
013 * all copies or substantial portions of the Software.
014 *
015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
018 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
021 * THE SOFTWARE.
022 */
023package com.restfb.types;
024
025import static java.util.Collections.unmodifiableList;
026import java.util.ArrayList;
027import java.util.Date;
028import java.util.List;
029import com.restfb.Facebook;
030
031/**
032 * Represents the <a href="http://developers.facebook.com/docs/reference/api/page/#conversations"> Conversation Graph
033 * API type</a>.
034 * 
035 * @author <a href="http://restfb.com">Mark Allen</a>
036 * @author Felipe Kurkowski
037 */
038public class Conversation extends FacebookType {
039  /**
040   * A URL for this conversation.
041   */
042  @Facebook
043  private String link;
044  /**
045   * The subject of this conversation.
046   */
047  @Facebook
048  private String subject;
049  /**
050   * The title of a message in the conversation
051   */
052  @Facebook
053  private String snippet;
054  /**
055   * The new identifier for threads effective after September 24, 2017
056   */
057  @Facebook("thread_key")
058  private String threadKey;
059  /**
060   * Last update time of the conversation
061   */
062  @Facebook("updated_time")
063  private Date updatedTime;
064  /**
065   * The number of messages in the conversation
066   */
067  @Facebook("message_count")
068  private Long messageCount;
069  /**
070   * The name of the message folder or source.
071   */
072  @Facebook
073  private String name;
074  /**
075   * The number of unread messages in the conversation
076   * 
077   * Facebook does not send the unread count if there aren't any new messages. In order to keep data consistency, we set
078   * the default value to zero. If this value is sent, the {@link com.restfb.JsonMapper} will override it.
079   */
080  @Facebook("unread_count")
081  private Long unreadCount = 0L;
082  /**
083   * Wallpaper to display as a background for the thread
084   */
085  @Facebook
086  private String wallpaper;
087  @Facebook
088  private List<Tag> tags = new ArrayList<>();
089  @Facebook
090  private List<NamedFacebookType> participants = new ArrayList<>();
091  @Facebook("former_participants")
092  private List<NamedFacebookType> formerParticipants = new ArrayList<>();
093  @Facebook
094  private List<NamedFacebookType> senders = new ArrayList<>();
095  /**
096   * Whether The Page can reply to the conversation
097   */
098  @Facebook("can_reply")
099  private Boolean canReply;
100  /**
101   * Whether you are subscribed to the conversation
102   */
103  @Facebook("is_subscribed")
104  private Boolean subscribed;
105  @Facebook
106  private List<Message> messages = new ArrayList<>();
107  private static final long serialVersionUID = 1L;
108
109
110  /**
111   * Represents the <a href="http://developers.facebook.com/docs/reference/api/page/#conversations"> Tag Graph API
112   * type</a>.
113   * 
114   * @author <a href="http://restfb.com">Mark Allen</a>
115   * @author Felipe Kurkowski
116   */
117  public static class Tag extends AbstractFacebookType {
118    /**
119     * The name field for this type.
120     */
121    @Facebook
122    private String name;
123    private static final long serialVersionUID = 1L;
124
125    /**
126     * The name field for this type.
127     * 
128     * @return The name field for this type.
129     */
130    @java.lang.SuppressWarnings("all")
131    public String getName() {
132      return this.name;
133    }
134
135    /**
136     * The name field for this type.
137     */
138    @java.lang.SuppressWarnings("all")
139    public void setName(final String name) {
140      this.name = name;
141    }
142  }
143
144  /**
145   * A list of tags indicating the message folder, and whether the conversation is read and seen.
146   * 
147   * @return A list of tags indicating the message folder, and whether the conversation is read and seen.
148   */
149  public List<Tag> getTags() {
150    return unmodifiableList(tags);
151  }
152
153  public boolean addTag(Tag tag) {
154    return tags.add(tag);
155  }
156
157  public boolean removeTag(Tag tag) {
158    return tags.remove(tag);
159  }
160
161  /**
162   * Users who are on this message conversation
163   * 
164   * @return Users who are on this message conversation
165   */
166  public List<NamedFacebookType> getParticipants() {
167    return unmodifiableList(participants);
168  }
169
170  public boolean addParticipant(NamedFacebookType participant) {
171    return participants.add(participant);
172  }
173
174  public boolean removeParticipant(NamedFacebookType participant) {
175    return participants.remove(participant);
176  }
177
178  /**
179   * Users who send a message on the conversation
180   * 
181   * @return Users who send a message on the conversation
182   */
183  public List<NamedFacebookType> getSenders() {
184    return unmodifiableList(senders);
185  }
186
187  public boolean addSender(NamedFacebookType sender) {
188    return senders.add(sender);
189  }
190
191  public boolean removeSender(NamedFacebookType sender) {
192    return senders.remove(sender);
193  }
194
195  /**
196   * List of all messages in the conversation
197   * 
198   * @return List of all messages in the conversation
199   */
200  public List<Message> getMessages() {
201    return unmodifiableList(messages);
202  }
203
204  public boolean addMessage(Message message) {
205    return messages.add(message);
206  }
207
208  public boolean removeMessage(Message message) {
209    return messages.remove(message);
210  }
211
212  /**
213   * Users who used to be on this message conversation.
214   * 
215   * @return Users who used to be on this message conversation.
216   */
217  public List<NamedFacebookType> getFormerParticipants() {
218    return unmodifiableList(formerParticipants);
219  }
220
221  public boolean addFormerParticipant(NamedFacebookType formerParticipant) {
222    return formerParticipants.add(formerParticipant);
223  }
224
225  public boolean removeFormerParticipant(NamedFacebookType formerParticipant) {
226    return formerParticipants.remove(formerParticipant);
227  }
228
229  /**
230   * A URL for this conversation.
231   * 
232   * @return A URL for this conversation.
233   */
234  @java.lang.SuppressWarnings("all")
235  public String getLink() {
236    return this.link;
237  }
238
239  /**
240   * A URL for this conversation.
241   */
242  @java.lang.SuppressWarnings("all")
243  public void setLink(final String link) {
244    this.link = link;
245  }
246
247  /**
248   * The subject of this conversation.
249   * 
250   * @return The subject of this conversation.
251   */
252  @java.lang.SuppressWarnings("all")
253  public String getSubject() {
254    return this.subject;
255  }
256
257  /**
258   * The subject of this conversation.
259   */
260  @java.lang.SuppressWarnings("all")
261  public void setSubject(final String subject) {
262    this.subject = subject;
263  }
264
265  /**
266   * The title of a message in the conversation
267   * 
268   * @return The title of a message in the conversation
269   */
270  @java.lang.SuppressWarnings("all")
271  public String getSnippet() {
272    return this.snippet;
273  }
274
275  /**
276   * The title of a message in the conversation
277   */
278  @java.lang.SuppressWarnings("all")
279  public void setSnippet(final String snippet) {
280    this.snippet = snippet;
281  }
282
283  /**
284   * The new identifier for threads effective after September 24, 2017
285   *
286   * @return The new identifier for threads effective after September 24, 2017
287   */
288  @java.lang.SuppressWarnings("all")
289  public String getThreadKey() {
290    return this.threadKey;
291  }
292
293  /**
294   * The new identifier for threads effective after September 24, 2017
295   */
296  @java.lang.SuppressWarnings("all")
297  public void setThreadKey(final String threadKey) {
298    this.threadKey = threadKey;
299  }
300
301  /**
302   * Last update time of the conversation
303   * 
304   * @return Last update time of the conversation
305   */
306  @java.lang.SuppressWarnings("all")
307  public Date getUpdatedTime() {
308    return this.updatedTime;
309  }
310
311  /**
312   * Last update time of the conversation
313   */
314  @java.lang.SuppressWarnings("all")
315  public void setUpdatedTime(final Date updatedTime) {
316    this.updatedTime = updatedTime;
317  }
318
319  /**
320   * The number of messages in the conversation
321   * 
322   * @return The number of messages in the conversation
323   */
324  @java.lang.SuppressWarnings("all")
325  public Long getMessageCount() {
326    return this.messageCount;
327  }
328
329  /**
330   * The number of messages in the conversation
331   */
332  @java.lang.SuppressWarnings("all")
333  public void setMessageCount(final Long messageCount) {
334    this.messageCount = messageCount;
335  }
336
337  /**
338   * The name of the message folder or source.
339   *
340   * @return The name of the message folder or source
341   */
342  @java.lang.SuppressWarnings("all")
343  public String getName() {
344    return this.name;
345  }
346
347  /**
348   * The name of the message folder or source.
349   */
350  @java.lang.SuppressWarnings("all")
351  public void setName(final String name) {
352    this.name = name;
353  }
354
355  /**
356   * The number of unread messages in the conversation
357   * 
358   * Facebook does not send the unread count if there aren't any new messages. In order to keep data consistency, we set
359   * the default value to zero. If this value is sent, the {@link com.restfb.JsonMapper} will override it.
360   * 
361   * @return The number of unread messages in the conversation
362   */
363  @java.lang.SuppressWarnings("all")
364  public Long getUnreadCount() {
365    return this.unreadCount;
366  }
367
368  /**
369   * The number of unread messages in the conversation
370   * 
371   * Facebook does not send the unread count if there aren't any new messages. In order to keep data consistency, we set
372   * the default value to zero. If this value is sent, the {@link com.restfb.JsonMapper} will override it.
373   */
374  @java.lang.SuppressWarnings("all")
375  public void setUnreadCount(final Long unreadCount) {
376    this.unreadCount = unreadCount;
377  }
378
379  /**
380   * Wallpaper to display as a background for the thread
381   *
382   * @return Wallpaper to display as a background for the thread
383   */
384  @java.lang.SuppressWarnings("all")
385  public String getWallpaper() {
386    return this.wallpaper;
387  }
388
389  /**
390   * Wallpaper to display as a background for the thread
391   */
392  @java.lang.SuppressWarnings("all")
393  public void setWallpaper(final String wallpaper) {
394    this.wallpaper = wallpaper;
395  }
396
397  /**
398   * Whether The Page can reply to the conversation
399   * 
400   * @return Whether The Page can reply to the conversation
401   */
402  @java.lang.SuppressWarnings("all")
403  public Boolean getCanReply() {
404    return this.canReply;
405  }
406
407  /**
408   * Whether The Page can reply to the conversation
409   */
410  @java.lang.SuppressWarnings("all")
411  public void setCanReply(final Boolean canReply) {
412    this.canReply = canReply;
413  }
414
415  /**
416   * Whether you are subscribed to the conversation
417   * 
418   * @return Whether you are subscribed to the conversation
419   */
420  @java.lang.SuppressWarnings("all")
421  public Boolean getSubscribed() {
422    return this.subscribed;
423  }
424
425  /**
426   * Whether you are subscribed to the conversation
427   */
428  @java.lang.SuppressWarnings("all")
429  public void setSubscribed(final Boolean subscribed) {
430    this.subscribed = subscribed;
431  }
432}