Skip to content

Commit 599573b

Browse files
tmoskovitchzacmos
authored andcommitted
Update examples in the documentation.
1 parent dfaa024 commit 599573b

File tree

12 files changed

+1066
-150
lines changed

12 files changed

+1066
-150
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Add this dependency to your project's POM:
6363
<dependency>
6464
<groupId>com.twitter</groupId>
6565
<artifactId>twitter-api-java-sdk</artifactId>
66-
<version>1.2.0</version>
66+
<version>1.2.1</version>
6767
</dependency>
6868
```
6969

@@ -78,7 +78,7 @@ mavenLocal() // Needed if the 'twitter-api-java-sdk' jar has been publishe
7878
}
7979
8080
dependencies {
81-
implementation "com.twitter:twitter-api-java-sdk:1.2.0"
81+
implementation "com.twitter:twitter-api-java-sdk:1.2.1"
8282
}
8383
```
8484

@@ -92,7 +92,7 @@ mvn clean package
9292

9393
Then manually install the following JARs:
9494

95-
* `target/twitter-api-java-sdk-1.2.0.jar`
95+
* `target/twitter-api-java-sdk-1.2.1.jar`
9696
* `target/lib/*.jar`
9797

9898
## Twitter Credentials

docs/BookmarksApi.md

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,20 @@ import java.time.OffsetDateTime;
3838

3939
public class Example {
4040
public static void main(String[] args) {
41-
TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
4241
TwitterApi apiInstance = new TwitterApi();
43-
apiInstance.setTwitterCredentials(credentials);
42+
// Set the credentials based on the API's "security" tag values.
43+
// Check the API definition in https://api.twitter.com/2/openapi.json
44+
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
45+
46+
// Uncomment and set the credentials configuration
47+
48+
// Configure OAuth2 access token for authorization:
49+
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
50+
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
51+
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
52+
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
53+
// apiInstance.setTwitterCredentials(credentials);
54+
4455
// Set the params values
4556
String id = "id_example"; // String | The ID of the user for whom to return results
4657
Integer maxResults = 56; // Integer | The maximum number of results
@@ -127,9 +138,20 @@ import java.time.OffsetDateTime;
127138

128139
public class Example {
129140
public static void main(String[] args) {
130-
TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
131141
TwitterApi apiInstance = new TwitterApi();
132-
apiInstance.setTwitterCredentials(credentials);
142+
// Set the credentials based on the API's "security" tag values.
143+
// Check the API definition in https://api.twitter.com/2/openapi.json
144+
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
145+
146+
// Uncomment and set the credentials configuration
147+
148+
// Configure OAuth2 access token for authorization:
149+
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
150+
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
151+
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
152+
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
153+
// apiInstance.setTwitterCredentials(credentials);
154+
133155
// Set the params values
134156
AddBookmarkRequest addBookmarkRequest = new AddBookmarkRequest(); // AddBookmarkRequest |
135157
String id = "id_example"; // String | The ID of the user for whom to add bookmarks
@@ -202,9 +224,20 @@ import java.time.OffsetDateTime;
202224

203225
public class Example {
204226
public static void main(String[] args) {
205-
TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
206227
TwitterApi apiInstance = new TwitterApi();
207-
apiInstance.setTwitterCredentials(credentials);
228+
// Set the credentials based on the API's "security" tag values.
229+
// Check the API definition in https://api.twitter.com/2/openapi.json
230+
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
231+
232+
// Uncomment and set the credentials configuration
233+
234+
// Configure OAuth2 access token for authorization:
235+
// TwitterCredentialsOAuth2 credentials = new TwitterCredentialsOAuth2(System.getenv("TWITTER_OAUTH2_CLIENT_ID"),
236+
// System.getenv("TWITTER_OAUTH2_CLIENT_SECRET"),
237+
// System.getenv("TWITTER_OAUTH2_ACCESS_TOKEN"),
238+
// System.getenv("TWITTER_OAUTH2_REFRESH_TOKEN"));
239+
// apiInstance.setTwitterCredentials(credentials);
240+
208241
// Set the params values
209242
String id = "id_example"; // String | The ID of the user whose bookmark is to be removed.
210243
String tweetId = "tweetId_example"; // String | The ID of the tweet that the user is removing from bookmarks

docs/ComplianceApi.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,17 @@ import java.time.OffsetDateTime;
3838

3939
public class Example {
4040
public static void main(String[] args) {
41-
TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
4241
TwitterApi apiInstance = new TwitterApi();
43-
apiInstance.setTwitterCredentials(credentials);
42+
// Set the credentials based on the API's "security" tag values.
43+
// Check the API definition in https://api.twitter.com/2/openapi.json
44+
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
45+
46+
// Uncomment and set the credentials configuration
47+
48+
// Configure HTTP bearer authorization:
49+
// TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
50+
// apiInstance.setTwitterCredentials(credentials);
51+
4452
// Set the params values
4553
CreateBatchComplianceJobRequest createBatchComplianceJobRequest = new CreateBatchComplianceJobRequest(); // CreateBatchComplianceJobRequest |
4654
try {
@@ -111,9 +119,17 @@ import java.time.OffsetDateTime;
111119

112120
public class Example {
113121
public static void main(String[] args) {
114-
TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
115122
TwitterApi apiInstance = new TwitterApi();
116-
apiInstance.setTwitterCredentials(credentials);
123+
// Set the credentials based on the API's "security" tag values.
124+
// Check the API definition in https://api.twitter.com/2/openapi.json
125+
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
126+
127+
// Uncomment and set the credentials configuration
128+
129+
// Configure HTTP bearer authorization:
130+
// TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
131+
// apiInstance.setTwitterCredentials(credentials);
132+
117133
// Set the params values
118134
String id = "id_example"; // String | ID of the compliance job to retrieve.
119135
try {
@@ -184,9 +200,17 @@ import java.time.OffsetDateTime;
184200

185201
public class Example {
186202
public static void main(String[] args) {
187-
TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
188203
TwitterApi apiInstance = new TwitterApi();
189-
apiInstance.setTwitterCredentials(credentials);
204+
// Set the credentials based on the API's "security" tag values.
205+
// Check the API definition in https://api.twitter.com/2/openapi.json
206+
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
207+
208+
// Uncomment and set the credentials configuration
209+
210+
// Configure HTTP bearer authorization:
211+
// TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
212+
// apiInstance.setTwitterCredentials(credentials);
213+
190214
// Set the params values
191215
ComplianceJobType type = ComplianceJobType.fromValue("tweets"); // ComplianceJobType | Type of compliance job to list.
192216
ComplianceJobStatus status = ComplianceJobStatus.fromValue("created"); // ComplianceJobStatus | Status of compliance job to list.

docs/GeneralApi.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@ import java.time.OffsetDateTime;
3535

3636
public class Example {
3737
public static void main(String[] args) {
38-
TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
3938
TwitterApi apiInstance = new TwitterApi();
40-
apiInstance.setTwitterCredentials(credentials);
39+
// Set the credentials based on the API's "security" tag values.
40+
// Check the API definition in https://api.twitter.com/2/openapi.json
41+
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"
42+
43+
// Uncomment and set the credentials configuration
44+
4145
// Set the params values
4246
try {
4347
Object result = apiInstance.general().getOpenApiSpec();

0 commit comments

Comments
 (0)