Skip to content

Commit

Permalink
Updated Link and Media structure
Browse files Browse the repository at this point in the history
  • Loading branch information
yvasyliev committed Sep 4, 2022
1 parent 636215a commit c0d894b
Show file tree
Hide file tree
Showing 2 changed files with 270 additions and 6 deletions.
88 changes: 82 additions & 6 deletions src/main/java/com/github/masecla/objects/reddit/Link.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public class Link {
private int totalAwardsReceived;

@SerializedName("media_embed")
private JsonElement mediaEmbed; // TODO: 18.07.2022 what are the possible values?
private MediaEmbed mediaEmbed;

@SerializedName("thumbnail_width")
private int thumbnailWidth;
Expand All @@ -117,7 +117,7 @@ public class Link {
private String category;

@SerializedName("secure_media_embed")
private JsonElement secureMediaEmbed; // TODO: 18.07.2022 What are the possible values?
private SecureMediaEmbed secureMediaEmbed;

@SerializedName("link_flair_text")
private String linkFlairText;
Expand Down Expand Up @@ -347,6 +347,82 @@ public class Link {
@SerializedName("crosspost_parent_list")
private List<Link> crosspostParentList;

public static class MediaEmbed {
@SerializedName("content")
private String content;

@SerializedName("width")
private int width;

@SerializedName("scrolling")
private boolean scrolling;

@SerializedName("height")
private int height;

public String getContent() {
return content;
}

public void setContent(String content) {
this.content = content;
}

public int getWidth() {
return width;
}

public void setWidth(int width) {
this.width = width;
}

public boolean isScrolling() {
return scrolling;
}

public void setScrolling(boolean scrolling) {
this.scrolling = scrolling;
}

public int getHeight() {
return height;
}

public void setHeight(int height) {
this.height = height;
}

@Override
public String toString() {
return "MediaEmbed{" +
"content='" + content + '\'' +
", width=" + width +
", scrolling=" + scrolling +
", height=" + height +
'}';
}
}

public static class SecureMediaEmbed extends MediaEmbed {
@SerializedName("media_domain_url")
private String mediaDomainUrl;

public String getMediaDomainUrl() {
return mediaDomainUrl;
}

public void setMediaDomainUrl(String mediaDomainUrl) {
this.mediaDomainUrl = mediaDomainUrl;
}

@Override
public String toString() {
return "SecureMediaEmbed{" +
"mediaDomainUrl='" + mediaDomainUrl + '\'' +
"} " + super.toString();
}
}

public String getApprovedAtUtc() {
return approvedAtUtc;
}
Expand Down Expand Up @@ -563,11 +639,11 @@ public void setTotalAwardsReceived(int totalAwardsReceived) {
this.totalAwardsReceived = totalAwardsReceived;
}

public JsonElement getMediaEmbed() {
public MediaEmbed getMediaEmbed() {
return mediaEmbed;
}

public void setMediaEmbed(JsonElement mediaEmbed) {
public void setMediaEmbed(MediaEmbed mediaEmbed) {
this.mediaEmbed = mediaEmbed;
}

Expand Down Expand Up @@ -635,11 +711,11 @@ public void setCategory(String category) {
this.category = category;
}

public JsonElement getSecureMediaEmbed() {
public SecureMediaEmbed getSecureMediaEmbed() {
return secureMediaEmbed;
}

public void setSecureMediaEmbed(JsonElement secureMediaEmbed) {
public void setSecureMediaEmbed(SecureMediaEmbed secureMediaEmbed) {
this.secureMediaEmbed = secureMediaEmbed;
}

Expand Down
188 changes: 188 additions & 0 deletions src/main/java/com/github/masecla/objects/reddit/Media.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,176 @@ public class Media {
@SerializedName("reddit_video")
private RedditVideo redditVideo;

@SerializedName("type")
private String type;

@SerializedName("oembed")
private Oembed oembed;

public static class Oembed {
@SerializedName("provider_url")
private String providerUrl;

@SerializedName("version")
private String version;

@SerializedName("title")
private String title;

@SerializedName("type")
private String type;

@SerializedName("thumbnail_width")
private int thumbnailWidth;

@SerializedName("height")
private int height;

@SerializedName("width")
private int width;

@SerializedName("html")
private String html;

@SerializedName("author_name")
private String authorName;

@SerializedName("provider_name")
private String providerName;

@SerializedName("thumbnail_url")
private String thumbnailUrl;

@SerializedName("thumbnail_height")
private int thumbnailHeight;

@SerializedName("author_url")
private String authorUrl;

public String getProviderUrl() {
return providerUrl;
}

public void setProviderUrl(String providerUrl) {
this.providerUrl = providerUrl;
}

public String getVersion() {
return version;
}

public void setVersion(String version) {
this.version = version;
}

public String getTitle() {
return title;
}

public void setTitle(String title) {
this.title = title;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public int getThumbnailWidth() {
return thumbnailWidth;
}

public void setThumbnailWidth(int thumbnailWidth) {
this.thumbnailWidth = thumbnailWidth;
}

public int getHeight() {
return height;
}

public void setHeight(int height) {
this.height = height;
}

public int getWidth() {
return width;
}

public void setWidth(int width) {
this.width = width;
}

public String getHtml() {
return html;
}

public void setHtml(String html) {
this.html = html;
}

public String getAuthorName() {
return authorName;
}

public void setAuthorName(String authorName) {
this.authorName = authorName;
}

public String getProviderName() {
return providerName;
}

public void setProviderName(String providerName) {
this.providerName = providerName;
}

public String getThumbnailUrl() {
return thumbnailUrl;
}

public void setThumbnailUrl(String thumbnailUrl) {
this.thumbnailUrl = thumbnailUrl;
}

public int getThumbnailHeight() {
return thumbnailHeight;
}

public void setThumbnailHeight(int thumbnailHeight) {
this.thumbnailHeight = thumbnailHeight;
}

public String getAuthorUrl() {
return authorUrl;
}

public void setAuthorUrl(String authorUrl) {
this.authorUrl = authorUrl;
}

@Override
public String toString() {
return "Oembed{" +
"providerUrl='" + providerUrl + '\'' +
", version='" + version + '\'' +
", title='" + title + '\'' +
", type='" + type + '\'' +
", thumbnailWidth=" + thumbnailWidth +
", height=" + height +
", width=" + width +
", html='" + html + '\'' +
", authorName='" + authorName + '\'' +
", providerName='" + providerName + '\'' +
", thumbnailUrl='" + thumbnailUrl + '\'' +
", thumbnailHeight=" + thumbnailHeight +
", authorUrl='" + authorUrl + '\'' +
'}';
}
}

public RedditVideo getRedditVideo() {
return redditVideo;
}
Expand All @@ -14,10 +184,28 @@ public void setRedditVideo(RedditVideo redditVideo) {
this.redditVideo = redditVideo;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public Oembed getOembed() {
return oembed;
}

public void setOembed(Oembed oembed) {
this.oembed = oembed;
}

@Override
public String toString() {
return "Media{" +
"redditVideo=" + redditVideo +
", type='" + type + '\'' +
", oembed=" + oembed +
'}';
}
}

0 comments on commit c0d894b

Please sign in to comment.