Skip to content

Latest commit

 

History

History
63 lines (43 loc) · 2.64 KB

File metadata and controls

63 lines (43 loc) · 2.64 KB

Analysis

Overview

Available Operations

sentiment

Sentiment Analysis, 50 credits per call.

Example Usage

package hello.world;

import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.components.SentimentAnalysisQuery;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.AnalysisSentimentResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws HTTPValidationError, Exception {

        XapiScraper sdk = XapiScraper.builder()
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        SentimentAnalysisQuery req = SentimentAnalysisQuery.builder()
                .text("<value>")
                .build();

        AnalysisSentimentResponse res = sdk.analysis().sentiment()
                .request(req)
                .call();

        if (res.sentimentAnalysisResponse().isPresent()) {
            System.out.println(res.sentimentAnalysisResponse().get());
        }
    }
}

Parameters

Parameter Type Required Description
request SentimentAnalysisQuery ✔️ The request object to use for the request.

Response

AnalysisSentimentResponse

Errors

Error Type Status Code Content Type
models/errors/HTTPValidationError 422 application/json
models/errors/APIException 4XX, 5XX */*