diff --git a/src/main/java/com/patreon/PatreonAPI.java b/src/main/java/com/patreon/PatreonAPI.java
index 4ca62aa..3f40dbf 100644
--- a/src/main/java/com/patreon/PatreonAPI.java
+++ b/src/main/java/com/patreon/PatreonAPI.java
@@ -22,201 +22,227 @@
import java.util.*;
public class PatreonAPI {
- /**
- * The base URI for requests to the patreon API. This may be overridden (e.g. for testing) by passing
- * -Dpatreon.rest.uri="https://my.other.server.com" as jvm arguments
- */
- public static final String BASE_URI = System.getProperty("patreon.rest.uri", "https://www.patreon.com");
-
- private static final Logger LOG = LoggerFactory.getLogger(PatreonAPI.class);
- private final String accessToken;
- private final RequestUtil requestUtil;
- private ResourceConverter converter;
-
- /**
- * Create a new instance of the Patreon API. You only need one of these objects unless you are using the API
- * with multiple tokens
- *
- * @param accessToken The "Creator's Access Token" found on
- * the patreon client page
- * OR OAuth access token
- */
- public PatreonAPI(String accessToken) {
- this(accessToken, new RequestUtil());
- }
-
- /**
- * For use in test.
- */
- PatreonAPI(String accessToken, RequestUtil requestUtil) {
- this.accessToken = accessToken;
- this.requestUtil = requestUtil;
-
- ObjectMapper objectMapper = new ObjectMapper();
- objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
- objectMapper.configure(com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- this.converter = new ResourceConverter(
- objectMapper,
- User.class,
- Campaign.class,
- Pledge.class
- );
- this.converter.enableDeserializationOption(DeserializationFeature.ALLOW_UNKNOWN_INCLUSIONS);
- }
-
- /**
- * Get the user object of the creator
- *
- * @return the current user
- * @throws IOException Thrown when the GET request failed
- */
- public JSONAPIDocument fetchUser() throws IOException {
- return fetchUser(null);
- }
-
- /**
- * Get the user object of the creator
- *
- * @param optionalFields A list of optional fields to request, or null. See {@link User.UserField}
- * @return the current user
- * @throws IOException Thrown when the GET request failed
- */
- public JSONAPIDocument fetchUser(Collection optionalFields) throws IOException {
- URIBuilder pathBuilder = new URIBuilder()
- .setPath("current_user")
- .addParameter("include", "pledges");
- if (optionalFields != null) {
- Set optionalAndDefaultFields = new HashSet<>(optionalFields);
- optionalAndDefaultFields.addAll(User.UserField.getDefaultFields());
- addFieldsParam(pathBuilder, User.class, optionalAndDefaultFields);
+
+ /**
+ * The base URI for requests to the patreon API. This may be overridden (e.g. for testing) by passing
+ * -Dpatreon.rest.uri="https://my.other.server.com" as jvm arguments
+ */
+ public static final String BASE_URI = System.getProperty("patreon.rest.uri", "https://www.patreon.com");
+
+ private static final Logger LOG = LoggerFactory.getLogger(PatreonAPI.class);
+ private final String accessToken;
+ private final RequestUtil requestUtil;
+ private final ResourceConverter converter;
+
+ /**
+ * Create a new instance of the Patreon API. You only need one of these objects unless you are using the API
+ * with multiple tokens
+ *
+ * @param accessToken The "Creator's Access Token" found on
+ * the patreon client page
+ * OR OAuth access token
+ */
+ public PatreonAPI(String accessToken) {
+ this(accessToken, new RequestUtil());
}
- return converter.readDocument(
- getDataStream(pathBuilder.toString()),
- User.class
- );
- }
-
- /**
- * Get a list of campaigns the current creator is running - also contains other related data like Goals
- * Note: The first campaign data object is located at index 0 in the data list
- *
- * @return the list of campaigns
- * @throws IOException Thrown when the GET request failed
- */
- public JSONAPIDocument> fetchCampaigns() throws IOException {
- String path = new URIBuilder()
- .setPath("current_user/campaigns")
- .addParameter("include", "rewards,creator,goals")
- .toString();
- return converter.readDocumentCollection(
- getDataStream(path),
- Campaign.class
- );
- }
-
- /**
- * Retrieve pledges for the specified campaign
- *
- * @param campaignId id for campaign to retrieve
- * @param pageSize how many pledges to return
- * @param pageCursor A cursor retreived from a previous API call, or null for the initial page.
- * See {@link #getNextCursorFromDocument(JSONAPIDocument)}
- * @return the page of pledges
- * @throws IOException Thrown when the GET request failed
- */
- public JSONAPIDocument> fetchPageOfPledges(String campaignId, int pageSize, String pageCursor) throws IOException {
- return fetchPageOfPledges(campaignId, pageSize, pageCursor, null);
- }
-
- /**
- * Retrieve pledges for the specified campaign
- *
- * @param campaignId id for campaign to retrieve
- * @param pageSize how many pledges to return
- * @param pageCursor A cursor retreived from a previous API call, or null for the initial page.
- * See {@link #getNextCursorFromDocument(JSONAPIDocument)}
- * @param optionalFields A list of optional fields to return. See {@link Pledge.PledgeField}
- * @return the page of pledges
- * @throws IOException Thrown when the GET request failed
- */
- public JSONAPIDocument> fetchPageOfPledges(String campaignId, int pageSize, String pageCursor, Collection optionalFields) throws IOException {
- URIBuilder pathBuilder = new URIBuilder()
- .setPath(String.format("campaigns/%s/pledges", campaignId))
- .addParameter("page[count]", String.valueOf(pageSize));
- if (pageCursor != null) {
- pathBuilder.addParameter("page[cursor]", pageCursor);
+ /**
+ * For use in test.
+ */
+ PatreonAPI(String accessToken, RequestUtil requestUtil) {
+ this.accessToken = accessToken;
+ this.requestUtil = requestUtil;
+
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
+ objectMapper.configure(com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ this.converter = new ResourceConverter(
+ objectMapper,
+ User.class,
+ Campaign.class,
+ Pledge.class
+ );
+ this.converter.enableDeserializationOption(DeserializationFeature.ALLOW_UNKNOWN_INCLUSIONS);
}
- if (optionalFields != null) {
- Set optionalAndDefaultFields = new HashSet<>(optionalFields);
- optionalAndDefaultFields.addAll(Pledge.PledgeField.getDefaultFields());
- addFieldsParam(pathBuilder, Pledge.class, optionalAndDefaultFields);
+
+ /**
+ * Get the user object of the creator
+ *
+ * @return the current user
+ * @throws IOException Thrown when the GET request failed
+ */
+ public JSONAPIDocument fetchUser() throws IOException {
+ return fetchUser(null);
}
- return converter.readDocumentCollection(
- getDataStream(pathBuilder.toString()),
- Pledge.class
- );
- }
-
- public String getNextCursorFromDocument(JSONAPIDocument document) {
- Links links = document.getLinks();
- if (links == null) {
- return null;
+
+ /**
+ * Get the user object of the creator
+ *
+ * @param optionalFields A list of optional fields to request, or null. See {@link User.UserField}
+ * @return the current user
+ * @throws IOException Thrown when the GET request failed
+ */
+ public JSONAPIDocument fetchUser(Collection optionalFields) throws IOException {
+ URIBuilder pathBuilder = new URIBuilder()
+ .setPath("current_user")
+ .addParameter("include", "pledges");
+ if (optionalFields != null) {
+ Set optionalAndDefaultFields = new HashSet<>(optionalFields);
+ optionalAndDefaultFields.addAll(User.UserField.getDefaultFields());
+ addFieldsParam(pathBuilder, User.class, optionalAndDefaultFields);
+ }
+
+ return converter.readDocument(
+ getDataStream(pathBuilder.toString()),
+ User.class
+ );
+ }
+
+ public JSONAPIDocument fetchUser(Collection optionalFields,
+ Collection optionalPledgeFields) throws IOException {
+ URIBuilder pathBuilder = new URIBuilder()
+ .setPath("current_user")
+ .addParameter("include", "pledges");
+ if (optionalFields != null) {
+ Set optionalAndDefaultFields = new HashSet<>(optionalFields);
+ optionalAndDefaultFields.addAll(User.UserField.getDefaultFields());
+ addFieldsParam(pathBuilder, User.class, optionalAndDefaultFields);
+ }
+
+ if (optionalPledgeFields != null) {
+ Set optionalAndDefaultFields = new HashSet<>(optionalPledgeFields);
+ optionalAndDefaultFields.addAll(Pledge.PledgeField.getDefaultFields());
+ addFieldsParam(pathBuilder, Pledge.class, optionalAndDefaultFields);
+ }
+
+ return converter.readDocument(
+ getDataStream(pathBuilder.toString()),
+ User.class
+ );
}
- Link nextLink = links.getNext();
- if (nextLink == null) {
- return null;
+
+ private InputStream getDataStream(String suffix) throws IOException {
+ return this.requestUtil.request(suffix, this.accessToken);
}
- String nextLinkString = nextLink.toString();
- try {
- List queryParameters = URLEncodedUtils.parse(new URI(nextLinkString), "utf8");
- for (NameValuePair pair : queryParameters) {
- String name = pair.getName();
- if (name.equals("page[cursor]")) {
- return pair.getValue();
+
+ /**
+ * Add fields[type]=fieldName,fieldName,fieldName as a query parameter to the request represented by builder
+ *
+ * @param builder A URIBuilder building a request to the API
+ * @param type A BaseResource annotated with {@link com.github.jasminb.jsonapi.annotations.Type}
+ * @param fields A list of fields to include. Only fields in this list will be retrieved in the query
+ * @return builder
+ */
+ private URIBuilder addFieldsParam(URIBuilder builder, Class extends BaseResource> type, Collection
+ extends Field> fields) {
+ List fieldNames = new ArrayList<>();
+ for (Field f : fields) {
+ fieldNames.add(f.getPropertyName());
}
- }
- } catch (URISyntaxException e) {
- LOG.error(e.getMessage());
+ String typeStr = BaseResource.getType(type);
+ builder.addParameter("fields[" + typeStr + "]", String.join(",", fieldNames));
+
+ return builder;
}
- return null;
- }
-
- public List fetchAllPledges(String campaignId) throws IOException {
- Set pledges = new HashSet<>();
- String cursor = null;
- while (true) {
- JSONAPIDocument> pledgesPage = fetchPageOfPledges(campaignId, 15, cursor);
- pledges.addAll(pledgesPage.get());
- cursor = getNextCursorFromDocument(pledgesPage);
- if (cursor == null) {
- break;
- }
+
+ /**
+ * Get a list of campaigns the current creator is running - also contains other related data like Goals
+ * Note: The first campaign data object is located at index 0 in the data list
+ *
+ * @return the list of campaigns
+ * @throws IOException Thrown when the GET request failed
+ */
+ public JSONAPIDocument> fetchCampaigns() throws IOException {
+ String path = new URIBuilder()
+ .setPath("current_user/campaigns")
+ .addParameter("include", "rewards,creator,goals")
+ .toString();
+ return converter.readDocumentCollection(
+ getDataStream(path),
+ Campaign.class
+ );
}
- return new ArrayList<>(pledges);
- }
-
-
- private InputStream getDataStream(String suffix) throws IOException {
- return this.requestUtil.request(suffix, this.accessToken);
- }
-
- /**
- * Add fields[type]=fieldName,fieldName,fieldName as a query parameter to the request represented by builder
- * @param builder A URIBuilder building a request to the API
- * @param type A BaseResource annotated with {@link com.github.jasminb.jsonapi.annotations.Type}
- * @param fields A list of fields to include. Only fields in this list will be retrieved in the query
- * @return builder
- */
- private URIBuilder addFieldsParam(URIBuilder builder, Class extends BaseResource> type, Collection extends Field> fields) {
- List fieldNames = new ArrayList<>();
- for (Field f : fields) {
- fieldNames.add(f.getPropertyName());
+
+ public List fetchAllPledges(String campaignId) throws IOException {
+ Set pledges = new HashSet<>();
+ String cursor = null;
+ while (true) {
+ JSONAPIDocument> pledgesPage = fetchPageOfPledges(campaignId, 15, cursor);
+ pledges.addAll(pledgesPage.get());
+ cursor = getNextCursorFromDocument(pledgesPage);
+ if (cursor == null) {
+ break;
+ }
+ }
+ return new ArrayList<>(pledges);
}
- String typeStr = BaseResource.getType(type);
- builder.addParameter("fields[" + typeStr + "]", String.join(",", fieldNames));
- return builder;
- }
+ /**
+ * Retrieve pledges for the specified campaign
+ *
+ * @param campaignId id for campaign to retrieve
+ * @param pageSize how many pledges to return
+ * @param pageCursor A cursor retreived from a previous API call, or null for the initial page.
+ * See {@link #getNextCursorFromDocument(JSONAPIDocument)}
+ * @return the page of pledges
+ * @throws IOException Thrown when the GET request failed
+ */
+ public JSONAPIDocument> fetchPageOfPledges(String campaignId, int pageSize, String pageCursor) throws IOException {
+ return fetchPageOfPledges(campaignId, pageSize, pageCursor, null);
+ }
+
+ /**
+ * Retrieve pledges for the specified campaign
+ *
+ * @param campaignId id for campaign to retrieve
+ * @param pageSize how many pledges to return
+ * @param pageCursor A cursor retreived from a previous API call, or null for the initial page.
+ * See {@link #getNextCursorFromDocument(JSONAPIDocument)}
+ * @param optionalFields A list of optional fields to return. See {@link Pledge.PledgeField}
+ * @return the page of pledges
+ * @throws IOException Thrown when the GET request failed
+ */
+ public JSONAPIDocument> fetchPageOfPledges(String campaignId, int pageSize, String pageCursor,
+ Collection optionalFields) throws IOException {
+ URIBuilder pathBuilder = new URIBuilder()
+ .setPath(String.format("campaigns/%s/pledges", campaignId))
+ .addParameter("page[count]", String.valueOf(pageSize));
+ if (pageCursor != null) {
+ pathBuilder.addParameter("page[cursor]", pageCursor);
+ }
+ if (optionalFields != null) {
+ Set optionalAndDefaultFields = new HashSet<>(optionalFields);
+ optionalAndDefaultFields.addAll(Pledge.PledgeField.getDefaultFields());
+ addFieldsParam(pathBuilder, Pledge.class, optionalAndDefaultFields);
+ }
+ return converter.readDocumentCollection(
+ getDataStream(pathBuilder.toString()),
+ Pledge.class
+ );
+ }
+
+ public String getNextCursorFromDocument(JSONAPIDocument document) {
+ Links links = document.getLinks();
+ if (links == null) {
+ return null;
+ }
+ Link nextLink = links.getNext();
+ if (nextLink == null) {
+ return null;
+ }
+ String nextLinkString = nextLink.toString();
+ try {
+ List queryParameters = URLEncodedUtils.parse(new URI(nextLinkString), "utf8");
+ for (NameValuePair pair : queryParameters) {
+ String name = pair.getName();
+ if (name.equals("page[cursor]")) {
+ return pair.getValue();
+ }
+ }
+ } catch (URISyntaxException e) {
+ LOG.error(e.getMessage());
+ }
+ return null;
+ }
}
diff --git a/src/main/java/com/patreon/PatreonOAuth.java b/src/main/java/com/patreon/PatreonOAuth.java
index 984986a..dbad5bc 100644
--- a/src/main/java/com/patreon/PatreonOAuth.java
+++ b/src/main/java/com/patreon/PatreonOAuth.java
@@ -15,98 +15,100 @@
public class PatreonOAuth {
- private static final Gson gson = new GsonBuilder().serializeNulls().enableComplexMapKeySerialization().create();
- private static final Logger LOG = LoggerFactory.getLogger(PatreonOAuth.class);
- private static final String GRANT_TYPE_AUTHORIZATION = "authorization_code";
- private static final String GRANT_TYPE_TOKEN_REFRESH = "refresh_token";
- private final String clientID;
- private final String clientSecret;
- private final String redirectUri;
-
- public PatreonOAuth(String clientID, String clientSecret, String redirectUri) {
- this.clientID = clientID;
- this.clientSecret = clientSecret;
- this.redirectUri = redirectUri;
- }
-
- private static E toObject(String str, Class clazz) {
- return gson.fromJson(str, clazz);
- }
-
- public String getAuthorizationURL() {
- URIBuilder builder = null;
- try {
- builder = new URIBuilder(PatreonAPI.BASE_URI + "/oauth2/authorize");
- } catch (URISyntaxException e) {
- LOG.error(e.getMessage());
- }
- builder.addParameter("response_type", "code");
- builder.addParameter("client_id", clientID);
- builder.addParameter("redirect_uri", redirectUri);
- return builder.toString();
- }
-
- public TokensResponse getTokens(String code) throws IOException {
- Connection requestInfo = Jsoup.connect(PatreonAPI.BASE_URI + "/api/oauth2/token")
- .data("grant_type", GRANT_TYPE_AUTHORIZATION)
- .data("code", code)
- .data("client_id", clientID)
- .data("client_secret", clientSecret)
- .data("redirect_uri", redirectUri)
- .ignoreContentType(true);
- String response = requestInfo.post().body().text();
-
- return toObject(response, TokensResponse.class);
- }
-
- public TokensResponse refreshTokens(String refreshToken) throws IOException {
- Connection requestInfo = Jsoup.connect(PatreonAPI.BASE_URI + "/api/oauth2/token")
- .data("grant_type", GRANT_TYPE_TOKEN_REFRESH)
- .data("client_id", clientID)
- .data("client_secret", clientSecret)
- .data("refresh_token", refreshToken)
- .ignoreContentType(true);
- String response = requestInfo.post().body().text();
- return toObject(response, TokensResponse.class);
- }
-
- public static class TokensResponse {
- private String access_token;
- private String refresh_token;
- private int expires_in;
- private String scope;
- private String token_type;
- private Date expiresAt;
-
- public TokensResponse(String access_token, String refresh_token, int expires_in, String scope, String token_type) {
- this.access_token = access_token;
- this.refresh_token = refresh_token;
- this.expires_in = expires_in;
- this.scope = scope;
- this.token_type = token_type;
- Calendar calendar = Calendar.getInstance(); // gets a calendar using the default time zone and locale.
- calendar.add(Calendar.SECOND, expires_in);
- this.expiresAt = calendar.getTime();
+ private static final Gson gson = new GsonBuilder().serializeNulls().enableComplexMapKeySerialization().create();
+ private static final Logger LOG = LoggerFactory.getLogger(PatreonOAuth.class);
+ private static final String GRANT_TYPE_AUTHORIZATION = "authorization_code";
+ private static final String GRANT_TYPE_TOKEN_REFRESH = "refresh_token";
+ private final String clientID;
+ private final String clientSecret;
+ private final String redirectUri;
+
+ public PatreonOAuth(String clientID, String clientSecret, String redirectUri) {
+ this.clientID = clientID;
+ this.clientSecret = clientSecret;
+ this.redirectUri = redirectUri;
}
- public String getAccessToken() {
- return access_token;
+ public String getAuthorizationURL() {
+ URIBuilder builder = null;
+ try {
+ builder = new URIBuilder(PatreonAPI.BASE_URI + "/oauth2/authorize");
+ } catch (URISyntaxException e) {
+ LOG.error(e.getMessage());
+ }
+ builder.addParameter("response_type", "code");
+ builder.addParameter("client_id", clientID);
+ builder.addParameter("redirect_uri", redirectUri);
+ return builder.toString();
}
- public String getRefreshToken() {
- return refresh_token;
+ public TokensResponse getTokens(String code) throws IOException {
+ Connection requestInfo = Jsoup.connect(PatreonAPI.BASE_URI + "/api/oauth2/token")
+ .data("grant_type", GRANT_TYPE_AUTHORIZATION)
+ .data("code", code)
+ .data("client_id", clientID)
+ .data("client_secret", clientSecret)
+ .data("redirect_uri", redirectUri)
+ .ignoreContentType(true);
+ String response = requestInfo.post().body().text();
+
+ return toObject(response, TokensResponse.class);
}
- public int getExpiresIn() {
- return expires_in;
+ private static E toObject(String str, Class clazz) {
+ return gson.fromJson(str, clazz);
}
- public String getScope() {
- return scope;
+ public TokensResponse refreshTokens(String refreshToken) throws IOException {
+ Connection requestInfo = Jsoup.connect(PatreonAPI.BASE_URI + "/api/oauth2/token")
+ .data("grant_type", GRANT_TYPE_TOKEN_REFRESH)
+ .data("client_id", clientID)
+ .data("client_secret", clientSecret)
+ .data("refresh_token", refreshToken)
+ .ignoreContentType(true);
+ String response = requestInfo.post().body().text();
+ return toObject(response, TokensResponse.class);
}
- public String getTokenType() {
- return token_type;
+ public static class TokensResponse {
+
+ private final String access_token;
+ private final String refresh_token;
+ private final int expires_in;
+ private final String scope;
+ private final String token_type;
+ private final Date expiresAt;
+
+ public TokensResponse(String access_token, String refresh_token, int expires_in, String scope,
+ String token_type) {
+ this.access_token = access_token;
+ this.refresh_token = refresh_token;
+ this.expires_in = expires_in;
+ this.scope = scope;
+ this.token_type = token_type;
+ Calendar calendar = Calendar.getInstance(); // gets a calendar using the default time zone and locale.
+ calendar.add(Calendar.SECOND, expires_in);
+ this.expiresAt = calendar.getTime();
+ }
+
+ public String getAccessToken() {
+ return access_token;
+ }
+
+ public String getRefreshToken() {
+ return refresh_token;
+ }
+
+ public int getExpiresIn() {
+ return expires_in;
+ }
+
+ public String getScope() {
+ return scope;
+ }
+
+ public String getTokenType() {
+ return token_type;
+ }
}
- }
}
diff --git a/src/main/java/com/patreon/resources/Campaign.java b/src/main/java/com/patreon/resources/Campaign.java
index ba14bc9..543859a 100644
--- a/src/main/java/com/patreon/resources/Campaign.java
+++ b/src/main/java/com/patreon/resources/Campaign.java
@@ -7,7 +7,6 @@
import com.patreon.resources.shared.BaseResource;
import com.patreon.resources.shared.Field;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@@ -15,279 +14,275 @@
@Type("campaign")
public class Campaign extends BaseResource {
-
- public enum CampaignField implements Field {
- PledgeSum("pledge_sum", true),
- CreationName("creation_name", true),
- DiscordServerId("discor_server_id", true),
- CreatedAt("created_at", true),
- IsPlural("is_plural", true),
- MainVideoUrl("main_video_url", true),
- IsNsfw("is_nsfw", true),
- IsMonthly("is_monthly", true),
- PublishedAt("published_at", true),
- EarningsVisibility("earnings_visibility", true),
- OutstandingPaymentAmountCents("outstanding_payment_amount_cents", true),
- ImageSmallUrl("image_small_url", true),
- Summary("summary", true),
- ThanksMsg("thanks_msg", true),
- ImageUrl("image_url", true),
- CreationCount("creation_count", true),
- OneLiner("one_liner", true),
- IsChargedImmediately("is_charged_immediately", true),
- PatronCount("patron_count", true),
- DisplayPatronGoals("display_patron_goals", true),
- PledgeUrl("pledge_url", true),
- PayPerName("pay_per_name", true),
- ThanksEmbed("thanks_embed", true),
- MainVideoEmbed("main_video_embed", true),
- ThanksVideoUrl("thanks_video_url", true),
- About("about", true),
- ;
-
- private final String propertyName;
- private final boolean isDefault;
-
- CampaignField(String propertyName, boolean isDefault) {
- this.propertyName = propertyName;
- this.isDefault = isDefault;
- }
-
- public static Collection getDefaultFields() {
- return Arrays.stream(values()).filter(Field::isDefault).collect(Collectors.toList());
- }
-
- @Override
- public String getPropertyName() {
- return this.propertyName;
- }
-
- @Override
- public boolean isDefault() {
- return this.isDefault;
- }
- }
-
- private int pledgeSum;
- private String creationName;
- private String createdAt;
- private String pledgeUrl;
- private String payPerName;
- private String oneLiner;
- private String imageUrl;
- private String imageSmallUrl;
- private String summary;
- private String about;
- private String mainVideoEmbed;
- private String mainVideoUrl;
- private String thanksMsg;
- private String thanksEmbed;
- private String thanksVideoUrl;
- private String publishedAt;
- private String earningsVisibility;
- private boolean isMonthly;
- private boolean isChargedImmediately;
- private boolean isNsfw;
- private int patronCount;
- private int outstandingPaymentAmountCents;
- private int creationCount;
- private boolean isPlural;
- private boolean displayPatronGoals;
- private String discordServerId;
-
- @Relationship("pledges")
- private List pledges;
-
- @Relationship("creator")
- private User creator;
-
- @Relationship("rewards")
- private List rewards;
-
- @Relationship("goals")
- private List goals;
-
- public Campaign(
- @JsonProperty("pledge_sum") int pledgeSum,
- @JsonProperty("creation_name") String creationName,
- @JsonProperty("discor_server_id") String discordServerId,
- @JsonProperty("created_at") String createdAt,
- @JsonProperty("is_plural") boolean isPlural,
- @JsonProperty("main_video_url") String mainVideoUrl,
- @JsonProperty("is_nsfw") boolean isNsfw,
- @JsonProperty("is_monthly") boolean isMonthly,
- @JsonProperty("published_at") String publishedAt,
- @JsonProperty("earnings_visibility") String earningsVisibility,
- @JsonProperty("outstanding_payment_amount_cents") int outstandingPaymentAmountCents,
- @JsonProperty("image_small_url") String imageSmallUrl,
- @JsonProperty("summary") String summary,
- @JsonProperty("thanks_msg") String thanksMsg,
- @JsonProperty("image_url") String imageUrl,
- @JsonProperty("creation_count") int creationCount,
- @JsonProperty("one_liner") String oneLiner,
- @JsonProperty("is_charged_immediately") boolean isChargedImmediately,
- @JsonProperty("patron_count") int patronCount,
- @JsonProperty("display_patron_goals") boolean displayPatronGoals,
- @JsonProperty("pledge_url") String pledgeUrl,
- @JsonProperty("pay_per_name") String payPerName,
- @JsonProperty("thanks_embed") String thanksEmbed,
- @JsonProperty("main_video_embed") String mainVideoEmbed,
- @JsonProperty("thanks_video_url") String thanksVideoUrl,
- @JsonProperty("about") String about,
- @JsonProperty("pledges") List pledges,
- @JsonProperty("creator") User creator,
- @JsonProperty("rewards") List rewards,
- @JsonProperty("goals") List goals
- ) {
- this.pledgeSum = pledgeSum;
- this.creationName = creationName;
- this.discordServerId = discordServerId;
- this.createdAt = createdAt;
- this.isPlural = isPlural;
- this.mainVideoUrl = mainVideoUrl;
- this.isNsfw = isNsfw;
- this.isMonthly = isMonthly;
- this.publishedAt = publishedAt;
- this.earningsVisibility = earningsVisibility;
- this.outstandingPaymentAmountCents = outstandingPaymentAmountCents;
- this.imageSmallUrl = imageSmallUrl;
- this.summary = summary;
- this.thanksMsg = thanksMsg;
- this.imageUrl = imageUrl;
- this.creationCount = creationCount;
- this.oneLiner = oneLiner;
- this.isChargedImmediately = isChargedImmediately;
- this.patronCount = patronCount;
- this.displayPatronGoals = displayPatronGoals;
- this.pledgeUrl = pledgeUrl;
- this.payPerName = payPerName;
- this.thanksEmbed = thanksEmbed;
- this.mainVideoEmbed = mainVideoEmbed;
- this.thanksVideoUrl = thanksVideoUrl;
- this.about = about;
- this.pledges = pledges;
- this.creator = creator;
- this.rewards = rewards;
- this.goals = goals;
- }
-
- public int getPledgeSum() {
- return pledgeSum;
- }
-
- public String getCreationName() {
- return creationName;
- }
-
- public String getDiscordServerId() {
- return discordServerId;
- }
-
- public String getCreatedAt() {
- return createdAt;
- }
-
- public boolean isPlural() {
- return isPlural;
- }
-
- public String getMainVideoUrl() {
- return mainVideoUrl;
- }
-
- public boolean isNsfw() {
- return isNsfw;
- }
-
- public boolean isMonthly() {
- return isMonthly;
- }
-
- public String getPublishedAt() {
- return publishedAt;
- }
-
- public String getEarningsVisibility() {
- return earningsVisibility;
- }
-
- public int getOutstandingPaymentAmountCents() {
- return outstandingPaymentAmountCents;
- }
-
- public String getImageSmallUrl() {
- return imageSmallUrl;
- }
-
- public String getSummary() {
- return summary;
- }
-
- public String getThanksMsg() {
- return thanksMsg;
- }
-
- public String getImageUrl() {
- return imageUrl;
- }
-
- public int getCreationCount() {
- return creationCount;
- }
-
- public String getOneLiner() {
- return oneLiner;
- }
-
- public boolean isChargedImmediately() {
- return isChargedImmediately;
- }
-
- public int getPatronCount() {
- return patronCount;
- }
-
- public boolean isDisplayPatronGoals() {
- return displayPatronGoals;
- }
-
- public String getPledgeUrl() {
- return pledgeUrl;
- }
-
- public String getPayPerName() {
- return payPerName;
- }
-
- public String getThanksEmbed() {
- return thanksEmbed;
- }
-
- public String getMainVideoEmbed() {
- return mainVideoEmbed;
- }
-
- public String getThanksVideoUrl() {
- return thanksVideoUrl;
- }
- public String getAbout() {
- return about;
- }
+ private final int pledgeSum;
+ private final String creationName;
+ private final String createdAt;
+ private final String pledgeUrl;
+ private final String payPerName;
+ private final String oneLiner;
+ private final String imageUrl;
+ private final String imageSmallUrl;
+ private final String summary;
+ private final String about;
+ private final String mainVideoEmbed;
+ private final String mainVideoUrl;
+ private final String thanksMsg;
+ private final String thanksEmbed;
+ private final String thanksVideoUrl;
+ private final String publishedAt;
+ private final String earningsVisibility;
+ private final boolean isMonthly;
+ private final boolean isChargedImmediately;
+ private final boolean isNsfw;
+ private final int patronCount;
+ private final int outstandingPaymentAmountCents;
+ private final int creationCount;
+ private final boolean isPlural;
+ private final boolean displayPatronGoals;
+ private final String discordServerId;
+ @Relationship("pledges")
+ private final List pledges;
+ @Relationship("creator")
+ private final User creator;
+ @Relationship("rewards")
+ private final List rewards;
+ @Relationship("goals")
+ private final List goals;
+
+ public Campaign(
+ @JsonProperty("pledge_sum") int pledgeSum,
+ @JsonProperty("creation_name") String creationName,
+ @JsonProperty("discor_server_id") String discordServerId,
+ @JsonProperty("created_at") String createdAt,
+ @JsonProperty("is_plural") boolean isPlural,
+ @JsonProperty("main_video_url") String mainVideoUrl,
+ @JsonProperty("is_nsfw") boolean isNsfw,
+ @JsonProperty("is_monthly") boolean isMonthly,
+ @JsonProperty("published_at") String publishedAt,
+ @JsonProperty("earnings_visibility") String earningsVisibility,
+ @JsonProperty("outstanding_payment_amount_cents") int outstandingPaymentAmountCents,
+ @JsonProperty("image_small_url") String imageSmallUrl,
+ @JsonProperty("summary") String summary,
+ @JsonProperty("thanks_msg") String thanksMsg,
+ @JsonProperty("image_url") String imageUrl,
+ @JsonProperty("creation_count") int creationCount,
+ @JsonProperty("one_liner") String oneLiner,
+ @JsonProperty("is_charged_immediately") boolean isChargedImmediately,
+ @JsonProperty("patron_count") int patronCount,
+ @JsonProperty("display_patron_goals") boolean displayPatronGoals,
+ @JsonProperty("pledge_url") String pledgeUrl,
+ @JsonProperty("pay_per_name") String payPerName,
+ @JsonProperty("thanks_embed") String thanksEmbed,
+ @JsonProperty("main_video_embed") String mainVideoEmbed,
+ @JsonProperty("thanks_video_url") String thanksVideoUrl,
+ @JsonProperty("about") String about,
+ @JsonProperty("pledges") List pledges,
+ @JsonProperty("creator") User creator,
+ @JsonProperty("rewards") List rewards,
+ @JsonProperty("goals") List goals
+ ) {
+ this.pledgeSum = pledgeSum;
+ this.creationName = creationName;
+ this.discordServerId = discordServerId;
+ this.createdAt = createdAt;
+ this.isPlural = isPlural;
+ this.mainVideoUrl = mainVideoUrl;
+ this.isNsfw = isNsfw;
+ this.isMonthly = isMonthly;
+ this.publishedAt = publishedAt;
+ this.earningsVisibility = earningsVisibility;
+ this.outstandingPaymentAmountCents = outstandingPaymentAmountCents;
+ this.imageSmallUrl = imageSmallUrl;
+ this.summary = summary;
+ this.thanksMsg = thanksMsg;
+ this.imageUrl = imageUrl;
+ this.creationCount = creationCount;
+ this.oneLiner = oneLiner;
+ this.isChargedImmediately = isChargedImmediately;
+ this.patronCount = patronCount;
+ this.displayPatronGoals = displayPatronGoals;
+ this.pledgeUrl = pledgeUrl;
+ this.payPerName = payPerName;
+ this.thanksEmbed = thanksEmbed;
+ this.mainVideoEmbed = mainVideoEmbed;
+ this.thanksVideoUrl = thanksVideoUrl;
+ this.about = about;
+ this.pledges = pledges;
+ this.creator = creator;
+ this.rewards = rewards;
+ this.goals = goals;
+ }
+
+ public int getPledgeSum() {
+ return pledgeSum;
+ }
+
+ public String getCreationName() {
+ return creationName;
+ }
+
+ public String getDiscordServerId() {
+ return discordServerId;
+ }
+
+ public String getCreatedAt() {
+ return createdAt;
+ }
+
+ public boolean isPlural() {
+ return isPlural;
+ }
+
+ public String getMainVideoUrl() {
+ return mainVideoUrl;
+ }
+
+ public boolean isNsfw() {
+ return isNsfw;
+ }
- public List getPledges() {
- return pledges;
- }
+ public boolean isMonthly() {
+ return isMonthly;
+ }
+
+ public String getPublishedAt() {
+ return publishedAt;
+ }
+
+ public String getEarningsVisibility() {
+ return earningsVisibility;
+ }
+
+ public int getOutstandingPaymentAmountCents() {
+ return outstandingPaymentAmountCents;
+ }
- public User getCreator() {
- return creator;
- }
+ public String getImageSmallUrl() {
+ return imageSmallUrl;
+ }
- public List getRewards() {
- return rewards;
- }
+ public String getSummary() {
+ return summary;
+ }
+
+ public String getThanksMsg() {
+ return thanksMsg;
+ }
+
+ public String getImageUrl() {
+ return imageUrl;
+ }
+
+ public int getCreationCount() {
+ return creationCount;
+ }
- public List getGoals() {
- return goals;
- }
+ public String getOneLiner() {
+ return oneLiner;
+ }
+
+ public boolean isChargedImmediately() {
+ return isChargedImmediately;
+ }
+
+ public int getPatronCount() {
+ return patronCount;
+ }
+
+ public boolean isDisplayPatronGoals() {
+ return displayPatronGoals;
+ }
+
+ public String getPledgeUrl() {
+ return pledgeUrl;
+ }
+
+ public String getPayPerName() {
+ return payPerName;
+ }
+
+ public String getThanksEmbed() {
+ return thanksEmbed;
+ }
+
+ public String getMainVideoEmbed() {
+ return mainVideoEmbed;
+ }
+
+ public String getThanksVideoUrl() {
+ return thanksVideoUrl;
+ }
+
+ public String getAbout() {
+ return about;
+ }
+
+ public List getPledges() {
+ return pledges;
+ }
+
+ public User getCreator() {
+ return creator;
+ }
+
+ public List getRewards() {
+ return rewards;
+ }
+
+ public List getGoals() {
+ return goals;
+ }
+
+ public enum CampaignField implements Field {
+ PledgeSum("pledge_sum", true),
+ CreationName("creation_name", true),
+ DiscordServerId("discor_server_id", true),
+ CreatedAt("created_at", true),
+ IsPlural("is_plural", true),
+ MainVideoUrl("main_video_url", true),
+ IsNsfw("is_nsfw", true),
+ IsMonthly("is_monthly", true),
+ PublishedAt("published_at", true),
+ EarningsVisibility("earnings_visibility", true),
+ OutstandingPaymentAmountCents("outstanding_payment_amount_cents", true),
+ ImageSmallUrl("image_small_url", true),
+ Summary("summary", true),
+ ThanksMsg("thanks_msg", true),
+ ImageUrl("image_url", true),
+ CreationCount("creation_count", true),
+ OneLiner("one_liner", true),
+ IsChargedImmediately("is_charged_immediately", true),
+ PatronCount("patron_count", true),
+ DisplayPatronGoals("display_patron_goals", true),
+ PledgeUrl("pledge_url", true),
+ PayPerName("pay_per_name", true),
+ ThanksEmbed("thanks_embed", true),
+ MainVideoEmbed("main_video_embed", true),
+ ThanksVideoUrl("thanks_video_url", true),
+ About("about", true),
+ ;
+
+ private final String propertyName;
+ private final boolean isDefault;
+
+ CampaignField(String propertyName, boolean isDefault) {
+ this.propertyName = propertyName;
+ this.isDefault = isDefault;
+ }
+
+ public static Collection getDefaultFields() {
+ return Arrays.stream(values()).filter(Field::isDefault).collect(Collectors.toList());
+ }
+
+ @Override
+ public String getPropertyName() {
+ return this.propertyName;
+ }
+
+ @Override
+ public boolean isDefault() {
+ return this.isDefault;
+ }
+ }
}
diff --git a/src/main/java/com/patreon/resources/Goal.java b/src/main/java/com/patreon/resources/Goal.java
index c03e62c..dce47b8 100644
--- a/src/main/java/com/patreon/resources/Goal.java
+++ b/src/main/java/com/patreon/resources/Goal.java
@@ -5,91 +5,88 @@
import com.patreon.resources.shared.BaseResource;
import com.patreon.resources.shared.Field;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-import java.util.List;
import java.util.stream.Collectors;
@Type("goal")
public class Goal extends BaseResource {
-
- public enum GoalField implements Field {
- AmountCents("amount_cents", true),
- CompletedPercentage("completed_percentage", true),
- CreatedAt("created_at", true),
- Description("description", true),
- ReachedAt("reached_at", true),
- Title("title", true),
- ;
-
- private final String propertyName;
- private final boolean isDefault;
-
- GoalField(String propertyName, boolean isDefault) {
- this.propertyName = propertyName;
- this.isDefault = isDefault;
+
+ private final int amount_cents;
+ private final int completed_percentage;
+ private final String created_at;
+ private final String description;
+ private final String reached_at;
+ private final String title;
+ public Goal(
+ @JsonProperty("amount_cents") int amount_cents,
+ @JsonProperty("completed_percentage") int completed_percentage,
+ @JsonProperty("created_at") String created_at,
+ @JsonProperty("description") String description,
+ @JsonProperty("reached_at") String reached_at,
+ @JsonProperty("title") String title
+ ) {
+ this.amount_cents = amount_cents;
+ this.completed_percentage = completed_percentage;
+ this.created_at = created_at;
+ this.description = description;
+ this.reached_at = reached_at;
+ this.title = title;
+ }
+
+ public int getAmountCents() {
+ return amount_cents;
+ }
+
+ public int getCompletedPercentage() {
+ return completed_percentage;
+ }
+
+ public String getCreatedAt() {
+ return created_at;
+ }
+
+ public String getDescription() {
+ return description;
}
- public static Collection getDefaultFields() {
- return Arrays.stream(values()).filter(Field::isDefault).collect(Collectors.toList());
+ public String getReachedAt() {
+ return reached_at;
}
- @Override
- public String getPropertyName() {
- return this.propertyName;
+ public String getTitle() {
+ return title;
}
- @Override
- public boolean isDefault() {
- return this.isDefault;
+ public enum GoalField implements Field {
+ AmountCents("amount_cents", true),
+ CompletedPercentage("completed_percentage", true),
+ CreatedAt("created_at", true),
+ Description("description", true),
+ ReachedAt("reached_at", true),
+ Title("title", true),
+ ;
+
+ private final String propertyName;
+ private final boolean isDefault;
+
+ GoalField(String propertyName, boolean isDefault) {
+ this.propertyName = propertyName;
+ this.isDefault = isDefault;
+ }
+
+ public static Collection getDefaultFields() {
+ return Arrays.stream(values()).filter(Field::isDefault).collect(Collectors.toList());
+ }
+
+ @Override
+ public String getPropertyName() {
+ return this.propertyName;
+ }
+
+ @Override
+ public boolean isDefault() {
+ return this.isDefault;
+ }
}
- }
-
- private int amount_cents;
- private int completed_percentage;
- private String created_at;
- private String description;
- private String reached_at;
- private String title;
-
- public Goal(
- @JsonProperty("amount_cents") int amount_cents,
- @JsonProperty("completed_percentage") int completed_percentage,
- @JsonProperty("created_at") String created_at,
- @JsonProperty("description") String description,
- @JsonProperty("reached_at") String reached_at,
- @JsonProperty("title") String title
- ) {
- this.amount_cents = amount_cents;
- this.completed_percentage = completed_percentage;
- this.created_at = created_at;
- this.description = description;
- this.reached_at = reached_at;
- this.title = title;
- }
-
- public int getAmountCents() {
- return amount_cents;
- }
-
- public int getCompletedPercentage() {
- return completed_percentage;
- }
-
- public String getCreatedAt() {
- return created_at;
- }
-
- public String getDescription() {
- return description;
- }
-
- public String getReachedAt() {
- return reached_at;
- }
-
- public String getTitle() {
- return title;
- }
}
diff --git a/src/main/java/com/patreon/resources/Pledge.java b/src/main/java/com/patreon/resources/Pledge.java
index bcb4a72..2c08534 100644
--- a/src/main/java/com/patreon/resources/Pledge.java
+++ b/src/main/java/com/patreon/resources/Pledge.java
@@ -6,146 +6,156 @@
import com.patreon.resources.shared.BaseResource;
import com.patreon.resources.shared.Field;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-import java.util.List;
import java.util.stream.Collectors;
@Type("pledge")
public class Pledge extends BaseResource {
-
- public enum PledgeField implements Field {
- AmountCents("amount_cents", true),
- CreatedAt("created_at", true),
- DeclinedSince("declined_since", true),
- PatronPaysFees("patron_pays_fees", true),
- PledgeCapCents("pledge_cap_cents", true),
- TotalHistoricalAmountCents("total_historical_amount_cents", false),
- IsPaused("is_paused", false),
- HasShippingAddress("has_shipping_address", false),
- ;
-
- private final String propertyName;
- private final boolean isDefault;
-
- PledgeField(String propertyName, boolean isDefault) {
- this.propertyName = propertyName;
- this.isDefault = isDefault;
+
+ private final int amountCents;
+ private final String createdAt;
+ private final String currency;
+ private final String declinedSince;
+ private final boolean patronPaysFees;
+ private final int pledgeCapCents;
+ //Optional properties. Will be null if not requested
+ private final Integer totalHistoricalAmountCents;
+ private final Boolean isPaused;
+ private final String status;
+ private final Boolean hasShippingAddress;
+ @Relationship("creator")
+ private final User creator;
+ @Relationship("patron")
+ private final User patron;
+ @Relationship("reward")
+ private final Reward reward;
+
+ public Pledge(
+ @JsonProperty("amount_cents") int amount_cents,
+ @JsonProperty("created_at") String created_at,
+ @JsonProperty("currency") String currency,
+ @JsonProperty("declined_since") String declined_since,
+ @JsonProperty("patron_pays_fees") boolean patron_pays_fees,
+ @JsonProperty("pledge_cap_cents") int pledge_cap_cents,
+ @JsonProperty("total_historical_amount_cents") Integer total_historical_amount_cents,
+ @JsonProperty("is_paused") Boolean is_paused,
+ @JsonProperty("status") String status,
+ @JsonProperty("has_shipping_address") Boolean has_shipping_address,
+ @JsonProperty("creator") User creator,
+ @JsonProperty("patron") User patron,
+ @JsonProperty("reward") Reward reward
+ ) {
+ this.amountCents = amount_cents;
+ this.createdAt = created_at;
+ this.currency = currency;
+ this.declinedSince = declined_since;
+ this.patronPaysFees = patron_pays_fees;
+ this.pledgeCapCents = pledge_cap_cents;
+ this.totalHistoricalAmountCents = total_historical_amount_cents;
+ this.isPaused = is_paused;
+ this.status = status;
+ this.hasShippingAddress = has_shipping_address;
+ this.creator = creator;
+ this.patron = patron;
+ this.reward = reward;
+ }
+
+ public int getAmountCents() {
+ return amountCents;
+ }
+
+ public String getCreatedAt() {
+ return createdAt;
+ }
+
+ public String getCurrency() {
+ return currency;
+ }
+
+ public String getDeclinedSince() {
+ return declinedSince;
+ }
+
+ public boolean getPatronPaysFees() {
+ return patronPaysFees;
+ }
+
+ public int getPledgeCapCents() {
+ return pledgeCapCents;
+ }
+
+ /**
+ * @return The lifetime value this patron has paid to the campaign, or null
+ * if this field was not requested
+ */
+ public Integer getTotalHistoricalAmountCents() {
+ return totalHistoricalAmountCents;
+ }
+
+ /**
+ * @return Whether the pledge is paused, or null if this field wasn't requested.
+ */
+ public Boolean getPaused() {
+ return isPaused;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ /**
+ * @return Whether this patron has a shipping address, or null if this field wasn't requested
+ */
+ public Boolean getHasShippingAddress() {
+ return hasShippingAddress;
+ }
+
+ public User getCreator() {
+ return creator;
}
- public static Collection getDefaultFields() {
- return Arrays.stream(values()).filter(Field::isDefault).collect(Collectors.toList());
+ public User getPatron() {
+ return patron;
}
- @Override
- public String getPropertyName() {
- return this.propertyName;
+ public Reward getReward() {
+ return reward;
}
- @Override
- public boolean isDefault() {
- return this.isDefault;
+ public enum PledgeField implements Field {
+ AmountCents("amount_cents", true),
+ CreatedAt("created_at", true),
+ Currency("currency", true),
+ DeclinedSince("declined_since", true),
+ PatronPaysFees("patron_pays_fees", true),
+ PledgeCapCents("pledge_cap_cents", true),
+ TotalHistoricalAmountCents("total_historical_amount_cents", false),
+ IsPaused("is_paused", false),
+ Status("status", false),
+ HasShippingAddress("has_shipping_address", false),
+ ;
+
+ private final String propertyName;
+ private final boolean isDefault;
+
+ PledgeField(String propertyName, boolean isDefault) {
+ this.propertyName = propertyName;
+ this.isDefault = isDefault;
+ }
+
+ public static Collection getDefaultFields() {
+ return Arrays.stream(values()).filter(Field::isDefault).collect(Collectors.toList());
+ }
+
+ @Override
+ public String getPropertyName() {
+ return this.propertyName;
+ }
+
+ @Override
+ public boolean isDefault() {
+ return this.isDefault;
+ }
}
- }
-
- private int amountCents;
- private String createdAt;
- private String declinedSince;
- private boolean patronPaysFees;
- private int pledgeCapCents;
-
- //Optional properties. Will be null if not requested
- private Integer totalHistoricalAmountCents;
- private Boolean isPaused;
- private Boolean hasShippingAddress;
-
- @Relationship("creator")
- private User creator;
-
- @Relationship("patron")
- private User patron;
-
- @Relationship("reward")
- private Reward reward;
-
- public Pledge(
- @JsonProperty("amount_cents") int amount_cents,
- @JsonProperty("created_at") String created_at,
- @JsonProperty("declined_since") String declined_since,
- @JsonProperty("patron_pays_fees") boolean patron_pays_fees,
- @JsonProperty("pledge_cap_cents") int pledge_cap_cents,
- @JsonProperty("total_historical_amount_cents") Integer total_historical_amount_cents,
- @JsonProperty("is_paused") Boolean is_paused,
- @JsonProperty("has_shipping_address") Boolean has_shipping_address,
- @JsonProperty("creator") User creator,
- @JsonProperty("patron") User patron,
- @JsonProperty("reward") Reward reward
- ) {
- this.amountCents = amount_cents;
- this.createdAt = created_at;
- this.declinedSince = declined_since;
- this.patronPaysFees = patron_pays_fees;
- this.pledgeCapCents = pledge_cap_cents;
- this.totalHistoricalAmountCents = total_historical_amount_cents;
- this.isPaused = is_paused;
- this.hasShippingAddress = has_shipping_address;
- this.creator = creator;
- this.patron = patron;
- this.reward = reward;
- }
-
- public int getAmountCents() {
- return amountCents;
- }
-
- public String getCreatedAt() {
- return createdAt;
- }
-
- public String getDeclinedSince() {
- return declinedSince;
- }
-
- public boolean getPatronPaysFees() {
- return patronPaysFees;
- }
-
- public int getPledgeCapCents() {
- return pledgeCapCents;
- }
-
- /**
- * @return The lifetime value this patron has paid to the campaign, or null
- * if this field was not requested
- */
- public Integer getTotalHistoricalAmountCents() {
- return totalHistoricalAmountCents;
- }
-
- /**
- * @return Whether the pledge is paused, or null if this field wasn't requested.
- */
- public Boolean getPaused() {
- return isPaused;
- }
-
- /**
- * @return Whether this patron has a shipping address, or null if this field wasn't requested
- */
- public Boolean getHasShippingAddress() {
- return hasShippingAddress;
- }
-
- public User getCreator() {
- return creator;
- }
-
- public User getPatron() {
- return patron;
- }
-
- public Reward getReward() {
- return reward;
- }
}
diff --git a/src/main/java/com/patreon/resources/RequestUtil.java b/src/main/java/com/patreon/resources/RequestUtil.java
index cabb20e..ec629d0 100644
--- a/src/main/java/com/patreon/resources/RequestUtil.java
+++ b/src/main/java/com/patreon/resources/RequestUtil.java
@@ -12,26 +12,26 @@
*/
public class RequestUtil {
- public InputStream request(String pathSuffix, String accessToken) throws IOException {
- String prefix = BASE_URI + "/api/oauth2/api/";
- URL url = new URL(prefix.concat(pathSuffix));
- HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- connection.setRequestProperty("Authorization", "Bearer ".concat(accessToken));
- connection.setRequestProperty("User-Agent",
- String.format(
- "Patreon-Java, version %s, platform %s %s",
- getVersion(),
- System.getProperty("os.name"),
- System.getProperty("os.version")));
- return connection.getInputStream();
- }
+ public InputStream request(String pathSuffix, String accessToken) throws IOException {
+ String prefix = BASE_URI + "/api/oauth2/api";
+ URL url = new URL(prefix.concat(pathSuffix));
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setRequestProperty("Authorization", "Bearer ".concat(accessToken));
+ connection.setRequestProperty("User-Agent",
+ String.format(
+ "Patreon-Java, version %s, platform %s %s",
+ getVersion(),
+ System.getProperty("os.name"),
+ System.getProperty("os.version")));
+ return connection.getInputStream();
+ }
- private String getVersion() throws IOException {
- InputStream resourceAsStream = this.getClass().getResourceAsStream("/version.properties");
- java.util.Properties prop = new java.util.Properties();
- prop.load(resourceAsStream);
- return prop.getProperty("version");
- }
+ private String getVersion() throws IOException {
+ InputStream resourceAsStream = this.getClass().getResourceAsStream("/version.properties");
+ java.util.Properties prop = new java.util.Properties();
+ prop.load(resourceAsStream);
+ return prop.getProperty("version");
+ }
}
diff --git a/src/main/java/com/patreon/resources/Reward.java b/src/main/java/com/patreon/resources/Reward.java
index 714c852..312110e 100644
--- a/src/main/java/com/patreon/resources/Reward.java
+++ b/src/main/java/com/patreon/resources/Reward.java
@@ -6,7 +6,6 @@
import com.patreon.resources.shared.BaseResource;
import com.patreon.resources.shared.Field;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@@ -14,172 +13,171 @@
@Type("reward")
public class Reward extends BaseResource {
-
- public enum RewardField implements Field {
- AmountCents("amount_cents", true),
- CreatedAt("created_at", true),
- Description("description", true),
- Remaining("remaining", true),
- RequiresShipping("requires_shipping", true),
- Url("url", true),
- UserLimit("user_limit", true),
- EditedAt("edited_at", true),
- PatronCount("patron_count", true),
- Published("published", true),
- PublishedAt("published_at", true),
- ImageUrl("image_url", true),
- DiscordRoleIds("discord_role_ids", true),
- Title("title", true),
- UnpublishedAt("unpublished_at", true),;
-
- private final String propertyName;
- private final boolean isDefault;
-
- RewardField(String propertyName, boolean isDefault) {
- this.propertyName = propertyName;
- this.isDefault = isDefault;
- }
-
- public static Collection getDefaultFields() {
- return Arrays.stream(values()).filter(Field::isDefault).collect(Collectors.toList());
- }
-
- @Override
- public String getPropertyName() {
- return this.propertyName;
- }
-
- @Override
- public boolean isDefault() {
- return this.isDefault;
- }
- }
-
- private int amount_cents;
- private String created_at;
- private String description;
- private float remaining;
- private boolean requires_shipping;
- private String url;
- private Integer user_limit;
- private String edited_at;
- private int patron_count;
- private boolean published;
- private String published_at;
- private String image_url;
- private List discord_role_ids;
- private String title;
- private String unpublished_at;
-
- @Relationship("creator")
- private User creator;
-
- @Relationship("campaign")
- private Campaign campaign;
-
- public Reward(
- @JsonProperty("amount_cents") int amount_cents,
- @JsonProperty("created_at") String created_at,
- @JsonProperty("description") String description,
- @JsonProperty("remaining") float remaining,
- @JsonProperty("requires_shipping") boolean requires_shipping,
- @JsonProperty("url") String url,
- @JsonProperty("user_limit") Integer user_limit,
- @JsonProperty("edited_at") String edited_at,
- @JsonProperty("patron_count") int patron_count,
- @JsonProperty("published") boolean published,
- @JsonProperty("published_at") String published_at,
- @JsonProperty("image_url") String image_url,
- @JsonProperty("discord_role_ids") List discord_role_ids,
- @JsonProperty("title") String title,
- @JsonProperty("unpublished_at") String unpublished_at,
- @JsonProperty("creator") User creator,
- @JsonProperty("campaign") Campaign campaign
- ) {
- this.amount_cents = amount_cents;
- this.created_at = created_at;
- this.description = description;
- this.remaining = remaining;
- this.requires_shipping = requires_shipping;
- this.url = url;
- this.user_limit = user_limit;
- this.edited_at = edited_at;
- this.patron_count = patron_count;
- this.published = published;
- this.published_at = published_at;
- this.image_url = image_url;
- this.discord_role_ids = discord_role_ids;
- this.title = title;
- this.unpublished_at = unpublished_at;
- this.creator = creator;
- this.campaign = campaign;
- }
-
- public int getAmountCents() {
- return amount_cents;
- }
-
- public String getCreatedAt() {
- return created_at;
- }
-
- public String getDescription() {
- return description;
- }
-
- public float getRemaining() {
- return remaining;
- }
-
- public boolean isRequiresShipping() {
- return requires_shipping;
- }
-
- public String getUrl() {
- return url;
- }
-
- public Integer getUserLimit() {
- return user_limit;
- }
-
- public String getEditedAt() {
- return edited_at;
- }
-
- public String getPublishedAt() {
- return published_at;
- }
-
- public String getImageUrl() {
- return image_url;
- }
-
- public List getDiscordRoleIds() {
- return discord_role_ids;
- }
-
- public String getTitle() {
- return title;
- }
-
- public String getUnpublishedAt() {
- return unpublished_at;
- }
-
- public User getCreator() {
- return creator;
- }
-
- public Campaign getCampaign() {
- return campaign;
- }
-
- public int getPatronCount() {
- return patron_count;
- }
-
- public boolean isPublished() {
- return published;
- }
+
+ private final int amount_cents;
+ private final String created_at;
+ private final String description;
+ private final float remaining;
+ private final boolean requires_shipping;
+ private final String url;
+ private final Integer user_limit;
+ private final String edited_at;
+ private final int patron_count;
+ private final boolean published;
+ private final String published_at;
+ private final String image_url;
+ private final List discord_role_ids;
+ private final String title;
+ private final String unpublished_at;
+ @Relationship("creator")
+ private final User creator;
+ @Relationship("campaign")
+ private final Campaign campaign;
+
+ public Reward(
+ @JsonProperty("amount_cents") int amount_cents,
+ @JsonProperty("created_at") String created_at,
+ @JsonProperty("description") String description,
+ @JsonProperty("remaining") float remaining,
+ @JsonProperty("requires_shipping") boolean requires_shipping,
+ @JsonProperty("url") String url,
+ @JsonProperty("user_limit") Integer user_limit,
+ @JsonProperty("edited_at") String edited_at,
+ @JsonProperty("patron_count") int patron_count,
+ @JsonProperty("published") boolean published,
+ @JsonProperty("published_at") String published_at,
+ @JsonProperty("image_url") String image_url,
+ @JsonProperty("discord_role_ids") List discord_role_ids,
+ @JsonProperty("title") String title,
+ @JsonProperty("unpublished_at") String unpublished_at,
+ @JsonProperty("creator") User creator,
+ @JsonProperty("campaign") Campaign campaign
+ ) {
+ this.amount_cents = amount_cents;
+ this.created_at = created_at;
+ this.description = description;
+ this.remaining = remaining;
+ this.requires_shipping = requires_shipping;
+ this.url = url;
+ this.user_limit = user_limit;
+ this.edited_at = edited_at;
+ this.patron_count = patron_count;
+ this.published = published;
+ this.published_at = published_at;
+ this.image_url = image_url;
+ this.discord_role_ids = discord_role_ids;
+ this.title = title;
+ this.unpublished_at = unpublished_at;
+ this.creator = creator;
+ this.campaign = campaign;
+ }
+
+ public int getAmountCents() {
+ return amount_cents;
+ }
+
+ public String getCreatedAt() {
+ return created_at;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public float getRemaining() {
+ return remaining;
+ }
+
+ public boolean isRequiresShipping() {
+ return requires_shipping;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public Integer getUserLimit() {
+ return user_limit;
+ }
+
+ public String getEditedAt() {
+ return edited_at;
+ }
+
+ public String getPublishedAt() {
+ return published_at;
+ }
+
+ public String getImageUrl() {
+ return image_url;
+ }
+
+ public List getDiscordRoleIds() {
+ return discord_role_ids;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public String getUnpublishedAt() {
+ return unpublished_at;
+ }
+
+ public User getCreator() {
+ return creator;
+ }
+
+ public Campaign getCampaign() {
+ return campaign;
+ }
+
+ public int getPatronCount() {
+ return patron_count;
+ }
+
+ public boolean isPublished() {
+ return published;
+ }
+
+ public enum RewardField implements Field {
+ AmountCents("amount_cents", true),
+ CreatedAt("created_at", true),
+ Description("description", true),
+ Remaining("remaining", true),
+ RequiresShipping("requires_shipping", true),
+ Url("url", true),
+ UserLimit("user_limit", true),
+ EditedAt("edited_at", true),
+ PatronCount("patron_count", true),
+ Published("published", true),
+ PublishedAt("published_at", true),
+ ImageUrl("image_url", true),
+ DiscordRoleIds("discord_role_ids", true),
+ Title("title", true),
+ UnpublishedAt("unpublished_at", true),
+ ;
+
+ private final String propertyName;
+ private final boolean isDefault;
+
+ RewardField(String propertyName, boolean isDefault) {
+ this.propertyName = propertyName;
+ this.isDefault = isDefault;
+ }
+
+ public static Collection getDefaultFields() {
+ return Arrays.stream(values()).filter(Field::isDefault).collect(Collectors.toList());
+ }
+
+ @Override
+ public String getPropertyName() {
+ return this.propertyName;
+ }
+
+ @Override
+ public boolean isDefault() {
+ return this.isDefault;
+ }
+ }
}
diff --git a/src/main/java/com/patreon/resources/User.java b/src/main/java/com/patreon/resources/User.java
index 59eb974..5ef7ec5 100644
--- a/src/main/java/com/patreon/resources/User.java
+++ b/src/main/java/com/patreon/resources/User.java
@@ -17,207 +17,205 @@
@Type("user")
public class User extends BaseResource {
- /**
- * Metadata about fields in User
- */
- public enum UserField implements Field {
- FullName("full_name", true),
- DiscordId("discord_id", true),
- Twitch("twitch", true),
- Vanity("vanity", true),
- Email("email", true),
- About("about", true),
- FacebookId("facebook_id", true),
- ImageUrl("image_url", true),
- ThumbUrl("thumb_url", true),
- Youtube("youtube", true),
- Twitter("twitter", true),
- Facebook("facebook", true),
- Created("created", true),
- Url("url", true),
- SocialConnections("social_connections", true),
- IsEmailVerified("is_email_verified", true),
- LikeCount("like_count", false),
- CommentCount("comment_count", false),
- ;
+ private final String fullName;
+ private final String discordId;
+ private final String twitch;
+ private final String vanity;
+ private final String email;
+ private final String about;
+ private final String facebookId;
+ private final String imageUrl;
+ private final String thumbUrl;
+ private final String youtube;
+ private final String twitter;
+ private final String facebook;
+ private final Date created;
+ private final String url;
+ private final SocialConnections socialConnections;
+ private final boolean isEmailVerified;
+ //Optional properties
+ private final Integer likeCount;
+ private final Integer commentCount;
+ @Relationship("pledges")
+ private final List pledges;
+
+ @JsonCreator
+ public User(
+ @JsonProperty("full_name") String fullName,
+ @JsonProperty("discord_id") String discordId,
+ @JsonProperty("twitch") String twitch,
+ @JsonProperty("vanity") String vanity,
+ @JsonProperty("email") String email,
+ @JsonProperty("about") String about,
+ @JsonProperty("facebook_id") String facebookId,
+ @JsonProperty("image_url") String imageUrl,
+ @JsonProperty("thumb_url") String thumbUrl,
+ @JsonProperty("youtube") String youtube,
+ @JsonProperty("twitter") String twitter,
+ @JsonProperty("facebook") String facebook,
+ @JsonProperty("created") Date created,
+ @JsonProperty("url") String url,
+ @JsonProperty("social_connections") SocialConnections socialConnections,
+ @JsonProperty("is_email_verified") boolean isEmailVerified,
+ @JsonProperty("like_count") Integer likeCount,
+ @JsonProperty("comment_count") Integer commentCount,
+ @JsonProperty("pledges") List pledges
+ ) {
+ this.fullName = fullName;
+ this.discordId = discordId;
+ this.twitch = twitch;
+ this.vanity = vanity;
+ this.email = email;
+ this.about = about;
+ this.facebookId = facebookId;
+ this.imageUrl = imageUrl;
+ this.thumbUrl = thumbUrl;
+ this.youtube = youtube;
+ this.twitter = twitter;
+ this.facebook = facebook;
+ this.created = created;
+ this.url = url;
+ this.socialConnections = socialConnections;
+ this.isEmailVerified = isEmailVerified;
+ this.likeCount = likeCount;
+ this.commentCount = commentCount;
+ this.pledges = pledges;
+ }
+
+ public String getFullName() {
+ return fullName;
+ }
+
+ public String getDiscordId() {
+ return discordId;
+ }
+
+ public String getTwitch() {
+ return twitch;
+ }
+
+ public String getVanity() {
+ return vanity;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public String getAbout() {
+ return about;
+ }
+
+ public String getFacebookId() {
+ return facebookId;
+ }
+
+ public String getImageUrl() {
+ return imageUrl;
+ }
+
+ public String getThumbUrl() {
+ return thumbUrl;
+ }
+
+ public String getYoutube() {
+ return youtube;
+ }
+
+ public String getTwitter() {
+ return twitter;
+ }
+
+ public String getFacebook() {
+ return facebook;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public SocialConnections getSocialConnections() {
+ return socialConnections;
+ }
+
+ public boolean getIsEmailVerified() {
+ return isEmailVerified;
+ }
+
+ /**
+ * @return The number of likes of for this user, or null if this field wasn't requested
+ */
+ public Integer getLikeCount() {
+ return likeCount;
+ }
/**
- * The field's name from the API in JSON
+ * @return The number of comments for this user, or null if the field wasn't requested
*/
- public final String propertyName;
+ public Integer getCommentCount() {
+ return commentCount;
+ }
+
+ public List getPledges() {
+ return pledges;
+ }
/**
- * Whether the field is included by default
+ * Metadata about fields in User
*/
- public final boolean isDefault;
-
- UserField(String propertyName, boolean isDefault) {
- this.propertyName = propertyName;
- this.isDefault = isDefault;
- }
-
- @Override
- public String getPropertyName() {
- return this.propertyName;
- }
-
- @Override
- public boolean isDefault() {
- return this.isDefault;
- }
-
- public static Collection getDefaultFields() {
- return Arrays.stream(values()).filter(Field::isDefault).collect(Collectors.toList());
- }
-
- }
-
- private String fullName;
- private String discordId;
- private String twitch;
- private String vanity;
- private String email;
- private String about;
- private String facebookId;
- private String imageUrl;
- private String thumbUrl;
- private String youtube;
- private String twitter;
- private String facebook;
- private Date created;
- private String url;
- private SocialConnections socialConnections;
- private boolean isEmailVerified;
-
- //Optional properties
- private Integer likeCount;
- private Integer commentCount;
-
- @Relationship("pledges")
- private List pledges;
-
- @JsonCreator
- public User(
- @JsonProperty("full_name") String fullName,
- @JsonProperty("discord_id") String discordId,
- @JsonProperty("twitch") String twitch,
- @JsonProperty("vanity") String vanity,
- @JsonProperty("email") String email,
- @JsonProperty("about") String about,
- @JsonProperty("facebook_id") String facebookId,
- @JsonProperty("image_url") String imageUrl,
- @JsonProperty("thumb_url") String thumbUrl,
- @JsonProperty("youtube") String youtube,
- @JsonProperty("twitter") String twitter,
- @JsonProperty("facebook") String facebook,
- @JsonProperty("created") Date created,
- @JsonProperty("url") String url,
- @JsonProperty("social_connections") SocialConnections socialConnections,
- @JsonProperty("is_email_verified") boolean isEmailVerified,
- @JsonProperty("like_count") Integer likeCount,
- @JsonProperty("comment_count") Integer commentCount,
- @JsonProperty("pledges") List pledges
- ) {
- this.fullName = fullName;
- this.discordId = discordId;
- this.twitch = twitch;
- this.vanity = vanity;
- this.email = email;
- this.about = about;
- this.facebookId = facebookId;
- this.imageUrl = imageUrl;
- this.thumbUrl = thumbUrl;
- this.youtube = youtube;
- this.twitter = twitter;
- this.facebook = facebook;
- this.created = created;
- this.url = url;
- this.socialConnections = socialConnections;
- this.isEmailVerified = isEmailVerified;
- this.likeCount = likeCount;
- this.commentCount = commentCount;
- this.pledges = pledges;
- }
-
- public String getFullName() {
- return fullName;
- }
-
- public String getDiscordId() {
- return discordId;
- }
-
- public String getTwitch() {
- return twitch;
- }
-
- public String getVanity() {
- return vanity;
- }
-
- public String getEmail() {
- return email;
- }
-
- public String getAbout() {
- return about;
- }
-
- public String getFacebookId() {
- return facebookId;
- }
-
- public String getImageUrl() {
- return imageUrl;
- }
-
- public String getThumbUrl() {
- return thumbUrl;
- }
-
- public String getYoutube() {
- return youtube;
- }
-
- public String getTwitter() {
- return twitter;
- }
-
- public String getFacebook() {
- return facebook;
- }
-
- public Date getCreated() {
- return created;
- }
-
- public String getUrl() {
- return url;
- }
-
- public SocialConnections getSocialConnections() {
- return socialConnections;
- }
-
- public boolean getIsEmailVerified() {
- return isEmailVerified;
- }
-
- /**
- * @return The number of likes of for this user, or null if this field wasn't requested
- */
- public Integer getLikeCount() {
- return likeCount;
- }
-
- /**
- * @return The number of comments for this user, or null if the field wasn't requested
- */
- public Integer getCommentCount() {
- return commentCount;
- }
-
- public List getPledges() {
- return pledges;
- }
+ public enum UserField implements Field {
+ FullName("full_name", true),
+ DiscordId("discord_id", true),
+ Twitch("twitch", true),
+ Vanity("vanity", true),
+ Email("email", true),
+ About("about", true),
+ FacebookId("facebook_id", true),
+ ImageUrl("image_url", true),
+ ThumbUrl("thumb_url", true),
+ Youtube("youtube", true),
+ Twitter("twitter", true),
+ Facebook("facebook", true),
+ Created("created", true),
+ Url("url", true),
+ SocialConnections("social_connections", true),
+ IsEmailVerified("is_email_verified", true),
+ LikeCount("like_count", false),
+ CommentCount("comment_count", false),
+ ;
+
+ /**
+ * The field's name from the API in JSON
+ */
+ public final String propertyName;
+
+ /**
+ * Whether the field is included by default
+ */
+ public final boolean isDefault;
+
+ UserField(String propertyName, boolean isDefault) {
+ this.propertyName = propertyName;
+ this.isDefault = isDefault;
+ }
+
+ public static Collection getDefaultFields() {
+ return Arrays.stream(values()).filter(Field::isDefault).collect(Collectors.toList());
+ }
+
+ @Override
+ public String getPropertyName() {
+ return this.propertyName;
+ }
+
+ @Override
+ public boolean isDefault() {
+ return this.isDefault;
+ }
+
+ }
}
diff --git a/src/main/java/com/patreon/resources/shared/BaseResource.java b/src/main/java/com/patreon/resources/shared/BaseResource.java
index ecaa41f..7985d71 100644
--- a/src/main/java/com/patreon/resources/shared/BaseResource.java
+++ b/src/main/java/com/patreon/resources/shared/BaseResource.java
@@ -8,43 +8,48 @@
@JsonIgnoreProperties(ignoreUnknown = true)
public class BaseResource {
- @Id
- private String id;
-
- @Links
- private com.github.jasminb.jsonapi.Links links;
-
- public String getId() {
- return id;
- }
-
- public static String getType(Class extends BaseResource> resourceClass) {
- Type type = resourceClass.getAnnotation(Type.class);
- if (type != null) {
- return type.value();
- } else {
- return null;
+
+ @Id
+ private String id;
+
+ @Links
+ private com.github.jasminb.jsonapi.Links links;
+
+ public com.github.jasminb.jsonapi.Links getLinks() {
+ return links;
+ } public String getId() {
+ return id;
+ }
+
+ public static String getType(Class extends BaseResource> resourceClass) {
+ Type type = resourceClass.getAnnotation(Type.class);
+ if (type != null) {
+ return type.value();
+ } else {
+ return null;
+ }
+ }
+
+ public String getType() {
+ return getType(this.getClass());
+ }
+
+
+
+ @Override
+ public int hashCode() {
+ String typeAndId = getType().concat(getId());
+ return typeAndId.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ return this.hashCode() == o.hashCode();
}
- }
-
- public String getType() {
- return getType(this.getClass());
- }
-
- public com.github.jasminb.jsonapi.Links getLinks() {
- return links;
- }
-
- @Override
- public int hashCode() {
- String typeAndId = getType().concat(getId());
- return typeAndId.hashCode();
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- return this.hashCode() == o.hashCode();
- }
}
diff --git a/src/main/java/com/patreon/resources/shared/Field.java b/src/main/java/com/patreon/resources/shared/Field.java
index 7932424..d252a9a 100644
--- a/src/main/java/com/patreon/resources/shared/Field.java
+++ b/src/main/java/com/patreon/resources/shared/Field.java
@@ -1,7 +1,8 @@
package com.patreon.resources.shared;
public interface Field {
- String getPropertyName();
- boolean isDefault();
+ String getPropertyName();
+
+ boolean isDefault();
}
diff --git a/src/main/java/com/patreon/resources/shared/SocialConnections.java b/src/main/java/com/patreon/resources/shared/SocialConnections.java
index 3d044f1..ee21c8e 100644
--- a/src/main/java/com/patreon/resources/shared/SocialConnections.java
+++ b/src/main/java/com/patreon/resources/shared/SocialConnections.java
@@ -4,55 +4,57 @@
import java.util.List;
public class SocialConnections {
- private UserIdObject youtube;
- private UserIdObject twitter;
- private UserIdObject deviantart;
- private UserIdObject discord;
- private UserIdObject twitch;
- private UserIdObject facebook;
- private UserIdObject spotify;
- public UserIdObject getYoutube() {
- return youtube;
- }
+ private UserIdObject youtube;
+ private UserIdObject twitter;
+ private UserIdObject deviantart;
+ private UserIdObject discord;
+ private UserIdObject twitch;
+ private UserIdObject facebook;
+ private UserIdObject spotify;
- public UserIdObject getTwitter() {
- return twitter;
- }
-
- public UserIdObject getDeviantart() {
- return deviantart;
- }
-
- public UserIdObject getDiscord() {
- return discord;
- }
+ public UserIdObject getYoutube() {
+ return youtube;
+ }
- public UserIdObject getTwitch() {
- return twitch;
- }
+ public UserIdObject getTwitter() {
+ return twitter;
+ }
- public UserIdObject getFacebook() {
- return facebook;
- }
+ public UserIdObject getDeviantart() {
+ return deviantart;
+ }
- public UserIdObject getSpotify() {
- return spotify;
- }
+ public UserIdObject getDiscord() {
+ return discord;
+ }
- public static class UserIdObject {
- private String user_id;
- private List scopes;
- private String url;
+ public UserIdObject getTwitch() {
+ return twitch;
+ }
- public String getUser_id() {
- return user_id;
+ public UserIdObject getFacebook() {
+ return facebook;
}
- public List getScopes() {
- return scopes;
+ public UserIdObject getSpotify() {
+ return spotify;
}
- public String getUrl() {return url;}
- }
+ public static class UserIdObject {
+
+ private String user_id;
+ private List scopes;
+ private String url;
+
+ public String getUser_id() {
+ return user_id;
+ }
+
+ public List getScopes() {
+ return scopes;
+ }
+
+ public String getUrl() {return url;}
+ }
}