- Sentiment - Sentiment Analysis
Sentiment Analysis, 50 credits per call.
package main
import(
"context"
"os"
xapiscraper "github.com/twexapi-dev/x-api-scraper-go"
"github.com/twexapi-dev/x-api-scraper-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := xapiscraper.New(
xapiscraper.WithSecurity(os.Getenv("X_API_SCRAPER_BEARER_AUTH")),
)
res, err := s.Analysis.Sentiment(ctx, components.SentimentAnalysisQuery{
Text: "<value>",
})
if err != nil {
log.Fatal(err)
}
if res.SentimentAnalysisResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
components.SentimentAnalysisQuery | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.AnalysisSentimentResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.HTTPValidationError | 422 | application/json |
| apierrors.APIError | 4XX, 5XX | */* |