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.Collections;
028import java.util.List;
029import com.restfb.Facebook;
030
031/**
032 * Represents the <a href="https://developers.facebook.com/docs/graph-api/reference/v2.3/story_attachment">Story
033 * Attachment Graph API type</a>.
034 *
035 * @author <a href="https://github.com/kevinleturc/">Kevin Leturc</a>
036 * @since 1.12.0
037 */
038public class StoryAttachment extends FacebookType {
039  /**
040   * Returns text accompanying the attachment.
041   */
042  @Facebook
043  private String description;
044  /**
045   * Returns media object (photo, link etc.) contained in the attachment.
046   */
047  @Facebook
048  private Media media;
049  /**
050   * Type of the media such as (photo, video, link etc)
051   */
052  @Facebook("media_type")
053  private String mediaType;
054  /**
055   * Returns object that the attachment links to.
056   */
057  @Facebook
058  private Target target;
059  /**
060   * Returns title of the attachment.
061   */
062  @Facebook
063  private String title;
064  /**
065   * Returns URL of the attachment.
066   */
067  @Facebook
068  private String url;
069  /**
070   * Unshimmed URL of the attachment.
071   */
072  @Facebook("unshimmed_url")
073  private String unshimmedUrl;
074  /**
075   * Returns list of subattachments that are associated with this attachment.
076   */
077  @Facebook("subattachments")
078  private Attachments subAttachments;
079  @Facebook("description_tags")
080  private List<EntityAtTextRange> descriptionTags = new ArrayList<>();
081  private static final long serialVersionUID = 1L;
082
083  /**
084   * Profiles tagged in the text accompanying the attachment
085   *
086   * @return Profiles tagged in the text accompanying the attachment
087   */
088  public List<EntityAtTextRange> getDescriptionTags() {
089    return Collections.unmodifiableList(descriptionTags);
090  }
091
092  public boolean addDescriptionTag(EntityAtTextRange entityAtTextRange) {
093    return descriptionTags.add(entityAtTextRange);
094  }
095
096  public boolean removeDescriptionTag(EntityAtTextRange entityAtTextRange) {
097    return descriptionTags.remove(entityAtTextRange);
098  }
099
100
101  /**
102   * Represents the list of subattachments that are associated with this attachment. This will have data if the parent
103   * attachment is a container for multiple other attachments. For example, a multi-photo story will have a parent
104   * attachment representing an upload of multiple photos to an album where each subattachment will contain the actual
105   * photos that were uploaded.
106   *
107   * @author <a href="https://github.com/kevinleturc/">Kevin Leturc</a>
108   */
109  public static class Attachments extends AbstractFacebookType {
110    @Facebook
111    private List<StoryAttachment> data = new ArrayList<>();
112    private static final long serialVersionUID = 1L;
113
114    /**
115     * The attachments.
116     *
117     * @return The attachments.
118     */
119    public List<StoryAttachment> getData() {
120      return unmodifiableList(data);
121    }
122
123    public boolean addData(StoryAttachment attachment) {
124      return data.add(attachment);
125    }
126
127    public boolean removeData(StoryAttachment attachment) {
128      return data.remove(attachment);
129    }
130  }
131
132
133  /**
134   * Media data as applicable for the attachment.
135   *
136   * @author <a href="https://github.com/kevinleturc/">Kevin Leturc</a>
137   */
138  public static class Media extends FacebookType {
139    private static final long serialVersionUID = 1L;
140    @Facebook
141    private Image image;
142    @Facebook
143    private String source;
144
145    @java.lang.SuppressWarnings("all")
146    public Image getImage() {
147      return this.image;
148    }
149
150    @java.lang.SuppressWarnings("all")
151    public void setImage(final Image image) {
152      this.image = image;
153    }
154
155    @java.lang.SuppressWarnings("all")
156    public String getSource() {
157      return this.source;
158    }
159
160    @java.lang.SuppressWarnings("all")
161    public void setSource(final String source) {
162      this.source = source;
163    }
164  }
165
166
167  /**
168   * Image data as applicable for the attachment
169   *
170   * @author <a href="https://github.com/kevinleturc/">Kevin Leturc</a>
171   */
172  public static class Image extends FacebookType {
173    private static final long serialVersionUID = 1L;
174    @Facebook
175    private Integer height;
176    @Facebook
177    private Integer width;
178    @Facebook
179    private String src;
180
181    @java.lang.SuppressWarnings("all")
182    public Integer getHeight() {
183      return this.height;
184    }
185
186    @java.lang.SuppressWarnings("all")
187    public void setHeight(final Integer height) {
188      this.height = height;
189    }
190
191    @java.lang.SuppressWarnings("all")
192    public Integer getWidth() {
193      return this.width;
194    }
195
196    @java.lang.SuppressWarnings("all")
197    public void setWidth(final Integer width) {
198      this.width = width;
199    }
200
201    @java.lang.SuppressWarnings("all")
202    public String getSrc() {
203      return this.src;
204    }
205
206    @java.lang.SuppressWarnings("all")
207    public void setSrc(final String src) {
208      this.src = src;
209    }
210  }
211
212
213  /**
214   * Target data as applicable for the attachment
215   *
216   * @author <a href="https://github.com/kevinleturc/">Kevin Leturc</a>
217   */
218  public static class Target extends FacebookType {
219    private static final long serialVersionUID = 1L;
220    @Facebook
221    private String url;
222    @Facebook("unshimmed_url")
223    private String unshimmedUrl;
224
225    @java.lang.SuppressWarnings("all")
226    public String getUrl() {
227      return this.url;
228    }
229
230    @java.lang.SuppressWarnings("all")
231    public void setUrl(final String url) {
232      this.url = url;
233    }
234
235    @java.lang.SuppressWarnings("all")
236    public String getUnshimmedUrl() {
237      return this.unshimmedUrl;
238    }
239
240    @java.lang.SuppressWarnings("all")
241    public void setUnshimmedUrl(final String unshimmedUrl) {
242      this.unshimmedUrl = unshimmedUrl;
243    }
244  }
245
246  /**
247   * Returns text accompanying the attachment.
248   *
249   * @return Text accompanying the attachment.
250   */
251  @java.lang.SuppressWarnings("all")
252  public String getDescription() {
253    return this.description;
254  }
255
256  /**
257   * Returns text accompanying the attachment.
258   */
259  @java.lang.SuppressWarnings("all")
260  public void setDescription(final String description) {
261    this.description = description;
262  }
263
264  /**
265   * Returns media object (photo, link etc.) contained in the attachment.
266   *
267   * @return Media object (photo, link etc.) contained in the attachment.
268   */
269  @java.lang.SuppressWarnings("all")
270  public Media getMedia() {
271    return this.media;
272  }
273
274  /**
275   * Returns media object (photo, link etc.) contained in the attachment.
276   */
277  @java.lang.SuppressWarnings("all")
278  public void setMedia(final Media media) {
279    this.media = media;
280  }
281
282  /**
283   * Type of the media such as (photo, video, link etc)
284   *
285   * @return Type of the media such as (photo, video, link etc)
286   */
287  @java.lang.SuppressWarnings("all")
288  public String getMediaType() {
289    return this.mediaType;
290  }
291
292  /**
293   * Type of the media such as (photo, video, link etc)
294   */
295  @java.lang.SuppressWarnings("all")
296  public void setMediaType(final String mediaType) {
297    this.mediaType = mediaType;
298  }
299
300  /**
301   * Returns object that the attachment links to.
302   *
303   * @return Object that the attachment links to.
304   */
305  @java.lang.SuppressWarnings("all")
306  public Target getTarget() {
307    return this.target;
308  }
309
310  /**
311   * Returns object that the attachment links to.
312   */
313  @java.lang.SuppressWarnings("all")
314  public void setTarget(final Target target) {
315    this.target = target;
316  }
317
318  /**
319   * Returns title of the attachment.
320   *
321   * @return Title of the attachment.
322   */
323  @java.lang.SuppressWarnings("all")
324  public String getTitle() {
325    return this.title;
326  }
327
328  /**
329   * Returns title of the attachment.
330   */
331  @java.lang.SuppressWarnings("all")
332  public void setTitle(final String title) {
333    this.title = title;
334  }
335
336  /**
337   * Returns URL of the attachment.
338   *
339   * @return URL of the attachment.
340   */
341  @java.lang.SuppressWarnings("all")
342  public String getUrl() {
343    return this.url;
344  }
345
346  /**
347   * Returns URL of the attachment.
348   */
349  @java.lang.SuppressWarnings("all")
350  public void setUrl(final String url) {
351    this.url = url;
352  }
353
354  /**
355   * Unshimmed URL of the attachment.
356   *
357   * @return Unshimmed URL of the attachment
358   */
359  @java.lang.SuppressWarnings("all")
360  public String getUnshimmedUrl() {
361    return this.unshimmedUrl;
362  }
363
364  /**
365   * Unshimmed URL of the attachment.
366   */
367  @java.lang.SuppressWarnings("all")
368  public void setUnshimmedUrl(final String unshimmedUrl) {
369    this.unshimmedUrl = unshimmedUrl;
370  }
371
372  /**
373   * Returns list of subattachments that are associated with this attachment.
374   *
375   * @return List of subattachments that are associated with this attachment.
376   */
377  @java.lang.SuppressWarnings("all")
378  public Attachments getSubAttachments() {
379    return this.subAttachments;
380  }
381
382  /**
383   * Returns list of subattachments that are associated with this attachment.
384   */
385  @java.lang.SuppressWarnings("all")
386  public void setSubAttachments(final Attachments subAttachments) {
387    this.subAttachments = subAttachments;
388  }
389}