001// Generated by delombok at Sun Jul 31 22:49:44 CEST 2022
002/*
003 * Copyright (c) 2010-2022 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.instagram;
024
025import java.util.ArrayList;
026import java.util.Collections;
027import java.util.List;
028import com.restfb.Facebook;
029import com.restfb.types.Insight;
030
031/**
032 * Represents the <a href="https://developers.facebook.com/docs/instagram-api/reference/media">instagram media</a> type
033 */
034public class IgMedia extends IgMediaChild {
035  private static final long serialVersionUID = 1L;
036  @Facebook
037  private String caption;
038  /**
039   * Count of comments on the media.
040   *
041   * Excludes comments on album child media and the media's caption. Includes replies on comments.
042   */
043  @Facebook("comments_count")
044  private Long commentsCount;
045  /**
046   * Indicates if comments are enabled or disabled. Excludes album children.
047   */
048  @Facebook("is_comment_enabled")
049  private Boolean isCommentEnabled;
050  /**
051   * Reels only. If {@code true}, indicates the reel can appear in both the Feed and Reels tabs.
052   * 
053   * If {@code false}, indicates the reel can only appear in the Reels tab.
054   */
055  @Facebook("is_shared_to_feed")
056  private Boolean isSharedToFeed;
057  /**
058   * Count of likes on the media.
059   *
060   * Excludes likes on album child media and likes on promoted posts created from the media. Includes replies on
061   * comments.
062   * 
063   * <ul>
064   * <li><strong>v10.0 and older calls</strong>: value will be 0 if the media owner has hidden like counts it.</li>
065   * <li><strong>v11.0+ calls</strong>: field will be omitted if media owner has hidden like counts on it.</li>
066   * </ul>
067   */
068  @Facebook("like_count")
069  private Long likeCount;
070  /**
071   * Media thumbnail URL. Only available on VIDEO media.
072   */
073  @Facebook("thumbnail_url")
074  private String thumbnailUrl;
075  /**
076   * IGTV media title.
077   */
078  @Facebook("video_title")
079  private String videoTitle;
080  @Facebook
081  private List<IgMediaChild> children = new ArrayList<>();
082  @Facebook
083  private List<Insight> insights = new ArrayList<>();
084  @Facebook
085  private List<IgComment> comments = new ArrayList<>();
086
087  /**
088   * returns the list of child media objects, only available if the media_type is a carousal
089   * 
090   * @return the list of children as unmodifiable list
091   */
092  public List<IgMediaChild> getChildren() {
093    return Collections.unmodifiableList(children);
094  }
095
096  /**
097   * adds a new child to the children list
098   * 
099   * @param child
100   *          the child that is added
101   * @return true if adding the child works
102   */
103  public boolean addChild(IgMediaChild child) {
104    return children.add(child);
105  }
106
107  /**
108   * removes a new child from the children list
109   * 
110   * @param child
111   *          the child that is removed
112   * @return true if removing the child works
113   */
114  public boolean removeChild(IgMediaChild child) {
115    return children.remove(child);
116  }
117
118  public List<Insight> getInsights() {
119    return Collections.unmodifiableList(insights);
120  }
121
122  public boolean addChild(Insight insight) {
123    return insights.add(insight);
124  }
125
126  public boolean removeChild(Insight insight) {
127    return insights.remove(insight);
128  }
129
130  /**
131   * returns the comments of this media
132   * 
133   * @return the comments of this media
134   */
135  public List<IgComment> getComments() {
136    return Collections.unmodifiableList(comments);
137  }
138
139  public boolean addComment(IgComment comment) {
140    return comments.add(comment);
141  }
142
143  public boolean removeComment(IgComment comment) {
144    return comments.remove(comment);
145  }
146
147  @java.lang.SuppressWarnings("all")
148  public String getCaption() {
149    return this.caption;
150  }
151
152  @java.lang.SuppressWarnings("all")
153  public void setCaption(final String caption) {
154    this.caption = caption;
155  }
156
157  /**
158   * Count of comments on the media.
159   *
160   * Excludes comments on album child media and the media's caption. Includes replies on comments.
161   */
162  @java.lang.SuppressWarnings("all")
163  public Long getCommentsCount() {
164    return this.commentsCount;
165  }
166
167  /**
168   * Count of comments on the media.
169   *
170   * Excludes comments on album child media and the media's caption. Includes replies on comments.
171   */
172  @java.lang.SuppressWarnings("all")
173  public void setCommentsCount(final Long commentsCount) {
174    this.commentsCount = commentsCount;
175  }
176
177  /**
178   * Indicates if comments are enabled or disabled. Excludes album children.
179   */
180  @java.lang.SuppressWarnings("all")
181  public Boolean getIsCommentEnabled() {
182    return this.isCommentEnabled;
183  }
184
185  /**
186   * Indicates if comments are enabled or disabled. Excludes album children.
187   */
188  @java.lang.SuppressWarnings("all")
189  public void setIsCommentEnabled(final Boolean isCommentEnabled) {
190    this.isCommentEnabled = isCommentEnabled;
191  }
192
193  /**
194   * Reels only. If {@code true}, indicates the reel can appear in both the Feed and Reels tabs.
195   * 
196   * If {@code false}, indicates the reel can only appear in the Reels tab.
197   */
198  @java.lang.SuppressWarnings("all")
199  public Boolean getIsSharedToFeed() {
200    return this.isSharedToFeed;
201  }
202
203  /**
204   * Reels only. If {@code true}, indicates the reel can appear in both the Feed and Reels tabs.
205   * 
206   * If {@code false}, indicates the reel can only appear in the Reels tab.
207   */
208  @java.lang.SuppressWarnings("all")
209  public void setIsSharedToFeed(final Boolean isSharedToFeed) {
210    this.isSharedToFeed = isSharedToFeed;
211  }
212
213  /**
214   * Count of likes on the media.
215   *
216   * Excludes likes on album child media and likes on promoted posts created from the media. Includes replies on
217   * comments.
218   * 
219   * <ul>
220   * <li><strong>v10.0 and older calls</strong>: value will be 0 if the media owner has hidden like counts it.</li>
221   * <li><strong>v11.0+ calls</strong>: field will be omitted if media owner has hidden like counts on it.</li>
222   * </ul>
223   */
224  @java.lang.SuppressWarnings("all")
225  public Long getLikeCount() {
226    return this.likeCount;
227  }
228
229  /**
230   * Count of likes on the media.
231   *
232   * Excludes likes on album child media and likes on promoted posts created from the media. Includes replies on
233   * comments.
234   * 
235   * <ul>
236   * <li><strong>v10.0 and older calls</strong>: value will be 0 if the media owner has hidden like counts it.</li>
237   * <li><strong>v11.0+ calls</strong>: field will be omitted if media owner has hidden like counts on it.</li>
238   * </ul>
239   */
240  @java.lang.SuppressWarnings("all")
241  public void setLikeCount(final Long likeCount) {
242    this.likeCount = likeCount;
243  }
244
245  /**
246   * Media thumbnail URL. Only available on VIDEO media.
247   */
248  @java.lang.SuppressWarnings("all")
249  public String getThumbnailUrl() {
250    return this.thumbnailUrl;
251  }
252
253  /**
254   * Media thumbnail URL. Only available on VIDEO media.
255   */
256  @java.lang.SuppressWarnings("all")
257  public void setThumbnailUrl(final String thumbnailUrl) {
258    this.thumbnailUrl = thumbnailUrl;
259  }
260
261  /**
262   * IGTV media title.
263   */
264  @java.lang.SuppressWarnings("all")
265  public String getVideoTitle() {
266    return this.videoTitle;
267  }
268
269  /**
270   * IGTV media title.
271   */
272  @java.lang.SuppressWarnings("all")
273  public void setVideoTitle(final String videoTitle) {
274    this.videoTitle = videoTitle;
275  }
276}