Skip to content

Commit

Permalink
Support "tweet_mode=extended"
Browse files Browse the repository at this point in the history
  • Loading branch information
takke committed Sep 17, 2016
1 parent 4ebca9d commit f7e0e1c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions twitter4j-core/src/main/java/twitter4j/TwitterImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ class TwitterImpl extends TwitterBaseImpl implements Twitter {
if (conf.isIncludeExtAltTextEnabled()) {
params.add(new HttpParameter("include_ext_alt_text", "true"));
}
if (conf.isTweetModeExtended()) {
params.add(new HttpParameter("tweet_mode", "extended"));
}
HttpParameter[] implicitParams = params.toArray(new HttpParameter[params.size()]);

// implicitParamsMap.containsKey() is evaluated in the above if clause.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ public interface Configuration extends AuthorizationConfiguration, java.io.Seria

boolean isIncludeExtAltTextEnabled();

boolean isTweetModeExtended();

boolean isDaemonEnabled();

boolean isIncludeEmailEnabled();
Expand Down
13 changes: 13 additions & 0 deletions twitter4j-core/src/main/java/twitter4j/conf/ConfigurationBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class ConfigurationBase implements Configuration, java.io.Serializable {
private boolean includeEntitiesEnabled = true;
private boolean trimUserEnabled = false;
private boolean includeExtAltTextEnabled = true;
private boolean tweetModeExtended = false;
private boolean includeEmailEnabled = false;

private boolean jsonStoreEnabled = false;
Expand Down Expand Up @@ -620,6 +621,11 @@ public boolean isIncludeExtAltTextEnabled() {
return this.includeExtAltTextEnabled;
}

@Override
public boolean isTweetModeExtended() {
return this.tweetModeExtended;
}

@Override
public boolean isDaemonEnabled() {
return daemonEnabled;
Expand All @@ -646,6 +652,10 @@ public void setIncludeExtAltTextEnabled(boolean enabled) {
this.includeExtAltTextEnabled = enabled;
}

public void setTweetModeExtended(boolean enabled) {
this.tweetModeExtended = enabled;
}

@Override
public boolean isJSONStoreEnabled() {
return this.jsonStoreEnabled;
Expand Down Expand Up @@ -769,6 +779,7 @@ public boolean equals(Object o) {
if (includeEntitiesEnabled != that.includeEntitiesEnabled) return false;
if (trimUserEnabled != that.trimUserEnabled) return false;
if (includeExtAltTextEnabled != that.includeExtAltTextEnabled) return false;
if (tweetModeExtended != that.tweetModeExtended) return false;
if (includeEmailEnabled != that.includeEmailEnabled) return false;
if (jsonStoreEnabled != that.jsonStoreEnabled) return false;
if (mbeanEnabled != that.mbeanEnabled) return false;
Expand Down Expand Up @@ -863,6 +874,7 @@ public int hashCode() {
result = 31 * result + (includeEntitiesEnabled ? 1 : 0);
result = 31 * result + (trimUserEnabled ? 1 : 0);
result = 31 * result + (includeExtAltTextEnabled ? 1 : 0);
result = 31 * result + (tweetModeExtended ? 1 : 0);
result = 31 * result + (includeEmailEnabled ? 1 : 0);
result = 31 * result + (jsonStoreEnabled ? 1 : 0);
result = 31 * result + (mbeanEnabled ? 1 : 0);
Expand Down Expand Up @@ -914,6 +926,7 @@ public String toString() {
", includeEntitiesEnabled=" + includeEntitiesEnabled +
", trimUserEnabled=" + trimUserEnabled +
", includeExtAltTextEnabled=" + includeExtAltTextEnabled +
", tweetModeExtended=" + tweetModeExtended +
", includeEmailEnabled=" + includeEmailEnabled +
", jsonStoreEnabled=" + jsonStoreEnabled +
", mbeanEnabled=" + mbeanEnabled +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,12 @@ public ConfigurationBuilder setIncludeExtAltTextEnabled(boolean enabled) {
return this;
}

public ConfigurationBuilder setTweetModeExtended(boolean enabled) {
checkNotBuilt();
configurationBean.setTweetModeExtended(enabled);
return this;
}

public ConfigurationBuilder setIncludeMyRetweetEnabled(boolean enabled) {
checkNotBuilt();
configurationBean.setIncludeMyRetweetEnabled(enabled);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public final class PropertyConfiguration extends ConfigurationBase implements ja
private static final String INCLUDE_ENTITIES = "includeEntities";
private static final String INCLUDE_EMAIL = "includeEmail";
private static final String INCLUDE_EXT_ALT_TEXT = "includeExtAltText";
private static final String TWEET_MODE_EXTENDED = "tweetModeExtended";
private static final String LOGGER_FACTORY = "loggerFactory";
private static final String JSON_STORE_ENABLED = "jsonStoreEnabled";
private static final String MBEAN_ENABLED = "mbeanEnabled";
Expand Down Expand Up @@ -361,6 +362,9 @@ private void setFieldsWithPrefix(Properties props, String prefix) {
if (notNull(props, prefix, INCLUDE_EXT_ALT_TEXT)) {
setIncludeExtAltTextEnabled(getBoolean(props, prefix, INCLUDE_EXT_ALT_TEXT));
}
if (notNull(props, prefix, TWEET_MODE_EXTENDED)) {
setTweetModeExtended(getBoolean(props, prefix, TWEET_MODE_EXTENDED));
}
if (notNull(props, prefix, LOGGER_FACTORY)) {
setLoggerFactory(getString(props, prefix, LOGGER_FACTORY));
}
Expand Down

0 comments on commit f7e0e1c

Please sign in to comment.