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