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