Skip to content

Commit 40b9f92

Browse files
tmoskovitchzacmos
tmoskovitch
authored andcommitted
API v2.42
Remove support of OAuth1. Remove validation of extra fields.
1 parent 307a33e commit 40b9f92

File tree

425 files changed

+5595
-4810
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

425 files changed

+5595
-4810
lines changed

README.md

+18-26
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ You can find examples of using the SDK under the [examples/](examples/) director
66

77
**Note: Only Twitter API V2 is supported**
88

9-
9+
- API version: 2.42
1010

1111
Twitter API v2 available endpoints
1212

@@ -16,9 +16,8 @@ Twitter API v2 available endpoints
1616
## Requirements
1717

1818
Building the API client library requires:
19-
2019
1. Java 1.8+
21-
2. Maven/Gradle
20+
2. Maven (3.8.3+)/Gradle (7.2+)
2221

2322
## Installation
2423

@@ -44,7 +43,7 @@ Add this dependency to your project's POM:
4443
<dependency>
4544
<groupId>com.twitter</groupId>
4645
<artifactId>twitter-api-java-sdk</artifactId>
47-
<version>1.1.4</version>
46+
<version>1.2.0</version>
4847
</dependency>
4948
```
5049

@@ -53,7 +52,14 @@ Add this dependency to your project's POM:
5352
Add this dependency to your project's build file:
5453

5554
```groovy
56-
implementation "com.twitter:twitter-api-java-sdk:1.1.4"
55+
repositories {
56+
mavenCentral() // Needed if the 'twitter-api-java-sdk' jar has been published to maven central.
57+
mavenLocal() // Needed if the 'twitter-api-java-sdk' jar has been published to the local maven repo.
58+
}
59+
60+
dependencies {
61+
implementation "com.twitter:twitter-api-java-sdk:1.2.0"
62+
}
5763
```
5864

5965
### Others
@@ -66,8 +72,8 @@ mvn clean package
6672

6773
Then manually install the following JARs:
6874

69-
- `target/twitter-api-java-sdk-1.1.4.jar`
70-
- `target/lib/*.jar`
75+
* `target/twitter-api-java-sdk-1.2.0.jar`
76+
* `target/lib/*.jar`
7177

7278
## Twitter Credentials
7379

@@ -89,20 +95,10 @@ TWITTER_OAUTH2_IS_AUTO_REFRESH_TOKEN - default value is `false`
8995

9096
TWITTER_BEARER_TOKEN
9197

92-
* OAuth 1.0a
93-
94-
TWITTER_CONSUMER_KEY
95-
96-
TWITTER_CONSUMER_SECRET
97-
98-
TWITTER_TOKEN
99-
100-
TWITTER_TOKEN_SECRET
101-
10298

10399

104100
You can use the following objects in order to set the credentials:
105-
`TwitterCredentialsOAuth2`, `TwitterCredentialsBearer` & `TwitterCredentialsOAuth1`.
101+
`TwitterCredentialsOAuth2` & `TwitterCredentialsBearer`.
106102

107103

108104
```java
@@ -121,7 +117,7 @@ Check the `security` tag of the required APIs in https://api.twitter.com/2/opena
121117

122118
## Getting Started
123119

124-
Please follow the [installation](#installation) instructions and execute the following Java code:
120+
Please follow the [installation](#installation) instruction and execute the following Java code:
125121

126122
```java
127123

@@ -137,7 +133,7 @@ public class TwitterApiExample {
137133
public static void main(String[] args) {
138134
/**
139135
* Set the credentials for the required APIs.
140-
* The Java SDK supports TwitterCredentialsOAuth2, TwitterCredentialsBearer & TwitterCredentialsOAuth1.
136+
* The Java SDK supports TwitterCredentialsOAuth2 & TwitterCredentialsBearer.
141137
* Check the 'security' tag of the required APIs in https://api.twitter.com/2/openapi.json in order
142138
* to use the right credential object.
143139
*/
@@ -390,6 +386,7 @@ Class | Method | HTTP request | Description
390386
- [MentionFields](docs/MentionFields.md)
391387
- [ModelList](docs/ModelList.md)
392388
- [MultiComplianceJobResponse](docs/MultiComplianceJobResponse.md)
389+
- [MultiComplianceJobResponseMeta](docs/MultiComplianceJobResponseMeta.md)
393390
- [MultiListNoPaginationResponse](docs/MultiListNoPaginationResponse.md)
394391
- [MultiListNoPaginationResponseMeta](docs/MultiListNoPaginationResponseMeta.md)
395392
- [MultiListResponse](docs/MultiListResponse.md)
@@ -491,12 +488,7 @@ Class | Method | HTTP request | Description
491488
- [VideoAllOfOrganicMetrics](docs/VideoAllOfOrganicMetrics.md)
492489
- [VideoAllOfPromotedMetrics](docs/VideoAllOfPromotedMetrics.md)
493490
- [VideoAllOfPublicMetrics](docs/VideoAllOfPublicMetrics.md)
494-
495-
496-
497-
498-
499-
491+
- [VideoAllOfVariants](docs/VideoAllOfVariants.md)
500492

501493

502494

docs/AnimatedGif.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
Name | Type | Description | Notes
99
------------ | ------------- | ------------- | -------------
1010
**previewImageUrl** | **URI** | | [optional]
11+
**variants** | [**List&lt;VideoAllOfVariants&gt;**](VideoAllOfVariants.md) | An array of all available variants of the media | [optional]
1112

1213

1314

docs/AnimatedGifAllOf.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
Name | Type | Description | Notes
99
------------ | ------------- | ------------- | -------------
1010
**previewImageUrl** | **URI** | | [optional]
11+
**variants** | [**List&lt;VideoAllOfVariants&gt;**](VideoAllOfVariants.md) | An array of all available variants of the media | [optional]
1112

1213

1314

docs/BookmarksApi.md

+36-42
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
All URIs are relative to *https://api.twitter.com*
44

5-
Method | HTTP request | Description
6-
------------- | ------------- | -------------
7-
[**getUsersIdBookmarks**](BookmarksApi.md#getUsersIdBookmarks) | **GET** /2/users/{id}/bookmarks | Bookmarks by User
8-
[**postUsersIdBookmarks**](BookmarksApi.md#postUsersIdBookmarks) | **POST** /2/users/{id}/bookmarks | Add Tweet to Bookmarks
9-
[**usersIdBookmarksDelete**](BookmarksApi.md#usersIdBookmarksDelete) | **DELETE** /2/users/{id}/bookmarks/{tweet_id} | Remove a bookmarked Tweet
5+
| Method | HTTP request | Description |
6+
|------------- | ------------- | -------------|
7+
| [**getUsersIdBookmarks**](BookmarksApi.md#getUsersIdBookmarks) | **GET** /2/users/{id}/bookmarks | Bookmarks by User |
8+
| [**postUsersIdBookmarks**](BookmarksApi.md#postUsersIdBookmarks) | **POST** /2/users/{id}/bookmarks | Add Tweet to Bookmarks |
9+
| [**usersIdBookmarksDelete**](BookmarksApi.md#usersIdBookmarksDelete) | **DELETE** /2/users/{id}/bookmarks/{tweet_id} | Remove a bookmarked Tweet |
1010

1111

1212
<a name="getUsersIdBookmarks"></a>
1313
# **getUsersIdBookmarks**
14-
> GenericTweetsTimelineResponse getUsersIdBookmarks(idmaxResultspaginationTokenexpansionstweetFieldsuserFieldsmediaFieldsplaceFieldspollFields)
14+
> GenericTweetsTimelineResponse getUsersIdBookmarks(id, maxResults, paginationToken, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields)
1515
1616
Bookmarks by User
1717

@@ -27,7 +27,6 @@ import com.twitter.clientlib.auth.*;
2727
import com.twitter.clientlib.model.*;
2828
import com.twitter.clientlib.TwitterCredentialsOAuth2;
2929
import com.twitter.clientlib.TwitterCredentialsBearer;
30-
import com.twitter.clientlib.TwitterCredentialsOAuth1;
3130
import com.twitter.clientlib.api.TwitterApi;
3231

3332
import com.twitter.clientlib.api.BookmarksApi;
@@ -64,22 +63,21 @@ public class Example {
6463
}
6564
}
6665
}
67-
6866
```
6967

7068
### Parameters
7169

72-
Name | Type | Description | Notes
73-
------------- | ------------- | ------------- | -------------
74-
**id** | **String**| The ID of the user for whom to return results |
75-
**maxResults** | **Integer**| The maximum number of results | [optional]
76-
**paginationToken** | **String**| This parameter is used to get the next &#39;page&#39; of results. | [optional]
77-
**expansions** | [**Set&lt;String&gt;**](String.md)| A comma separated list of fields to expand. | [optional] [enum: author_id, referenced_tweets.id, in_reply_to_user_id, geo.place_id, attachments.media_keys, attachments.poll_ids, entities.mentions.username, referenced_tweets.id.author_id]
78-
**tweetFields** | [**Set&lt;String&gt;**](String.md)| A comma separated list of Tweet fields to display. | [optional] [enum: id, created_at, text, author_id, in_reply_to_user_id, referenced_tweets, attachments, withheld, geo, entities, public_metrics, possibly_sensitive, source, lang, context_annotations, non_public_metrics, promoted_metrics, organic_metrics, conversation_id, reply_settings]
79-
**userFields** | [**Set&lt;String&gt;**](String.md)| A comma separated list of User fields to display. | [optional] [enum: id, created_at, name, username, protected, verified, withheld, profile_image_url, location, url, description, entities, pinned_tweet_id, public_metrics]
80-
**mediaFields** | [**Set&lt;String&gt;**](String.md)| A comma separated list of Media fields to display. | [optional] [enum: media_key, duration_ms, height, preview_image_url, type, url, width, public_metrics, non_public_metrics, organic_metrics, promoted_metrics, alt_text]
81-
**placeFields** | [**Set&lt;String&gt;**](String.md)| A comma separated list of Place fields to display. | [optional] [enum: id, name, country_code, place_type, full_name, country, contained_within, geo]
82-
**pollFields** | [**Set&lt;String&gt;**](String.md)| A comma separated list of Poll fields to display. | [optional] [enum: id, options, voting_status, end_datetime, duration_minutes]
70+
| Name | Type | Description | Notes |
71+
|------------- | ------------- | ------------- | -------------|
72+
| **id** | **String**| The ID of the user for whom to return results | |
73+
| **maxResults** | **Integer**| The maximum number of results | [optional] |
74+
| **paginationToken** | **String**| This parameter is used to get the next &#39;page&#39; of results. | [optional] |
75+
| **expansions** | [**Set&lt;String&gt;**](String.md)| A comma separated list of fields to expand. | [optional] [enum: author_id, referenced_tweets.id, in_reply_to_user_id, geo.place_id, attachments.media_keys, attachments.poll_ids, entities.mentions.username, referenced_tweets.id.author_id] |
76+
| **tweetFields** | [**Set&lt;String&gt;**](String.md)| A comma separated list of Tweet fields to display. | [optional] [enum: id, created_at, text, author_id, in_reply_to_user_id, referenced_tweets, attachments, withheld, geo, entities, public_metrics, possibly_sensitive, source, lang, context_annotations, non_public_metrics, promoted_metrics, organic_metrics, conversation_id, reply_settings] |
77+
| **userFields** | [**Set&lt;String&gt;**](String.md)| A comma separated list of User fields to display. | [optional] [enum: id, created_at, name, username, protected, verified, withheld, profile_image_url, location, url, description, entities, pinned_tweet_id, public_metrics] |
78+
| **mediaFields** | [**Set&lt;String&gt;**](String.md)| A comma separated list of Media fields to display. | [optional] [enum: media_key, duration_ms, height, preview_image_url, type, url, width, public_metrics, non_public_metrics, organic_metrics, promoted_metrics, alt_text, variants] |
79+
| **placeFields** | [**Set&lt;String&gt;**](String.md)| A comma separated list of Place fields to display. | [optional] [enum: id, name, country_code, place_type, full_name, country, contained_within, geo] |
80+
| **pollFields** | [**Set&lt;String&gt;**](String.md)| A comma separated list of Poll fields to display. | [optional] [enum: id, options, voting_status, end_datetime, duration_minutes] |
8381

8482
### Return type
8583

@@ -92,17 +90,17 @@ Name | Type | Description | Notes
9290
### HTTP request headers
9391

9492
- **Content-Type**: Not defined
95-
- **Accept**: application/jsonapplication/problem+json
93+
- **Accept**: application/json, application/problem+json
9694

9795
### HTTP response details
9896
| Status code | Description | Response headers |
9997
|-------------|-------------|------------------|
100-
**200** | The request was successful | - |
101-
**0** | The request has failed. | - |
98+
| **200** | The request was successful | - |
99+
| **0** | The request has failed. | - |
102100

103101
<a name="postUsersIdBookmarks"></a>
104102
# **postUsersIdBookmarks**
105-
> BookmarkMutationResponse postUsersIdBookmarks(addBookmarkRequestid)
103+
> BookmarkMutationResponse postUsersIdBookmarks(addBookmarkRequest, id)
106104
107105
Add Tweet to Bookmarks
108106

@@ -118,7 +116,6 @@ import com.twitter.clientlib.auth.*;
118116
import com.twitter.clientlib.model.*;
119117
import com.twitter.clientlib.TwitterCredentialsOAuth2;
120118
import com.twitter.clientlib.TwitterCredentialsBearer;
121-
import com.twitter.clientlib.TwitterCredentialsOAuth1;
122119
import com.twitter.clientlib.api.TwitterApi;
123120

124121
import com.twitter.clientlib.api.BookmarksApi;
@@ -148,15 +145,14 @@ public class Example {
148145
}
149146
}
150147
}
151-
152148
```
153149

154150
### Parameters
155151

156-
Name | Type | Description | Notes
157-
------------- | ------------- | ------------- | -------------
158-
**addBookmarkRequest** | [**AddBookmarkRequest**](AddBookmarkRequest.md)| |
159-
**id** | **String**| The ID of the user for whom to add bookmarks |
152+
| Name | Type | Description | Notes |
153+
|------------- | ------------- | ------------- | -------------|
154+
| **addBookmarkRequest** | [**AddBookmarkRequest**](AddBookmarkRequest.md)| | |
155+
| **id** | **String**| The ID of the user for whom to add bookmarks | |
160156

161157
### Return type
162158

@@ -169,17 +165,17 @@ Name | Type | Description | Notes
169165
### HTTP request headers
170166

171167
- **Content-Type**: application/json
172-
- **Accept**: application/jsonapplication/problem+json
168+
- **Accept**: application/json, application/problem+json
173169

174170
### HTTP response details
175171
| Status code | Description | Response headers |
176172
|-------------|-------------|------------------|
177-
**200** | The request was successful | - |
178-
**0** | The request has failed. | - |
173+
| **200** | The request was successful | - |
174+
| **0** | The request has failed. | - |
179175

180176
<a name="usersIdBookmarksDelete"></a>
181177
# **usersIdBookmarksDelete**
182-
> BookmarkMutationResponse usersIdBookmarksDelete(idtweetId)
178+
> BookmarkMutationResponse usersIdBookmarksDelete(id, tweetId)
183179
184180
Remove a bookmarked Tweet
185181

@@ -195,7 +191,6 @@ import com.twitter.clientlib.auth.*;
195191
import com.twitter.clientlib.model.*;
196192
import com.twitter.clientlib.TwitterCredentialsOAuth2;
197193
import com.twitter.clientlib.TwitterCredentialsBearer;
198-
import com.twitter.clientlib.TwitterCredentialsOAuth1;
199194
import com.twitter.clientlib.api.TwitterApi;
200195

201196
import com.twitter.clientlib.api.BookmarksApi;
@@ -225,15 +220,14 @@ public class Example {
225220
}
226221
}
227222
}
228-
229223
```
230224

231225
### Parameters
232226

233-
Name | Type | Description | Notes
234-
------------- | ------------- | ------------- | -------------
235-
**id** | **String**| The ID of the user whose bookmark is to be removed. |
236-
**tweetId** | **String**| The ID of the tweet that the user is removing from bookmarks |
227+
| Name | Type | Description | Notes |
228+
|------------- | ------------- | ------------- | -------------|
229+
| **id** | **String**| The ID of the user whose bookmark is to be removed. | |
230+
| **tweetId** | **String**| The ID of the tweet that the user is removing from bookmarks | |
237231

238232
### Return type
239233

@@ -246,11 +240,11 @@ Name | Type | Description | Notes
246240
### HTTP request headers
247241

248242
- **Content-Type**: Not defined
249-
- **Accept**: application/jsonapplication/problem+json
243+
- **Accept**: application/json, application/problem+json
250244

251245
### HTTP response details
252246
| Status code | Description | Response headers |
253247
|-------------|-------------|------------------|
254-
**200** | The request was successful | - |
255-
**0** | The request has failed. | - |
248+
| **200** | The request was successful | - |
249+
| **0** | The request has failed. | - |
256250

0 commit comments

Comments
 (0)