001// Generated by delombok at Wed Jan 31 21:27:42 UTC 2024
002/*
003 * Copyright (c) 2010-2024 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   */
043  @Facebook
044  private String link;
045  /**
046   * The subject of this conversation.
047   * 
048   */
049  @Facebook
050  private String subject;
051  /**
052   * The title of a message in the conversation
053   * 
054   */
055  @Facebook
056  private String snippet;
057  /**
058   * The new identifier for threads effective after September 24, 2017
059   */
060  @Facebook("thread_key")
061  private String threadKey;
062  /**
063   * Last update time of the conversation
064   * 
065   */
066  @Facebook("updated_time")
067  private Date updatedTime;
068  /**
069   * The number of messages in the conversation
070   * 
071   */
072  @Facebook("message_count")
073  private Long messageCount;
074  /**
075   * The name of the message folder or source.
076   */
077  @Facebook
078  private String name;
079  /**
080   * The number of unread messages in the conversation
081   * 
082   * Facebook does not send the unread count if there aren't any new messages. In order to keep data consistency, we set
083   * the default value to zero. If this value is sent, the {@link com.restfb.JsonMapper} will override it.
084   * 
085   */
086  @Facebook("unread_count")
087  private Long unreadCount = 0L;
088  /**
089   * Wallpaper to display as a background for the thread
090   */
091  @Facebook
092  private String wallpaper;
093  @Facebook
094  private List<Tag> tags = new ArrayList<>();
095  @Facebook
096  private List<ExtendedReferenceType> participants = new ArrayList<>();
097  @Facebook("former_participants")
098  private List<NamedFacebookType> formerParticipants = new ArrayList<>();
099  @Facebook
100  private List<NamedFacebookType> senders = new ArrayList<>();
101  /**
102   * Whether The Page can reply to the conversation
103   * 
104   */
105  @Facebook("can_reply")
106  private Boolean canReply;
107  /**
108   * Whether you are subscribed to the conversation
109   * 
110   */
111  @Facebook("is_subscribed")
112  private Boolean subscribed;
113  @Facebook
114  private List<Message> messages = new ArrayList<>();
115  private static final long serialVersionUID = 1L;
116
117
118  /**
119   * Represents the <a href="http://developers.facebook.com/docs/reference/api/page/#conversations"> Tag Graph API
120   * type</a>.
121   * 
122   * @author <a href="http://restfb.com">Mark Allen</a>
123   * @author Felipe Kurkowski
124   */
125  public static class Tag extends AbstractFacebookType {
126    /**
127     * The name field for this type.
128     * 
129     */
130    @Facebook
131    private String name;
132    private static final long serialVersionUID = 1L;
133
134    /**
135     * The name field for this type.
136     * 
137     * @return The name field for this type.
138     */
139    @java.lang.SuppressWarnings("all")
140    public String getName() {
141      return this.name;
142    }
143
144    /**
145     * The name field for this type.
146     * 
147     */
148    @java.lang.SuppressWarnings("all")
149    public void setName(final String name) {
150      this.name = name;
151    }
152  }
153
154  /**
155   * A list of tags indicating the message folder, and whether the conversation is read and seen.
156   * 
157   * @return A list of tags indicating the message folder, and whether the conversation is read and seen.
158   */
159  public List<Tag> getTags() {
160    return unmodifiableList(tags);
161  }
162
163  public boolean addTag(Tag tag) {
164    return tags.add(tag);
165  }
166
167  public boolean removeTag(Tag tag) {
168    return tags.remove(tag);
169  }
170
171  /**
172   * Users who are on this message conversation
173   * 
174   * @return Users who are on this message conversation
175   */
176  public List<ExtendedReferenceType> getParticipants() {
177    return unmodifiableList(participants);
178  }
179
180  public boolean addParticipant(ExtendedReferenceType participant) {
181    return participants.add(participant);
182  }
183
184  public boolean removeParticipant(ExtendedReferenceType participant) {
185    return participants.remove(participant);
186  }
187
188  /**
189   * Users who send a message on the conversation
190   * 
191   * @return Users who send a message on the conversation
192   */
193  public List<NamedFacebookType> getSenders() {
194    return unmodifiableList(senders);
195  }
196
197  public boolean addSender(NamedFacebookType sender) {
198    return senders.add(sender);
199  }
200
201  public boolean removeSender(NamedFacebookType sender) {
202    return senders.remove(sender);
203  }
204
205  /**
206   * List of all messages in the conversation
207   * 
208   * @return List of all messages in the conversation
209   */
210  public List<Message> getMessages() {
211    return unmodifiableList(messages);
212  }
213
214  public boolean addMessage(Message message) {
215    return messages.add(message);
216  }
217
218  public boolean removeMessage(Message message) {
219    return messages.remove(message);
220  }
221
222  /**
223   * Users who used to be on this message conversation.
224   * 
225   * @return Users who used to be on this message conversation.
226   */
227  public List<NamedFacebookType> getFormerParticipants() {
228    return unmodifiableList(formerParticipants);
229  }
230
231  public boolean addFormerParticipant(NamedFacebookType formerParticipant) {
232    return formerParticipants.add(formerParticipant);
233  }
234
235  public boolean removeFormerParticipant(NamedFacebookType formerParticipant) {
236    return formerParticipants.remove(formerParticipant);
237  }
238
239  /**
240   * A URL for this conversation.
241   * 
242   * @return A URL for this conversation.
243   */
244  @java.lang.SuppressWarnings("all")
245  public String getLink() {
246    return this.link;
247  }
248
249  /**
250   * A URL for this conversation.
251   * 
252   */
253  @java.lang.SuppressWarnings("all")
254  public void setLink(final String link) {
255    this.link = link;
256  }
257
258  /**
259   * The subject of this conversation.
260   * 
261   * @return The subject of this conversation.
262   */
263  @java.lang.SuppressWarnings("all")
264  public String getSubject() {
265    return this.subject;
266  }
267
268  /**
269   * The subject of this conversation.
270   * 
271   */
272  @java.lang.SuppressWarnings("all")
273  public void setSubject(final String subject) {
274    this.subject = subject;
275  }
276
277  /**
278   * The title of a message in the conversation
279   * 
280   * @return The title of a message in the conversation
281   */
282  @java.lang.SuppressWarnings("all")
283  public String getSnippet() {
284    return this.snippet;
285  }
286
287  /**
288   * The title of a message in the conversation
289   * 
290   */
291  @java.lang.SuppressWarnings("all")
292  public void setSnippet(final String snippet) {
293    this.snippet = snippet;
294  }
295
296  /**
297   * The new identifier for threads effective after September 24, 2017
298   *
299   * @return The new identifier for threads effective after September 24, 2017
300   */
301  @java.lang.SuppressWarnings("all")
302  public String getThreadKey() {
303    return this.threadKey;
304  }
305
306  /**
307   * The new identifier for threads effective after September 24, 2017
308   */
309  @java.lang.SuppressWarnings("all")
310  public void setThreadKey(final String threadKey) {
311    this.threadKey = threadKey;
312  }
313
314  /**
315   * Last update time of the conversation
316   * 
317   * @return Last update time of the conversation
318   */
319  @java.lang.SuppressWarnings("all")
320  public Date getUpdatedTime() {
321    return this.updatedTime;
322  }
323
324  /**
325   * Last update time of the conversation
326   * 
327   */
328  @java.lang.SuppressWarnings("all")
329  public void setUpdatedTime(final Date updatedTime) {
330    this.updatedTime = updatedTime;
331  }
332
333  /**
334   * The number of messages in the conversation
335   * 
336   * @return The number of messages in the conversation
337   */
338  @java.lang.SuppressWarnings("all")
339  public Long getMessageCount() {
340    return this.messageCount;
341  }
342
343  /**
344   * The number of messages in the conversation
345   * 
346   */
347  @java.lang.SuppressWarnings("all")
348  public void setMessageCount(final Long messageCount) {
349    this.messageCount = messageCount;
350  }
351
352  /**
353   * The name of the message folder or source.
354   *
355   * @return The name of the message folder or source
356   */
357  @java.lang.SuppressWarnings("all")
358  public String getName() {
359    return this.name;
360  }
361
362  /**
363   * The name of the message folder or source.
364   */
365  @java.lang.SuppressWarnings("all")
366  public void setName(final String name) {
367    this.name = name;
368  }
369
370  /**
371   * The number of unread messages in the conversation
372   * 
373   * Facebook does not send the unread count if there aren't any new messages. In order to keep data consistency, we set
374   * the default value to zero. If this value is sent, the {@link com.restfb.JsonMapper} will override it.
375   * 
376   * @return The number of unread messages in the conversation
377   */
378  @java.lang.SuppressWarnings("all")
379  public Long getUnreadCount() {
380    return this.unreadCount;
381  }
382
383  /**
384   * The number of unread messages in the conversation
385   * 
386   * Facebook does not send the unread count if there aren't any new messages. In order to keep data consistency, we set
387   * the default value to zero. If this value is sent, the {@link com.restfb.JsonMapper} will override it.
388   * 
389   */
390  @java.lang.SuppressWarnings("all")
391  public void setUnreadCount(final Long unreadCount) {
392    this.unreadCount = unreadCount;
393  }
394
395  /**
396   * Wallpaper to display as a background for the thread
397   *
398   * @return Wallpaper to display as a background for the thread
399   */
400  @java.lang.SuppressWarnings("all")
401  public String getWallpaper() {
402    return this.wallpaper;
403  }
404
405  /**
406   * Wallpaper to display as a background for the thread
407   */
408  @java.lang.SuppressWarnings("all")
409  public void setWallpaper(final String wallpaper) {
410    this.wallpaper = wallpaper;
411  }
412
413  /**
414   * Whether The Page can reply to the conversation
415   * 
416   * @return Whether The Page can reply to the conversation
417   */
418  @java.lang.SuppressWarnings("all")
419  public Boolean getCanReply() {
420    return this.canReply;
421  }
422
423  /**
424   * Whether The Page can reply to the conversation
425   * 
426   */
427  @java.lang.SuppressWarnings("all")
428  public void setCanReply(final Boolean canReply) {
429    this.canReply = canReply;
430  }
431
432  /**
433   * Whether you are subscribed to the conversation
434   * 
435   * @return Whether you are subscribed to the conversation
436   */
437  @java.lang.SuppressWarnings("all")
438  public Boolean getSubscribed() {
439    return this.subscribed;
440  }
441
442  /**
443   * Whether you are subscribed to the conversation
444   * 
445   */
446  @java.lang.SuppressWarnings("all")
447  public void setSubscribed(final Boolean subscribed) {
448    this.subscribed = subscribed;
449  }
450}