|
| 1 | +# BookmarksApi |
| 2 | + |
| 3 | +All URIs are relative to *https://api.twitter.com* |
| 4 | + |
| 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 |
| 10 | + |
| 11 | + |
| 12 | +<a name="getUsersIdBookmarks"></a> |
| 13 | +# **getUsersIdBookmarks** |
| 14 | +> GenericTweetsTimelineResponse getUsersIdBookmarks(idmaxResultspaginationTokenexpansionstweetFieldsuserFieldsmediaFieldsplaceFieldspollFields) |
| 15 | +
|
| 16 | +Bookmarks by User |
| 17 | + |
| 18 | +Returns Tweet objects that have been bookmarked by the requesting user |
| 19 | + |
| 20 | +### Example |
| 21 | +```java |
| 22 | +// Import classes: |
| 23 | +import com.twitter.clientlib.ApiClient; |
| 24 | +import com.twitter.clientlib.ApiException; |
| 25 | +import com.twitter.clientlib.Configuration; |
| 26 | +import com.twitter.clientlib.auth.*; |
| 27 | +import com.twitter.clientlib.model.*; |
| 28 | +import com.twitter.clientlib.TwitterCredentialsOAuth2; |
| 29 | +import com.twitter.clientlib.TwitterCredentialsBearer; |
| 30 | +import com.twitter.clientlib.TwitterCredentialsOAuth1; |
| 31 | +import com.twitter.clientlib.api.TwitterApi; |
| 32 | + |
| 33 | +import com.twitter.clientlib.api.BookmarksApi; |
| 34 | +import java.util.List; |
| 35 | +import java.util.Set; |
| 36 | +import java.util.Arrays; |
| 37 | +import java.util.HashSet; |
| 38 | +import java.time.OffsetDateTime; |
| 39 | + |
| 40 | +public class Example { |
| 41 | + public static void main(String[] args) { |
| 42 | + TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN")); |
| 43 | + TwitterApi apiInstance = new TwitterApi(); |
| 44 | + apiInstance.setTwitterCredentials(credentials); |
| 45 | + // Set the params values |
| 46 | + String id = "id_example"; // String | The ID of the user for whom to return results |
| 47 | + Integer maxResults = 56; // Integer | The maximum number of results |
| 48 | + String paginationToken = "paginationToken_example"; // String | This parameter is used to get the next 'page' of results. |
| 49 | + Set<String> expansions = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of fields to expand. |
| 50 | + Set<String> tweetFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of Tweet fields to display. |
| 51 | + Set<String> userFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of User fields to display. |
| 52 | + Set<String> mediaFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of Media fields to display. |
| 53 | + Set<String> placeFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of Place fields to display. |
| 54 | + Set<String> pollFields = new HashSet<>(Arrays.asList()); // Set<String> | A comma separated list of Poll fields to display. |
| 55 | + try { |
| 56 | + GenericTweetsTimelineResponse result = apiInstance.bookmarks().getUsersIdBookmarks(id, maxResults, paginationToken, expansions, tweetFields, userFields, mediaFields, placeFields, pollFields); |
| 57 | + System.out.println(result); |
| 58 | + } catch (ApiException e) { |
| 59 | + System.err.println("Exception when calling BookmarksApi#getUsersIdBookmarks"); |
| 60 | + System.err.println("Status code: " + e.getCode()); |
| 61 | + System.err.println("Reason: " + e.getResponseBody()); |
| 62 | + System.err.println("Response headers: " + e.getResponseHeaders()); |
| 63 | + e.printStackTrace(); |
| 64 | + } |
| 65 | + } |
| 66 | +} |
| 67 | + |
| 68 | +``` |
| 69 | + |
| 70 | +### Parameters |
| 71 | + |
| 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 'page' of results. | [optional] |
| 77 | + **expansions** | [**Set<String>**](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<String>**](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<String>**](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<String>**](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<String>**](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<String>**](String.md)| A comma separated list of Poll fields to display. | [optional] [enum: id, options, voting_status, end_datetime, duration_minutes] |
| 83 | + |
| 84 | +### Return type |
| 85 | + |
| 86 | +[**GenericTweetsTimelineResponse**](GenericTweetsTimelineResponse.md) |
| 87 | + |
| 88 | +### Authorization |
| 89 | + |
| 90 | +[OAuth2UserToken](../README.md#OAuth2UserToken) |
| 91 | + |
| 92 | +### HTTP request headers |
| 93 | + |
| 94 | + - **Content-Type**: Not defined |
| 95 | + - **Accept**: application/jsonapplication/problem+json |
| 96 | + |
| 97 | +### HTTP response details |
| 98 | +| Status code | Description | Response headers | |
| 99 | +|-------------|-------------|------------------| |
| 100 | +**200** | The request was successful | - | |
| 101 | +**0** | The request has failed. | - | |
| 102 | + |
| 103 | +<a name="postUsersIdBookmarks"></a> |
| 104 | +# **postUsersIdBookmarks** |
| 105 | +> BookmarkMutationResponse postUsersIdBookmarks(addBookmarkRequestid) |
| 106 | +
|
| 107 | +Add Tweet to Bookmarks |
| 108 | + |
| 109 | +Adds a Tweet (ID in the body) to the requesting user's (in the path) bookmarks |
| 110 | + |
| 111 | +### Example |
| 112 | +```java |
| 113 | +// Import classes: |
| 114 | +import com.twitter.clientlib.ApiClient; |
| 115 | +import com.twitter.clientlib.ApiException; |
| 116 | +import com.twitter.clientlib.Configuration; |
| 117 | +import com.twitter.clientlib.auth.*; |
| 118 | +import com.twitter.clientlib.model.*; |
| 119 | +import com.twitter.clientlib.TwitterCredentialsOAuth2; |
| 120 | +import com.twitter.clientlib.TwitterCredentialsBearer; |
| 121 | +import com.twitter.clientlib.TwitterCredentialsOAuth1; |
| 122 | +import com.twitter.clientlib.api.TwitterApi; |
| 123 | + |
| 124 | +import com.twitter.clientlib.api.BookmarksApi; |
| 125 | +import java.util.List; |
| 126 | +import java.util.Set; |
| 127 | +import java.util.Arrays; |
| 128 | +import java.util.HashSet; |
| 129 | +import java.time.OffsetDateTime; |
| 130 | + |
| 131 | +public class Example { |
| 132 | + public static void main(String[] args) { |
| 133 | + TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN")); |
| 134 | + TwitterApi apiInstance = new TwitterApi(); |
| 135 | + apiInstance.setTwitterCredentials(credentials); |
| 136 | + // Set the params values |
| 137 | + AddBookmarkRequest addBookmarkRequest = new AddBookmarkRequest(); // AddBookmarkRequest | |
| 138 | + String id = "id_example"; // String | The ID of the user for whom to add bookmarks |
| 139 | + try { |
| 140 | + BookmarkMutationResponse result = apiInstance.bookmarks().postUsersIdBookmarks(addBookmarkRequest, id); |
| 141 | + System.out.println(result); |
| 142 | + } catch (ApiException e) { |
| 143 | + System.err.println("Exception when calling BookmarksApi#postUsersIdBookmarks"); |
| 144 | + System.err.println("Status code: " + e.getCode()); |
| 145 | + System.err.println("Reason: " + e.getResponseBody()); |
| 146 | + System.err.println("Response headers: " + e.getResponseHeaders()); |
| 147 | + e.printStackTrace(); |
| 148 | + } |
| 149 | + } |
| 150 | +} |
| 151 | + |
| 152 | +``` |
| 153 | + |
| 154 | +### Parameters |
| 155 | + |
| 156 | +Name | Type | Description | Notes |
| 157 | +------------- | ------------- | ------------- | ------------- |
| 158 | + **addBookmarkRequest** | [**AddBookmarkRequest**](AddBookmarkRequest.md)| | |
| 159 | + **id** | **String**| The ID of the user for whom to add bookmarks | |
| 160 | + |
| 161 | +### Return type |
| 162 | + |
| 163 | +[**BookmarkMutationResponse**](BookmarkMutationResponse.md) |
| 164 | + |
| 165 | +### Authorization |
| 166 | + |
| 167 | +[OAuth2UserToken](../README.md#OAuth2UserToken) |
| 168 | + |
| 169 | +### HTTP request headers |
| 170 | + |
| 171 | + - **Content-Type**: application/json |
| 172 | + - **Accept**: application/jsonapplication/problem+json |
| 173 | + |
| 174 | +### HTTP response details |
| 175 | +| Status code | Description | Response headers | |
| 176 | +|-------------|-------------|------------------| |
| 177 | +**200** | The request was successful | - | |
| 178 | +**0** | The request has failed. | - | |
| 179 | + |
| 180 | +<a name="usersIdBookmarksDelete"></a> |
| 181 | +# **usersIdBookmarksDelete** |
| 182 | +> BookmarkMutationResponse usersIdBookmarksDelete(idtweetId) |
| 183 | +
|
| 184 | +Remove a bookmarked Tweet |
| 185 | + |
| 186 | +Removes a Tweet from the requesting user's bookmarked Tweets. |
| 187 | + |
| 188 | +### Example |
| 189 | +```java |
| 190 | +// Import classes: |
| 191 | +import com.twitter.clientlib.ApiClient; |
| 192 | +import com.twitter.clientlib.ApiException; |
| 193 | +import com.twitter.clientlib.Configuration; |
| 194 | +import com.twitter.clientlib.auth.*; |
| 195 | +import com.twitter.clientlib.model.*; |
| 196 | +import com.twitter.clientlib.TwitterCredentialsOAuth2; |
| 197 | +import com.twitter.clientlib.TwitterCredentialsBearer; |
| 198 | +import com.twitter.clientlib.TwitterCredentialsOAuth1; |
| 199 | +import com.twitter.clientlib.api.TwitterApi; |
| 200 | + |
| 201 | +import com.twitter.clientlib.api.BookmarksApi; |
| 202 | +import java.util.List; |
| 203 | +import java.util.Set; |
| 204 | +import java.util.Arrays; |
| 205 | +import java.util.HashSet; |
| 206 | +import java.time.OffsetDateTime; |
| 207 | + |
| 208 | +public class Example { |
| 209 | + public static void main(String[] args) { |
| 210 | + TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN")); |
| 211 | + TwitterApi apiInstance = new TwitterApi(); |
| 212 | + apiInstance.setTwitterCredentials(credentials); |
| 213 | + // Set the params values |
| 214 | + String id = "id_example"; // String | The ID of the user whose bookmark is to be removed. |
| 215 | + String tweetId = "tweetId_example"; // String | The ID of the tweet that the user is removing from bookmarks |
| 216 | + try { |
| 217 | + BookmarkMutationResponse result = apiInstance.bookmarks().usersIdBookmarksDelete(id, tweetId); |
| 218 | + System.out.println(result); |
| 219 | + } catch (ApiException e) { |
| 220 | + System.err.println("Exception when calling BookmarksApi#usersIdBookmarksDelete"); |
| 221 | + System.err.println("Status code: " + e.getCode()); |
| 222 | + System.err.println("Reason: " + e.getResponseBody()); |
| 223 | + System.err.println("Response headers: " + e.getResponseHeaders()); |
| 224 | + e.printStackTrace(); |
| 225 | + } |
| 226 | + } |
| 227 | +} |
| 228 | + |
| 229 | +``` |
| 230 | + |
| 231 | +### Parameters |
| 232 | + |
| 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 | |
| 237 | + |
| 238 | +### Return type |
| 239 | + |
| 240 | +[**BookmarkMutationResponse**](BookmarkMutationResponse.md) |
| 241 | + |
| 242 | +### Authorization |
| 243 | + |
| 244 | +[OAuth2UserToken](../README.md#OAuth2UserToken) |
| 245 | + |
| 246 | +### HTTP request headers |
| 247 | + |
| 248 | + - **Content-Type**: Not defined |
| 249 | + - **Accept**: application/jsonapplication/problem+json |
| 250 | + |
| 251 | +### HTTP response details |
| 252 | +| Status code | Description | Response headers | |
| 253 | +|-------------|-------------|------------------| |
| 254 | +**200** | The request was successful | - | |
| 255 | +**0** | The request has failed. | - | |
| 256 | + |
0 commit comments