Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec version 2.55 #49

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 30 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ You can find examples of using the SDK under the [examples/](examples/) director

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

- API version: 2.51
- API version: 2.55

Twitter API v2 available endpoints

Expand Down Expand Up @@ -61,7 +61,7 @@ Add this dependency to your project's POM:
<dependency>
<groupId>com.twitter</groupId>
<artifactId>twitter-api-java-sdk</artifactId>
<version>2.0.3</version>
<version>2.0.4</version>
</dependency>
```

Expand All @@ -76,7 +76,7 @@ mavenLocal() // Needed if the 'twitter-api-java-sdk' jar has been publishe
}

dependencies {
implementation "com.twitter:twitter-api-java-sdk:2.0.3"
implementation "com.twitter:twitter-api-java-sdk:2.0.4"
}
```

Expand All @@ -90,7 +90,7 @@ mvn clean package

Then manually install the following JARs:

* `target/twitter-api-java-sdk-2.0.3.jar`
* `target/twitter-api-java-sdk-2.0.4.jar`
* `target/lib/*.jar`

## Twitter Credentials
Expand Down Expand Up @@ -278,8 +278,15 @@ Class | Method | HTTP request | Description
*ComplianceApi* | [**createBatchComplianceJob**](docs/ComplianceApi.md#createBatchComplianceJob) | **POST** /2/compliance/jobs | Create compliance job
*ComplianceApi* | [**getBatchComplianceJob**](docs/ComplianceApi.md#getBatchComplianceJob) | **GET** /2/compliance/jobs/{id} | Get Compliance Job
*ComplianceApi* | [**getTweetsComplianceStream**](docs/ComplianceApi.md#getTweetsComplianceStream) | **GET** /2/tweets/compliance/stream | Tweets Compliance stream
*ComplianceApi* | [**getTweetsLabelStream**](docs/ComplianceApi.md#getTweetsLabelStream) | **GET** /2/tweets/label/stream | Tweets Label stream
*ComplianceApi* | [**getUsersComplianceStream**](docs/ComplianceApi.md#getUsersComplianceStream) | **GET** /2/users/compliance/stream | Users Compliance stream
*ComplianceApi* | [**listBatchComplianceJobs**](docs/ComplianceApi.md#listBatchComplianceJobs) | **GET** /2/compliance/jobs | List Compliance Jobs
*DirectMessagesApi* | [**dmConversationByIdEventIdCreate**](docs/DirectMessagesApi.md#dmConversationByIdEventIdCreate) | **POST** /2/dm_conversations/{dm_conversation_id}/messages | Send a new message to a DM Conversation
*DirectMessagesApi* | [**dmConversationIdCreate**](docs/DirectMessagesApi.md#dmConversationIdCreate) | **POST** /2/dm_conversations | Create a new DM Conversation
*DirectMessagesApi* | [**dmConversationWithUserEventIdCreate**](docs/DirectMessagesApi.md#dmConversationWithUserEventIdCreate) | **POST** /2/dm_conversations/with/{participant_id}/messages | Send a new message to a user
*DirectMessagesApi* | [**getDmConversationsIdDmEvents**](docs/DirectMessagesApi.md#getDmConversationsIdDmEvents) | **GET** /2/dm_conversations/{id}/dm_events | Get DM Events for a DM Conversation
*DirectMessagesApi* | [**getDmConversationsWithParticipantIdDmEvents**](docs/DirectMessagesApi.md#getDmConversationsWithParticipantIdDmEvents) | **GET** /2/dm_conversations/with/{participant_id}/dm_events | Get DM Events for a DM Conversation
*DirectMessagesApi* | [**getDmEvents**](docs/DirectMessagesApi.md#getDmEvents) | **GET** /2/dm_events | Get recent DM Events
*GeneralApi* | [**getOpenApiSpec**](docs/GeneralApi.md#getOpenApiSpec) | **GET** /2/openapi.json | Returns the OpenAPI Specification document.
*ListsApi* | [**getUserListMemberships**](docs/ListsApi.md#getUserListMemberships) | **GET** /2/users/{id}/list_memberships | Get a User&#39;s List Memberships
*ListsApi* | [**listAddMember**](docs/ListsApi.md#listAddMember) | **POST** /2/lists/{id}/members | Add a List member
Expand Down Expand Up @@ -376,12 +383,21 @@ Class | Method | HTTP request | Description
- [ContextAnnotation](docs/ContextAnnotation.md)
- [ContextAnnotationDomainFields](docs/ContextAnnotationDomainFields.md)
- [ContextAnnotationEntityFields](docs/ContextAnnotationEntityFields.md)
- [CreateAttachmentsMessageRequest](docs/CreateAttachmentsMessageRequest.md)
- [CreateComplianceJobRequest](docs/CreateComplianceJobRequest.md)
- [CreateComplianceJobResponse](docs/CreateComplianceJobResponse.md)
- [CreateDmConversationRequest](docs/CreateDmConversationRequest.md)
- [CreateDmEventResponse](docs/CreateDmEventResponse.md)
- [CreateDmEventResponseData](docs/CreateDmEventResponseData.md)
- [CreateMessageRequest](docs/CreateMessageRequest.md)
- [CreateTextMessageRequest](docs/CreateTextMessageRequest.md)
- [DeleteRulesRequest](docs/DeleteRulesRequest.md)
- [DeleteRulesRequestDelete](docs/DeleteRulesRequestDelete.md)
- [DisallowedResourceProblem](docs/DisallowedResourceProblem.md)
- [DisallowedResourceProblemAllOf](docs/DisallowedResourceProblemAllOf.md)
- [DmEvent](docs/DmEvent.md)
- [DmEventAttachments](docs/DmEventAttachments.md)
- [DmMediaAttachment](docs/DmMediaAttachment.md)
- [DuplicateRuleProblem](docs/DuplicateRuleProblem.md)
- [DuplicateRuleProblemAllOf](docs/DuplicateRuleProblemAllOf.md)
- [EntityIndicesInclusiveExclusive](docs/EntityIndicesInclusiveExclusive.md)
Expand All @@ -400,6 +416,9 @@ Class | Method | HTTP request | Description
- [Get2ComplianceJobsIdResponse](docs/Get2ComplianceJobsIdResponse.md)
- [Get2ComplianceJobsResponse](docs/Get2ComplianceJobsResponse.md)
- [Get2ComplianceJobsResponseMeta](docs/Get2ComplianceJobsResponseMeta.md)
- [Get2DmConversationsIdDmEventsResponse](docs/Get2DmConversationsIdDmEventsResponse.md)
- [Get2DmConversationsWithParticipantIdDmEventsResponse](docs/Get2DmConversationsWithParticipantIdDmEventsResponse.md)
- [Get2DmEventsResponse](docs/Get2DmEventsResponse.md)
- [Get2ListsIdFollowersResponse](docs/Get2ListsIdFollowersResponse.md)
- [Get2ListsIdFollowersResponseMeta](docs/Get2ListsIdFollowersResponseMeta.md)
- [Get2ListsIdMembersResponse](docs/Get2ListsIdMembersResponse.md)
Expand Down Expand Up @@ -488,12 +507,8 @@ Class | Method | HTTP request | Description
- [Poll](docs/Poll.md)
- [PollOption](docs/PollOption.md)
- [Problem](docs/Problem.md)
- [ProblemErrors](docs/ProblemErrors.md)
- [ProblemOrError](docs/ProblemOrError.md)
- [ReplySettings](docs/ReplySettings.md)
- [ReportUsersRequest](docs/ReportUsersRequest.md)
- [ReportUsersResponse](docs/ReportUsersResponse.md)
- [ReportUsersResponseData](docs/ReportUsersResponseData.md)
- [ResourceNotFoundProblem](docs/ResourceNotFoundProblem.md)
- [ResourceNotFoundProblemAllOf](docs/ResourceNotFoundProblemAllOf.md)
- [ResourceUnauthorizedProblem](docs/ResourceUnauthorizedProblem.md)
Expand Down Expand Up @@ -540,13 +555,20 @@ Class | Method | HTTP request | Description
- [TweetHideRequest](docs/TweetHideRequest.md)
- [TweetHideResponse](docs/TweetHideResponse.md)
- [TweetHideResponseData](docs/TweetHideResponseData.md)
- [TweetLabelData](docs/TweetLabelData.md)
- [TweetLabelStreamResponse](docs/TweetLabelStreamResponse.md)
- [TweetLabelStreamResponseOneOf](docs/TweetLabelStreamResponseOneOf.md)
- [TweetNonPublicMetrics](docs/TweetNonPublicMetrics.md)
- [TweetNotice](docs/TweetNotice.md)
- [TweetNoticeSchema](docs/TweetNoticeSchema.md)
- [TweetOrganicMetrics](docs/TweetOrganicMetrics.md)
- [TweetPromotedMetrics](docs/TweetPromotedMetrics.md)
- [TweetPublicMetrics](docs/TweetPublicMetrics.md)
- [TweetReferencedTweets](docs/TweetReferencedTweets.md)
- [TweetTakedownComplianceSchema](docs/TweetTakedownComplianceSchema.md)
- [TweetUndropComplianceSchema](docs/TweetUndropComplianceSchema.md)
- [TweetUnviewable](docs/TweetUnviewable.md)
- [TweetUnviewableSchema](docs/TweetUnviewableSchema.md)
- [TweetWithheld](docs/TweetWithheld.md)
- [TweetWithheldComplianceSchema](docs/TweetWithheldComplianceSchema.md)
- [UnsupportedAuthenticationProblem](docs/UnsupportedAuthenticationProblem.md)
Expand Down
112 changes: 112 additions & 0 deletions docs/ComplianceApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All URIs are relative to *https://api.twitter.com*
| [**createBatchComplianceJob**](ComplianceApi.md#createBatchComplianceJob) | **POST** /2/compliance/jobs | Create compliance job |
| [**getBatchComplianceJob**](ComplianceApi.md#getBatchComplianceJob) | **GET** /2/compliance/jobs/{id} | Get Compliance Job |
| [**getTweetsComplianceStream**](ComplianceApi.md#getTweetsComplianceStream) | **GET** /2/tweets/compliance/stream | Tweets Compliance stream |
| [**getTweetsLabelStream**](ComplianceApi.md#getTweetsLabelStream) | **GET** /2/tweets/label/stream | Tweets Label stream |
| [**getUsersComplianceStream**](ComplianceApi.md#getUsersComplianceStream) | **GET** /2/users/compliance/stream | Users Compliance stream |
| [**listBatchComplianceJobs**](ComplianceApi.md#listBatchComplianceJobs) | **GET** /2/compliance/jobs | List Compliance Jobs |

Expand Down Expand Up @@ -289,6 +290,117 @@ public class Example {
| **200** | The request has succeeded. | - |
| **0** | The request has failed. | - |

<a name="getTweetsLabelStream"></a>
# **getTweetsLabelStream**
> TweetLabelStreamResponse getTweetsLabelStream().backfillMinutes(backfillMinutes).startTime(startTime).endTime(endTime).execute();

Tweets Label stream

Streams 100% of labeling events applied to Tweets

### Example
```java
// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.auth.*;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;

import com.twitter.clientlib.api.ComplianceApi;
import java.io.InputStream;
import com.google.common.reflect.TypeToken;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;

public class Example {
public static void main(String[] args) {
// Set the credentials based on the API's "security" tag values.
// Check the API definition in https://api.twitter.com/2/openapi.json
// When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"

// Uncomment and set the credentials configuration

// Configure HTTP bearer authorization:
// TwitterCredentialsBearer credentials = new TwitterCredentialsBearer(System.getenv("TWITTER_BEARER_TOKEN"));
TwitterApi apiInstance = new TwitterApi(credentials);

// Set the params values
Integer backfillMinutes = 56; // Integer | The number of minutes of backfill requested.
OffsetDateTime startTime = OffsetDateTime.parse("2021-02-01T18:40:40.000Z"); // OffsetDateTime | YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Tweet labels will be provided.
OffsetDateTime endTime = OffsetDateTime.parse("2021-02-01T18:40:40.000Z"); // OffsetDateTime | YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Tweet labels will be provided.
try {
InputStream result = apiInstance.compliance().getTweetsLabelStream()
.backfillMinutes(backfillMinutes)
.startTime(startTime)
.endTime(endTime)
.execute();
try{
JSON json = new JSON();
Type localVarReturnType = new TypeToken<TweetLabelStreamResponse>(){}.getType();
BufferedReader reader = new BufferedReader(new InputStreamReader(result));
String line = reader.readLine();
while (line != null) {
if(line.isEmpty()) {
System.out.println("==> Empty line");
line = reader.readLine();
continue;
}
Object jsonObject = json.getGson().fromJson(line, localVarReturnType);
System.out.println(jsonObject != null ? jsonObject.toString() : "Null object");
line = reader.readLine();
}
}catch (Exception e) {
e.printStackTrace();
System.out.println(e);
}
} catch (ApiException e) {
System.err.println("Exception when calling ComplianceApi#getTweetsLabelStream");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```

### Parameters

| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **backfillMinutes** | **Integer**| The number of minutes of backfill requested. | [optional] |
| **startTime** | **OffsetDateTime**| YYYY-MM-DDTHH:mm:ssZ. The earliest UTC timestamp from which the Tweet labels will be provided. | [optional] |
| **endTime** | **OffsetDateTime**| YYYY-MM-DDTHH:mm:ssZ. The latest UTC timestamp from which the Tweet labels will be provided. | [optional] |

### Return type

[**TweetLabelStreamResponse**](TweetLabelStreamResponse.md)

### Authorization

[BearerToken](../README.md#BearerToken)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json, application/problem+json

### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | The request has succeeded. | - |
| **0** | The request has failed. | - |

<a name="getUsersComplianceStream"></a>
# **getUsersComplianceStream**
> UserComplianceStreamResponse getUsersComplianceStream(partition).backfillMinutes(backfillMinutes).startTime(startTime).endTime(endTime).execute();
Expand Down
14 changes: 14 additions & 0 deletions docs/CreateAttachmentsMessageRequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@


# CreateAttachmentsMessageRequest


## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**attachments** | [**List&lt;DmMediaAttachment&gt;**](DmMediaAttachment.md) | Attachments to a DM Event. | |
|**text** | **String** | Text of the message. | [optional] |



23 changes: 23 additions & 0 deletions docs/CreateDmConversationRequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@


# CreateDmConversationRequest


## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**conversationType** | [**ConversationTypeEnum**](#ConversationTypeEnum) | The conversation type that is being created. | |
|**message** | [**CreateMessageRequest**](CreateMessageRequest.md) | | |
|**participantIds** | **List&lt;String&gt;** | Participants for the DM Conversation. | |



## Enum: ConversationTypeEnum

| Name | Value |
|---- | -----|
| GROUP | &quot;Group&quot; |



14 changes: 14 additions & 0 deletions docs/CreateDmEventResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@


# CreateDmEventResponse


## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**data** | [**CreateDmEventResponseData**](CreateDmEventResponseData.md) | | [optional] |
|**errors** | [**List&lt;Problem&gt;**](Problem.md) | | [optional] |



14 changes: 14 additions & 0 deletions docs/CreateDmEventResponseData.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@


# CreateDmEventResponseData


## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**dmConversationId** | **String** | Unique identifier of a DM conversation. This can either be a numeric string, or a pair of numeric strings separated by a &#39;-&#39; character in the case of one-on-one DM Conversations. | |
|**dmEventId** | **String** | Unique identifier of a DM Event. | |



14 changes: 14 additions & 0 deletions docs/CreateMessageRequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@


# CreateMessageRequest


## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**attachments** | [**List&lt;DmMediaAttachment&gt;**](DmMediaAttachment.md) | Attachments to a DM Event. | |
|**text** | **String** | Text of the message. | |



14 changes: 14 additions & 0 deletions docs/CreateTextMessageRequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@


# CreateTextMessageRequest


## Properties

| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**attachments** | [**List&lt;DmMediaAttachment&gt;**](DmMediaAttachment.md) | Attachments to a DM Event. | [optional] |
|**text** | **String** | Text of the message. | |



Loading