-
-
Notifications
You must be signed in to change notification settings - Fork 392
/
IgMedia.java
174 lines (150 loc) · 4.63 KB
/
IgMedia.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/*
* Copyright (c) 2010-2022 Mark Allen, Norbert Bartels.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.restfb.types.instagram;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.restfb.Facebook;
import com.restfb.types.Insight;
import lombok.Getter;
import lombok.Setter;
/**
* Represents the <a href="https://developers.facebook.com/docs/instagram-api/reference/media">instagram media</a> type
*/
public class IgMedia extends IgMediaChild {
private static final long serialVersionUID = 1L;
@Getter
@Setter
@Facebook
private String caption;
/**
* Count of comments on the media.
*
* Excludes comments on album child media and the media's caption. Includes replies on comments.
*/
@Getter
@Setter
@Facebook("comments_count")
private Long commentsCount;
/**
* Indicates if comments are enabled or disabled. Excludes album children.
*/
@Getter
@Setter
@Facebook("is_comment_enabled")
private Boolean isCommentEnabled;
/**
* Reels only. If {@code true}, indicates the reel can appear in both the Feed and Reels tabs.
*
* If {@code false}, indicates the reel can only appear in the Reels tab.
*/
@Getter
@Setter
@Facebook("is_shared_to_feed")
private Boolean isSharedToFeed;
/**
* Count of likes on the media.
*
* Excludes likes on album child media and likes on promoted posts created from the media. Includes replies on
* comments.
*
* <ul>
* <li><strong>v10.0 and older calls</strong>: value will be 0 if the media owner has hidden like counts it.</li>
* <li><strong>v11.0+ calls</strong>: field will be omitted if media owner has hidden like counts on it.</li>
* </ul>
*/
@Getter
@Setter
@Facebook("like_count")
private Long likeCount;
/**
* Media thumbnail URL. Only available on VIDEO media.
*/
@Getter
@Setter
@Facebook("thumbnail_url")
private String thumbnailUrl;
/**
* IGTV media title.
*/
@Getter
@Setter
@Facebook("video_title")
private String videoTitle;
@Facebook
private List<IgMediaChild> children = new ArrayList<>();
@Facebook
private List<Insight> insights = new ArrayList<>();
@Facebook
private List<IgComment> comments = new ArrayList<>();
/**
* returns the list of child media objects, only available if the media_type is a carousal
*
* @return the list of children as unmodifiable list
*/
public List<IgMediaChild> getChildren() {
return Collections.unmodifiableList(children);
}
/**
* adds a new child to the children list
*
* @param child
* the child that is added
* @return true if adding the child works
*/
public boolean addChild(IgMediaChild child) {
return children.add(child);
}
/**
* removes a new child from the children list
*
* @param child
* the child that is removed
* @return true if removing the child works
*/
public boolean removeChild(IgMediaChild child) {
return children.remove(child);
}
public List<Insight> getInsights() {
return Collections.unmodifiableList(insights);
}
public boolean addChild(Insight insight) {
return insights.add(insight);
}
public boolean removeChild(Insight insight) {
return insights.remove(insight);
}
/**
* returns the comments of this media
*
* @return the comments of this media
*/
public List<IgComment> getComments() {
return Collections.unmodifiableList(comments);
}
public boolean addComment(IgComment comment) {
return comments.add(comment);
}
public boolean removeComment(IgComment comment) {
return comments.remove(comment);
}
}