@@ -38,9 +38,20 @@ import java.time.OffsetDateTime;
3838
3939public 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
128139public 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
203225public 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
0 commit comments