diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6b7b74c..da59f99 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.3.0" + ".": "0.4.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index db87955..d470135 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 117 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/xquik%2Fx-twitter-scraper-d40c57a05527faf060d21c0e013729f371d88017b10680cea7c8fd6780ffaef5.yml -openapi_spec_hash: 597ebc460cf86740b9f6f7c95478dece -config_hash: 30ce23c9cfbf8fb8be9e5dd28a2124fa +configured_endpoints: 110 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/xquik%2Fx-twitter-scraper-2adc33156b4b42a4be18cc20c0205b38f0432d7958da99c65ee9b3f6a555ea0e.yml +openapi_spec_hash: be760f5620a268521d6793f65576a61f +config_hash: 320a9cb2f1293d1a7b73c63ab5865af5 diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ee5e83..e6a1d15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,32 @@ # Changelog +## 0.4.0 (2026-04-25) + +Full Changelog: [v0.3.0...v0.4.0](https://github.com/Xquik-dev/x-twitter-scraper-java/compare/v0.3.0...v0.4.0) + +### Features + +* **api:** api update ([30c1879](https://github.com/Xquik-dev/x-twitter-scraper-java/commit/30c1879055bd1a7fb925a8dc674fbbd932c29f9f)) +* **api:** api update ([5e2cc73](https://github.com/Xquik-dev/x-twitter-scraper-java/commit/5e2cc73283addfe9ac177efb47623c0f51dedf8e)) +* **api:** api update ([6022295](https://github.com/Xquik-dev/x-twitter-scraper-java/commit/6022295c6a25bd0b0797c85ae96304cc3eeb2103)) +* **api:** api update ([d4c753a](https://github.com/Xquik-dev/x-twitter-scraper-java/commit/d4c753ab0a9ee134dc567e576dac2892407e7e29)) + + +### Bug Fixes + +* escape ampersand in OpenAPI summaries for C# XML docs ([fb78c9a](https://github.com/Xquik-dev/x-twitter-scraper-java/commit/fb78c9aea1252be7535e3b5efcc5f916805831d4)) + + +### Chores + +* sync OpenAPI spec ([c225ad8](https://github.com/Xquik-dev/x-twitter-scraper-java/commit/c225ad8eb377c71093ce3f9b5292257ce191ed3a)) +* wire production_repo for all targets ([1a3de89](https://github.com/Xquik-dev/x-twitter-scraper-java/commit/1a3de8994dc023e9602bc359a0f5067f03082e9a)) + + +### Documentation + +* add Contributor Covenant 2.1 Code of Conduct ([#2192](https://github.com/Xquik-dev/x-twitter-scraper-java/issues/2192)) ([afb97b0](https://github.com/Xquik-dev/x-twitter-scraper-java/commit/afb97b0d326a8ff3602f871cd12daa63c7a3d847)) + ## 0.3.0 (2026-04-08) Full Changelog: [v0.2.0...v0.3.0](https://github.com/Xquik-dev/x-twitter-scraper-java/compare/v0.2.0...v0.3.0) diff --git a/README.md b/README.md index c3a3578..fe78e68 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.x_twitter_scraper.api/x-twitter-scraper-java)](https://central.sonatype.com/artifact/com.x_twitter_scraper.api/x-twitter-scraper-java/0.3.0) -[![javadoc](https://javadoc.io/badge2/com.x_twitter_scraper.api/x-twitter-scraper-java/0.3.0/javadoc.svg)](https://javadoc.io/doc/com.x_twitter_scraper.api/x-twitter-scraper-java/0.3.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.x_twitter_scraper.api/x-twitter-scraper-java)](https://central.sonatype.com/artifact/com.x_twitter_scraper.api/x-twitter-scraper-java/0.4.0) +[![javadoc](https://javadoc.io/badge2/com.x_twitter_scraper.api/x-twitter-scraper-java/0.4.0/javadoc.svg)](https://javadoc.io/doc/com.x_twitter_scraper.api/x-twitter-scraper-java/0.4.0) @@ -15,7 +15,7 @@ It is generated with [Stainless](https://www.stainless.com/). -The REST API documentation can be found on [xquik.com](https://xquik.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.x_twitter_scraper.api/x-twitter-scraper-java/0.3.0). +The REST API documentation can be found on [xquik.com](https://xquik.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.x_twitter_scraper.api/x-twitter-scraper-java/0.4.0). @@ -26,7 +26,7 @@ The REST API documentation can be found on [xquik.com](https://xquik.com). Javad ### Gradle ```kotlin -implementation("com.x_twitter_scraper.api:x-twitter-scraper-java:0.3.0") +implementation("com.x_twitter_scraper.api:x-twitter-scraper-java:0.4.0") ``` ### Maven @@ -35,7 +35,7 @@ implementation("com.x_twitter_scraper.api:x-twitter-scraper-java:0.3.0") com.x_twitter_scraper.api x-twitter-scraper-java - 0.3.0 + 0.4.0 ``` @@ -85,7 +85,6 @@ import com.x_twitter_scraper.api.client.okhttp.XTwitterScraperOkHttpClient; XTwitterScraperClient client = XTwitterScraperOkHttpClient.builder() .apiKey("My API Key") - .bearerToken("My Bearer Token") .build(); ``` @@ -564,21 +563,6 @@ TweetSearchParams params = TweetSearchParams.builder() These can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods. -To set undocumented parameters on _nested_ headers, query params, or body classes, call the `putAdditionalProperty` method on the nested class: - -```java -import com.x_twitter_scraper.api.core.JsonValue; -import com.x_twitter_scraper.api.models.integrations.IntegrationCreateParams; - -IntegrationCreateParams params = IntegrationCreateParams.builder() - .config(IntegrationCreateParams.Config.builder() - .putAdditionalProperty("secretProperty", JsonValue.from("42")) - .build()) - .build(); -``` - -These properties can be accessed on the nested built object later using the `_additionalProperties()` method. - To set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/core/Values.kt) object to its setter: ```java diff --git a/build.gradle.kts b/build.gradle.kts index 93d1d37..36ef221 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.x_twitter_scraper.api" - version = "0.3.0" // x-release-please-version + version = "0.4.0" // x-release-please-version } subprojects { diff --git a/buildSrc/src/main/kotlin/x-twitter-scraper.publish.gradle.kts b/buildSrc/src/main/kotlin/x-twitter-scraper.publish.gradle.kts index c59ccf8..f090adc 100644 --- a/buildSrc/src/main/kotlin/x-twitter-scraper.publish.gradle.kts +++ b/buildSrc/src/main/kotlin/x-twitter-scraper.publish.gradle.kts @@ -43,7 +43,7 @@ configure { pom { name.set("Xquik API") - description.set("Xquik is an all-in-one X (Twitter) automation API with 40+ endpoints for\nreading, writing, and monitoring X data. **Read endpoints** let you look up\ntweets, search tweets, fetch user profiles, list followers & following, browse\ntimelines, bookmarks, notifications, communities, lists, trending topics, and\ndownload media. **Write endpoints** let you post tweets, reply, like, unlike,\nretweet, unretweet, follow, unfollow, send DMs, upload media, update profiles,\nand manage communities. **Automation endpoints** power bulk data extractions (20\ntool types), giveaway draws from tweet replies, real-time account monitoring\nwith webhooks & Telegram integrations, tweet composition with AI, and writing\nstyle analysis. Authenticate with an API key or OAuth 2.1 bearer token.\nPay-per-use endpoints are also available without an account.") + description.set("Look up any tweet, user, or trend on X. Search tweets, check follower\nrelationships, download media, and monitor accounts in real time. 32 pay-per-use\nread endpoints work without a subscription — just pay per call. Write endpoints\n(post, like, retweet, follow, DM) and automation endpoints (bulk extractions,\ngiveaway draws, monitors, webhooks) require an API key or OAuth 2.1 bearer\ntoken.") url.set("https://xquik.com") licenses { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/client/XTwitterScraperClient.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/client/XTwitterScraperClient.kt index f9265b9..cf3e6dc 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/client/XTwitterScraperClient.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/client/XTwitterScraperClient.kt @@ -5,14 +5,12 @@ package com.x_twitter_scraper.api.client import com.x_twitter_scraper.api.core.ClientOptions import com.x_twitter_scraper.api.services.blocking.AccountService import com.x_twitter_scraper.api.services.blocking.ApiKeyService -import com.x_twitter_scraper.api.services.blocking.BotService import com.x_twitter_scraper.api.services.blocking.ComposeService import com.x_twitter_scraper.api.services.blocking.CreditService import com.x_twitter_scraper.api.services.blocking.DraftService import com.x_twitter_scraper.api.services.blocking.DrawService import com.x_twitter_scraper.api.services.blocking.EventService import com.x_twitter_scraper.api.services.blocking.ExtractionService -import com.x_twitter_scraper.api.services.blocking.IntegrationService import com.x_twitter_scraper.api.services.blocking.MonitorService import com.x_twitter_scraper.api.services.blocking.RadarService import com.x_twitter_scraper.api.services.blocking.StyleService @@ -59,25 +57,25 @@ interface XTwitterScraperClient { */ fun withOptions(modifier: Consumer): XTwitterScraperClient - /** Account info & settings */ + /** Account info and settings */ fun account(): AccountService /** API key management (session auth only) */ fun apiKeys(): ApiKeyService - /** Subscription & billing */ + /** Subscription, billing, and credits */ fun subscribe(): SubscribeService - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ fun compose(): ComposeService - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ fun drafts(): DraftService - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ fun styles(): StyleService - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ fun radar(): RadarService /** Real-time X account monitoring */ @@ -92,23 +90,17 @@ interface XTwitterScraperClient { /** Giveaway draws from tweet replies */ fun draws(): DrawService - /** Webhook endpoint management & delivery */ + /** Webhook endpoint management and delivery */ fun webhooks(): WebhookService - /** Push notification integrations (Telegram) */ - fun integrations(): IntegrationService - - /** X data lookups (subscription required) */ fun x(): XService - /** Trending topics by region */ + /** Trending topics and hashtags by region */ fun trends(): TrendService - fun bot(): BotService - fun support(): SupportService - /** Subscription & billing */ + /** Subscription, billing, and credits */ fun credits(): CreditService /** @@ -138,25 +130,25 @@ interface XTwitterScraperClient { modifier: Consumer ): XTwitterScraperClient.WithRawResponse - /** Account info & settings */ + /** Account info and settings */ fun account(): AccountService.WithRawResponse /** API key management (session auth only) */ fun apiKeys(): ApiKeyService.WithRawResponse - /** Subscription & billing */ + /** Subscription, billing, and credits */ fun subscribe(): SubscribeService.WithRawResponse - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ fun compose(): ComposeService.WithRawResponse - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ fun drafts(): DraftService.WithRawResponse - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ fun styles(): StyleService.WithRawResponse - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ fun radar(): RadarService.WithRawResponse /** Real-time X account monitoring */ @@ -171,23 +163,17 @@ interface XTwitterScraperClient { /** Giveaway draws from tweet replies */ fun draws(): DrawService.WithRawResponse - /** Webhook endpoint management & delivery */ + /** Webhook endpoint management and delivery */ fun webhooks(): WebhookService.WithRawResponse - /** Push notification integrations (Telegram) */ - fun integrations(): IntegrationService.WithRawResponse - - /** X data lookups (subscription required) */ fun x(): XService.WithRawResponse - /** Trending topics by region */ + /** Trending topics and hashtags by region */ fun trends(): TrendService.WithRawResponse - fun bot(): BotService.WithRawResponse - fun support(): SupportService.WithRawResponse - /** Subscription & billing */ + /** Subscription, billing, and credits */ fun credits(): CreditService.WithRawResponse } } diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/client/XTwitterScraperClientAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/client/XTwitterScraperClientAsync.kt index 39c429d..6de1cbe 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/client/XTwitterScraperClientAsync.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/client/XTwitterScraperClientAsync.kt @@ -5,14 +5,12 @@ package com.x_twitter_scraper.api.client import com.x_twitter_scraper.api.core.ClientOptions import com.x_twitter_scraper.api.services.async.AccountServiceAsync import com.x_twitter_scraper.api.services.async.ApiKeyServiceAsync -import com.x_twitter_scraper.api.services.async.BotServiceAsync import com.x_twitter_scraper.api.services.async.ComposeServiceAsync import com.x_twitter_scraper.api.services.async.CreditServiceAsync import com.x_twitter_scraper.api.services.async.DraftServiceAsync import com.x_twitter_scraper.api.services.async.DrawServiceAsync import com.x_twitter_scraper.api.services.async.EventServiceAsync import com.x_twitter_scraper.api.services.async.ExtractionServiceAsync -import com.x_twitter_scraper.api.services.async.IntegrationServiceAsync import com.x_twitter_scraper.api.services.async.MonitorServiceAsync import com.x_twitter_scraper.api.services.async.RadarServiceAsync import com.x_twitter_scraper.api.services.async.StyleServiceAsync @@ -59,25 +57,25 @@ interface XTwitterScraperClientAsync { */ fun withOptions(modifier: Consumer): XTwitterScraperClientAsync - /** Account info & settings */ + /** Account info and settings */ fun account(): AccountServiceAsync /** API key management (session auth only) */ fun apiKeys(): ApiKeyServiceAsync - /** Subscription & billing */ + /** Subscription, billing, and credits */ fun subscribe(): SubscribeServiceAsync - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ fun compose(): ComposeServiceAsync - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ fun drafts(): DraftServiceAsync - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ fun styles(): StyleServiceAsync - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ fun radar(): RadarServiceAsync /** Real-time X account monitoring */ @@ -92,23 +90,17 @@ interface XTwitterScraperClientAsync { /** Giveaway draws from tweet replies */ fun draws(): DrawServiceAsync - /** Webhook endpoint management & delivery */ + /** Webhook endpoint management and delivery */ fun webhooks(): WebhookServiceAsync - /** Push notification integrations (Telegram) */ - fun integrations(): IntegrationServiceAsync - - /** X data lookups (subscription required) */ fun x(): XServiceAsync - /** Trending topics by region */ + /** Trending topics and hashtags by region */ fun trends(): TrendServiceAsync - fun bot(): BotServiceAsync - fun support(): SupportServiceAsync - /** Subscription & billing */ + /** Subscription, billing, and credits */ fun credits(): CreditServiceAsync /** @@ -139,25 +131,25 @@ interface XTwitterScraperClientAsync { modifier: Consumer ): XTwitterScraperClientAsync.WithRawResponse - /** Account info & settings */ + /** Account info and settings */ fun account(): AccountServiceAsync.WithRawResponse /** API key management (session auth only) */ fun apiKeys(): ApiKeyServiceAsync.WithRawResponse - /** Subscription & billing */ + /** Subscription, billing, and credits */ fun subscribe(): SubscribeServiceAsync.WithRawResponse - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ fun compose(): ComposeServiceAsync.WithRawResponse - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ fun drafts(): DraftServiceAsync.WithRawResponse - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ fun styles(): StyleServiceAsync.WithRawResponse - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ fun radar(): RadarServiceAsync.WithRawResponse /** Real-time X account monitoring */ @@ -172,23 +164,17 @@ interface XTwitterScraperClientAsync { /** Giveaway draws from tweet replies */ fun draws(): DrawServiceAsync.WithRawResponse - /** Webhook endpoint management & delivery */ + /** Webhook endpoint management and delivery */ fun webhooks(): WebhookServiceAsync.WithRawResponse - /** Push notification integrations (Telegram) */ - fun integrations(): IntegrationServiceAsync.WithRawResponse - - /** X data lookups (subscription required) */ fun x(): XServiceAsync.WithRawResponse - /** Trending topics by region */ + /** Trending topics and hashtags by region */ fun trends(): TrendServiceAsync.WithRawResponse - fun bot(): BotServiceAsync.WithRawResponse - fun support(): SupportServiceAsync.WithRawResponse - /** Subscription & billing */ + /** Subscription, billing, and credits */ fun credits(): CreditServiceAsync.WithRawResponse } } diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/client/XTwitterScraperClientAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/client/XTwitterScraperClientAsyncImpl.kt index 5917e0a..8e09841 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/client/XTwitterScraperClientAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/client/XTwitterScraperClientAsyncImpl.kt @@ -8,8 +8,6 @@ import com.x_twitter_scraper.api.services.async.AccountServiceAsync import com.x_twitter_scraper.api.services.async.AccountServiceAsyncImpl import com.x_twitter_scraper.api.services.async.ApiKeyServiceAsync import com.x_twitter_scraper.api.services.async.ApiKeyServiceAsyncImpl -import com.x_twitter_scraper.api.services.async.BotServiceAsync -import com.x_twitter_scraper.api.services.async.BotServiceAsyncImpl import com.x_twitter_scraper.api.services.async.ComposeServiceAsync import com.x_twitter_scraper.api.services.async.ComposeServiceAsyncImpl import com.x_twitter_scraper.api.services.async.CreditServiceAsync @@ -22,8 +20,6 @@ import com.x_twitter_scraper.api.services.async.EventServiceAsync import com.x_twitter_scraper.api.services.async.EventServiceAsyncImpl import com.x_twitter_scraper.api.services.async.ExtractionServiceAsync import com.x_twitter_scraper.api.services.async.ExtractionServiceAsyncImpl -import com.x_twitter_scraper.api.services.async.IntegrationServiceAsync -import com.x_twitter_scraper.api.services.async.IntegrationServiceAsyncImpl import com.x_twitter_scraper.api.services.async.MonitorServiceAsync import com.x_twitter_scraper.api.services.async.MonitorServiceAsyncImpl import com.x_twitter_scraper.api.services.async.RadarServiceAsync @@ -106,18 +102,12 @@ class XTwitterScraperClientAsyncImpl(private val clientOptions: ClientOptions) : WebhookServiceAsyncImpl(clientOptionsWithUserAgent) } - private val integrations: IntegrationServiceAsync by lazy { - IntegrationServiceAsyncImpl(clientOptionsWithUserAgent) - } - private val x: XServiceAsync by lazy { XServiceAsyncImpl(clientOptionsWithUserAgent) } private val trends: TrendServiceAsync by lazy { TrendServiceAsyncImpl(clientOptionsWithUserAgent) } - private val bot: BotServiceAsync by lazy { BotServiceAsyncImpl(clientOptionsWithUserAgent) } - private val support: SupportServiceAsync by lazy { SupportServiceAsyncImpl(clientOptionsWithUserAgent) } @@ -135,25 +125,25 @@ class XTwitterScraperClientAsyncImpl(private val clientOptions: ClientOptions) : ): XTwitterScraperClientAsync = XTwitterScraperClientAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - /** Account info & settings */ + /** Account info and settings */ override fun account(): AccountServiceAsync = account /** API key management (session auth only) */ override fun apiKeys(): ApiKeyServiceAsync = apiKeys - /** Subscription & billing */ + /** Subscription, billing, and credits */ override fun subscribe(): SubscribeServiceAsync = subscribe - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ override fun compose(): ComposeServiceAsync = compose - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ override fun drafts(): DraftServiceAsync = drafts - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ override fun styles(): StyleServiceAsync = styles - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ override fun radar(): RadarServiceAsync = radar /** Real-time X account monitoring */ @@ -168,23 +158,17 @@ class XTwitterScraperClientAsyncImpl(private val clientOptions: ClientOptions) : /** Giveaway draws from tweet replies */ override fun draws(): DrawServiceAsync = draws - /** Webhook endpoint management & delivery */ + /** Webhook endpoint management and delivery */ override fun webhooks(): WebhookServiceAsync = webhooks - /** Push notification integrations (Telegram) */ - override fun integrations(): IntegrationServiceAsync = integrations - - /** X data lookups (subscription required) */ override fun x(): XServiceAsync = x - /** Trending topics by region */ + /** Trending topics and hashtags by region */ override fun trends(): TrendServiceAsync = trends - override fun bot(): BotServiceAsync = bot - override fun support(): SupportServiceAsync = support - /** Subscription & billing */ + /** Subscription, billing, and credits */ override fun credits(): CreditServiceAsync = credits override fun close() = clientOptions.close() @@ -240,10 +224,6 @@ class XTwitterScraperClientAsyncImpl(private val clientOptions: ClientOptions) : WebhookServiceAsyncImpl.WithRawResponseImpl(clientOptions) } - private val integrations: IntegrationServiceAsync.WithRawResponse by lazy { - IntegrationServiceAsyncImpl.WithRawResponseImpl(clientOptions) - } - private val x: XServiceAsync.WithRawResponse by lazy { XServiceAsyncImpl.WithRawResponseImpl(clientOptions) } @@ -252,10 +232,6 @@ class XTwitterScraperClientAsyncImpl(private val clientOptions: ClientOptions) : TrendServiceAsyncImpl.WithRawResponseImpl(clientOptions) } - private val bot: BotServiceAsync.WithRawResponse by lazy { - BotServiceAsyncImpl.WithRawResponseImpl(clientOptions) - } - private val support: SupportServiceAsync.WithRawResponse by lazy { SupportServiceAsyncImpl.WithRawResponseImpl(clientOptions) } @@ -271,25 +247,25 @@ class XTwitterScraperClientAsyncImpl(private val clientOptions: ClientOptions) : clientOptions.toBuilder().apply(modifier::accept).build() ) - /** Account info & settings */ + /** Account info and settings */ override fun account(): AccountServiceAsync.WithRawResponse = account /** API key management (session auth only) */ override fun apiKeys(): ApiKeyServiceAsync.WithRawResponse = apiKeys - /** Subscription & billing */ + /** Subscription, billing, and credits */ override fun subscribe(): SubscribeServiceAsync.WithRawResponse = subscribe - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ override fun compose(): ComposeServiceAsync.WithRawResponse = compose - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ override fun drafts(): DraftServiceAsync.WithRawResponse = drafts - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ override fun styles(): StyleServiceAsync.WithRawResponse = styles - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ override fun radar(): RadarServiceAsync.WithRawResponse = radar /** Real-time X account monitoring */ @@ -304,23 +280,17 @@ class XTwitterScraperClientAsyncImpl(private val clientOptions: ClientOptions) : /** Giveaway draws from tweet replies */ override fun draws(): DrawServiceAsync.WithRawResponse = draws - /** Webhook endpoint management & delivery */ + /** Webhook endpoint management and delivery */ override fun webhooks(): WebhookServiceAsync.WithRawResponse = webhooks - /** Push notification integrations (Telegram) */ - override fun integrations(): IntegrationServiceAsync.WithRawResponse = integrations - - /** X data lookups (subscription required) */ override fun x(): XServiceAsync.WithRawResponse = x - /** Trending topics by region */ + /** Trending topics and hashtags by region */ override fun trends(): TrendServiceAsync.WithRawResponse = trends - override fun bot(): BotServiceAsync.WithRawResponse = bot - override fun support(): SupportServiceAsync.WithRawResponse = support - /** Subscription & billing */ + /** Subscription, billing, and credits */ override fun credits(): CreditServiceAsync.WithRawResponse = credits } } diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/client/XTwitterScraperClientImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/client/XTwitterScraperClientImpl.kt index 36b4c7e..a67932c 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/client/XTwitterScraperClientImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/client/XTwitterScraperClientImpl.kt @@ -8,8 +8,6 @@ import com.x_twitter_scraper.api.services.blocking.AccountService import com.x_twitter_scraper.api.services.blocking.AccountServiceImpl import com.x_twitter_scraper.api.services.blocking.ApiKeyService import com.x_twitter_scraper.api.services.blocking.ApiKeyServiceImpl -import com.x_twitter_scraper.api.services.blocking.BotService -import com.x_twitter_scraper.api.services.blocking.BotServiceImpl import com.x_twitter_scraper.api.services.blocking.ComposeService import com.x_twitter_scraper.api.services.blocking.ComposeServiceImpl import com.x_twitter_scraper.api.services.blocking.CreditService @@ -22,8 +20,6 @@ import com.x_twitter_scraper.api.services.blocking.EventService import com.x_twitter_scraper.api.services.blocking.EventServiceImpl import com.x_twitter_scraper.api.services.blocking.ExtractionService import com.x_twitter_scraper.api.services.blocking.ExtractionServiceImpl -import com.x_twitter_scraper.api.services.blocking.IntegrationService -import com.x_twitter_scraper.api.services.blocking.IntegrationServiceImpl import com.x_twitter_scraper.api.services.blocking.MonitorService import com.x_twitter_scraper.api.services.blocking.MonitorServiceImpl import com.x_twitter_scraper.api.services.blocking.RadarService @@ -89,16 +85,10 @@ class XTwitterScraperClientImpl(private val clientOptions: ClientOptions) : XTwi private val webhooks: WebhookService by lazy { WebhookServiceImpl(clientOptionsWithUserAgent) } - private val integrations: IntegrationService by lazy { - IntegrationServiceImpl(clientOptionsWithUserAgent) - } - private val x: XService by lazy { XServiceImpl(clientOptionsWithUserAgent) } private val trends: TrendService by lazy { TrendServiceImpl(clientOptionsWithUserAgent) } - private val bot: BotService by lazy { BotServiceImpl(clientOptionsWithUserAgent) } - private val support: SupportService by lazy { SupportServiceImpl(clientOptionsWithUserAgent) } private val credits: CreditService by lazy { CreditServiceImpl(clientOptionsWithUserAgent) } @@ -110,25 +100,25 @@ class XTwitterScraperClientImpl(private val clientOptions: ClientOptions) : XTwi override fun withOptions(modifier: Consumer): XTwitterScraperClient = XTwitterScraperClientImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - /** Account info & settings */ + /** Account info and settings */ override fun account(): AccountService = account /** API key management (session auth only) */ override fun apiKeys(): ApiKeyService = apiKeys - /** Subscription & billing */ + /** Subscription, billing, and credits */ override fun subscribe(): SubscribeService = subscribe - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ override fun compose(): ComposeService = compose - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ override fun drafts(): DraftService = drafts - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ override fun styles(): StyleService = styles - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ override fun radar(): RadarService = radar /** Real-time X account monitoring */ @@ -143,23 +133,17 @@ class XTwitterScraperClientImpl(private val clientOptions: ClientOptions) : XTwi /** Giveaway draws from tweet replies */ override fun draws(): DrawService = draws - /** Webhook endpoint management & delivery */ + /** Webhook endpoint management and delivery */ override fun webhooks(): WebhookService = webhooks - /** Push notification integrations (Telegram) */ - override fun integrations(): IntegrationService = integrations - - /** X data lookups (subscription required) */ override fun x(): XService = x - /** Trending topics by region */ + /** Trending topics and hashtags by region */ override fun trends(): TrendService = trends - override fun bot(): BotService = bot - override fun support(): SupportService = support - /** Subscription & billing */ + /** Subscription, billing, and credits */ override fun credits(): CreditService = credits override fun close() = clientOptions.close() @@ -215,10 +199,6 @@ class XTwitterScraperClientImpl(private val clientOptions: ClientOptions) : XTwi WebhookServiceImpl.WithRawResponseImpl(clientOptions) } - private val integrations: IntegrationService.WithRawResponse by lazy { - IntegrationServiceImpl.WithRawResponseImpl(clientOptions) - } - private val x: XService.WithRawResponse by lazy { XServiceImpl.WithRawResponseImpl(clientOptions) } @@ -227,10 +207,6 @@ class XTwitterScraperClientImpl(private val clientOptions: ClientOptions) : XTwi TrendServiceImpl.WithRawResponseImpl(clientOptions) } - private val bot: BotService.WithRawResponse by lazy { - BotServiceImpl.WithRawResponseImpl(clientOptions) - } - private val support: SupportService.WithRawResponse by lazy { SupportServiceImpl.WithRawResponseImpl(clientOptions) } @@ -246,25 +222,25 @@ class XTwitterScraperClientImpl(private val clientOptions: ClientOptions) : XTwi clientOptions.toBuilder().apply(modifier::accept).build() ) - /** Account info & settings */ + /** Account info and settings */ override fun account(): AccountService.WithRawResponse = account /** API key management (session auth only) */ override fun apiKeys(): ApiKeyService.WithRawResponse = apiKeys - /** Subscription & billing */ + /** Subscription, billing, and credits */ override fun subscribe(): SubscribeService.WithRawResponse = subscribe - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ override fun compose(): ComposeService.WithRawResponse = compose - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ override fun drafts(): DraftService.WithRawResponse = drafts - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ override fun styles(): StyleService.WithRawResponse = styles - /** Tweet composition, drafts, writing styles & radar */ + /** AI tweet composition, drafts, writing styles, and radar */ override fun radar(): RadarService.WithRawResponse = radar /** Real-time X account monitoring */ @@ -279,23 +255,17 @@ class XTwitterScraperClientImpl(private val clientOptions: ClientOptions) : XTwi /** Giveaway draws from tweet replies */ override fun draws(): DrawService.WithRawResponse = draws - /** Webhook endpoint management & delivery */ + /** Webhook endpoint management and delivery */ override fun webhooks(): WebhookService.WithRawResponse = webhooks - /** Push notification integrations (Telegram) */ - override fun integrations(): IntegrationService.WithRawResponse = integrations - - /** X data lookups (subscription required) */ override fun x(): XService.WithRawResponse = x - /** Trending topics by region */ + /** Trending topics and hashtags by region */ override fun trends(): TrendService.WithRawResponse = trends - override fun bot(): BotService.WithRawResponse = bot - override fun support(): SupportService.WithRawResponse = support - /** Subscription & billing */ + /** Subscription, billing, and credits */ override fun credits(): CreditService.WithRawResponse = credits } } diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/core/ClientOptions.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/core/ClientOptions.kt index a049f9e..314db97 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/core/ClientOptions.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/core/ClientOptions.kt @@ -424,6 +424,16 @@ private constructor( // We replace after all the default headers to allow end-users to overwrite them. headers.replaceAll(this.headers.build()) queryParams.replaceAll(this.queryParams.build()) + apiKey?.let { + if (!it.isEmpty()) { + headers.replace("X-Api-Key", it) + } + } + bearerToken?.let { + if (!it.isEmpty()) { + headers.replace("Authorization", "Bearer $it") + } + } return ClientOptions( httpClient, @@ -463,24 +473,4 @@ private constructor( httpClient.close() sleeper.close() } - - @JvmSynthetic - internal fun securityHeaders(security: SecurityOptions): Headers { - val headers = Headers.builder() - if (security.apiKey) { - apiKey?.let { - if (!it.isEmpty()) { - headers.replace("X-Api-Key", it) - } - } - } - if (security.oauthBearer) { - bearerToken?.let { - if (!it.isEmpty()) { - headers.replace("Authorization", "Bearer $it") - } - } - } - return headers.build() - } } diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/core/PrepareRequest.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/core/PrepareRequest.kt index 9587a46..3837943 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/core/PrepareRequest.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/core/PrepareRequest.kt @@ -6,15 +6,10 @@ import com.x_twitter_scraper.api.core.http.HttpRequest import java.util.concurrent.CompletableFuture @JvmSynthetic -internal fun HttpRequest.prepare( - clientOptions: ClientOptions, - params: Params, - security: SecurityOptions = SecurityOptions.all(), -): HttpRequest = +internal fun HttpRequest.prepare(clientOptions: ClientOptions, params: Params): HttpRequest = toBuilder() .putAllQueryParams(clientOptions.queryParams) .replaceAllQueryParams(params._queryParams()) - .putAllHeaders(clientOptions.securityHeaders(security)) .putAllHeaders(clientOptions.headers) .replaceAllHeaders(params._headers()) .build() @@ -23,8 +18,7 @@ internal fun HttpRequest.prepare( internal fun HttpRequest.prepareAsync( clientOptions: ClientOptions, params: Params, - security: SecurityOptions = SecurityOptions.all(), ): CompletableFuture = // This async version exists to make it easier to add async specific preparation logic in the // future. - CompletableFuture.completedFuture(prepare(clientOptions, params, security)) + CompletableFuture.completedFuture(prepare(clientOptions, params)) diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/core/SecurityOptions.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/core/SecurityOptions.kt deleted file mode 100644 index 2735930..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/core/SecurityOptions.kt +++ /dev/null @@ -1,69 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.core - -import java.util.Objects - -/** A class for configuring which security schemes are enabled for a request. */ -class SecurityOptions -private constructor( - /** Whether the apiKey security scheme is enabled. */ - @get:JvmName("apiKey") val apiKey: Boolean, - /** Whether the oauthBearer security scheme is enabled. */ - @get:JvmName("oauthBearer") val oauthBearer: Boolean, -) { - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [SecurityOptions]. */ - @JvmStatic fun builder() = Builder() - - /** Returns a [Security] instance with all security schemes enabled. */ - @JvmStatic fun all(): SecurityOptions = builder().apiKey(true).oauthBearer(true).build() - - /** Returns a [Security] instance with no security schemes enabled. */ - @JvmStatic fun none(): SecurityOptions = builder().build() - } - - /** A builder for [SecurityOptions]. */ - class Builder internal constructor() { - - private var apiKey: Boolean = false - private var oauthBearer: Boolean = false - - @JvmSynthetic - internal fun from(securityOptions: SecurityOptions) = apply { - apiKey = securityOptions.apiKey - oauthBearer = securityOptions.oauthBearer - } - - /** Whether the apiKey security scheme is enabled. */ - fun apiKey(apiKey: Boolean) = apply { this.apiKey = apiKey } - - /** Whether the oauthBearer security scheme is enabled. */ - fun oauthBearer(oauthBearer: Boolean) = apply { this.oauthBearer = oauthBearer } - - /** - * Returns an immutable instance of [SecurityOptions]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): SecurityOptions = SecurityOptions(apiKey, oauthBearer) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SecurityOptions && - apiKey == other.apiKey && - oauthBearer == other.oauthBearer - } - - override fun hashCode(): Int = Objects.hash(apiKey, oauthBearer) - - override fun toString() = "SecurityOptions{apiKey=$apiKey, oauthBearer=$oauthBearer}" -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/Error.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/Error.kt index 6356b08..5ebd98d 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/Error.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/Error.kt @@ -184,6 +184,8 @@ private constructor( @JvmField val INVALID_USERNAME = of("invalid_username") + @JvmField val INSUFFICIENT_CREDITS = of("insufficient_credits") + @JvmField val MISSING_PARAMS = of("missing_params") @JvmField val MISSING_QUERY = of("missing_query") @@ -192,20 +194,18 @@ private constructor( @JvmField val MONITOR_LIMIT_REACHED = of("monitor_limit_reached") + @JvmField val NO_CREDITS = of("no_credits") + @JvmField val NO_SUBSCRIPTION = of("no_subscription") @JvmField val NOT_FOUND = of("not_found") - @JvmField val STREAM_REGISTRATION_FAILED = of("stream_registration_failed") - @JvmField val SUBSCRIPTION_INACTIVE = of("subscription_inactive") @JvmField val TWEET_NOT_FOUND = of("tweet_not_found") @JvmField val UNAUTHENTICATED = of("unauthenticated") - @JvmField val USAGE_LIMIT_REACHED = of("usage_limit_reached") - @JvmField val USER_NOT_FOUND = of("user_not_found") @JvmField val WEBHOOK_INACTIVE = of("webhook_inactive") @@ -230,17 +230,17 @@ private constructor( INVALID_TWEET_ID, INVALID_TWEET_URL, INVALID_USERNAME, + INSUFFICIENT_CREDITS, MISSING_PARAMS, MISSING_QUERY, MONITOR_ALREADY_EXISTS, MONITOR_LIMIT_REACHED, + NO_CREDITS, NO_SUBSCRIPTION, NOT_FOUND, - STREAM_REGISTRATION_FAILED, SUBSCRIPTION_INACTIVE, TWEET_NOT_FOUND, UNAUTHENTICATED, - USAGE_LIMIT_REACHED, USER_NOT_FOUND, WEBHOOK_INACTIVE, X_API_RATE_LIMITED, @@ -267,17 +267,17 @@ private constructor( INVALID_TWEET_ID, INVALID_TWEET_URL, INVALID_USERNAME, + INSUFFICIENT_CREDITS, MISSING_PARAMS, MISSING_QUERY, MONITOR_ALREADY_EXISTS, MONITOR_LIMIT_REACHED, + NO_CREDITS, NO_SUBSCRIPTION, NOT_FOUND, - STREAM_REGISTRATION_FAILED, SUBSCRIPTION_INACTIVE, TWEET_NOT_FOUND, UNAUTHENTICATED, - USAGE_LIMIT_REACHED, USER_NOT_FOUND, WEBHOOK_INACTIVE, X_API_RATE_LIMITED, @@ -307,17 +307,17 @@ private constructor( INVALID_TWEET_ID -> Value.INVALID_TWEET_ID INVALID_TWEET_URL -> Value.INVALID_TWEET_URL INVALID_USERNAME -> Value.INVALID_USERNAME + INSUFFICIENT_CREDITS -> Value.INSUFFICIENT_CREDITS MISSING_PARAMS -> Value.MISSING_PARAMS MISSING_QUERY -> Value.MISSING_QUERY MONITOR_ALREADY_EXISTS -> Value.MONITOR_ALREADY_EXISTS MONITOR_LIMIT_REACHED -> Value.MONITOR_LIMIT_REACHED + NO_CREDITS -> Value.NO_CREDITS NO_SUBSCRIPTION -> Value.NO_SUBSCRIPTION NOT_FOUND -> Value.NOT_FOUND - STREAM_REGISTRATION_FAILED -> Value.STREAM_REGISTRATION_FAILED SUBSCRIPTION_INACTIVE -> Value.SUBSCRIPTION_INACTIVE TWEET_NOT_FOUND -> Value.TWEET_NOT_FOUND UNAUTHENTICATED -> Value.UNAUTHENTICATED - USAGE_LIMIT_REACHED -> Value.USAGE_LIMIT_REACHED USER_NOT_FOUND -> Value.USER_NOT_FOUND WEBHOOK_INACTIVE -> Value.WEBHOOK_INACTIVE X_API_RATE_LIMITED -> Value.X_API_RATE_LIMITED @@ -346,17 +346,17 @@ private constructor( INVALID_TWEET_ID -> Known.INVALID_TWEET_ID INVALID_TWEET_URL -> Known.INVALID_TWEET_URL INVALID_USERNAME -> Known.INVALID_USERNAME + INSUFFICIENT_CREDITS -> Known.INSUFFICIENT_CREDITS MISSING_PARAMS -> Known.MISSING_PARAMS MISSING_QUERY -> Known.MISSING_QUERY MONITOR_ALREADY_EXISTS -> Known.MONITOR_ALREADY_EXISTS MONITOR_LIMIT_REACHED -> Known.MONITOR_LIMIT_REACHED + NO_CREDITS -> Known.NO_CREDITS NO_SUBSCRIPTION -> Known.NO_SUBSCRIPTION NOT_FOUND -> Known.NOT_FOUND - STREAM_REGISTRATION_FAILED -> Known.STREAM_REGISTRATION_FAILED SUBSCRIPTION_INACTIVE -> Known.SUBSCRIPTION_INACTIVE TWEET_NOT_FOUND -> Known.TWEET_NOT_FOUND UNAUTHENTICATED -> Known.UNAUTHENTICATED - USAGE_LIMIT_REACHED -> Known.USAGE_LIMIT_REACHED USER_NOT_FOUND -> Known.USER_NOT_FOUND WEBHOOK_INACTIVE -> Known.WEBHOOK_INACTIVE X_API_RATE_LIMITED -> Known.X_API_RATE_LIMITED diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/EventType.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/EventType.kt index fad6c19..419dd0e 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/EventType.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/EventType.kt @@ -29,10 +29,6 @@ class EventType @JsonCreator private constructor(private val value: JsonField Value.TWEET_REPLY TWEET_RETWEET -> Value.TWEET_RETWEET TWEET_QUOTE -> Value.TWEET_QUOTE - FOLLOWER_GAINED -> Value.FOLLOWER_GAINED - FOLLOWER_LOST -> Value.FOLLOWER_LOST else -> Value._UNKNOWN } @@ -99,8 +89,6 @@ class EventType @JsonCreator private constructor(private val value: JsonField Known.TWEET_REPLY TWEET_RETWEET -> Known.TWEET_RETWEET TWEET_QUOTE -> Known.TWEET_QUOTE - FOLLOWER_GAINED -> Known.FOLLOWER_GAINED - FOLLOWER_LOST -> Known.FOLLOWER_LOST else -> throw XTwitterScraperInvalidDataException("Unknown EventType: $value") } diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/PaginatedTweets.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/PaginatedTweets.kt index 2817a3e..49fe132 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/PaginatedTweets.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/PaginatedTweets.kt @@ -14,7 +14,6 @@ import com.x_twitter_scraper.api.core.checkKnown import com.x_twitter_scraper.api.core.checkRequired import com.x_twitter_scraper.api.core.toImmutable import com.x_twitter_scraper.api.errors.XTwitterScraperInvalidDataException -import com.x_twitter_scraper.api.models.x.tweets.SearchTweet import java.util.Collections import java.util.Objects import kotlin.jvm.optionals.getOrNull diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/PaginatedUsers.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/PaginatedUsers.kt index f7a0acf..e03d8ad 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/PaginatedUsers.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/PaginatedUsers.kt @@ -14,7 +14,6 @@ import com.x_twitter_scraper.api.core.checkKnown import com.x_twitter_scraper.api.core.checkRequired import com.x_twitter_scraper.api.core.toImmutable import com.x_twitter_scraper.api.errors.XTwitterScraperInvalidDataException -import com.x_twitter_scraper.api.models.x.users.UserProfile import java.util.Collections import java.util.Objects import kotlin.jvm.optionals.getOrNull diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/SearchTweet.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/SearchTweet.kt similarity index 99% rename from x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/SearchTweet.kt rename to x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/SearchTweet.kt index 6bea90b..ca875d3 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/SearchTweet.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/SearchTweet.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.x_twitter_scraper.api.models.x.tweets +package com.x_twitter_scraper.api.models import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserProfile.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/UserProfile.kt similarity index 99% rename from x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserProfile.kt rename to x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/UserProfile.kt index f95b2aa..bb77db6 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserProfile.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/UserProfile.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.x_twitter_scraper.api.models.x.users +package com.x_twitter_scraper.api.models import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/account/AccountRetrieveResponse.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/account/AccountRetrieveResponse.kt index e2d4dca..35889aa 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/account/AccountRetrieveResponse.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/account/AccountRetrieveResponse.kt @@ -13,7 +13,6 @@ import com.x_twitter_scraper.api.core.JsonMissing import com.x_twitter_scraper.api.core.JsonValue import com.x_twitter_scraper.api.core.checkRequired import com.x_twitter_scraper.api.errors.XTwitterScraperInvalidDataException -import java.time.OffsetDateTime import java.util.Collections import java.util.Objects import java.util.Optional @@ -25,7 +24,7 @@ private constructor( private val monitorsAllowed: JsonField, private val monitorsUsed: JsonField, private val plan: JsonField, - private val currentPeriod: JsonField, + private val creditInfo: JsonField, private val additionalProperties: MutableMap, ) { @@ -38,10 +37,10 @@ private constructor( @ExcludeMissing monitorsUsed: JsonField = JsonMissing.of(), @JsonProperty("plan") @ExcludeMissing plan: JsonField = JsonMissing.of(), - @JsonProperty("currentPeriod") + @JsonProperty("creditInfo") @ExcludeMissing - currentPeriod: JsonField = JsonMissing.of(), - ) : this(monitorsAllowed, monitorsUsed, plan, currentPeriod, mutableMapOf()) + creditInfo: JsonField = JsonMissing.of(), + ) : this(monitorsAllowed, monitorsUsed, plan, creditInfo, mutableMapOf()) /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is @@ -65,7 +64,7 @@ private constructor( * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun currentPeriod(): Optional = currentPeriod.getOptional("currentPeriod") + fun creditInfo(): Optional = creditInfo.getOptional("creditInfo") /** * Returns the raw JSON value of [monitorsAllowed]. @@ -93,13 +92,13 @@ private constructor( @JsonProperty("plan") @ExcludeMissing fun _plan(): JsonField = plan /** - * Returns the raw JSON value of [currentPeriod]. + * Returns the raw JSON value of [creditInfo]. * - * Unlike [currentPeriod], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [creditInfo], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("currentPeriod") + @JsonProperty("creditInfo") @ExcludeMissing - fun _currentPeriod(): JsonField = currentPeriod + fun _creditInfo(): JsonField = creditInfo @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -134,7 +133,7 @@ private constructor( private var monitorsAllowed: JsonField? = null private var monitorsUsed: JsonField? = null private var plan: JsonField? = null - private var currentPeriod: JsonField = JsonMissing.of() + private var creditInfo: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -142,7 +141,7 @@ private constructor( monitorsAllowed = accountRetrieveResponse.monitorsAllowed monitorsUsed = accountRetrieveResponse.monitorsUsed plan = accountRetrieveResponse.plan - currentPeriod = accountRetrieveResponse.currentPeriod + creditInfo = accountRetrieveResponse.creditInfo additionalProperties = accountRetrieveResponse.additionalProperties.toMutableMap() } @@ -180,18 +179,16 @@ private constructor( */ fun plan(plan: JsonField) = apply { this.plan = plan } - fun currentPeriod(currentPeriod: CurrentPeriod) = currentPeriod(JsonField.of(currentPeriod)) + fun creditInfo(creditInfo: CreditInfo) = creditInfo(JsonField.of(creditInfo)) /** - * Sets [Builder.currentPeriod] to an arbitrary JSON value. + * Sets [Builder.creditInfo] to an arbitrary JSON value. * - * You should usually call [Builder.currentPeriod] with a well-typed [CurrentPeriod] value + * You should usually call [Builder.creditInfo] with a well-typed [CreditInfo] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun currentPeriod(currentPeriod: JsonField) = apply { - this.currentPeriod = currentPeriod - } + fun creditInfo(creditInfo: JsonField) = apply { this.creditInfo = creditInfo } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -231,7 +228,7 @@ private constructor( checkRequired("monitorsAllowed", monitorsAllowed), checkRequired("monitorsUsed", monitorsUsed), checkRequired("plan", plan), - currentPeriod, + creditInfo, additionalProperties.toMutableMap(), ) } @@ -246,7 +243,7 @@ private constructor( monitorsAllowed() monitorsUsed() plan().validate() - currentPeriod().ifPresent { it.validate() } + creditInfo().ifPresent { it.validate() } validated = true } @@ -268,7 +265,7 @@ private constructor( (if (monitorsAllowed.asKnown().isPresent) 1 else 0) + (if (monitorsUsed.asKnown().isPresent) 1 else 0) + (plan.asKnown().getOrNull()?.validity() ?: 0) + - (currentPeriod.asKnown().getOrNull()?.validity() ?: 0) + (creditInfo.asKnown().getOrNull()?.validity() ?: 0) class Plan @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -397,70 +394,94 @@ private constructor( override fun toString() = value.toString() } - class CurrentPeriod + class CreditInfo @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val end: JsonField, - private val start: JsonField, - private val usagePercent: JsonField, + private val autoTopupEnabled: JsonField, + private val balance: JsonField, + private val lifetimePurchased: JsonField, + private val lifetimeUsed: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("end") @ExcludeMissing end: JsonField = JsonMissing.of(), - @JsonProperty("start") + @JsonProperty("autoTopupEnabled") + @ExcludeMissing + autoTopupEnabled: JsonField = JsonMissing.of(), + @JsonProperty("balance") @ExcludeMissing balance: JsonField = JsonMissing.of(), + @JsonProperty("lifetimePurchased") @ExcludeMissing - start: JsonField = JsonMissing.of(), - @JsonProperty("usagePercent") + lifetimePurchased: JsonField = JsonMissing.of(), + @JsonProperty("lifetimeUsed") @ExcludeMissing - usagePercent: JsonField = JsonMissing.of(), - ) : this(end, start, usagePercent, mutableMapOf()) + lifetimeUsed: JsonField = JsonMissing.of(), + ) : this(autoTopupEnabled, balance, lifetimePurchased, lifetimeUsed, mutableMapOf()) /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or * is unexpectedly missing or null (e.g. if the server responded with an unexpected * value). */ - fun end(): OffsetDateTime = end.getRequired("end") + fun autoTopupEnabled(): Boolean = autoTopupEnabled.getRequired("autoTopupEnabled") /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or * is unexpectedly missing or null (e.g. if the server responded with an unexpected * value). */ - fun start(): OffsetDateTime = start.getRequired("start") + fun balance(): Long = balance.getRequired("balance") /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or * is unexpectedly missing or null (e.g. if the server responded with an unexpected * value). */ - fun usagePercent(): Double = usagePercent.getRequired("usagePercent") + fun lifetimePurchased(): Long = lifetimePurchased.getRequired("lifetimePurchased") /** - * Returns the raw JSON value of [end]. + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or + * is unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun lifetimeUsed(): Long = lifetimeUsed.getRequired("lifetimeUsed") + + /** + * Returns the raw JSON value of [autoTopupEnabled]. * - * Unlike [end], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [autoTopupEnabled], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("end") @ExcludeMissing fun _end(): JsonField = end + @JsonProperty("autoTopupEnabled") + @ExcludeMissing + fun _autoTopupEnabled(): JsonField = autoTopupEnabled /** - * Returns the raw JSON value of [start]. + * Returns the raw JSON value of [balance]. * - * Unlike [start], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [balance], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("start") @ExcludeMissing fun _start(): JsonField = start + @JsonProperty("balance") @ExcludeMissing fun _balance(): JsonField = balance /** - * Returns the raw JSON value of [usagePercent]. + * Returns the raw JSON value of [lifetimePurchased]. * - * Unlike [usagePercent], this method doesn't throw if the JSON field has an unexpected + * Unlike [lifetimePurchased], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("usagePercent") + @JsonProperty("lifetimePurchased") @ExcludeMissing - fun _usagePercent(): JsonField = usagePercent + fun _lifetimePurchased(): JsonField = lifetimePurchased + + /** + * Returns the raw JSON value of [lifetimeUsed]. + * + * Unlike [lifetimeUsed], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("lifetimeUsed") + @ExcludeMissing + fun _lifetimeUsed(): JsonField = lifetimeUsed @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -477,67 +498,87 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [CurrentPeriod]. + * Returns a mutable builder for constructing an instance of [CreditInfo]. * * The following fields are required: * ```java - * .end() - * .start() - * .usagePercent() + * .autoTopupEnabled() + * .balance() + * .lifetimePurchased() + * .lifetimeUsed() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [CurrentPeriod]. */ + /** A builder for [CreditInfo]. */ class Builder internal constructor() { - private var end: JsonField? = null - private var start: JsonField? = null - private var usagePercent: JsonField? = null + private var autoTopupEnabled: JsonField? = null + private var balance: JsonField? = null + private var lifetimePurchased: JsonField? = null + private var lifetimeUsed: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(currentPeriod: CurrentPeriod) = apply { - end = currentPeriod.end - start = currentPeriod.start - usagePercent = currentPeriod.usagePercent - additionalProperties = currentPeriod.additionalProperties.toMutableMap() + internal fun from(creditInfo: CreditInfo) = apply { + autoTopupEnabled = creditInfo.autoTopupEnabled + balance = creditInfo.balance + lifetimePurchased = creditInfo.lifetimePurchased + lifetimeUsed = creditInfo.lifetimeUsed + additionalProperties = creditInfo.additionalProperties.toMutableMap() } - fun end(end: OffsetDateTime) = end(JsonField.of(end)) + fun autoTopupEnabled(autoTopupEnabled: Boolean) = + autoTopupEnabled(JsonField.of(autoTopupEnabled)) /** - * Sets [Builder.end] to an arbitrary JSON value. + * Sets [Builder.autoTopupEnabled] to an arbitrary JSON value. * - * You should usually call [Builder.end] with a well-typed [OffsetDateTime] value + * You should usually call [Builder.autoTopupEnabled] with a well-typed [Boolean] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun end(end: JsonField) = apply { this.end = end } + fun autoTopupEnabled(autoTopupEnabled: JsonField) = apply { + this.autoTopupEnabled = autoTopupEnabled + } + + fun balance(balance: Long) = balance(JsonField.of(balance)) + + /** + * Sets [Builder.balance] to an arbitrary JSON value. + * + * You should usually call [Builder.balance] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun balance(balance: JsonField) = apply { this.balance = balance } - fun start(start: OffsetDateTime) = start(JsonField.of(start)) + fun lifetimePurchased(lifetimePurchased: Long) = + lifetimePurchased(JsonField.of(lifetimePurchased)) /** - * Sets [Builder.start] to an arbitrary JSON value. + * Sets [Builder.lifetimePurchased] to an arbitrary JSON value. * - * You should usually call [Builder.start] with a well-typed [OffsetDateTime] value + * You should usually call [Builder.lifetimePurchased] with a well-typed [Long] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun start(start: JsonField) = apply { this.start = start } + fun lifetimePurchased(lifetimePurchased: JsonField) = apply { + this.lifetimePurchased = lifetimePurchased + } - fun usagePercent(usagePercent: Double) = usagePercent(JsonField.of(usagePercent)) + fun lifetimeUsed(lifetimeUsed: Long) = lifetimeUsed(JsonField.of(lifetimeUsed)) /** - * Sets [Builder.usagePercent] to an arbitrary JSON value. + * Sets [Builder.lifetimeUsed] to an arbitrary JSON value. * - * You should usually call [Builder.usagePercent] with a well-typed [Double] value + * You should usually call [Builder.lifetimeUsed] with a well-typed [Long] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun usagePercent(usagePercent: JsonField) = apply { - this.usagePercent = usagePercent + fun lifetimeUsed(lifetimeUsed: JsonField) = apply { + this.lifetimeUsed = lifetimeUsed } fun additionalProperties(additionalProperties: Map) = apply { @@ -560,38 +601,41 @@ private constructor( } /** - * Returns an immutable instance of [CurrentPeriod]. + * Returns an immutable instance of [CreditInfo]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .end() - * .start() - * .usagePercent() + * .autoTopupEnabled() + * .balance() + * .lifetimePurchased() + * .lifetimeUsed() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): CurrentPeriod = - CurrentPeriod( - checkRequired("end", end), - checkRequired("start", start), - checkRequired("usagePercent", usagePercent), + fun build(): CreditInfo = + CreditInfo( + checkRequired("autoTopupEnabled", autoTopupEnabled), + checkRequired("balance", balance), + checkRequired("lifetimePurchased", lifetimePurchased), + checkRequired("lifetimeUsed", lifetimeUsed), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): CurrentPeriod = apply { + fun validate(): CreditInfo = apply { if (validated) { return@apply } - end() - start() - usagePercent() + autoTopupEnabled() + balance() + lifetimePurchased() + lifetimeUsed() validated = true } @@ -611,30 +655,38 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (end.asKnown().isPresent) 1 else 0) + - (if (start.asKnown().isPresent) 1 else 0) + - (if (usagePercent.asKnown().isPresent) 1 else 0) + (if (autoTopupEnabled.asKnown().isPresent) 1 else 0) + + (if (balance.asKnown().isPresent) 1 else 0) + + (if (lifetimePurchased.asKnown().isPresent) 1 else 0) + + (if (lifetimeUsed.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is CurrentPeriod && - end == other.end && - start == other.start && - usagePercent == other.usagePercent && + return other is CreditInfo && + autoTopupEnabled == other.autoTopupEnabled && + balance == other.balance && + lifetimePurchased == other.lifetimePurchased && + lifetimeUsed == other.lifetimeUsed && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(end, start, usagePercent, additionalProperties) + Objects.hash( + autoTopupEnabled, + balance, + lifetimePurchased, + lifetimeUsed, + additionalProperties, + ) } override fun hashCode(): Int = hashCode override fun toString() = - "CurrentPeriod{end=$end, start=$start, usagePercent=$usagePercent, additionalProperties=$additionalProperties}" + "CreditInfo{autoTopupEnabled=$autoTopupEnabled, balance=$balance, lifetimePurchased=$lifetimePurchased, lifetimeUsed=$lifetimeUsed, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -646,16 +698,16 @@ private constructor( monitorsAllowed == other.monitorsAllowed && monitorsUsed == other.monitorsUsed && plan == other.plan && - currentPeriod == other.currentPeriod && + creditInfo == other.creditInfo && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(monitorsAllowed, monitorsUsed, plan, currentPeriod, additionalProperties) + Objects.hash(monitorsAllowed, monitorsUsed, plan, creditInfo, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "AccountRetrieveResponse{monitorsAllowed=$monitorsAllowed, monitorsUsed=$monitorsUsed, plan=$plan, currentPeriod=$currentPeriod, additionalProperties=$additionalProperties}" + "AccountRetrieveResponse{monitorsAllowed=$monitorsAllowed, monitorsUsed=$monitorsUsed, plan=$plan, creditInfo=$creditInfo, additionalProperties=$additionalProperties}" } diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/extractions/ExtractionEstimateCostResponse.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/extractions/ExtractionEstimateCostResponse.kt index 9869751..16d32a5 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/extractions/ExtractionEstimateCostResponse.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/extractions/ExtractionEstimateCostResponse.kt @@ -14,32 +14,45 @@ import com.x_twitter_scraper.api.core.checkRequired import com.x_twitter_scraper.api.errors.XTwitterScraperInvalidDataException import java.util.Collections import java.util.Objects +import java.util.Optional class ExtractionEstimateCostResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val allowed: JsonField, + private val creditsAvailable: JsonField, + private val creditsRequired: JsonField, private val estimatedResults: JsonField, - private val projectedPercent: JsonField, private val source: JsonField, - private val usagePercent: JsonField, + private val resolvedXUserId: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( @JsonProperty("allowed") @ExcludeMissing allowed: JsonField = JsonMissing.of(), + @JsonProperty("creditsAvailable") + @ExcludeMissing + creditsAvailable: JsonField = JsonMissing.of(), + @JsonProperty("creditsRequired") + @ExcludeMissing + creditsRequired: JsonField = JsonMissing.of(), @JsonProperty("estimatedResults") @ExcludeMissing estimatedResults: JsonField = JsonMissing.of(), - @JsonProperty("projectedPercent") - @ExcludeMissing - projectedPercent: JsonField = JsonMissing.of(), @JsonProperty("source") @ExcludeMissing source: JsonField = JsonMissing.of(), - @JsonProperty("usagePercent") + @JsonProperty("resolvedXUserId") @ExcludeMissing - usagePercent: JsonField = JsonMissing.of(), - ) : this(allowed, estimatedResults, projectedPercent, source, usagePercent, mutableMapOf()) + resolvedXUserId: JsonField = JsonMissing.of(), + ) : this( + allowed, + creditsAvailable, + creditsRequired, + estimatedResults, + source, + resolvedXUserId, + mutableMapOf(), + ) /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is @@ -51,25 +64,31 @@ private constructor( * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun estimatedResults(): Long = estimatedResults.getRequired("estimatedResults") + fun creditsAvailable(): String = creditsAvailable.getRequired("creditsAvailable") /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun projectedPercent(): Double = projectedPercent.getRequired("projectedPercent") + fun creditsRequired(): String = creditsRequired.getRequired("creditsRequired") /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun source(): String = source.getRequired("source") + fun estimatedResults(): Long = estimatedResults.getRequired("estimatedResults") /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun usagePercent(): Double = usagePercent.getRequired("usagePercent") + fun source(): String = source.getRequired("source") + + /** + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun resolvedXUserId(): Optional = resolvedXUserId.getOptional("resolvedXUserId") /** * Returns the raw JSON value of [allowed]. @@ -79,24 +98,33 @@ private constructor( @JsonProperty("allowed") @ExcludeMissing fun _allowed(): JsonField = allowed /** - * Returns the raw JSON value of [estimatedResults]. + * Returns the raw JSON value of [creditsAvailable]. * - * Unlike [estimatedResults], this method doesn't throw if the JSON field has an unexpected + * Unlike [creditsAvailable], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("estimatedResults") + @JsonProperty("creditsAvailable") @ExcludeMissing - fun _estimatedResults(): JsonField = estimatedResults + fun _creditsAvailable(): JsonField = creditsAvailable /** - * Returns the raw JSON value of [projectedPercent]. + * Returns the raw JSON value of [creditsRequired]. * - * Unlike [projectedPercent], this method doesn't throw if the JSON field has an unexpected + * Unlike [creditsRequired], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("creditsRequired") + @ExcludeMissing + fun _creditsRequired(): JsonField = creditsRequired + + /** + * Returns the raw JSON value of [estimatedResults]. + * + * Unlike [estimatedResults], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("projectedPercent") + @JsonProperty("estimatedResults") @ExcludeMissing - fun _projectedPercent(): JsonField = projectedPercent + fun _estimatedResults(): JsonField = estimatedResults /** * Returns the raw JSON value of [source]. @@ -106,13 +134,13 @@ private constructor( @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source /** - * Returns the raw JSON value of [usagePercent]. + * Returns the raw JSON value of [resolvedXUserId]. * - * Unlike [usagePercent], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [resolvedXUserId], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("usagePercent") + @JsonProperty("resolvedXUserId") @ExcludeMissing - fun _usagePercent(): JsonField = usagePercent + fun _resolvedXUserId(): JsonField = resolvedXUserId @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -135,10 +163,10 @@ private constructor( * The following fields are required: * ```java * .allowed() + * .creditsAvailable() + * .creditsRequired() * .estimatedResults() - * .projectedPercent() * .source() - * .usagePercent() * ``` */ @JvmStatic fun builder() = Builder() @@ -148,19 +176,21 @@ private constructor( class Builder internal constructor() { private var allowed: JsonField? = null + private var creditsAvailable: JsonField? = null + private var creditsRequired: JsonField? = null private var estimatedResults: JsonField? = null - private var projectedPercent: JsonField? = null private var source: JsonField? = null - private var usagePercent: JsonField? = null + private var resolvedXUserId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(extractionEstimateCostResponse: ExtractionEstimateCostResponse) = apply { allowed = extractionEstimateCostResponse.allowed + creditsAvailable = extractionEstimateCostResponse.creditsAvailable + creditsRequired = extractionEstimateCostResponse.creditsRequired estimatedResults = extractionEstimateCostResponse.estimatedResults - projectedPercent = extractionEstimateCostResponse.projectedPercent source = extractionEstimateCostResponse.source - usagePercent = extractionEstimateCostResponse.usagePercent + resolvedXUserId = extractionEstimateCostResponse.resolvedXUserId additionalProperties = extractionEstimateCostResponse.additionalProperties.toMutableMap() } @@ -175,32 +205,46 @@ private constructor( */ fun allowed(allowed: JsonField) = apply { this.allowed = allowed } - fun estimatedResults(estimatedResults: Long) = - estimatedResults(JsonField.of(estimatedResults)) + fun creditsAvailable(creditsAvailable: String) = + creditsAvailable(JsonField.of(creditsAvailable)) /** - * Sets [Builder.estimatedResults] to an arbitrary JSON value. + * Sets [Builder.creditsAvailable] to an arbitrary JSON value. * - * You should usually call [Builder.estimatedResults] with a well-typed [Long] value + * You should usually call [Builder.creditsAvailable] with a well-typed [String] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun estimatedResults(estimatedResults: JsonField) = apply { - this.estimatedResults = estimatedResults + fun creditsAvailable(creditsAvailable: JsonField) = apply { + this.creditsAvailable = creditsAvailable + } + + fun creditsRequired(creditsRequired: String) = + creditsRequired(JsonField.of(creditsRequired)) + + /** + * Sets [Builder.creditsRequired] to an arbitrary JSON value. + * + * You should usually call [Builder.creditsRequired] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun creditsRequired(creditsRequired: JsonField) = apply { + this.creditsRequired = creditsRequired } - fun projectedPercent(projectedPercent: Double) = - projectedPercent(JsonField.of(projectedPercent)) + fun estimatedResults(estimatedResults: Long) = + estimatedResults(JsonField.of(estimatedResults)) /** - * Sets [Builder.projectedPercent] to an arbitrary JSON value. + * Sets [Builder.estimatedResults] to an arbitrary JSON value. * - * You should usually call [Builder.projectedPercent] with a well-typed [Double] value + * You should usually call [Builder.estimatedResults] with a well-typed [Long] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun projectedPercent(projectedPercent: JsonField) = apply { - this.projectedPercent = projectedPercent + fun estimatedResults(estimatedResults: JsonField) = apply { + this.estimatedResults = estimatedResults } fun source(source: String) = source(JsonField.of(source)) @@ -213,17 +257,18 @@ private constructor( */ fun source(source: JsonField) = apply { this.source = source } - fun usagePercent(usagePercent: Double) = usagePercent(JsonField.of(usagePercent)) + fun resolvedXUserId(resolvedXUserId: String) = + resolvedXUserId(JsonField.of(resolvedXUserId)) /** - * Sets [Builder.usagePercent] to an arbitrary JSON value. + * Sets [Builder.resolvedXUserId] to an arbitrary JSON value. * - * You should usually call [Builder.usagePercent] with a well-typed [Double] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * You should usually call [Builder.resolvedXUserId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun usagePercent(usagePercent: JsonField) = apply { - this.usagePercent = usagePercent + fun resolvedXUserId(resolvedXUserId: JsonField) = apply { + this.resolvedXUserId = resolvedXUserId } fun additionalProperties(additionalProperties: Map) = apply { @@ -253,10 +298,10 @@ private constructor( * The following fields are required: * ```java * .allowed() + * .creditsAvailable() + * .creditsRequired() * .estimatedResults() - * .projectedPercent() * .source() - * .usagePercent() * ``` * * @throws IllegalStateException if any required field is unset. @@ -264,10 +309,11 @@ private constructor( fun build(): ExtractionEstimateCostResponse = ExtractionEstimateCostResponse( checkRequired("allowed", allowed), + checkRequired("creditsAvailable", creditsAvailable), + checkRequired("creditsRequired", creditsRequired), checkRequired("estimatedResults", estimatedResults), - checkRequired("projectedPercent", projectedPercent), checkRequired("source", source), - checkRequired("usagePercent", usagePercent), + resolvedXUserId, additionalProperties.toMutableMap(), ) } @@ -280,10 +326,11 @@ private constructor( } allowed() + creditsAvailable() + creditsRequired() estimatedResults() - projectedPercent() source() - usagePercent() + resolvedXUserId() validated = true } @@ -303,10 +350,11 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (allowed.asKnown().isPresent) 1 else 0) + + (if (creditsAvailable.asKnown().isPresent) 1 else 0) + + (if (creditsRequired.asKnown().isPresent) 1 else 0) + (if (estimatedResults.asKnown().isPresent) 1 else 0) + - (if (projectedPercent.asKnown().isPresent) 1 else 0) + (if (source.asKnown().isPresent) 1 else 0) + - (if (usagePercent.asKnown().isPresent) 1 else 0) + (if (resolvedXUserId.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -315,20 +363,22 @@ private constructor( return other is ExtractionEstimateCostResponse && allowed == other.allowed && + creditsAvailable == other.creditsAvailable && + creditsRequired == other.creditsRequired && estimatedResults == other.estimatedResults && - projectedPercent == other.projectedPercent && source == other.source && - usagePercent == other.usagePercent && + resolvedXUserId == other.resolvedXUserId && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( allowed, + creditsAvailable, + creditsRequired, estimatedResults, - projectedPercent, source, - usagePercent, + resolvedXUserId, additionalProperties, ) } @@ -336,5 +386,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ExtractionEstimateCostResponse{allowed=$allowed, estimatedResults=$estimatedResults, projectedPercent=$projectedPercent, source=$source, usagePercent=$usagePercent, additionalProperties=$additionalProperties}" + "ExtractionEstimateCostResponse{allowed=$allowed, creditsAvailable=$creditsAvailable, creditsRequired=$creditsRequired, estimatedResults=$estimatedResults, source=$source, resolvedXUserId=$resolvedXUserId, additionalProperties=$additionalProperties}" } diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/Integration.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/Integration.kt deleted file mode 100644 index 2e88a37..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/Integration.kt +++ /dev/null @@ -1,787 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import com.x_twitter_scraper.api.core.ExcludeMissing -import com.x_twitter_scraper.api.core.JsonField -import com.x_twitter_scraper.api.core.JsonMissing -import com.x_twitter_scraper.api.core.JsonValue -import com.x_twitter_scraper.api.core.checkKnown -import com.x_twitter_scraper.api.core.checkRequired -import com.x_twitter_scraper.api.core.toImmutable -import com.x_twitter_scraper.api.errors.XTwitterScraperInvalidDataException -import com.x_twitter_scraper.api.models.EventType -import java.time.OffsetDateTime -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Third-party integration (e.g. Telegram) subscribed to monitor events. */ -class Integration -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val id: JsonField, - private val config: JsonField, - private val createdAt: JsonField, - private val eventTypes: JsonField>, - private val isActive: JsonField, - private val name: JsonField, - private val type: JsonValue, - private val filters: JsonField, - private val messageTemplate: JsonField, - private val scopeAllMonitors: JsonField, - private val silentPush: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("config") @ExcludeMissing config: JsonField = JsonMissing.of(), - @JsonProperty("createdAt") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("eventTypes") - @ExcludeMissing - eventTypes: JsonField> = JsonMissing.of(), - @JsonProperty("isActive") @ExcludeMissing isActive: JsonField = JsonMissing.of(), - @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), - @JsonProperty("filters") @ExcludeMissing filters: JsonField = JsonMissing.of(), - @JsonProperty("messageTemplate") - @ExcludeMissing - messageTemplate: JsonField = JsonMissing.of(), - @JsonProperty("scopeAllMonitors") - @ExcludeMissing - scopeAllMonitors: JsonField = JsonMissing.of(), - @JsonProperty("silentPush") - @ExcludeMissing - silentPush: JsonField = JsonMissing.of(), - ) : this( - id, - config, - createdAt, - eventTypes, - isActive, - name, - type, - filters, - messageTemplate, - scopeAllMonitors, - silentPush, - mutableMapOf(), - ) - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun id(): String = id.getRequired("id") - - /** - * Integration config — shape varies by type (JSON) - * - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun config(): Config = config.getRequired("config") - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("createdAt") - - /** - * Array of event types to subscribe to. - * - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun eventTypes(): List = eventTypes.getRequired("eventTypes") - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun isActive(): Boolean = isActive.getRequired("isActive") - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun name(): String = name.getRequired("name") - - /** - * Expected to always return the following: - * ```java - * JsonValue.from("telegram") - * ``` - * - * However, this method can be useful for debugging and logging (e.g. if the server responded - * with an unexpected value). - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type - - /** - * Event filter rules (JSON) - * - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun filters(): Optional = filters.getOptional("filters") - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun messageTemplate(): Optional = messageTemplate.getOptional("messageTemplate") - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun scopeAllMonitors(): Optional = scopeAllMonitors.getOptional("scopeAllMonitors") - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun silentPush(): Optional = silentPush.getOptional("silentPush") - - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - - /** - * Returns the raw JSON value of [config]. - * - * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("config") @ExcludeMissing fun _config(): JsonField = config - - /** - * Returns the raw JSON value of [createdAt]. - * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("createdAt") - @ExcludeMissing - fun _createdAt(): JsonField = createdAt - - /** - * Returns the raw JSON value of [eventTypes]. - * - * Unlike [eventTypes], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("eventTypes") - @ExcludeMissing - fun _eventTypes(): JsonField> = eventTypes - - /** - * Returns the raw JSON value of [isActive]. - * - * Unlike [isActive], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("isActive") @ExcludeMissing fun _isActive(): JsonField = isActive - - /** - * Returns the raw JSON value of [name]. - * - * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** - * Returns the raw JSON value of [filters]. - * - * Unlike [filters], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("filters") @ExcludeMissing fun _filters(): JsonField = filters - - /** - * Returns the raw JSON value of [messageTemplate]. - * - * Unlike [messageTemplate], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("messageTemplate") - @ExcludeMissing - fun _messageTemplate(): JsonField = messageTemplate - - /** - * Returns the raw JSON value of [scopeAllMonitors]. - * - * Unlike [scopeAllMonitors], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("scopeAllMonitors") - @ExcludeMissing - fun _scopeAllMonitors(): JsonField = scopeAllMonitors - - /** - * Returns the raw JSON value of [silentPush]. - * - * Unlike [silentPush], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("silentPush") @ExcludeMissing fun _silentPush(): JsonField = silentPush - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Integration]. - * - * The following fields are required: - * ```java - * .id() - * .config() - * .createdAt() - * .eventTypes() - * .isActive() - * .name() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Integration]. */ - class Builder internal constructor() { - - private var id: JsonField? = null - private var config: JsonField? = null - private var createdAt: JsonField? = null - private var eventTypes: JsonField>? = null - private var isActive: JsonField? = null - private var name: JsonField? = null - private var type: JsonValue = JsonValue.from("telegram") - private var filters: JsonField = JsonMissing.of() - private var messageTemplate: JsonField = JsonMissing.of() - private var scopeAllMonitors: JsonField = JsonMissing.of() - private var silentPush: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(integration: Integration) = apply { - id = integration.id - config = integration.config - createdAt = integration.createdAt - eventTypes = integration.eventTypes.map { it.toMutableList() } - isActive = integration.isActive - name = integration.name - type = integration.type - filters = integration.filters - messageTemplate = integration.messageTemplate - scopeAllMonitors = integration.scopeAllMonitors - silentPush = integration.silentPush - additionalProperties = integration.additionalProperties.toMutableMap() - } - - fun id(id: String) = id(JsonField.of(id)) - - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun id(id: JsonField) = apply { this.id = id } - - /** Integration config — shape varies by type (JSON) */ - fun config(config: Config) = config(JsonField.of(config)) - - /** - * Sets [Builder.config] to an arbitrary JSON value. - * - * You should usually call [Builder.config] with a well-typed [Config] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun config(config: JsonField) = apply { this.config = config } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - /** - * Sets [Builder.createdAt] to an arbitrary JSON value. - * - * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - /** Array of event types to subscribe to. */ - fun eventTypes(eventTypes: List) = eventTypes(JsonField.of(eventTypes)) - - /** - * Sets [Builder.eventTypes] to an arbitrary JSON value. - * - * You should usually call [Builder.eventTypes] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun eventTypes(eventTypes: JsonField>) = apply { - this.eventTypes = eventTypes.map { it.toMutableList() } - } - - /** - * Adds a single [EventType] to [eventTypes]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addEventType(eventType: EventType) = apply { - eventTypes = - (eventTypes ?: JsonField.of(mutableListOf())).also { - checkKnown("eventTypes", it).add(eventType) - } - } - - fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) - - /** - * Sets [Builder.isActive] to an arbitrary JSON value. - * - * You should usually call [Builder.isActive] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun isActive(isActive: JsonField) = apply { this.isActive = isActive } - - fun name(name: String) = name(JsonField.of(name)) - - /** - * Sets [Builder.name] to an arbitrary JSON value. - * - * You should usually call [Builder.name] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun name(name: JsonField) = apply { this.name = name } - - /** - * Sets the field to an arbitrary JSON value. - * - * It is usually unnecessary to call this method because the field defaults to the - * following: - * ```java - * JsonValue.from("telegram") - * ``` - * - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun type(type: JsonValue) = apply { this.type = type } - - /** Event filter rules (JSON) */ - fun filters(filters: Filters) = filters(JsonField.of(filters)) - - /** - * Sets [Builder.filters] to an arbitrary JSON value. - * - * You should usually call [Builder.filters] with a well-typed [Filters] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun filters(filters: JsonField) = apply { this.filters = filters } - - fun messageTemplate(messageTemplate: String) = - messageTemplate(JsonField.of(messageTemplate)) - - /** - * Sets [Builder.messageTemplate] to an arbitrary JSON value. - * - * You should usually call [Builder.messageTemplate] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun messageTemplate(messageTemplate: JsonField) = apply { - this.messageTemplate = messageTemplate - } - - fun scopeAllMonitors(scopeAllMonitors: Boolean) = - scopeAllMonitors(JsonField.of(scopeAllMonitors)) - - /** - * Sets [Builder.scopeAllMonitors] to an arbitrary JSON value. - * - * You should usually call [Builder.scopeAllMonitors] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun scopeAllMonitors(scopeAllMonitors: JsonField) = apply { - this.scopeAllMonitors = scopeAllMonitors - } - - fun silentPush(silentPush: Boolean) = silentPush(JsonField.of(silentPush)) - - /** - * Sets [Builder.silentPush] to an arbitrary JSON value. - * - * You should usually call [Builder.silentPush] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun silentPush(silentPush: JsonField) = apply { this.silentPush = silentPush } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Integration]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .config() - * .createdAt() - * .eventTypes() - * .isActive() - * .name() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Integration = - Integration( - checkRequired("id", id), - checkRequired("config", config), - checkRequired("createdAt", createdAt), - checkRequired("eventTypes", eventTypes).map { it.toImmutable() }, - checkRequired("isActive", isActive), - checkRequired("name", name), - type, - filters, - messageTemplate, - scopeAllMonitors, - silentPush, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Integration = apply { - if (validated) { - return@apply - } - - id() - config().validate() - createdAt() - eventTypes().forEach { it.validate() } - isActive() - name() - _type().let { - if (it != JsonValue.from("telegram")) { - throw XTwitterScraperInvalidDataException("'type' is invalid, received $it") - } - } - filters().ifPresent { it.validate() } - messageTemplate() - scopeAllMonitors() - silentPush() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: XTwitterScraperInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (config.asKnown().getOrNull()?.validity() ?: 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (eventTypes.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (isActive.asKnown().isPresent) 1 else 0) + - (if (name.asKnown().isPresent) 1 else 0) + - type.let { if (it == JsonValue.from("telegram")) 1 else 0 } + - (filters.asKnown().getOrNull()?.validity() ?: 0) + - (if (messageTemplate.asKnown().isPresent) 1 else 0) + - (if (scopeAllMonitors.asKnown().isPresent) 1 else 0) + - (if (silentPush.asKnown().isPresent) 1 else 0) - - /** Integration config — shape varies by type (JSON) */ - class Config - @JsonCreator - private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map - ) { - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Config]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Config]. */ - class Builder internal constructor() { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(config: Config) = apply { - additionalProperties = config.additionalProperties.toMutableMap() - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Config]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Config = Config(additionalProperties.toImmutable()) - } - - private var validated: Boolean = false - - fun validate(): Config = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: XTwitterScraperInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Config && additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = "Config{additionalProperties=$additionalProperties}" - } - - /** Event filter rules (JSON) */ - class Filters - @JsonCreator - private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map - ) { - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Filters]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Filters]. */ - class Builder internal constructor() { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(filters: Filters) = apply { - additionalProperties = filters.additionalProperties.toMutableMap() - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Filters]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Filters = Filters(additionalProperties.toImmutable()) - } - - private var validated: Boolean = false - - fun validate(): Filters = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: XTwitterScraperInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Filters && additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = "Filters{additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Integration && - id == other.id && - config == other.config && - createdAt == other.createdAt && - eventTypes == other.eventTypes && - isActive == other.isActive && - name == other.name && - type == other.type && - filters == other.filters && - messageTemplate == other.messageTemplate && - scopeAllMonitors == other.scopeAllMonitors && - silentPush == other.silentPush && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - id, - config, - createdAt, - eventTypes, - isActive, - name, - type, - filters, - messageTemplate, - scopeAllMonitors, - silentPush, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Integration{id=$id, config=$config, createdAt=$createdAt, eventTypes=$eventTypes, isActive=$isActive, name=$name, type=$type, filters=$filters, messageTemplate=$messageTemplate, scopeAllMonitors=$scopeAllMonitors, silentPush=$silentPush, additionalProperties=$additionalProperties}" -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationCreateParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationCreateParams.kt deleted file mode 100644 index e1b81b6..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationCreateParams.kt +++ /dev/null @@ -1,801 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import com.x_twitter_scraper.api.core.ExcludeMissing -import com.x_twitter_scraper.api.core.JsonField -import com.x_twitter_scraper.api.core.JsonMissing -import com.x_twitter_scraper.api.core.JsonValue -import com.x_twitter_scraper.api.core.Params -import com.x_twitter_scraper.api.core.checkKnown -import com.x_twitter_scraper.api.core.checkRequired -import com.x_twitter_scraper.api.core.http.Headers -import com.x_twitter_scraper.api.core.http.QueryParams -import com.x_twitter_scraper.api.core.toImmutable -import com.x_twitter_scraper.api.errors.XTwitterScraperInvalidDataException -import com.x_twitter_scraper.api.models.EventType -import java.util.Collections -import java.util.Objects -import kotlin.jvm.optionals.getOrNull - -/** Create integration */ -class IntegrationCreateParams -private constructor( - private val body: Body, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** - * Integration config (e.g. Telegram chatId) - * - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun config(): Config = body.config() - - /** - * Array of event types to subscribe to. - * - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun eventTypes(): List = body.eventTypes() - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun name(): String = body.name() - - /** - * Expected to always return the following: - * ```java - * JsonValue.from("telegram") - * ``` - * - * However, this method can be useful for debugging and logging (e.g. if the server responded - * with an unexpected value). - */ - fun _type(): JsonValue = body._type() - - /** - * Returns the raw JSON value of [config]. - * - * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _config(): JsonField = body._config() - - /** - * Returns the raw JSON value of [eventTypes]. - * - * Unlike [eventTypes], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _eventTypes(): JsonField> = body._eventTypes() - - /** - * Returns the raw JSON value of [name]. - * - * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _name(): JsonField = body._name() - - fun _additionalBodyProperties(): Map = body._additionalProperties() - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [IntegrationCreateParams]. - * - * The following fields are required: - * ```java - * .config() - * .eventTypes() - * .name() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [IntegrationCreateParams]. */ - class Builder internal constructor() { - - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(integrationCreateParams: IntegrationCreateParams) = apply { - body = integrationCreateParams.body.toBuilder() - additionalHeaders = integrationCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = integrationCreateParams.additionalQueryParams.toBuilder() - } - - /** - * Sets the entire request body. - * - * This is generally only useful if you are already constructing the body separately. - * Otherwise, it's more convenient to use the top-level setters instead: - * - [config] - * - [eventTypes] - * - [name] - * - [type] - */ - fun body(body: Body) = apply { this.body = body.toBuilder() } - - /** Integration config (e.g. Telegram chatId) */ - fun config(config: Config) = apply { body.config(config) } - - /** - * Sets [Builder.config] to an arbitrary JSON value. - * - * You should usually call [Builder.config] with a well-typed [Config] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun config(config: JsonField) = apply { body.config(config) } - - /** Array of event types to subscribe to. */ - fun eventTypes(eventTypes: List) = apply { body.eventTypes(eventTypes) } - - /** - * Sets [Builder.eventTypes] to an arbitrary JSON value. - * - * You should usually call [Builder.eventTypes] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun eventTypes(eventTypes: JsonField>) = apply { - body.eventTypes(eventTypes) - } - - /** - * Adds a single [EventType] to [eventTypes]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addEventType(eventType: EventType) = apply { body.addEventType(eventType) } - - fun name(name: String) = apply { body.name(name) } - - /** - * Sets [Builder.name] to an arbitrary JSON value. - * - * You should usually call [Builder.name] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun name(name: JsonField) = apply { body.name(name) } - - /** - * Sets the field to an arbitrary JSON value. - * - * It is usually unnecessary to call this method because the field defaults to the - * following: - * ```java - * JsonValue.from("telegram") - * ``` - * - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun type(type: JsonValue) = apply { body.type(type) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [IntegrationCreateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .config() - * .eventTypes() - * .name() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): IntegrationCreateParams = - IntegrationCreateParams( - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - class Body - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val config: JsonField, - private val eventTypes: JsonField>, - private val name: JsonField, - private val type: JsonValue, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("config") @ExcludeMissing config: JsonField = JsonMissing.of(), - @JsonProperty("eventTypes") - @ExcludeMissing - eventTypes: JsonField> = JsonMissing.of(), - @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), - ) : this(config, eventTypes, name, type, mutableMapOf()) - - /** - * Integration config (e.g. Telegram chatId) - * - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun config(): Config = config.getRequired("config") - - /** - * Array of event types to subscribe to. - * - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun eventTypes(): List = eventTypes.getRequired("eventTypes") - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun name(): String = name.getRequired("name") - - /** - * Expected to always return the following: - * ```java - * JsonValue.from("telegram") - * ``` - * - * However, this method can be useful for debugging and logging (e.g. if the server - * responded with an unexpected value). - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type - - /** - * Returns the raw JSON value of [config]. - * - * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("config") @ExcludeMissing fun _config(): JsonField = config - - /** - * Returns the raw JSON value of [eventTypes]. - * - * Unlike [eventTypes], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("eventTypes") - @ExcludeMissing - fun _eventTypes(): JsonField> = eventTypes - - /** - * Returns the raw JSON value of [name]. - * - * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Body]. - * - * The following fields are required: - * ```java - * .config() - * .eventTypes() - * .name() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var config: JsonField? = null - private var eventTypes: JsonField>? = null - private var name: JsonField? = null - private var type: JsonValue = JsonValue.from("telegram") - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - config = body.config - eventTypes = body.eventTypes.map { it.toMutableList() } - name = body.name - type = body.type - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** Integration config (e.g. Telegram chatId) */ - fun config(config: Config) = config(JsonField.of(config)) - - /** - * Sets [Builder.config] to an arbitrary JSON value. - * - * You should usually call [Builder.config] with a well-typed [Config] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun config(config: JsonField) = apply { this.config = config } - - /** Array of event types to subscribe to. */ - fun eventTypes(eventTypes: List) = eventTypes(JsonField.of(eventTypes)) - - /** - * Sets [Builder.eventTypes] to an arbitrary JSON value. - * - * You should usually call [Builder.eventTypes] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun eventTypes(eventTypes: JsonField>) = apply { - this.eventTypes = eventTypes.map { it.toMutableList() } - } - - /** - * Adds a single [EventType] to [eventTypes]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addEventType(eventType: EventType) = apply { - eventTypes = - (eventTypes ?: JsonField.of(mutableListOf())).also { - checkKnown("eventTypes", it).add(eventType) - } - } - - fun name(name: String) = name(JsonField.of(name)) - - /** - * Sets [Builder.name] to an arbitrary JSON value. - * - * You should usually call [Builder.name] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun name(name: JsonField) = apply { this.name = name } - - /** - * Sets the field to an arbitrary JSON value. - * - * It is usually unnecessary to call this method because the field defaults to the - * following: - * ```java - * JsonValue.from("telegram") - * ``` - * - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun type(type: JsonValue) = apply { this.type = type } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .config() - * .eventTypes() - * .name() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body( - checkRequired("config", config), - checkRequired("eventTypes", eventTypes).map { it.toImmutable() }, - checkRequired("name", name), - type, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - config().validate() - eventTypes().forEach { it.validate() } - name() - _type().let { - if (it != JsonValue.from("telegram")) { - throw XTwitterScraperInvalidDataException("'type' is invalid, received $it") - } - } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: XTwitterScraperInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (config.asKnown().getOrNull()?.validity() ?: 0) + - (eventTypes.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (name.asKnown().isPresent) 1 else 0) + - type.let { if (it == JsonValue.from("telegram")) 1 else 0 } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Body && - config == other.config && - eventTypes == other.eventTypes && - name == other.name && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(config, eventTypes, name, type, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{config=$config, eventTypes=$eventTypes, name=$name, type=$type, additionalProperties=$additionalProperties}" - } - - /** Integration config (e.g. Telegram chatId) */ - class Config - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val chatId: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("chatId") @ExcludeMissing chatId: JsonField = JsonMissing.of() - ) : this(chatId, mutableMapOf()) - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun chatId(): String = chatId.getRequired("chatId") - - /** - * Returns the raw JSON value of [chatId]. - * - * Unlike [chatId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("chatId") @ExcludeMissing fun _chatId(): JsonField = chatId - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Config]. - * - * The following fields are required: - * ```java - * .chatId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Config]. */ - class Builder internal constructor() { - - private var chatId: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(config: Config) = apply { - chatId = config.chatId - additionalProperties = config.additionalProperties.toMutableMap() - } - - fun chatId(chatId: String) = chatId(JsonField.of(chatId)) - - /** - * Sets [Builder.chatId] to an arbitrary JSON value. - * - * You should usually call [Builder.chatId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun chatId(chatId: JsonField) = apply { this.chatId = chatId } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Config]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .chatId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Config = - Config(checkRequired("chatId", chatId), additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - fun validate(): Config = apply { - if (validated) { - return@apply - } - - chatId() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: XTwitterScraperInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = (if (chatId.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Config && - chatId == other.chatId && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(chatId, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Config{chatId=$chatId, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is IntegrationCreateParams && - body == other.body && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) - - override fun toString() = - "IntegrationCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationDeleteParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationDeleteParams.kt deleted file mode 100644 index 93f939c..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationDeleteParams.kt +++ /dev/null @@ -1,230 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.x_twitter_scraper.api.core.JsonValue -import com.x_twitter_scraper.api.core.Params -import com.x_twitter_scraper.api.core.http.Headers -import com.x_twitter_scraper.api.core.http.QueryParams -import com.x_twitter_scraper.api.core.toImmutable -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Delete integration */ -class IntegrationDeleteParams -private constructor( - private val id: String?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, -) : Params { - - fun id(): Optional = Optional.ofNullable(id) - - /** Additional body properties to send with the request. */ - fun _additionalBodyProperties(): Map = additionalBodyProperties - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): IntegrationDeleteParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [IntegrationDeleteParams]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [IntegrationDeleteParams]. */ - class Builder internal constructor() { - - private var id: String? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(integrationDeleteParams: IntegrationDeleteParams) = apply { - id = integrationDeleteParams.id - additionalHeaders = integrationDeleteParams.additionalHeaders.toBuilder() - additionalQueryParams = integrationDeleteParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - integrationDeleteParams.additionalBodyProperties.toMutableMap() - } - - fun id(id: String?) = apply { this.id = id } - - /** Alias for calling [Builder.id] with `id.orElse(null)`. */ - fun id(id: Optional) = id(id.getOrNull()) - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) - } - - /** - * Returns an immutable instance of [IntegrationDeleteParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): IntegrationDeleteParams = - IntegrationDeleteParams( - id, - additionalHeaders.build(), - additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), - ) - } - - fun _body(): Optional> = - Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - - fun _pathParam(index: Int): String = - when (index) { - 0 -> id ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is IntegrationDeleteParams && - id == other.id && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams && - additionalBodyProperties == other.additionalBodyProperties - } - - override fun hashCode(): Int = - Objects.hash(id, additionalHeaders, additionalQueryParams, additionalBodyProperties) - - override fun toString() = - "IntegrationDeleteParams{id=$id, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationDeleteResponse.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationDeleteResponse.kt deleted file mode 100644 index e333cfd..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationDeleteResponse.kt +++ /dev/null @@ -1,160 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import com.x_twitter_scraper.api.core.ExcludeMissing -import com.x_twitter_scraper.api.core.JsonMissing -import com.x_twitter_scraper.api.core.JsonValue -import com.x_twitter_scraper.api.errors.XTwitterScraperInvalidDataException -import java.util.Collections -import java.util.Objects - -class IntegrationDeleteResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val success: JsonValue, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("success") @ExcludeMissing success: JsonValue = JsonMissing.of() - ) : this(success, mutableMapOf()) - - /** - * Expected to always return the following: - * ```java - * JsonValue.from(true) - * ``` - * - * However, this method can be useful for debugging and logging (e.g. if the server responded - * with an unexpected value). - */ - @JsonProperty("success") @ExcludeMissing fun _success(): JsonValue = success - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [IntegrationDeleteResponse]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [IntegrationDeleteResponse]. */ - class Builder internal constructor() { - - private var success: JsonValue = JsonValue.from(true) - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(integrationDeleteResponse: IntegrationDeleteResponse) = apply { - success = integrationDeleteResponse.success - additionalProperties = integrationDeleteResponse.additionalProperties.toMutableMap() - } - - /** - * Sets the field to an arbitrary JSON value. - * - * It is usually unnecessary to call this method because the field defaults to the - * following: - * ```java - * JsonValue.from(true) - * ``` - * - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun success(success: JsonValue) = apply { this.success = success } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [IntegrationDeleteResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): IntegrationDeleteResponse = - IntegrationDeleteResponse(success, additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - fun validate(): IntegrationDeleteResponse = apply { - if (validated) { - return@apply - } - - _success().let { - if (it != JsonValue.from(true)) { - throw XTwitterScraperInvalidDataException("'success' is invalid, received $it") - } - } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: XTwitterScraperInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = success.let { if (it == JsonValue.from(true)) 1 else 0 } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is IntegrationDeleteResponse && - success == other.success && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(success, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "IntegrationDeleteResponse{success=$success, additionalProperties=$additionalProperties}" -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationDelivery.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationDelivery.kt deleted file mode 100644 index 9fc6c54..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationDelivery.kt +++ /dev/null @@ -1,510 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import com.x_twitter_scraper.api.core.ExcludeMissing -import com.x_twitter_scraper.api.core.JsonField -import com.x_twitter_scraper.api.core.JsonMissing -import com.x_twitter_scraper.api.core.JsonValue -import com.x_twitter_scraper.api.core.checkRequired -import com.x_twitter_scraper.api.errors.XTwitterScraperInvalidDataException -import java.time.OffsetDateTime -import java.util.Collections -import java.util.Objects -import java.util.Optional - -/** Integration delivery attempt record with status and retry count. */ -class IntegrationDelivery -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val id: JsonField, - private val attempts: JsonField, - private val createdAt: JsonField, - private val eventType: JsonField, - private val status: JsonField, - private val deliveredAt: JsonField, - private val lastError: JsonField, - private val lastStatusCode: JsonField, - private val sourceId: JsonField, - private val sourceType: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("attempts") @ExcludeMissing attempts: JsonField = JsonMissing.of(), - @JsonProperty("createdAt") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("eventType") @ExcludeMissing eventType: JsonField = JsonMissing.of(), - @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), - @JsonProperty("deliveredAt") - @ExcludeMissing - deliveredAt: JsonField = JsonMissing.of(), - @JsonProperty("lastError") @ExcludeMissing lastError: JsonField = JsonMissing.of(), - @JsonProperty("lastStatusCode") - @ExcludeMissing - lastStatusCode: JsonField = JsonMissing.of(), - @JsonProperty("sourceId") @ExcludeMissing sourceId: JsonField = JsonMissing.of(), - @JsonProperty("sourceType") @ExcludeMissing sourceType: JsonField = JsonMissing.of(), - ) : this( - id, - attempts, - createdAt, - eventType, - status, - deliveredAt, - lastError, - lastStatusCode, - sourceId, - sourceType, - mutableMapOf(), - ) - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun id(): String = id.getRequired("id") - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun attempts(): Long = attempts.getRequired("attempts") - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("createdAt") - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun eventType(): String = eventType.getRequired("eventType") - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun status(): String = status.getRequired("status") - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun deliveredAt(): Optional = deliveredAt.getOptional("deliveredAt") - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun lastError(): Optional = lastError.getOptional("lastError") - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun lastStatusCode(): Optional = lastStatusCode.getOptional("lastStatusCode") - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun sourceId(): Optional = sourceId.getOptional("sourceId") - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun sourceType(): Optional = sourceType.getOptional("sourceType") - - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - - /** - * Returns the raw JSON value of [attempts]. - * - * Unlike [attempts], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("attempts") @ExcludeMissing fun _attempts(): JsonField = attempts - - /** - * Returns the raw JSON value of [createdAt]. - * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("createdAt") - @ExcludeMissing - fun _createdAt(): JsonField = createdAt - - /** - * Returns the raw JSON value of [eventType]. - * - * Unlike [eventType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("eventType") @ExcludeMissing fun _eventType(): JsonField = eventType - - /** - * Returns the raw JSON value of [status]. - * - * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - - /** - * Returns the raw JSON value of [deliveredAt]. - * - * Unlike [deliveredAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("deliveredAt") - @ExcludeMissing - fun _deliveredAt(): JsonField = deliveredAt - - /** - * Returns the raw JSON value of [lastError]. - * - * Unlike [lastError], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("lastError") @ExcludeMissing fun _lastError(): JsonField = lastError - - /** - * Returns the raw JSON value of [lastStatusCode]. - * - * Unlike [lastStatusCode], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("lastStatusCode") - @ExcludeMissing - fun _lastStatusCode(): JsonField = lastStatusCode - - /** - * Returns the raw JSON value of [sourceId]. - * - * Unlike [sourceId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("sourceId") @ExcludeMissing fun _sourceId(): JsonField = sourceId - - /** - * Returns the raw JSON value of [sourceType]. - * - * Unlike [sourceType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("sourceType") @ExcludeMissing fun _sourceType(): JsonField = sourceType - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [IntegrationDelivery]. - * - * The following fields are required: - * ```java - * .id() - * .attempts() - * .createdAt() - * .eventType() - * .status() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [IntegrationDelivery]. */ - class Builder internal constructor() { - - private var id: JsonField? = null - private var attempts: JsonField? = null - private var createdAt: JsonField? = null - private var eventType: JsonField? = null - private var status: JsonField? = null - private var deliveredAt: JsonField = JsonMissing.of() - private var lastError: JsonField = JsonMissing.of() - private var lastStatusCode: JsonField = JsonMissing.of() - private var sourceId: JsonField = JsonMissing.of() - private var sourceType: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(integrationDelivery: IntegrationDelivery) = apply { - id = integrationDelivery.id - attempts = integrationDelivery.attempts - createdAt = integrationDelivery.createdAt - eventType = integrationDelivery.eventType - status = integrationDelivery.status - deliveredAt = integrationDelivery.deliveredAt - lastError = integrationDelivery.lastError - lastStatusCode = integrationDelivery.lastStatusCode - sourceId = integrationDelivery.sourceId - sourceType = integrationDelivery.sourceType - additionalProperties = integrationDelivery.additionalProperties.toMutableMap() - } - - fun id(id: String) = id(JsonField.of(id)) - - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun id(id: JsonField) = apply { this.id = id } - - fun attempts(attempts: Long) = attempts(JsonField.of(attempts)) - - /** - * Sets [Builder.attempts] to an arbitrary JSON value. - * - * You should usually call [Builder.attempts] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun attempts(attempts: JsonField) = apply { this.attempts = attempts } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - /** - * Sets [Builder.createdAt] to an arbitrary JSON value. - * - * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - fun eventType(eventType: String) = eventType(JsonField.of(eventType)) - - /** - * Sets [Builder.eventType] to an arbitrary JSON value. - * - * You should usually call [Builder.eventType] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun eventType(eventType: JsonField) = apply { this.eventType = eventType } - - fun status(status: String) = status(JsonField.of(status)) - - /** - * Sets [Builder.status] to an arbitrary JSON value. - * - * You should usually call [Builder.status] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun status(status: JsonField) = apply { this.status = status } - - fun deliveredAt(deliveredAt: OffsetDateTime) = deliveredAt(JsonField.of(deliveredAt)) - - /** - * Sets [Builder.deliveredAt] to an arbitrary JSON value. - * - * You should usually call [Builder.deliveredAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun deliveredAt(deliveredAt: JsonField) = apply { - this.deliveredAt = deliveredAt - } - - fun lastError(lastError: String) = lastError(JsonField.of(lastError)) - - /** - * Sets [Builder.lastError] to an arbitrary JSON value. - * - * You should usually call [Builder.lastError] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun lastError(lastError: JsonField) = apply { this.lastError = lastError } - - fun lastStatusCode(lastStatusCode: Long) = lastStatusCode(JsonField.of(lastStatusCode)) - - /** - * Sets [Builder.lastStatusCode] to an arbitrary JSON value. - * - * You should usually call [Builder.lastStatusCode] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun lastStatusCode(lastStatusCode: JsonField) = apply { - this.lastStatusCode = lastStatusCode - } - - fun sourceId(sourceId: String) = sourceId(JsonField.of(sourceId)) - - /** - * Sets [Builder.sourceId] to an arbitrary JSON value. - * - * You should usually call [Builder.sourceId] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun sourceId(sourceId: JsonField) = apply { this.sourceId = sourceId } - - fun sourceType(sourceType: String) = sourceType(JsonField.of(sourceType)) - - /** - * Sets [Builder.sourceType] to an arbitrary JSON value. - * - * You should usually call [Builder.sourceType] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun sourceType(sourceType: JsonField) = apply { this.sourceType = sourceType } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [IntegrationDelivery]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .attempts() - * .createdAt() - * .eventType() - * .status() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): IntegrationDelivery = - IntegrationDelivery( - checkRequired("id", id), - checkRequired("attempts", attempts), - checkRequired("createdAt", createdAt), - checkRequired("eventType", eventType), - checkRequired("status", status), - deliveredAt, - lastError, - lastStatusCode, - sourceId, - sourceType, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): IntegrationDelivery = apply { - if (validated) { - return@apply - } - - id() - attempts() - createdAt() - eventType() - status() - deliveredAt() - lastError() - lastStatusCode() - sourceId() - sourceType() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: XTwitterScraperInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (if (attempts.asKnown().isPresent) 1 else 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (eventType.asKnown().isPresent) 1 else 0) + - (if (status.asKnown().isPresent) 1 else 0) + - (if (deliveredAt.asKnown().isPresent) 1 else 0) + - (if (lastError.asKnown().isPresent) 1 else 0) + - (if (lastStatusCode.asKnown().isPresent) 1 else 0) + - (if (sourceId.asKnown().isPresent) 1 else 0) + - (if (sourceType.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is IntegrationDelivery && - id == other.id && - attempts == other.attempts && - createdAt == other.createdAt && - eventType == other.eventType && - status == other.status && - deliveredAt == other.deliveredAt && - lastError == other.lastError && - lastStatusCode == other.lastStatusCode && - sourceId == other.sourceId && - sourceType == other.sourceType && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - id, - attempts, - createdAt, - eventType, - status, - deliveredAt, - lastError, - lastStatusCode, - sourceId, - sourceType, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "IntegrationDelivery{id=$id, attempts=$attempts, createdAt=$createdAt, eventType=$eventType, status=$status, deliveredAt=$deliveredAt, lastError=$lastError, lastStatusCode=$lastStatusCode, sourceId=$sourceId, sourceType=$sourceType, additionalProperties=$additionalProperties}" -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListDeliveriesParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListDeliveriesParams.kt deleted file mode 100644 index be7b04c..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListDeliveriesParams.kt +++ /dev/null @@ -1,225 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.x_twitter_scraper.api.core.Params -import com.x_twitter_scraper.api.core.http.Headers -import com.x_twitter_scraper.api.core.http.QueryParams -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** List integration delivery history */ -class IntegrationListDeliveriesParams -private constructor( - private val id: String?, - private val limit: Long?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - fun id(): Optional = Optional.ofNullable(id) - - /** Maximum number of items to return (1-100, default 50) */ - fun limit(): Optional = Optional.ofNullable(limit) - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): IntegrationListDeliveriesParams = builder().build() - - /** - * Returns a mutable builder for constructing an instance of - * [IntegrationListDeliveriesParams]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [IntegrationListDeliveriesParams]. */ - class Builder internal constructor() { - - private var id: String? = null - private var limit: Long? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(integrationListDeliveriesParams: IntegrationListDeliveriesParams) = - apply { - id = integrationListDeliveriesParams.id - limit = integrationListDeliveriesParams.limit - additionalHeaders = integrationListDeliveriesParams.additionalHeaders.toBuilder() - additionalQueryParams = - integrationListDeliveriesParams.additionalQueryParams.toBuilder() - } - - fun id(id: String?) = apply { this.id = id } - - /** Alias for calling [Builder.id] with `id.orElse(null)`. */ - fun id(id: Optional) = id(id.getOrNull()) - - /** Maximum number of items to return (1-100, default 50) */ - fun limit(limit: Long?) = apply { this.limit = limit } - - /** - * Alias for [Builder.limit]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun limit(limit: Long) = limit(limit as Long?) - - /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ - fun limit(limit: Optional) = limit(limit.getOrNull()) - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [IntegrationListDeliveriesParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): IntegrationListDeliveriesParams = - IntegrationListDeliveriesParams( - id, - limit, - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _pathParam(index: Int): String = - when (index) { - 0 -> id ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - limit?.let { put("limit", it.toString()) } - putAll(additionalQueryParams) - } - .build() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is IntegrationListDeliveriesParams && - id == other.id && - limit == other.limit && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = Objects.hash(id, limit, additionalHeaders, additionalQueryParams) - - override fun toString() = - "IntegrationListDeliveriesParams{id=$id, limit=$limit, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListDeliveriesResponse.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListDeliveriesResponse.kt deleted file mode 100644 index a56505f..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListDeliveriesResponse.kt +++ /dev/null @@ -1,197 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import com.x_twitter_scraper.api.core.ExcludeMissing -import com.x_twitter_scraper.api.core.JsonField -import com.x_twitter_scraper.api.core.JsonMissing -import com.x_twitter_scraper.api.core.JsonValue -import com.x_twitter_scraper.api.core.checkKnown -import com.x_twitter_scraper.api.core.checkRequired -import com.x_twitter_scraper.api.core.toImmutable -import com.x_twitter_scraper.api.errors.XTwitterScraperInvalidDataException -import java.util.Collections -import java.util.Objects -import kotlin.jvm.optionals.getOrNull - -class IntegrationListDeliveriesResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val deliveries: JsonField>, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("deliveries") - @ExcludeMissing - deliveries: JsonField> = JsonMissing.of() - ) : this(deliveries, mutableMapOf()) - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun deliveries(): List = deliveries.getRequired("deliveries") - - /** - * Returns the raw JSON value of [deliveries]. - * - * Unlike [deliveries], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("deliveries") - @ExcludeMissing - fun _deliveries(): JsonField> = deliveries - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [IntegrationListDeliveriesResponse]. - * - * The following fields are required: - * ```java - * .deliveries() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [IntegrationListDeliveriesResponse]. */ - class Builder internal constructor() { - - private var deliveries: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(integrationListDeliveriesResponse: IntegrationListDeliveriesResponse) = - apply { - deliveries = integrationListDeliveriesResponse.deliveries.map { it.toMutableList() } - additionalProperties = - integrationListDeliveriesResponse.additionalProperties.toMutableMap() - } - - fun deliveries(deliveries: List) = deliveries(JsonField.of(deliveries)) - - /** - * Sets [Builder.deliveries] to an arbitrary JSON value. - * - * You should usually call [Builder.deliveries] with a well-typed - * `List` value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun deliveries(deliveries: JsonField>) = apply { - this.deliveries = deliveries.map { it.toMutableList() } - } - - /** - * Adds a single [IntegrationDelivery] to [deliveries]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addDelivery(delivery: IntegrationDelivery) = apply { - deliveries = - (deliveries ?: JsonField.of(mutableListOf())).also { - checkKnown("deliveries", it).add(delivery) - } - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [IntegrationListDeliveriesResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .deliveries() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): IntegrationListDeliveriesResponse = - IntegrationListDeliveriesResponse( - checkRequired("deliveries", deliveries).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): IntegrationListDeliveriesResponse = apply { - if (validated) { - return@apply - } - - deliveries().forEach { it.validate() } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: XTwitterScraperInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (deliveries.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is IntegrationListDeliveriesResponse && - deliveries == other.deliveries && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(deliveries, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "IntegrationListDeliveriesResponse{deliveries=$deliveries, additionalProperties=$additionalProperties}" -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListParams.kt deleted file mode 100644 index 52df86d..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListParams.kt +++ /dev/null @@ -1,170 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.x_twitter_scraper.api.core.Params -import com.x_twitter_scraper.api.core.http.Headers -import com.x_twitter_scraper.api.core.http.QueryParams -import java.util.Objects - -/** List integrations */ -class IntegrationListParams -private constructor( - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): IntegrationListParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [IntegrationListParams]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [IntegrationListParams]. */ - class Builder internal constructor() { - - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(integrationListParams: IntegrationListParams) = apply { - additionalHeaders = integrationListParams.additionalHeaders.toBuilder() - additionalQueryParams = integrationListParams.additionalQueryParams.toBuilder() - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [IntegrationListParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): IntegrationListParams = - IntegrationListParams(additionalHeaders.build(), additionalQueryParams.build()) - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is IntegrationListParams && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = Objects.hash(additionalHeaders, additionalQueryParams) - - override fun toString() = - "IntegrationListParams{additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListResponse.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListResponse.kt deleted file mode 100644 index 9a9f4a2..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListResponse.kt +++ /dev/null @@ -1,194 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import com.x_twitter_scraper.api.core.ExcludeMissing -import com.x_twitter_scraper.api.core.JsonField -import com.x_twitter_scraper.api.core.JsonMissing -import com.x_twitter_scraper.api.core.JsonValue -import com.x_twitter_scraper.api.core.checkKnown -import com.x_twitter_scraper.api.core.checkRequired -import com.x_twitter_scraper.api.core.toImmutable -import com.x_twitter_scraper.api.errors.XTwitterScraperInvalidDataException -import java.util.Collections -import java.util.Objects -import kotlin.jvm.optionals.getOrNull - -class IntegrationListResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val integrations: JsonField>, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("integrations") - @ExcludeMissing - integrations: JsonField> = JsonMissing.of() - ) : this(integrations, mutableMapOf()) - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun integrations(): List = integrations.getRequired("integrations") - - /** - * Returns the raw JSON value of [integrations]. - * - * Unlike [integrations], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("integrations") - @ExcludeMissing - fun _integrations(): JsonField> = integrations - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [IntegrationListResponse]. - * - * The following fields are required: - * ```java - * .integrations() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [IntegrationListResponse]. */ - class Builder internal constructor() { - - private var integrations: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(integrationListResponse: IntegrationListResponse) = apply { - integrations = integrationListResponse.integrations.map { it.toMutableList() } - additionalProperties = integrationListResponse.additionalProperties.toMutableMap() - } - - fun integrations(integrations: List) = integrations(JsonField.of(integrations)) - - /** - * Sets [Builder.integrations] to an arbitrary JSON value. - * - * You should usually call [Builder.integrations] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun integrations(integrations: JsonField>) = apply { - this.integrations = integrations.map { it.toMutableList() } - } - - /** - * Adds a single [Integration] to [integrations]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addIntegration(integration: Integration) = apply { - integrations = - (integrations ?: JsonField.of(mutableListOf())).also { - checkKnown("integrations", it).add(integration) - } - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [IntegrationListResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .integrations() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): IntegrationListResponse = - IntegrationListResponse( - checkRequired("integrations", integrations).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): IntegrationListResponse = apply { - if (validated) { - return@apply - } - - integrations().forEach { it.validate() } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: XTwitterScraperInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (integrations.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is IntegrationListResponse && - integrations == other.integrations && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(integrations, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "IntegrationListResponse{integrations=$integrations, additionalProperties=$additionalProperties}" -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationRetrieveParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationRetrieveParams.kt deleted file mode 100644 index d82a1ab..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationRetrieveParams.kt +++ /dev/null @@ -1,191 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.x_twitter_scraper.api.core.Params -import com.x_twitter_scraper.api.core.http.Headers -import com.x_twitter_scraper.api.core.http.QueryParams -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Get integration details */ -class IntegrationRetrieveParams -private constructor( - private val id: String?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - fun id(): Optional = Optional.ofNullable(id) - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): IntegrationRetrieveParams = builder().build() - - /** - * Returns a mutable builder for constructing an instance of [IntegrationRetrieveParams]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [IntegrationRetrieveParams]. */ - class Builder internal constructor() { - - private var id: String? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(integrationRetrieveParams: IntegrationRetrieveParams) = apply { - id = integrationRetrieveParams.id - additionalHeaders = integrationRetrieveParams.additionalHeaders.toBuilder() - additionalQueryParams = integrationRetrieveParams.additionalQueryParams.toBuilder() - } - - fun id(id: String?) = apply { this.id = id } - - /** Alias for calling [Builder.id] with `id.orElse(null)`. */ - fun id(id: Optional) = id(id.getOrNull()) - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [IntegrationRetrieveParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): IntegrationRetrieveParams = - IntegrationRetrieveParams(id, additionalHeaders.build(), additionalQueryParams.build()) - } - - fun _pathParam(index: Int): String = - when (index) { - 0 -> id ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is IntegrationRetrieveParams && - id == other.id && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = Objects.hash(id, additionalHeaders, additionalQueryParams) - - override fun toString() = - "IntegrationRetrieveParams{id=$id, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationSendTestParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationSendTestParams.kt deleted file mode 100644 index cfee8af..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationSendTestParams.kt +++ /dev/null @@ -1,232 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.x_twitter_scraper.api.core.JsonValue -import com.x_twitter_scraper.api.core.Params -import com.x_twitter_scraper.api.core.http.Headers -import com.x_twitter_scraper.api.core.http.QueryParams -import com.x_twitter_scraper.api.core.toImmutable -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Send test delivery */ -class IntegrationSendTestParams -private constructor( - private val id: String?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, -) : Params { - - fun id(): Optional = Optional.ofNullable(id) - - /** Additional body properties to send with the request. */ - fun _additionalBodyProperties(): Map = additionalBodyProperties - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): IntegrationSendTestParams = builder().build() - - /** - * Returns a mutable builder for constructing an instance of [IntegrationSendTestParams]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [IntegrationSendTestParams]. */ - class Builder internal constructor() { - - private var id: String? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(integrationSendTestParams: IntegrationSendTestParams) = apply { - id = integrationSendTestParams.id - additionalHeaders = integrationSendTestParams.additionalHeaders.toBuilder() - additionalQueryParams = integrationSendTestParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - integrationSendTestParams.additionalBodyProperties.toMutableMap() - } - - fun id(id: String?) = apply { this.id = id } - - /** Alias for calling [Builder.id] with `id.orElse(null)`. */ - fun id(id: Optional) = id(id.getOrNull()) - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) - } - - /** - * Returns an immutable instance of [IntegrationSendTestParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): IntegrationSendTestParams = - IntegrationSendTestParams( - id, - additionalHeaders.build(), - additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), - ) - } - - fun _body(): Optional> = - Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - - fun _pathParam(index: Int): String = - when (index) { - 0 -> id ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is IntegrationSendTestParams && - id == other.id && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams && - additionalBodyProperties == other.additionalBodyProperties - } - - override fun hashCode(): Int = - Objects.hash(id, additionalHeaders, additionalQueryParams, additionalBodyProperties) - - override fun toString() = - "IntegrationSendTestParams{id=$id, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationSendTestResponse.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationSendTestResponse.kt deleted file mode 100644 index ea5fcce..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationSendTestResponse.kt +++ /dev/null @@ -1,160 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import com.x_twitter_scraper.api.core.ExcludeMissing -import com.x_twitter_scraper.api.core.JsonMissing -import com.x_twitter_scraper.api.core.JsonValue -import com.x_twitter_scraper.api.errors.XTwitterScraperInvalidDataException -import java.util.Collections -import java.util.Objects - -class IntegrationSendTestResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val success: JsonValue, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("success") @ExcludeMissing success: JsonValue = JsonMissing.of() - ) : this(success, mutableMapOf()) - - /** - * Expected to always return the following: - * ```java - * JsonValue.from(true) - * ``` - * - * However, this method can be useful for debugging and logging (e.g. if the server responded - * with an unexpected value). - */ - @JsonProperty("success") @ExcludeMissing fun _success(): JsonValue = success - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [IntegrationSendTestResponse]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [IntegrationSendTestResponse]. */ - class Builder internal constructor() { - - private var success: JsonValue = JsonValue.from(true) - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(integrationSendTestResponse: IntegrationSendTestResponse) = apply { - success = integrationSendTestResponse.success - additionalProperties = integrationSendTestResponse.additionalProperties.toMutableMap() - } - - /** - * Sets the field to an arbitrary JSON value. - * - * It is usually unnecessary to call this method because the field defaults to the - * following: - * ```java - * JsonValue.from(true) - * ``` - * - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun success(success: JsonValue) = apply { this.success = success } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [IntegrationSendTestResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): IntegrationSendTestResponse = - IntegrationSendTestResponse(success, additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - fun validate(): IntegrationSendTestResponse = apply { - if (validated) { - return@apply - } - - _success().let { - if (it != JsonValue.from(true)) { - throw XTwitterScraperInvalidDataException("'success' is invalid, received $it") - } - } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: XTwitterScraperInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = success.let { if (it == JsonValue.from(true)) 1 else 0 } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is IntegrationSendTestResponse && - success == other.success && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(success, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "IntegrationSendTestResponse{success=$success, additionalProperties=$additionalProperties}" -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationUpdateParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationUpdateParams.kt deleted file mode 100644 index 9da8486..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationUpdateParams.kt +++ /dev/null @@ -1,1047 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import com.x_twitter_scraper.api.core.ExcludeMissing -import com.x_twitter_scraper.api.core.JsonField -import com.x_twitter_scraper.api.core.JsonMissing -import com.x_twitter_scraper.api.core.JsonValue -import com.x_twitter_scraper.api.core.Params -import com.x_twitter_scraper.api.core.checkKnown -import com.x_twitter_scraper.api.core.http.Headers -import com.x_twitter_scraper.api.core.http.QueryParams -import com.x_twitter_scraper.api.core.toImmutable -import com.x_twitter_scraper.api.errors.XTwitterScraperInvalidDataException -import com.x_twitter_scraper.api.models.EventType -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Update integration */ -class IntegrationUpdateParams -private constructor( - private val id: String?, - private val body: Body, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - fun id(): Optional = Optional.ofNullable(id) - - /** - * Array of event types to subscribe to. - * - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun eventTypes(): Optional> = body.eventTypes() - - /** - * Event filter rules (JSON) - * - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun filters(): Optional = body.filters() - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun isActive(): Optional = body.isActive() - - /** - * Custom message template (JSON) - * - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun messageTemplate(): Optional = body.messageTemplate() - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun name(): Optional = body.name() - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun scopeAllMonitors(): Optional = body.scopeAllMonitors() - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun silentPush(): Optional = body.silentPush() - - /** - * Returns the raw JSON value of [eventTypes]. - * - * Unlike [eventTypes], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _eventTypes(): JsonField> = body._eventTypes() - - /** - * Returns the raw JSON value of [filters]. - * - * Unlike [filters], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _filters(): JsonField = body._filters() - - /** - * Returns the raw JSON value of [isActive]. - * - * Unlike [isActive], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _isActive(): JsonField = body._isActive() - - /** - * Returns the raw JSON value of [messageTemplate]. - * - * Unlike [messageTemplate], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _messageTemplate(): JsonField = body._messageTemplate() - - /** - * Returns the raw JSON value of [name]. - * - * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _name(): JsonField = body._name() - - /** - * Returns the raw JSON value of [scopeAllMonitors]. - * - * Unlike [scopeAllMonitors], this method doesn't throw if the JSON field has an unexpected - * type. - */ - fun _scopeAllMonitors(): JsonField = body._scopeAllMonitors() - - /** - * Returns the raw JSON value of [silentPush]. - * - * Unlike [silentPush], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _silentPush(): JsonField = body._silentPush() - - fun _additionalBodyProperties(): Map = body._additionalProperties() - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): IntegrationUpdateParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [IntegrationUpdateParams]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [IntegrationUpdateParams]. */ - class Builder internal constructor() { - - private var id: String? = null - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(integrationUpdateParams: IntegrationUpdateParams) = apply { - id = integrationUpdateParams.id - body = integrationUpdateParams.body.toBuilder() - additionalHeaders = integrationUpdateParams.additionalHeaders.toBuilder() - additionalQueryParams = integrationUpdateParams.additionalQueryParams.toBuilder() - } - - fun id(id: String?) = apply { this.id = id } - - /** Alias for calling [Builder.id] with `id.orElse(null)`. */ - fun id(id: Optional) = id(id.getOrNull()) - - /** - * Sets the entire request body. - * - * This is generally only useful if you are already constructing the body separately. - * Otherwise, it's more convenient to use the top-level setters instead: - * - [eventTypes] - * - [filters] - * - [isActive] - * - [messageTemplate] - * - [name] - * - etc. - */ - fun body(body: Body) = apply { this.body = body.toBuilder() } - - /** Array of event types to subscribe to. */ - fun eventTypes(eventTypes: List) = apply { body.eventTypes(eventTypes) } - - /** - * Sets [Builder.eventTypes] to an arbitrary JSON value. - * - * You should usually call [Builder.eventTypes] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun eventTypes(eventTypes: JsonField>) = apply { - body.eventTypes(eventTypes) - } - - /** - * Adds a single [EventType] to [eventTypes]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addEventType(eventType: EventType) = apply { body.addEventType(eventType) } - - /** Event filter rules (JSON) */ - fun filters(filters: Filters) = apply { body.filters(filters) } - - /** - * Sets [Builder.filters] to an arbitrary JSON value. - * - * You should usually call [Builder.filters] with a well-typed [Filters] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun filters(filters: JsonField) = apply { body.filters(filters) } - - fun isActive(isActive: Boolean) = apply { body.isActive(isActive) } - - /** - * Sets [Builder.isActive] to an arbitrary JSON value. - * - * You should usually call [Builder.isActive] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun isActive(isActive: JsonField) = apply { body.isActive(isActive) } - - /** Custom message template (JSON) */ - fun messageTemplate(messageTemplate: MessageTemplate) = apply { - body.messageTemplate(messageTemplate) - } - - /** - * Sets [Builder.messageTemplate] to an arbitrary JSON value. - * - * You should usually call [Builder.messageTemplate] with a well-typed [MessageTemplate] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun messageTemplate(messageTemplate: JsonField) = apply { - body.messageTemplate(messageTemplate) - } - - fun name(name: String) = apply { body.name(name) } - - /** - * Sets [Builder.name] to an arbitrary JSON value. - * - * You should usually call [Builder.name] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun name(name: JsonField) = apply { body.name(name) } - - fun scopeAllMonitors(scopeAllMonitors: Boolean) = apply { - body.scopeAllMonitors(scopeAllMonitors) - } - - /** - * Sets [Builder.scopeAllMonitors] to an arbitrary JSON value. - * - * You should usually call [Builder.scopeAllMonitors] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun scopeAllMonitors(scopeAllMonitors: JsonField) = apply { - body.scopeAllMonitors(scopeAllMonitors) - } - - fun silentPush(silentPush: Boolean) = apply { body.silentPush(silentPush) } - - /** - * Sets [Builder.silentPush] to an arbitrary JSON value. - * - * You should usually call [Builder.silentPush] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun silentPush(silentPush: JsonField) = apply { body.silentPush(silentPush) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [IntegrationUpdateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): IntegrationUpdateParams = - IntegrationUpdateParams( - id, - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _body(): Body = body - - fun _pathParam(index: Int): String = - when (index) { - 0 -> id ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - class Body - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val eventTypes: JsonField>, - private val filters: JsonField, - private val isActive: JsonField, - private val messageTemplate: JsonField, - private val name: JsonField, - private val scopeAllMonitors: JsonField, - private val silentPush: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("eventTypes") - @ExcludeMissing - eventTypes: JsonField> = JsonMissing.of(), - @JsonProperty("filters") @ExcludeMissing filters: JsonField = JsonMissing.of(), - @JsonProperty("isActive") - @ExcludeMissing - isActive: JsonField = JsonMissing.of(), - @JsonProperty("messageTemplate") - @ExcludeMissing - messageTemplate: JsonField = JsonMissing.of(), - @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), - @JsonProperty("scopeAllMonitors") - @ExcludeMissing - scopeAllMonitors: JsonField = JsonMissing.of(), - @JsonProperty("silentPush") - @ExcludeMissing - silentPush: JsonField = JsonMissing.of(), - ) : this( - eventTypes, - filters, - isActive, - messageTemplate, - name, - scopeAllMonitors, - silentPush, - mutableMapOf(), - ) - - /** - * Array of event types to subscribe to. - * - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun eventTypes(): Optional> = eventTypes.getOptional("eventTypes") - - /** - * Event filter rules (JSON) - * - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun filters(): Optional = filters.getOptional("filters") - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun isActive(): Optional = isActive.getOptional("isActive") - - /** - * Custom message template (JSON) - * - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun messageTemplate(): Optional = - messageTemplate.getOptional("messageTemplate") - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun name(): Optional = name.getOptional("name") - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun scopeAllMonitors(): Optional = scopeAllMonitors.getOptional("scopeAllMonitors") - - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun silentPush(): Optional = silentPush.getOptional("silentPush") - - /** - * Returns the raw JSON value of [eventTypes]. - * - * Unlike [eventTypes], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("eventTypes") - @ExcludeMissing - fun _eventTypes(): JsonField> = eventTypes - - /** - * Returns the raw JSON value of [filters]. - * - * Unlike [filters], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("filters") @ExcludeMissing fun _filters(): JsonField = filters - - /** - * Returns the raw JSON value of [isActive]. - * - * Unlike [isActive], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("isActive") @ExcludeMissing fun _isActive(): JsonField = isActive - - /** - * Returns the raw JSON value of [messageTemplate]. - * - * Unlike [messageTemplate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("messageTemplate") - @ExcludeMissing - fun _messageTemplate(): JsonField = messageTemplate - - /** - * Returns the raw JSON value of [name]. - * - * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** - * Returns the raw JSON value of [scopeAllMonitors]. - * - * Unlike [scopeAllMonitors], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("scopeAllMonitors") - @ExcludeMissing - fun _scopeAllMonitors(): JsonField = scopeAllMonitors - - /** - * Returns the raw JSON value of [silentPush]. - * - * Unlike [silentPush], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("silentPush") - @ExcludeMissing - fun _silentPush(): JsonField = silentPush - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Body]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var eventTypes: JsonField>? = null - private var filters: JsonField = JsonMissing.of() - private var isActive: JsonField = JsonMissing.of() - private var messageTemplate: JsonField = JsonMissing.of() - private var name: JsonField = JsonMissing.of() - private var scopeAllMonitors: JsonField = JsonMissing.of() - private var silentPush: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - eventTypes = body.eventTypes.map { it.toMutableList() } - filters = body.filters - isActive = body.isActive - messageTemplate = body.messageTemplate - name = body.name - scopeAllMonitors = body.scopeAllMonitors - silentPush = body.silentPush - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** Array of event types to subscribe to. */ - fun eventTypes(eventTypes: List) = eventTypes(JsonField.of(eventTypes)) - - /** - * Sets [Builder.eventTypes] to an arbitrary JSON value. - * - * You should usually call [Builder.eventTypes] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun eventTypes(eventTypes: JsonField>) = apply { - this.eventTypes = eventTypes.map { it.toMutableList() } - } - - /** - * Adds a single [EventType] to [eventTypes]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addEventType(eventType: EventType) = apply { - eventTypes = - (eventTypes ?: JsonField.of(mutableListOf())).also { - checkKnown("eventTypes", it).add(eventType) - } - } - - /** Event filter rules (JSON) */ - fun filters(filters: Filters) = filters(JsonField.of(filters)) - - /** - * Sets [Builder.filters] to an arbitrary JSON value. - * - * You should usually call [Builder.filters] with a well-typed [Filters] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun filters(filters: JsonField) = apply { this.filters = filters } - - fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive)) - - /** - * Sets [Builder.isActive] to an arbitrary JSON value. - * - * You should usually call [Builder.isActive] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun isActive(isActive: JsonField) = apply { this.isActive = isActive } - - /** Custom message template (JSON) */ - fun messageTemplate(messageTemplate: MessageTemplate) = - messageTemplate(JsonField.of(messageTemplate)) - - /** - * Sets [Builder.messageTemplate] to an arbitrary JSON value. - * - * You should usually call [Builder.messageTemplate] with a well-typed [MessageTemplate] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun messageTemplate(messageTemplate: JsonField) = apply { - this.messageTemplate = messageTemplate - } - - fun name(name: String) = name(JsonField.of(name)) - - /** - * Sets [Builder.name] to an arbitrary JSON value. - * - * You should usually call [Builder.name] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun name(name: JsonField) = apply { this.name = name } - - fun scopeAllMonitors(scopeAllMonitors: Boolean) = - scopeAllMonitors(JsonField.of(scopeAllMonitors)) - - /** - * Sets [Builder.scopeAllMonitors] to an arbitrary JSON value. - * - * You should usually call [Builder.scopeAllMonitors] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun scopeAllMonitors(scopeAllMonitors: JsonField) = apply { - this.scopeAllMonitors = scopeAllMonitors - } - - fun silentPush(silentPush: Boolean) = silentPush(JsonField.of(silentPush)) - - /** - * Sets [Builder.silentPush] to an arbitrary JSON value. - * - * You should usually call [Builder.silentPush] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun silentPush(silentPush: JsonField) = apply { this.silentPush = silentPush } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Body = - Body( - (eventTypes ?: JsonMissing.of()).map { it.toImmutable() }, - filters, - isActive, - messageTemplate, - name, - scopeAllMonitors, - silentPush, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - eventTypes().ifPresent { it.forEach { it.validate() } } - filters().ifPresent { it.validate() } - isActive() - messageTemplate().ifPresent { it.validate() } - name() - scopeAllMonitors() - silentPush() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: XTwitterScraperInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (eventTypes.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (filters.asKnown().getOrNull()?.validity() ?: 0) + - (if (isActive.asKnown().isPresent) 1 else 0) + - (messageTemplate.asKnown().getOrNull()?.validity() ?: 0) + - (if (name.asKnown().isPresent) 1 else 0) + - (if (scopeAllMonitors.asKnown().isPresent) 1 else 0) + - (if (silentPush.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Body && - eventTypes == other.eventTypes && - filters == other.filters && - isActive == other.isActive && - messageTemplate == other.messageTemplate && - name == other.name && - scopeAllMonitors == other.scopeAllMonitors && - silentPush == other.silentPush && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - eventTypes, - filters, - isActive, - messageTemplate, - name, - scopeAllMonitors, - silentPush, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{eventTypes=$eventTypes, filters=$filters, isActive=$isActive, messageTemplate=$messageTemplate, name=$name, scopeAllMonitors=$scopeAllMonitors, silentPush=$silentPush, additionalProperties=$additionalProperties}" - } - - /** Event filter rules (JSON) */ - class Filters - @JsonCreator - private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map - ) { - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Filters]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Filters]. */ - class Builder internal constructor() { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(filters: Filters) = apply { - additionalProperties = filters.additionalProperties.toMutableMap() - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Filters]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Filters = Filters(additionalProperties.toImmutable()) - } - - private var validated: Boolean = false - - fun validate(): Filters = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: XTwitterScraperInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Filters && additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = "Filters{additionalProperties=$additionalProperties}" - } - - /** Custom message template (JSON) */ - class MessageTemplate - @JsonCreator - private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map - ) { - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [MessageTemplate]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [MessageTemplate]. */ - class Builder internal constructor() { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(messageTemplate: MessageTemplate) = apply { - additionalProperties = messageTemplate.additionalProperties.toMutableMap() - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [MessageTemplate]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): MessageTemplate = MessageTemplate(additionalProperties.toImmutable()) - } - - private var validated: Boolean = false - - fun validate(): MessageTemplate = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: XTwitterScraperInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is MessageTemplate && additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = "MessageTemplate{additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is IntegrationUpdateParams && - id == other.id && - body == other.body && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = Objects.hash(id, body, additionalHeaders, additionalQueryParams) - - override fun toString() = - "IntegrationUpdateParams{id=$id, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/radar/RadarItem.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/radar/RadarItem.kt index 7231e8e..ef8d04e 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/radar/RadarItem.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/radar/RadarItem.kt @@ -6,26 +6,34 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty +import com.x_twitter_scraper.api.core.Enum import com.x_twitter_scraper.api.core.ExcludeMissing import com.x_twitter_scraper.api.core.JsonField import com.x_twitter_scraper.api.core.JsonMissing import com.x_twitter_scraper.api.core.JsonValue import com.x_twitter_scraper.api.core.checkRequired +import com.x_twitter_scraper.api.core.toImmutable import com.x_twitter_scraper.api.errors.XTwitterScraperInvalidDataException import java.time.OffsetDateTime import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull -/** Trending topic with score, category, source, and region. */ +/** Trending topic with score, category, source, region, language, and source-specific metadata. */ class RadarItem @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val category: JsonField, + private val id: JsonField, + private val category: JsonField, + private val createdAt: JsonField, + private val language: JsonField, + private val metadata: JsonField, private val publishedAt: JsonField, private val region: JsonField, private val score: JsonField, - private val source: JsonField, + private val source: JsonField, + private val sourceId: JsonField, private val title: JsonField, private val description: JsonField, private val imageUrl: JsonField, @@ -35,13 +43,20 @@ private constructor( @JsonCreator private constructor( - @JsonProperty("category") @ExcludeMissing category: JsonField = JsonMissing.of(), + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("category") @ExcludeMissing category: JsonField = JsonMissing.of(), + @JsonProperty("createdAt") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("language") @ExcludeMissing language: JsonField = JsonMissing.of(), + @JsonProperty("metadata") @ExcludeMissing metadata: JsonField = JsonMissing.of(), @JsonProperty("publishedAt") @ExcludeMissing publishedAt: JsonField = JsonMissing.of(), @JsonProperty("region") @ExcludeMissing region: JsonField = JsonMissing.of(), @JsonProperty("score") @ExcludeMissing score: JsonField = JsonMissing.of(), - @JsonProperty("source") @ExcludeMissing source: JsonField = JsonMissing.of(), + @JsonProperty("source") @ExcludeMissing source: JsonField = JsonMissing.of(), + @JsonProperty("sourceId") @ExcludeMissing sourceId: JsonField = JsonMissing.of(), @JsonProperty("title") @ExcludeMissing title: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing @@ -49,11 +64,16 @@ private constructor( @JsonProperty("imageUrl") @ExcludeMissing imageUrl: JsonField = JsonMissing.of(), @JsonProperty("url") @ExcludeMissing url: JsonField = JsonMissing.of(), ) : this( + id, category, + createdAt, + language, + metadata, publishedAt, region, score, source, + sourceId, title, description, imageUrl, @@ -61,11 +81,48 @@ private constructor( mutableMapOf(), ) + /** + * Internal numeric identifier (stringified bigint). + * + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun category(): String = category.getRequired("category") + fun category(): Category = category.getRequired("category") + + /** + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun createdAt(): OffsetDateTime = createdAt.getRequired("createdAt") + + /** + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun language(): String = language.getRequired("language") + + /** + * Source-specific fields. Shape varies per source: + * - reddit: { subreddit: string, author: string } + * - github: { starsToday: number } + * - hacker_news: { points: number, numberComments: number } + * - google_trends: { approxTraffic: number } + * - polymarket: { volume24hr: number } + * - wikipedia: { views: number } + * - trustmrr: { mrr, growthPercent, last30Days, total, customers, activeSubscriptions, onSale, + * xHandle?, category?, askingPrice?, country?, growthMrrPercent?, multiple?, + * paymentProvider?, rank? } + * + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun metadata(): Metadata = metadata.getRequired("metadata") /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is @@ -89,7 +146,15 @@ private constructor( * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun source(): String = source.getRequired("source") + fun source(): Source = source.getRequired("source") + + /** + * Source-specific identifier used for deduplication. + * + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun sourceId(): String = sourceId.getRequired("sourceId") /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is @@ -115,12 +180,42 @@ private constructor( */ fun url(): Optional = url.getOptional("url") + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** * Returns the raw JSON value of [category]. * * Unlike [category], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("category") @ExcludeMissing fun _category(): JsonField = category + @JsonProperty("category") @ExcludeMissing fun _category(): JsonField = category + + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("createdAt") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt + + /** + * Returns the raw JSON value of [language]. + * + * Unlike [language], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("language") @ExcludeMissing fun _language(): JsonField = language + + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField = metadata /** * Returns the raw JSON value of [publishedAt]. @@ -150,7 +245,14 @@ private constructor( * * Unlike [source], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source + @JsonProperty("source") @ExcludeMissing fun _source(): JsonField = source + + /** + * Returns the raw JSON value of [sourceId]. + * + * Unlike [sourceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("sourceId") @ExcludeMissing fun _sourceId(): JsonField = sourceId /** * Returns the raw JSON value of [title]. @@ -199,11 +301,16 @@ private constructor( * * The following fields are required: * ```java + * .id() * .category() + * .createdAt() + * .language() + * .metadata() * .publishedAt() * .region() * .score() * .source() + * .sourceId() * .title() * ``` */ @@ -213,11 +320,16 @@ private constructor( /** A builder for [RadarItem]. */ class Builder internal constructor() { - private var category: JsonField? = null + private var id: JsonField? = null + private var category: JsonField? = null + private var createdAt: JsonField? = null + private var language: JsonField? = null + private var metadata: JsonField? = null private var publishedAt: JsonField? = null private var region: JsonField? = null private var score: JsonField? = null - private var source: JsonField? = null + private var source: JsonField? = null + private var sourceId: JsonField? = null private var title: JsonField? = null private var description: JsonField = JsonMissing.of() private var imageUrl: JsonField = JsonMissing.of() @@ -226,11 +338,16 @@ private constructor( @JvmSynthetic internal fun from(radarItem: RadarItem) = apply { + id = radarItem.id category = radarItem.category + createdAt = radarItem.createdAt + language = radarItem.language + metadata = radarItem.metadata publishedAt = radarItem.publishedAt region = radarItem.region score = radarItem.score source = radarItem.source + sourceId = radarItem.sourceId title = radarItem.title description = radarItem.description imageUrl = radarItem.imageUrl @@ -238,15 +355,71 @@ private constructor( additionalProperties = radarItem.additionalProperties.toMutableMap() } - fun category(category: String) = category(JsonField.of(category)) + /** Internal numeric identifier (stringified bigint). */ + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + fun category(category: Category) = category(JsonField.of(category)) /** * Sets [Builder.category] to an arbitrary JSON value. * - * You should usually call [Builder.category] with a well-typed [String] value instead. This + * You should usually call [Builder.category] with a well-typed [Category] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun category(category: JsonField) = apply { this.category = category } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + fun language(language: String) = language(JsonField.of(language)) + + /** + * Sets [Builder.language] to an arbitrary JSON value. + * + * You should usually call [Builder.language] with a well-typed [String] value instead. This * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun category(category: JsonField) = apply { this.category = category } + fun language(language: JsonField) = apply { this.language = language } + + /** + * Source-specific fields. Shape varies per source: + * - reddit: { subreddit: string, author: string } + * - github: { starsToday: number } + * - hacker_news: { points: number, numberComments: number } + * - google_trends: { approxTraffic: number } + * - polymarket: { volume24hr: number } + * - wikipedia: { views: number } + * - trustmrr: { mrr, growthPercent, last30Days, total, customers, activeSubscriptions, + * onSale, xHandle?, category?, askingPrice?, country?, growthMrrPercent?, multiple?, + * paymentProvider?, rank? } + */ + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } fun publishedAt(publishedAt: OffsetDateTime) = publishedAt(JsonField.of(publishedAt)) @@ -281,15 +454,26 @@ private constructor( */ fun score(score: JsonField) = apply { this.score = score } - fun source(source: String) = source(JsonField.of(source)) + fun source(source: Source) = source(JsonField.of(source)) /** * Sets [Builder.source] to an arbitrary JSON value. * - * You should usually call [Builder.source] with a well-typed [String] value instead. This + * You should usually call [Builder.source] with a well-typed [Source] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun source(source: JsonField) = apply { this.source = source } + + /** Source-specific identifier used for deduplication. */ + fun sourceId(sourceId: String) = sourceId(JsonField.of(sourceId)) + + /** + * Sets [Builder.sourceId] to an arbitrary JSON value. + * + * You should usually call [Builder.sourceId] with a well-typed [String] value instead. This * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun source(source: JsonField) = apply { this.source = source } + fun sourceId(sourceId: JsonField) = apply { this.sourceId = sourceId } fun title(title: String) = title(JsonField.of(title)) @@ -358,11 +542,16 @@ private constructor( * * The following fields are required: * ```java + * .id() * .category() + * .createdAt() + * .language() + * .metadata() * .publishedAt() * .region() * .score() * .source() + * .sourceId() * .title() * ``` * @@ -370,11 +559,16 @@ private constructor( */ fun build(): RadarItem = RadarItem( + checkRequired("id", id), checkRequired("category", category), + checkRequired("createdAt", createdAt), + checkRequired("language", language), + checkRequired("metadata", metadata), checkRequired("publishedAt", publishedAt), checkRequired("region", region), checkRequired("score", score), checkRequired("source", source), + checkRequired("sourceId", sourceId), checkRequired("title", title), description, imageUrl, @@ -390,11 +584,16 @@ private constructor( return@apply } - category() + id() + category().validate() + createdAt() + language() + metadata().validate() publishedAt() region() score() - source() + source().validate() + sourceId() title() description() imageUrl() @@ -417,27 +616,468 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (category.asKnown().isPresent) 1 else 0) + + (if (id.asKnown().isPresent) 1 else 0) + + (category.asKnown().getOrNull()?.validity() ?: 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (if (language.asKnown().isPresent) 1 else 0) + + (metadata.asKnown().getOrNull()?.validity() ?: 0) + (if (publishedAt.asKnown().isPresent) 1 else 0) + (if (region.asKnown().isPresent) 1 else 0) + (if (score.asKnown().isPresent) 1 else 0) + - (if (source.asKnown().isPresent) 1 else 0) + + (source.asKnown().getOrNull()?.validity() ?: 0) + + (if (sourceId.asKnown().isPresent) 1 else 0) + (if (title.asKnown().isPresent) 1 else 0) + (if (description.asKnown().isPresent) 1 else 0) + (if (imageUrl.asKnown().isPresent) 1 else 0) + (if (url.asKnown().isPresent) 1 else 0) + class Category @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val GENERAL = of("general") + + @JvmField val TECH = of("tech") + + @JvmField val DEV = of("dev") + + @JvmField val SCIENCE = of("science") + + @JvmField val CULTURE = of("culture") + + @JvmField val POLITICS = of("politics") + + @JvmField val BUSINESS = of("business") + + @JvmField val ENTERTAINMENT = of("entertainment") + + @JvmStatic fun of(value: String) = Category(JsonField.of(value)) + } + + /** An enum containing [Category]'s known values. */ + enum class Known { + GENERAL, + TECH, + DEV, + SCIENCE, + CULTURE, + POLITICS, + BUSINESS, + ENTERTAINMENT, + } + + /** + * An enum containing [Category]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Category] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + GENERAL, + TECH, + DEV, + SCIENCE, + CULTURE, + POLITICS, + BUSINESS, + ENTERTAINMENT, + /** An enum member indicating that [Category] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + GENERAL -> Value.GENERAL + TECH -> Value.TECH + DEV -> Value.DEV + SCIENCE -> Value.SCIENCE + CULTURE -> Value.CULTURE + POLITICS -> Value.POLITICS + BUSINESS -> Value.BUSINESS + ENTERTAINMENT -> Value.ENTERTAINMENT + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws XTwitterScraperInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + GENERAL -> Known.GENERAL + TECH -> Known.TECH + DEV -> Known.DEV + SCIENCE -> Known.SCIENCE + CULTURE -> Known.CULTURE + POLITICS -> Known.POLITICS + BUSINESS -> Known.BUSINESS + ENTERTAINMENT -> Known.ENTERTAINMENT + else -> throw XTwitterScraperInvalidDataException("Unknown Category: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws XTwitterScraperInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + XTwitterScraperInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Category = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: XTwitterScraperInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Category && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * Source-specific fields. Shape varies per source: + * - reddit: { subreddit: string, author: string } + * - github: { starsToday: number } + * - hacker_news: { points: number, numberComments: number } + * - google_trends: { approxTraffic: number } + * - polymarket: { volume24hr: number } + * - wikipedia: { views: number } + * - trustmrr: { mrr, growthPercent, last30Days, total, customers, activeSubscriptions, onSale, + * xHandle?, category?, askingPrice?, country?, growthMrrPercent?, multiple?, + * paymentProvider?, rank? } + */ + class Metadata + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Metadata]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Metadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: XTwitterScraperInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Metadata && additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } + + class Source @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val GITHUB = of("github") + + @JvmField val GOOGLE_TRENDS = of("google_trends") + + @JvmField val HACKER_NEWS = of("hacker_news") + + @JvmField val POLYMARKET = of("polymarket") + + @JvmField val REDDIT = of("reddit") + + @JvmField val TRUSTMRR = of("trustmrr") + + @JvmField val WIKIPEDIA = of("wikipedia") + + @JvmStatic fun of(value: String) = Source(JsonField.of(value)) + } + + /** An enum containing [Source]'s known values. */ + enum class Known { + GITHUB, + GOOGLE_TRENDS, + HACKER_NEWS, + POLYMARKET, + REDDIT, + TRUSTMRR, + WIKIPEDIA, + } + + /** + * An enum containing [Source]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Source] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + GITHUB, + GOOGLE_TRENDS, + HACKER_NEWS, + POLYMARKET, + REDDIT, + TRUSTMRR, + WIKIPEDIA, + /** An enum member indicating that [Source] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + GITHUB -> Value.GITHUB + GOOGLE_TRENDS -> Value.GOOGLE_TRENDS + HACKER_NEWS -> Value.HACKER_NEWS + POLYMARKET -> Value.POLYMARKET + REDDIT -> Value.REDDIT + TRUSTMRR -> Value.TRUSTMRR + WIKIPEDIA -> Value.WIKIPEDIA + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws XTwitterScraperInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + GITHUB -> Known.GITHUB + GOOGLE_TRENDS -> Known.GOOGLE_TRENDS + HACKER_NEWS -> Known.HACKER_NEWS + POLYMARKET -> Known.POLYMARKET + REDDIT -> Known.REDDIT + TRUSTMRR -> Known.TRUSTMRR + WIKIPEDIA -> Known.WIKIPEDIA + else -> throw XTwitterScraperInvalidDataException("Unknown Source: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws XTwitterScraperInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + XTwitterScraperInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Source = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: XTwitterScraperInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Source && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } return other is RadarItem && + id == other.id && category == other.category && + createdAt == other.createdAt && + language == other.language && + metadata == other.metadata && publishedAt == other.publishedAt && region == other.region && score == other.score && source == other.source && + sourceId == other.sourceId && title == other.title && description == other.description && imageUrl == other.imageUrl && @@ -447,11 +1087,16 @@ private constructor( private val hashCode: Int by lazy { Objects.hash( + id, category, + createdAt, + language, + metadata, publishedAt, region, score, source, + sourceId, title, description, imageUrl, @@ -463,5 +1108,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "RadarItem{category=$category, publishedAt=$publishedAt, region=$region, score=$score, source=$source, title=$title, description=$description, imageUrl=$imageUrl, url=$url, additionalProperties=$additionalProperties}" + "RadarItem{id=$id, category=$category, createdAt=$createdAt, language=$language, metadata=$metadata, publishedAt=$publishedAt, region=$region, score=$score, source=$source, sourceId=$sourceId, title=$title, description=$description, imageUrl=$imageUrl, url=$url, additionalProperties=$additionalProperties}" } diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/radar/RadarRetrieveTrendingTopicsParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/radar/RadarRetrieveTrendingTopicsParams.kt index a00f5fb..59653e1 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/radar/RadarRetrieveTrendingTopicsParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/radar/RadarRetrieveTrendingTopicsParams.kt @@ -16,24 +16,28 @@ import kotlin.jvm.optionals.getOrNull /** Get trending topics from curated sources */ class RadarRetrieveTrendingTopicsParams private constructor( - private val category: String?, - private val count: Long?, + private val after: String?, + private val category: Category?, private val hours: Long?, + private val limit: Long?, private val region: String?, private val source: Source?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { - /** Filter by category (general, tech, dev, etc.) */ - fun category(): Optional = Optional.ofNullable(category) + /** Cursor for pagination (from prior response nextCursor). */ + fun after(): Optional = Optional.ofNullable(after) - /** Number of items to return */ - fun count(): Optional = Optional.ofNullable(count) + /** Filter by category. */ + fun category(): Optional = Optional.ofNullable(category) - /** Lookback window in hours */ + /** Lookback window in hours (1-168, default 24). */ fun hours(): Optional = Optional.ofNullable(hours) + /** Number of items to return (1-100, default 50). */ + fun limit(): Optional = Optional.ofNullable(limit) + /** Region filter (us, global, etc.) */ fun region(): Optional = Optional.ofNullable(region) @@ -65,9 +69,10 @@ private constructor( /** A builder for [RadarRetrieveTrendingTopicsParams]. */ class Builder internal constructor() { - private var category: String? = null - private var count: Long? = null + private var after: String? = null + private var category: Category? = null private var hours: Long? = null + private var limit: Long? = null private var region: String? = null private var source: Source? = null private var additionalHeaders: Headers.Builder = Headers.builder() @@ -76,9 +81,10 @@ private constructor( @JvmSynthetic internal fun from(radarRetrieveTrendingTopicsParams: RadarRetrieveTrendingTopicsParams) = apply { + after = radarRetrieveTrendingTopicsParams.after category = radarRetrieveTrendingTopicsParams.category - count = radarRetrieveTrendingTopicsParams.count hours = radarRetrieveTrendingTopicsParams.hours + limit = radarRetrieveTrendingTopicsParams.limit region = radarRetrieveTrendingTopicsParams.region source = radarRetrieveTrendingTopicsParams.source additionalHeaders = radarRetrieveTrendingTopicsParams.additionalHeaders.toBuilder() @@ -86,37 +92,43 @@ private constructor( radarRetrieveTrendingTopicsParams.additionalQueryParams.toBuilder() } - /** Filter by category (general, tech, dev, etc.) */ - fun category(category: String?) = apply { this.category = category } + /** Cursor for pagination (from prior response nextCursor). */ + fun after(after: String?) = apply { this.after = after } + + /** Alias for calling [Builder.after] with `after.orElse(null)`. */ + fun after(after: Optional) = after(after.getOrNull()) + + /** Filter by category. */ + fun category(category: Category?) = apply { this.category = category } /** Alias for calling [Builder.category] with `category.orElse(null)`. */ - fun category(category: Optional) = category(category.getOrNull()) + fun category(category: Optional) = category(category.getOrNull()) - /** Number of items to return */ - fun count(count: Long?) = apply { this.count = count } + /** Lookback window in hours (1-168, default 24). */ + fun hours(hours: Long?) = apply { this.hours = hours } /** - * Alias for [Builder.count]. + * Alias for [Builder.hours]. * * This unboxed primitive overload exists for backwards compatibility. */ - fun count(count: Long) = count(count as Long?) + fun hours(hours: Long) = hours(hours as Long?) - /** Alias for calling [Builder.count] with `count.orElse(null)`. */ - fun count(count: Optional) = count(count.getOrNull()) + /** Alias for calling [Builder.hours] with `hours.orElse(null)`. */ + fun hours(hours: Optional) = hours(hours.getOrNull()) - /** Lookback window in hours */ - fun hours(hours: Long?) = apply { this.hours = hours } + /** Number of items to return (1-100, default 50). */ + fun limit(limit: Long?) = apply { this.limit = limit } /** - * Alias for [Builder.hours]. + * Alias for [Builder.limit]. * * This unboxed primitive overload exists for backwards compatibility. */ - fun hours(hours: Long) = hours(hours as Long?) + fun limit(limit: Long) = limit(limit as Long?) - /** Alias for calling [Builder.hours] with `hours.orElse(null)`. */ - fun hours(hours: Optional) = hours(hours.getOrNull()) + /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ + fun limit(limit: Optional) = limit(limit.getOrNull()) /** Region filter (us, global, etc.) */ fun region(region: String?) = apply { this.region = region } @@ -238,9 +250,10 @@ private constructor( */ fun build(): RadarRetrieveTrendingTopicsParams = RadarRetrieveTrendingTopicsParams( + after, category, - count, hours, + limit, region, source, additionalHeaders.build(), @@ -253,15 +266,180 @@ private constructor( override fun _queryParams(): QueryParams = QueryParams.builder() .apply { - category?.let { put("category", it) } - count?.let { put("count", it.toString()) } + after?.let { put("after", it) } + category?.let { put("category", it.toString()) } hours?.let { put("hours", it.toString()) } + limit?.let { put("limit", it.toString()) } region?.let { put("region", it) } source?.let { put("source", it.toString()) } putAll(additionalQueryParams) } .build() + /** Filter by category. */ + class Category @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val GENERAL = of("general") + + @JvmField val TECH = of("tech") + + @JvmField val DEV = of("dev") + + @JvmField val SCIENCE = of("science") + + @JvmField val CULTURE = of("culture") + + @JvmField val POLITICS = of("politics") + + @JvmField val BUSINESS = of("business") + + @JvmField val ENTERTAINMENT = of("entertainment") + + @JvmStatic fun of(value: String) = Category(JsonField.of(value)) + } + + /** An enum containing [Category]'s known values. */ + enum class Known { + GENERAL, + TECH, + DEV, + SCIENCE, + CULTURE, + POLITICS, + BUSINESS, + ENTERTAINMENT, + } + + /** + * An enum containing [Category]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Category] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + GENERAL, + TECH, + DEV, + SCIENCE, + CULTURE, + POLITICS, + BUSINESS, + ENTERTAINMENT, + /** An enum member indicating that [Category] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + GENERAL -> Value.GENERAL + TECH -> Value.TECH + DEV -> Value.DEV + SCIENCE -> Value.SCIENCE + CULTURE -> Value.CULTURE + POLITICS -> Value.POLITICS + BUSINESS -> Value.BUSINESS + ENTERTAINMENT -> Value.ENTERTAINMENT + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws XTwitterScraperInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + GENERAL -> Known.GENERAL + TECH -> Known.TECH + DEV -> Known.DEV + SCIENCE -> Known.SCIENCE + CULTURE -> Known.CULTURE + POLITICS -> Known.POLITICS + BUSINESS -> Known.BUSINESS + ENTERTAINMENT -> Known.ENTERTAINMENT + else -> throw XTwitterScraperInvalidDataException("Unknown Category: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws XTwitterScraperInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + XTwitterScraperInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Category = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: XTwitterScraperInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Category && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + /** * Source filter. One of: github, google_trends, hacker_news, polymarket, reddit, trustmrr, * wikipedia @@ -429,9 +607,10 @@ private constructor( } return other is RadarRetrieveTrendingTopicsParams && + after == other.after && category == other.category && - count == other.count && hours == other.hours && + limit == other.limit && region == other.region && source == other.source && additionalHeaders == other.additionalHeaders && @@ -440,9 +619,10 @@ private constructor( override fun hashCode(): Int = Objects.hash( + after, category, - count, hours, + limit, region, source, additionalHeaders, @@ -450,5 +630,5 @@ private constructor( ) override fun toString() = - "RadarRetrieveTrendingTopicsParams{category=$category, count=$count, hours=$hours, region=$region, source=$source, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "RadarRetrieveTrendingTopicsParams{after=$after, category=$category, hours=$hours, limit=$limit, region=$region, source=$source, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/radar/RadarRetrieveTrendingTopicsResponse.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/radar/RadarRetrieveTrendingTopicsResponse.kt index 5f17e52..ca1ea0b 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/radar/RadarRetrieveTrendingTopicsResponse.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/radar/RadarRetrieveTrendingTopicsResponse.kt @@ -16,33 +16,51 @@ import com.x_twitter_scraper.api.core.toImmutable import com.x_twitter_scraper.api.errors.XTwitterScraperInvalidDataException import java.util.Collections import java.util.Objects +import java.util.Optional import kotlin.jvm.optionals.getOrNull class RadarRetrieveTrendingTopicsResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( + private val hasMore: JsonField, private val items: JsonField>, - private val total: JsonField, + private val nextCursor: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( + @JsonProperty("hasMore") @ExcludeMissing hasMore: JsonField = JsonMissing.of(), @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of(), - @JsonProperty("total") @ExcludeMissing total: JsonField = JsonMissing.of(), - ) : this(items, total, mutableMapOf()) + @JsonProperty("nextCursor") @ExcludeMissing nextCursor: JsonField = JsonMissing.of(), + ) : this(hasMore, items, nextCursor, mutableMapOf()) /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun items(): List = items.getRequired("items") + fun hasMore(): Boolean = hasMore.getRequired("hasMore") /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun total(): Long = total.getRequired("total") + fun items(): List = items.getRequired("items") + + /** + * Opaque cursor for the next page (present only when hasMore is true). + * + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun nextCursor(): Optional = nextCursor.getOptional("nextCursor") + + /** + * Returns the raw JSON value of [hasMore]. + * + * Unlike [hasMore], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("hasMore") @ExcludeMissing fun _hasMore(): JsonField = hasMore /** * Returns the raw JSON value of [items]. @@ -52,11 +70,11 @@ private constructor( @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items /** - * Returns the raw JSON value of [total]. + * Returns the raw JSON value of [nextCursor]. * - * Unlike [total], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [nextCursor], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("total") @ExcludeMissing fun _total(): JsonField = total + @JsonProperty("nextCursor") @ExcludeMissing fun _nextCursor(): JsonField = nextCursor @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -78,8 +96,8 @@ private constructor( * * The following fields are required: * ```java + * .hasMore() * .items() - * .total() * ``` */ @JvmStatic fun builder() = Builder() @@ -88,20 +106,32 @@ private constructor( /** A builder for [RadarRetrieveTrendingTopicsResponse]. */ class Builder internal constructor() { + private var hasMore: JsonField? = null private var items: JsonField>? = null - private var total: JsonField? = null + private var nextCursor: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from( radarRetrieveTrendingTopicsResponse: RadarRetrieveTrendingTopicsResponse ) = apply { + hasMore = radarRetrieveTrendingTopicsResponse.hasMore items = radarRetrieveTrendingTopicsResponse.items.map { it.toMutableList() } - total = radarRetrieveTrendingTopicsResponse.total + nextCursor = radarRetrieveTrendingTopicsResponse.nextCursor additionalProperties = radarRetrieveTrendingTopicsResponse.additionalProperties.toMutableMap() } + fun hasMore(hasMore: Boolean) = hasMore(JsonField.of(hasMore)) + + /** + * Sets [Builder.hasMore] to an arbitrary JSON value. + * + * You should usually call [Builder.hasMore] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun hasMore(hasMore: JsonField) = apply { this.hasMore = hasMore } + fun items(items: List) = items(JsonField.of(items)) /** @@ -125,15 +155,17 @@ private constructor( (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } } - fun total(total: Long) = total(JsonField.of(total)) + /** Opaque cursor for the next page (present only when hasMore is true). */ + fun nextCursor(nextCursor: String) = nextCursor(JsonField.of(nextCursor)) /** - * Sets [Builder.total] to an arbitrary JSON value. + * Sets [Builder.nextCursor] to an arbitrary JSON value. * - * You should usually call [Builder.total] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * You should usually call [Builder.nextCursor] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun total(total: JsonField) = apply { this.total = total } + fun nextCursor(nextCursor: JsonField) = apply { this.nextCursor = nextCursor } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -161,16 +193,17 @@ private constructor( * * The following fields are required: * ```java + * .hasMore() * .items() - * .total() * ``` * * @throws IllegalStateException if any required field is unset. */ fun build(): RadarRetrieveTrendingTopicsResponse = RadarRetrieveTrendingTopicsResponse( + checkRequired("hasMore", hasMore), checkRequired("items", items).map { it.toImmutable() }, - checkRequired("total", total), + nextCursor, additionalProperties.toMutableMap(), ) } @@ -182,8 +215,9 @@ private constructor( return@apply } + hasMore() items().forEach { it.validate() } - total() + nextCursor() validated = true } @@ -202,8 +236,9 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (total.asKnown().isPresent) 1 else 0) + (if (hasMore.asKnown().isPresent) 1 else 0) + + (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (nextCursor.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -211,15 +246,18 @@ private constructor( } return other is RadarRetrieveTrendingTopicsResponse && + hasMore == other.hasMore && items == other.items && - total == other.total && + nextCursor == other.nextCursor && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(items, total, additionalProperties) } + private val hashCode: Int by lazy { + Objects.hash(hasMore, items, nextCursor, additionalProperties) + } override fun hashCode(): Int = hashCode override fun toString() = - "RadarRetrieveTrendingTopicsResponse{items=$items, total=$total, additionalProperties=$additionalProperties}" + "RadarRetrieveTrendingTopicsResponse{hasMore=$hasMore, items=$items, nextCursor=$nextCursor, additionalProperties=$additionalProperties}" } diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/trends/TrendListParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/trends/TrendListParams.kt index 60f5ab4..1f00491 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/trends/TrendListParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/trends/TrendListParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get regional trending topics */ +/** Get trending hashtags and topics by region (alias) */ class TrendListParams private constructor( private val count: Long?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/XGetTrendsParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/XGetTrendsParams.kt index 6fe43e1..d95d2a5 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/XGetTrendsParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/XGetTrendsParams.kt @@ -6,14 +6,24 @@ import com.x_twitter_scraper.api.core.Params import com.x_twitter_scraper.api.core.http.Headers import com.x_twitter_scraper.api.core.http.QueryParams import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull -/** Get trending topics */ +/** Get trending hashtags and topics from X by region */ class XGetTrendsParams private constructor( + private val count: Long?, + private val woeid: Long?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { + /** Number of trending topics to return (1-50, default 30) */ + fun count(): Optional = Optional.ofNullable(count) + + /** Region WOEID (1=Worldwide, 23424977=US, 23424975=UK, 23424969=Turkey) */ + fun woeid(): Optional = Optional.ofNullable(woeid) + /** Additional headers to send with the request. */ fun _additionalHeaders(): Headers = additionalHeaders @@ -33,15 +43,45 @@ private constructor( /** A builder for [XGetTrendsParams]. */ class Builder internal constructor() { + private var count: Long? = null + private var woeid: Long? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic internal fun from(xGetTrendsParams: XGetTrendsParams) = apply { + count = xGetTrendsParams.count + woeid = xGetTrendsParams.woeid additionalHeaders = xGetTrendsParams.additionalHeaders.toBuilder() additionalQueryParams = xGetTrendsParams.additionalQueryParams.toBuilder() } + /** Number of trending topics to return (1-50, default 30) */ + fun count(count: Long?) = apply { this.count = count } + + /** + * Alias for [Builder.count]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun count(count: Long) = count(count as Long?) + + /** Alias for calling [Builder.count] with `count.orElse(null)`. */ + fun count(count: Optional) = count(count.getOrNull()) + + /** Region WOEID (1=Worldwide, 23424977=US, 23424975=UK, 23424969=Turkey) */ + fun woeid(woeid: Long?) = apply { this.woeid = woeid } + + /** + * Alias for [Builder.woeid]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun woeid(woeid: Long) = woeid(woeid as Long?) + + /** Alias for calling [Builder.woeid] with `woeid.orElse(null)`. */ + fun woeid(woeid: Optional) = woeid(woeid.getOrNull()) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) @@ -146,12 +186,19 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): XGetTrendsParams = - XGetTrendsParams(additionalHeaders.build(), additionalQueryParams.build()) + XGetTrendsParams(count, woeid, additionalHeaders.build(), additionalQueryParams.build()) } override fun _headers(): Headers = additionalHeaders - override fun _queryParams(): QueryParams = additionalQueryParams + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + count?.let { put("count", it.toString()) } + woeid?.let { put("woeid", it.toString()) } + putAll(additionalQueryParams) + } + .build() override fun equals(other: Any?): Boolean { if (this === other) { @@ -159,12 +206,15 @@ private constructor( } return other is XGetTrendsParams && + count == other.count && + woeid == other.woeid && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams } - override fun hashCode(): Int = Objects.hash(additionalHeaders, additionalQueryParams) + override fun hashCode(): Int = + Objects.hash(count, woeid, additionalHeaders, additionalQueryParams) override fun toString() = - "XGetTrendsParams{additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "XGetTrendsParams{count=$count, woeid=$woeid, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountCreateResponse.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountCreateResponse.kt index 092c8ad..222f77c 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountCreateResponse.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountCreateResponse.kt @@ -6,32 +6,52 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty +import com.x_twitter_scraper.api.core.Enum import com.x_twitter_scraper.api.core.ExcludeMissing import com.x_twitter_scraper.api.core.JsonField import com.x_twitter_scraper.api.core.JsonMissing import com.x_twitter_scraper.api.core.JsonValue import com.x_twitter_scraper.api.core.checkRequired import com.x_twitter_scraper.api.errors.XTwitterScraperInvalidDataException +import java.time.OffsetDateTime import java.util.Collections import java.util.Objects - +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Sanitized X account summary returned by connect and reauth. Includes an optional `loginCountry` + * field surfaced only when the declared proxy region had no Driver capacity and the login fell back + * to a single US consumer device for this one-time action. Future activity continues to use the + * selected `proxy_country`; the field is omitted on normal logins. + */ class AccountCreateResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val id: JsonField, + private val createdAt: JsonField, + private val health: JsonField, private val status: JsonField, private val xUserId: JsonField, private val xUsername: JsonField, + private val loginCountry: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("createdAt") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("health") @ExcludeMissing health: JsonField = JsonMissing.of(), @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), @JsonProperty("xUserId") @ExcludeMissing xUserId: JsonField = JsonMissing.of(), @JsonProperty("xUsername") @ExcludeMissing xUsername: JsonField = JsonMissing.of(), - ) : this(id, status, xUserId, xUsername, mutableMapOf()) + @JsonProperty("loginCountry") + @ExcludeMissing + loginCountry: JsonField = JsonMissing.of(), + ) : this(id, createdAt, health, status, xUserId, xUsername, loginCountry, mutableMapOf()) /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is @@ -39,6 +59,18 @@ private constructor( */ fun id(): String = id.getRequired("id") + /** + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun createdAt(): OffsetDateTime = createdAt.getRequired("createdAt") + + /** + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun health(): Health = health.getRequired("health") + /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -57,6 +89,16 @@ private constructor( */ fun xUsername(): String = xUsername.getRequired("xUsername") + /** + * ISO-3166-1 alpha-2 country code of the Driver consumer device used for this login. Present + * only when the US fallback was triggered because Driver had no capacity in the declared + * region. Omitted otherwise. + * + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun loginCountry(): Optional = loginCountry.getOptional("loginCountry") + /** * Returns the raw JSON value of [id]. * @@ -64,6 +106,22 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("createdAt") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt + + /** + * Returns the raw JSON value of [health]. + * + * Unlike [health], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("health") @ExcludeMissing fun _health(): JsonField = health + /** * Returns the raw JSON value of [status]. * @@ -85,6 +143,15 @@ private constructor( */ @JsonProperty("xUsername") @ExcludeMissing fun _xUsername(): JsonField = xUsername + /** + * Returns the raw JSON value of [loginCountry]. + * + * Unlike [loginCountry], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("loginCountry") + @ExcludeMissing + fun _loginCountry(): JsonField = loginCountry + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -105,6 +172,8 @@ private constructor( * The following fields are required: * ```java * .id() + * .createdAt() + * .health() * .status() * .xUserId() * .xUsername() @@ -117,17 +186,23 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null + private var createdAt: JsonField? = null + private var health: JsonField? = null private var status: JsonField? = null private var xUserId: JsonField? = null private var xUsername: JsonField? = null + private var loginCountry: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(accountCreateResponse: AccountCreateResponse) = apply { id = accountCreateResponse.id + createdAt = accountCreateResponse.createdAt + health = accountCreateResponse.health status = accountCreateResponse.status xUserId = accountCreateResponse.xUserId xUsername = accountCreateResponse.xUsername + loginCountry = accountCreateResponse.loginCountry additionalProperties = accountCreateResponse.additionalProperties.toMutableMap() } @@ -141,6 +216,27 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + fun health(health: Health) = health(JsonField.of(health)) + + /** + * Sets [Builder.health] to an arbitrary JSON value. + * + * You should usually call [Builder.health] with a well-typed [Health] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun health(health: JsonField) = apply { this.health = health } + fun status(status: String) = status(JsonField.of(status)) /** @@ -172,6 +268,24 @@ private constructor( */ fun xUsername(xUsername: JsonField) = apply { this.xUsername = xUsername } + /** + * ISO-3166-1 alpha-2 country code of the Driver consumer device used for this login. + * Present only when the US fallback was triggered because Driver had no capacity in the + * declared region. Omitted otherwise. + */ + fun loginCountry(loginCountry: String) = loginCountry(JsonField.of(loginCountry)) + + /** + * Sets [Builder.loginCountry] to an arbitrary JSON value. + * + * You should usually call [Builder.loginCountry] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun loginCountry(loginCountry: JsonField) = apply { + this.loginCountry = loginCountry + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -199,6 +313,8 @@ private constructor( * The following fields are required: * ```java * .id() + * .createdAt() + * .health() * .status() * .xUserId() * .xUsername() @@ -209,9 +325,12 @@ private constructor( fun build(): AccountCreateResponse = AccountCreateResponse( checkRequired("id", id), + checkRequired("createdAt", createdAt), + checkRequired("health", health), checkRequired("status", status), checkRequired("xUserId", xUserId), checkRequired("xUsername", xUsername), + loginCountry, additionalProperties.toMutableMap(), ) } @@ -224,9 +343,12 @@ private constructor( } id() + createdAt() + health().validate() status() xUserId() xUsername() + loginCountry() validated = true } @@ -246,9 +368,163 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (health.asKnown().getOrNull()?.validity() ?: 0) + (if (status.asKnown().isPresent) 1 else 0) + (if (xUserId.asKnown().isPresent) 1 else 0) + - (if (xUsername.asKnown().isPresent) 1 else 0) + (if (xUsername.asKnown().isPresent) 1 else 0) + + (if (loginCountry.asKnown().isPresent) 1 else 0) + + class Health @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val HEALTHY = of("healthy") + + @JvmField val LOCKED = of("locked") + + @JvmField val NEEDS_REAUTH = of("needsReauth") + + @JvmField val RECOVERING = of("recovering") + + @JvmField val SUSPENDED = of("suspended") + + @JvmField val TEMPORARY_ISSUE = of("temporaryIssue") + + @JvmStatic fun of(value: String) = Health(JsonField.of(value)) + } + + /** An enum containing [Health]'s known values. */ + enum class Known { + HEALTHY, + LOCKED, + NEEDS_REAUTH, + RECOVERING, + SUSPENDED, + TEMPORARY_ISSUE, + } + + /** + * An enum containing [Health]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Health] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + HEALTHY, + LOCKED, + NEEDS_REAUTH, + RECOVERING, + SUSPENDED, + TEMPORARY_ISSUE, + /** An enum member indicating that [Health] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + HEALTHY -> Value.HEALTHY + LOCKED -> Value.LOCKED + NEEDS_REAUTH -> Value.NEEDS_REAUTH + RECOVERING -> Value.RECOVERING + SUSPENDED -> Value.SUSPENDED + TEMPORARY_ISSUE -> Value.TEMPORARY_ISSUE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws XTwitterScraperInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + HEALTHY -> Known.HEALTHY + LOCKED -> Known.LOCKED + NEEDS_REAUTH -> Known.NEEDS_REAUTH + RECOVERING -> Known.RECOVERING + SUSPENDED -> Known.SUSPENDED + TEMPORARY_ISSUE -> Known.TEMPORARY_ISSUE + else -> throw XTwitterScraperInvalidDataException("Unknown Health: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws XTwitterScraperInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + XTwitterScraperInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Health = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: XTwitterScraperInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Health && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -257,18 +533,30 @@ private constructor( return other is AccountCreateResponse && id == other.id && + createdAt == other.createdAt && + health == other.health && status == other.status && xUserId == other.xUserId && xUsername == other.xUsername && + loginCountry == other.loginCountry && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(id, status, xUserId, xUsername, additionalProperties) + Objects.hash( + id, + createdAt, + health, + status, + xUserId, + xUsername, + loginCountry, + additionalProperties, + ) } override fun hashCode(): Int = hashCode override fun toString() = - "AccountCreateResponse{id=$id, status=$status, xUserId=$xUserId, xUsername=$xUsername, additionalProperties=$additionalProperties}" + "AccountCreateResponse{id=$id, createdAt=$createdAt, health=$health, status=$status, xUserId=$xUserId, xUsername=$xUsername, loginCountry=$loginCountry, additionalProperties=$additionalProperties}" } diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountReauthParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountReauthParams.kt index b40e086..c222c69 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountReauthParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountReauthParams.kt @@ -39,6 +39,22 @@ private constructor( */ fun password(): String = body.password() + /** + * Email for the X account (updates stored email) + * + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun email(): Optional = body.email() + + /** + * Two-letter country code for login proxy region + * + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun proxyCountry(): Optional = body.proxyCountry() + /** * TOTP secret for 2FA re-authentication * @@ -54,6 +70,20 @@ private constructor( */ fun _password(): JsonField = body._password() + /** + * Returns the raw JSON value of [email]. + * + * Unlike [email], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _email(): JsonField = body._email() + + /** + * Returns the raw JSON value of [proxyCountry]. + * + * Unlike [proxyCountry], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _proxyCountry(): JsonField = body._proxyCountry() + /** * Returns the raw JSON value of [totpSecret]. * @@ -111,6 +141,8 @@ private constructor( * This is generally only useful if you are already constructing the body separately. * Otherwise, it's more convenient to use the top-level setters instead: * - [password] + * - [email] + * - [proxyCountry] * - [totpSecret] */ fun body(body: Body) = apply { this.body = body.toBuilder() } @@ -126,6 +158,31 @@ private constructor( */ fun password(password: JsonField) = apply { body.password(password) } + /** Email for the X account (updates stored email) */ + fun email(email: String) = apply { body.email(email) } + + /** + * Sets [Builder.email] to an arbitrary JSON value. + * + * You should usually call [Builder.email] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun email(email: JsonField) = apply { body.email(email) } + + /** Two-letter country code for login proxy region */ + fun proxyCountry(proxyCountry: String) = apply { body.proxyCountry(proxyCountry) } + + /** + * Sets [Builder.proxyCountry] to an arbitrary JSON value. + * + * You should usually call [Builder.proxyCountry] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun proxyCountry(proxyCountry: JsonField) = apply { + body.proxyCountry(proxyCountry) + } + /** TOTP secret for 2FA re-authentication */ fun totpSecret(totpSecret: String) = apply { body.totpSecret(totpSecret) } @@ -292,6 +349,8 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val password: JsonField, + private val email: JsonField, + private val proxyCountry: JsonField, private val totpSecret: JsonField, private val additionalProperties: MutableMap, ) { @@ -301,10 +360,14 @@ private constructor( @JsonProperty("password") @ExcludeMissing password: JsonField = JsonMissing.of(), + @JsonProperty("email") @ExcludeMissing email: JsonField = JsonMissing.of(), + @JsonProperty("proxy_country") + @ExcludeMissing + proxyCountry: JsonField = JsonMissing.of(), @JsonProperty("totp_secret") @ExcludeMissing totpSecret: JsonField = JsonMissing.of(), - ) : this(password, totpSecret, mutableMapOf()) + ) : this(password, email, proxyCountry, totpSecret, mutableMapOf()) /** * Updated account password @@ -315,6 +378,22 @@ private constructor( */ fun password(): String = password.getRequired("password") + /** + * Email for the X account (updates stored email) + * + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun email(): Optional = email.getOptional("email") + + /** + * Two-letter country code for login proxy region + * + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun proxyCountry(): Optional = proxyCountry.getOptional("proxy_country") + /** * TOTP secret for 2FA re-authentication * @@ -330,6 +409,23 @@ private constructor( */ @JsonProperty("password") @ExcludeMissing fun _password(): JsonField = password + /** + * Returns the raw JSON value of [email]. + * + * Unlike [email], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("email") @ExcludeMissing fun _email(): JsonField = email + + /** + * Returns the raw JSON value of [proxyCountry]. + * + * Unlike [proxyCountry], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("proxy_country") + @ExcludeMissing + fun _proxyCountry(): JsonField = proxyCountry + /** * Returns the raw JSON value of [totpSecret]. * @@ -368,12 +464,16 @@ private constructor( class Builder internal constructor() { private var password: JsonField? = null + private var email: JsonField = JsonMissing.of() + private var proxyCountry: JsonField = JsonMissing.of() private var totpSecret: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(body: Body) = apply { password = body.password + email = body.email + proxyCountry = body.proxyCountry totpSecret = body.totpSecret additionalProperties = body.additionalProperties.toMutableMap() } @@ -390,6 +490,32 @@ private constructor( */ fun password(password: JsonField) = apply { this.password = password } + /** Email for the X account (updates stored email) */ + fun email(email: String) = email(JsonField.of(email)) + + /** + * Sets [Builder.email] to an arbitrary JSON value. + * + * You should usually call [Builder.email] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun email(email: JsonField) = apply { this.email = email } + + /** Two-letter country code for login proxy region */ + fun proxyCountry(proxyCountry: String) = proxyCountry(JsonField.of(proxyCountry)) + + /** + * Sets [Builder.proxyCountry] to an arbitrary JSON value. + * + * You should usually call [Builder.proxyCountry] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun proxyCountry(proxyCountry: JsonField) = apply { + this.proxyCountry = proxyCountry + } + /** TOTP secret for 2FA re-authentication */ fun totpSecret(totpSecret: String) = totpSecret(JsonField.of(totpSecret)) @@ -436,6 +562,8 @@ private constructor( fun build(): Body = Body( checkRequired("password", password), + email, + proxyCountry, totpSecret, additionalProperties.toMutableMap(), ) @@ -449,6 +577,8 @@ private constructor( } password() + email() + proxyCountry() totpSecret() validated = true } @@ -470,6 +600,8 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (password.asKnown().isPresent) 1 else 0) + + (if (email.asKnown().isPresent) 1 else 0) + + (if (proxyCountry.asKnown().isPresent) 1 else 0) + (if (totpSecret.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { @@ -479,18 +611,20 @@ private constructor( return other is Body && password == other.password && + email == other.email && + proxyCountry == other.proxyCountry && totpSecret == other.totpSecret && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(password, totpSecret, additionalProperties) + Objects.hash(password, email, proxyCountry, totpSecret, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Body{password=$password, totpSecret=$totpSecret, additionalProperties=$additionalProperties}" + "Body{password=$password, email=$email, proxyCountry=$proxyCountry, totpSecret=$totpSecret, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountReauthResponse.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountReauthResponse.kt index 04a250d..dfb71df 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountReauthResponse.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountReauthResponse.kt @@ -6,30 +6,52 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty +import com.x_twitter_scraper.api.core.Enum import com.x_twitter_scraper.api.core.ExcludeMissing import com.x_twitter_scraper.api.core.JsonField import com.x_twitter_scraper.api.core.JsonMissing import com.x_twitter_scraper.api.core.JsonValue import com.x_twitter_scraper.api.core.checkRequired import com.x_twitter_scraper.api.errors.XTwitterScraperInvalidDataException +import java.time.OffsetDateTime import java.util.Collections import java.util.Objects - +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Sanitized X account summary returned by connect and reauth. Includes an optional `loginCountry` + * field surfaced only when the declared proxy region had no Driver capacity and the login fell back + * to a single US consumer device for this one-time action. Future activity continues to use the + * selected `proxy_country`; the field is omitted on normal logins. + */ class AccountReauthResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val id: JsonField, + private val createdAt: JsonField, + private val health: JsonField, private val status: JsonField, + private val xUserId: JsonField, private val xUsername: JsonField, + private val loginCountry: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("createdAt") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("health") @ExcludeMissing health: JsonField = JsonMissing.of(), @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("xUserId") @ExcludeMissing xUserId: JsonField = JsonMissing.of(), @JsonProperty("xUsername") @ExcludeMissing xUsername: JsonField = JsonMissing.of(), - ) : this(id, status, xUsername, mutableMapOf()) + @JsonProperty("loginCountry") + @ExcludeMissing + loginCountry: JsonField = JsonMissing.of(), + ) : this(id, createdAt, health, status, xUserId, xUsername, loginCountry, mutableMapOf()) /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is @@ -37,18 +59,46 @@ private constructor( */ fun id(): String = id.getRequired("id") + /** + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun createdAt(): OffsetDateTime = createdAt.getRequired("createdAt") + + /** + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun health(): Health = health.getRequired("health") + /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun status(): String = status.getRequired("status") + /** + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun xUserId(): String = xUserId.getRequired("xUserId") + /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ fun xUsername(): String = xUsername.getRequired("xUsername") + /** + * ISO-3166-1 alpha-2 country code of the Driver consumer device used for this login. Present + * only when the US fallback was triggered because Driver had no capacity in the declared + * region. Omitted otherwise. + * + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun loginCountry(): Optional = loginCountry.getOptional("loginCountry") + /** * Returns the raw JSON value of [id]. * @@ -56,6 +106,22 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("createdAt") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt + + /** + * Returns the raw JSON value of [health]. + * + * Unlike [health], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("health") @ExcludeMissing fun _health(): JsonField = health + /** * Returns the raw JSON value of [status]. * @@ -63,6 +129,13 @@ private constructor( */ @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + /** + * Returns the raw JSON value of [xUserId]. + * + * Unlike [xUserId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("xUserId") @ExcludeMissing fun _xUserId(): JsonField = xUserId + /** * Returns the raw JSON value of [xUsername]. * @@ -70,6 +143,15 @@ private constructor( */ @JsonProperty("xUsername") @ExcludeMissing fun _xUsername(): JsonField = xUsername + /** + * Returns the raw JSON value of [loginCountry]. + * + * Unlike [loginCountry], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("loginCountry") + @ExcludeMissing + fun _loginCountry(): JsonField = loginCountry + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -90,7 +172,10 @@ private constructor( * The following fields are required: * ```java * .id() + * .createdAt() + * .health() * .status() + * .xUserId() * .xUsername() * ``` */ @@ -101,15 +186,23 @@ private constructor( class Builder internal constructor() { private var id: JsonField? = null + private var createdAt: JsonField? = null + private var health: JsonField? = null private var status: JsonField? = null + private var xUserId: JsonField? = null private var xUsername: JsonField? = null + private var loginCountry: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(accountReauthResponse: AccountReauthResponse) = apply { id = accountReauthResponse.id + createdAt = accountReauthResponse.createdAt + health = accountReauthResponse.health status = accountReauthResponse.status + xUserId = accountReauthResponse.xUserId xUsername = accountReauthResponse.xUsername + loginCountry = accountReauthResponse.loginCountry additionalProperties = accountReauthResponse.additionalProperties.toMutableMap() } @@ -123,6 +216,27 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + fun health(health: Health) = health(JsonField.of(health)) + + /** + * Sets [Builder.health] to an arbitrary JSON value. + * + * You should usually call [Builder.health] with a well-typed [Health] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun health(health: JsonField) = apply { this.health = health } + fun status(status: String) = status(JsonField.of(status)) /** @@ -133,6 +247,16 @@ private constructor( */ fun status(status: JsonField) = apply { this.status = status } + fun xUserId(xUserId: String) = xUserId(JsonField.of(xUserId)) + + /** + * Sets [Builder.xUserId] to an arbitrary JSON value. + * + * You should usually call [Builder.xUserId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun xUserId(xUserId: JsonField) = apply { this.xUserId = xUserId } + fun xUsername(xUsername: String) = xUsername(JsonField.of(xUsername)) /** @@ -144,6 +268,24 @@ private constructor( */ fun xUsername(xUsername: JsonField) = apply { this.xUsername = xUsername } + /** + * ISO-3166-1 alpha-2 country code of the Driver consumer device used for this login. + * Present only when the US fallback was triggered because Driver had no capacity in the + * declared region. Omitted otherwise. + */ + fun loginCountry(loginCountry: String) = loginCountry(JsonField.of(loginCountry)) + + /** + * Sets [Builder.loginCountry] to an arbitrary JSON value. + * + * You should usually call [Builder.loginCountry] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun loginCountry(loginCountry: JsonField) = apply { + this.loginCountry = loginCountry + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -171,7 +313,10 @@ private constructor( * The following fields are required: * ```java * .id() + * .createdAt() + * .health() * .status() + * .xUserId() * .xUsername() * ``` * @@ -180,8 +325,12 @@ private constructor( fun build(): AccountReauthResponse = AccountReauthResponse( checkRequired("id", id), + checkRequired("createdAt", createdAt), + checkRequired("health", health), checkRequired("status", status), + checkRequired("xUserId", xUserId), checkRequired("xUsername", xUsername), + loginCountry, additionalProperties.toMutableMap(), ) } @@ -194,8 +343,12 @@ private constructor( } id() + createdAt() + health().validate() status() + xUserId() xUsername() + loginCountry() validated = true } @@ -215,8 +368,163 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (health.asKnown().getOrNull()?.validity() ?: 0) + (if (status.asKnown().isPresent) 1 else 0) + - (if (xUsername.asKnown().isPresent) 1 else 0) + (if (xUserId.asKnown().isPresent) 1 else 0) + + (if (xUsername.asKnown().isPresent) 1 else 0) + + (if (loginCountry.asKnown().isPresent) 1 else 0) + + class Health @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val HEALTHY = of("healthy") + + @JvmField val LOCKED = of("locked") + + @JvmField val NEEDS_REAUTH = of("needsReauth") + + @JvmField val RECOVERING = of("recovering") + + @JvmField val SUSPENDED = of("suspended") + + @JvmField val TEMPORARY_ISSUE = of("temporaryIssue") + + @JvmStatic fun of(value: String) = Health(JsonField.of(value)) + } + + /** An enum containing [Health]'s known values. */ + enum class Known { + HEALTHY, + LOCKED, + NEEDS_REAUTH, + RECOVERING, + SUSPENDED, + TEMPORARY_ISSUE, + } + + /** + * An enum containing [Health]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Health] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + HEALTHY, + LOCKED, + NEEDS_REAUTH, + RECOVERING, + SUSPENDED, + TEMPORARY_ISSUE, + /** An enum member indicating that [Health] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + HEALTHY -> Value.HEALTHY + LOCKED -> Value.LOCKED + NEEDS_REAUTH -> Value.NEEDS_REAUTH + RECOVERING -> Value.RECOVERING + SUSPENDED -> Value.SUSPENDED + TEMPORARY_ISSUE -> Value.TEMPORARY_ISSUE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws XTwitterScraperInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + HEALTHY -> Known.HEALTHY + LOCKED -> Known.LOCKED + NEEDS_REAUTH -> Known.NEEDS_REAUTH + RECOVERING -> Known.RECOVERING + SUSPENDED -> Known.SUSPENDED + TEMPORARY_ISSUE -> Known.TEMPORARY_ISSUE + else -> throw XTwitterScraperInvalidDataException("Unknown Health: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws XTwitterScraperInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + XTwitterScraperInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Health = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: XTwitterScraperInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Health && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -225,15 +533,30 @@ private constructor( return other is AccountReauthResponse && id == other.id && + createdAt == other.createdAt && + health == other.health && status == other.status && + xUserId == other.xUserId && xUsername == other.xUsername && + loginCountry == other.loginCountry && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(id, status, xUsername, additionalProperties) } + private val hashCode: Int by lazy { + Objects.hash( + id, + createdAt, + health, + status, + xUserId, + xUsername, + loginCountry, + additionalProperties, + ) + } override fun hashCode(): Int = hashCode override fun toString() = - "AccountReauthResponse{id=$id, status=$status, xUsername=$xUsername, additionalProperties=$additionalProperties}" + "AccountReauthResponse{id=$id, createdAt=$createdAt, health=$health, status=$status, xUserId=$xUserId, xUsername=$xUsername, loginCountry=$loginCountry, additionalProperties=$additionalProperties}" } diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/XAccount.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/XAccount.kt index fab341e..95cc4ca 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/XAccount.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/XAccount.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty +import com.x_twitter_scraper.api.core.Enum import com.x_twitter_scraper.api.core.ExcludeMissing import com.x_twitter_scraper.api.core.JsonField import com.x_twitter_scraper.api.core.JsonMissing @@ -15,6 +16,7 @@ import com.x_twitter_scraper.api.errors.XTwitterScraperInvalidDataException import java.time.OffsetDateTime import java.util.Collections import java.util.Objects +import kotlin.jvm.optionals.getOrNull /** Linked X account summary with username and connection status. */ class XAccount @@ -22,6 +24,7 @@ class XAccount private constructor( private val id: JsonField, private val createdAt: JsonField, + private val health: JsonField, private val status: JsonField, private val xUserId: JsonField, private val xUsername: JsonField, @@ -34,10 +37,11 @@ private constructor( @JsonProperty("createdAt") @ExcludeMissing createdAt: JsonField = JsonMissing.of(), + @JsonProperty("health") @ExcludeMissing health: JsonField = JsonMissing.of(), @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), @JsonProperty("xUserId") @ExcludeMissing xUserId: JsonField = JsonMissing.of(), @JsonProperty("xUsername") @ExcludeMissing xUsername: JsonField = JsonMissing.of(), - ) : this(id, createdAt, status, xUserId, xUsername, mutableMapOf()) + ) : this(id, createdAt, health, status, xUserId, xUsername, mutableMapOf()) /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is @@ -51,6 +55,17 @@ private constructor( */ fun createdAt(): OffsetDateTime = createdAt.getRequired("createdAt") + /** + * Derived login/cookie health. `healthy` = cookies valid. `needsReauth` = user must submit + * fresh credentials. `locked` = X locked the account; unlock on x.com first. `suspended` = X + * banned the account. `recovering` = past cooldown, will auto-retry on next use. + * `temporaryIssue` = transient backend problem; retry shortly. + * + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun health(): Health = health.getRequired("health") + /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -85,6 +100,13 @@ private constructor( @ExcludeMissing fun _createdAt(): JsonField = createdAt + /** + * Returns the raw JSON value of [health]. + * + * Unlike [health], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("health") @ExcludeMissing fun _health(): JsonField = health + /** * Returns the raw JSON value of [status]. * @@ -127,6 +149,7 @@ private constructor( * ```java * .id() * .createdAt() + * .health() * .status() * .xUserId() * .xUsername() @@ -140,6 +163,7 @@ private constructor( private var id: JsonField? = null private var createdAt: JsonField? = null + private var health: JsonField? = null private var status: JsonField? = null private var xUserId: JsonField? = null private var xUsername: JsonField? = null @@ -149,6 +173,7 @@ private constructor( internal fun from(xAccount: XAccount) = apply { id = xAccount.id createdAt = xAccount.createdAt + health = xAccount.health status = xAccount.status xUserId = xAccount.xUserId xUsername = xAccount.xUsername @@ -176,6 +201,22 @@ private constructor( */ fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + /** + * Derived login/cookie health. `healthy` = cookies valid. `needsReauth` = user must submit + * fresh credentials. `locked` = X locked the account; unlock on x.com first. `suspended` = + * X banned the account. `recovering` = past cooldown, will auto-retry on next use. + * `temporaryIssue` = transient backend problem; retry shortly. + */ + fun health(health: Health) = health(JsonField.of(health)) + + /** + * Sets [Builder.health] to an arbitrary JSON value. + * + * You should usually call [Builder.health] with a well-typed [Health] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun health(health: JsonField) = apply { this.health = health } + fun status(status: String) = status(JsonField.of(status)) /** @@ -235,6 +276,7 @@ private constructor( * ```java * .id() * .createdAt() + * .health() * .status() * .xUserId() * .xUsername() @@ -246,6 +288,7 @@ private constructor( XAccount( checkRequired("id", id), checkRequired("createdAt", createdAt), + checkRequired("health", health), checkRequired("status", status), checkRequired("xUserId", xUserId), checkRequired("xUsername", xUsername), @@ -262,6 +305,7 @@ private constructor( id() createdAt() + health().validate() status() xUserId() xUsername() @@ -285,10 +329,168 @@ private constructor( internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + (if (createdAt.asKnown().isPresent) 1 else 0) + + (health.asKnown().getOrNull()?.validity() ?: 0) + (if (status.asKnown().isPresent) 1 else 0) + (if (xUserId.asKnown().isPresent) 1 else 0) + (if (xUsername.asKnown().isPresent) 1 else 0) + /** + * Derived login/cookie health. `healthy` = cookies valid. `needsReauth` = user must submit + * fresh credentials. `locked` = X locked the account; unlock on x.com first. `suspended` = X + * banned the account. `recovering` = past cooldown, will auto-retry on next use. + * `temporaryIssue` = transient backend problem; retry shortly. + */ + class Health @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val HEALTHY = of("healthy") + + @JvmField val LOCKED = of("locked") + + @JvmField val NEEDS_REAUTH = of("needsReauth") + + @JvmField val RECOVERING = of("recovering") + + @JvmField val SUSPENDED = of("suspended") + + @JvmField val TEMPORARY_ISSUE = of("temporaryIssue") + + @JvmStatic fun of(value: String) = Health(JsonField.of(value)) + } + + /** An enum containing [Health]'s known values. */ + enum class Known { + HEALTHY, + LOCKED, + NEEDS_REAUTH, + RECOVERING, + SUSPENDED, + TEMPORARY_ISSUE, + } + + /** + * An enum containing [Health]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Health] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + HEALTHY, + LOCKED, + NEEDS_REAUTH, + RECOVERING, + SUSPENDED, + TEMPORARY_ISSUE, + /** An enum member indicating that [Health] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + HEALTHY -> Value.HEALTHY + LOCKED -> Value.LOCKED + NEEDS_REAUTH -> Value.NEEDS_REAUTH + RECOVERING -> Value.RECOVERING + SUSPENDED -> Value.SUSPENDED + TEMPORARY_ISSUE -> Value.TEMPORARY_ISSUE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws XTwitterScraperInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + HEALTHY -> Known.HEALTHY + LOCKED -> Known.LOCKED + NEEDS_REAUTH -> Known.NEEDS_REAUTH + RECOVERING -> Known.RECOVERING + SUSPENDED -> Known.SUSPENDED + TEMPORARY_ISSUE -> Known.TEMPORARY_ISSUE + else -> throw XTwitterScraperInvalidDataException("Unknown Health: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws XTwitterScraperInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + XTwitterScraperInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Health = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: XTwitterScraperInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Health && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -297,6 +499,7 @@ private constructor( return other is XAccount && id == other.id && createdAt == other.createdAt && + health == other.health && status == other.status && xUserId == other.xUserId && xUsername == other.xUsername && @@ -304,11 +507,11 @@ private constructor( } private val hashCode: Int by lazy { - Objects.hash(id, createdAt, status, xUserId, xUsername, additionalProperties) + Objects.hash(id, createdAt, health, status, xUserId, xUsername, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "XAccount{id=$id, createdAt=$createdAt, status=$status, xUserId=$xUserId, xUsername=$xUsername, additionalProperties=$additionalProperties}" + "XAccount{id=$id, createdAt=$createdAt, health=$health, status=$status, xUserId=$xUserId, xUsername=$xUsername, additionalProperties=$additionalProperties}" } diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/XAccountDetail.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/XAccountDetail.kt index a984393..625d327 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/XAccountDetail.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/accounts/XAccountDetail.kt @@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty +import com.x_twitter_scraper.api.core.Enum import com.x_twitter_scraper.api.core.ExcludeMissing import com.x_twitter_scraper.api.core.JsonField import com.x_twitter_scraper.api.core.JsonMissing @@ -16,6 +17,7 @@ import java.time.OffsetDateTime import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull /** Full X account details including proxy, cookies, and update timestamp. */ class XAccountDetail @@ -23,6 +25,7 @@ class XAccountDetail private constructor( private val id: JsonField, private val createdAt: JsonField, + private val health: JsonField, private val status: JsonField, private val xUserId: JsonField, private val xUsername: JsonField, @@ -38,6 +41,7 @@ private constructor( @JsonProperty("createdAt") @ExcludeMissing createdAt: JsonField = JsonMissing.of(), + @JsonProperty("health") @ExcludeMissing health: JsonField = JsonMissing.of(), @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), @JsonProperty("xUserId") @ExcludeMissing xUserId: JsonField = JsonMissing.of(), @JsonProperty("xUsername") @ExcludeMissing xUsername: JsonField = JsonMissing.of(), @@ -53,6 +57,7 @@ private constructor( ) : this( id, createdAt, + health, status, xUserId, xUsername, @@ -74,6 +79,12 @@ private constructor( */ fun createdAt(): OffsetDateTime = createdAt.getRequired("createdAt") + /** + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun health(): Health = health.getRequired("health") + /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -127,6 +138,13 @@ private constructor( @ExcludeMissing fun _createdAt(): JsonField = createdAt + /** + * Returns the raw JSON value of [health]. + * + * Unlike [health], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("health") @ExcludeMissing fun _health(): JsonField = health + /** * Returns the raw JSON value of [status]. * @@ -197,6 +215,7 @@ private constructor( * ```java * .id() * .createdAt() + * .health() * .status() * .xUserId() * .xUsername() @@ -210,6 +229,7 @@ private constructor( private var id: JsonField? = null private var createdAt: JsonField? = null + private var health: JsonField? = null private var status: JsonField? = null private var xUserId: JsonField? = null private var xUsername: JsonField? = null @@ -222,6 +242,7 @@ private constructor( internal fun from(xAccountDetail: XAccountDetail) = apply { id = xAccountDetail.id createdAt = xAccountDetail.createdAt + health = xAccountDetail.health status = xAccountDetail.status xUserId = xAccountDetail.xUserId xUsername = xAccountDetail.xUsername @@ -252,6 +273,16 @@ private constructor( */ fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + fun health(health: Health) = health(JsonField.of(health)) + + /** + * Sets [Builder.health] to an arbitrary JSON value. + * + * You should usually call [Builder.health] with a well-typed [Health] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun health(health: JsonField) = apply { this.health = health } + fun status(status: String) = status(JsonField.of(status)) /** @@ -349,6 +380,7 @@ private constructor( * ```java * .id() * .createdAt() + * .health() * .status() * .xUserId() * .xUsername() @@ -360,6 +392,7 @@ private constructor( XAccountDetail( checkRequired("id", id), checkRequired("createdAt", createdAt), + checkRequired("health", health), checkRequired("status", status), checkRequired("xUserId", xUserId), checkRequired("xUsername", xUsername), @@ -379,6 +412,7 @@ private constructor( id() createdAt() + health().validate() status() xUserId() xUsername() @@ -405,6 +439,7 @@ private constructor( internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + (if (createdAt.asKnown().isPresent) 1 else 0) + + (health.asKnown().getOrNull()?.validity() ?: 0) + (if (status.asKnown().isPresent) 1 else 0) + (if (xUserId.asKnown().isPresent) 1 else 0) + (if (xUsername.asKnown().isPresent) 1 else 0) + @@ -412,6 +447,157 @@ private constructor( (if (proxyCountry.asKnown().isPresent) 1 else 0) + (if (updatedAt.asKnown().isPresent) 1 else 0) + class Health @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val HEALTHY = of("healthy") + + @JvmField val LOCKED = of("locked") + + @JvmField val NEEDS_REAUTH = of("needsReauth") + + @JvmField val RECOVERING = of("recovering") + + @JvmField val SUSPENDED = of("suspended") + + @JvmField val TEMPORARY_ISSUE = of("temporaryIssue") + + @JvmStatic fun of(value: String) = Health(JsonField.of(value)) + } + + /** An enum containing [Health]'s known values. */ + enum class Known { + HEALTHY, + LOCKED, + NEEDS_REAUTH, + RECOVERING, + SUSPENDED, + TEMPORARY_ISSUE, + } + + /** + * An enum containing [Health]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Health] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + HEALTHY, + LOCKED, + NEEDS_REAUTH, + RECOVERING, + SUSPENDED, + TEMPORARY_ISSUE, + /** An enum member indicating that [Health] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + HEALTHY -> Value.HEALTHY + LOCKED -> Value.LOCKED + NEEDS_REAUTH -> Value.NEEDS_REAUTH + RECOVERING -> Value.RECOVERING + SUSPENDED -> Value.SUSPENDED + TEMPORARY_ISSUE -> Value.TEMPORARY_ISSUE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws XTwitterScraperInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + HEALTHY -> Known.HEALTHY + LOCKED -> Known.LOCKED + NEEDS_REAUTH -> Known.NEEDS_REAUTH + RECOVERING -> Known.RECOVERING + SUSPENDED -> Known.SUSPENDED + TEMPORARY_ISSUE -> Known.TEMPORARY_ISSUE + else -> throw XTwitterScraperInvalidDataException("Unknown Health: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws XTwitterScraperInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + XTwitterScraperInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Health = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: XTwitterScraperInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Health && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -420,6 +606,7 @@ private constructor( return other is XAccountDetail && id == other.id && createdAt == other.createdAt && + health == other.health && status == other.status && xUserId == other.xUserId && xUsername == other.xUsername && @@ -433,6 +620,7 @@ private constructor( Objects.hash( id, createdAt, + health, status, xUserId, xUsername, @@ -446,5 +634,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "XAccountDetail{id=$id, createdAt=$createdAt, status=$status, xUserId=$xUserId, xUsername=$xUsername, cookiesObtainedAt=$cookiesObtainedAt, proxyCountry=$proxyCountry, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" + "XAccountDetail{id=$id, createdAt=$createdAt, health=$health, status=$status, xUserId=$xUserId, xUsername=$xUsername, cookiesObtainedAt=$cookiesObtainedAt, proxyCountry=$proxyCountry, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" } diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/CommunityRetrieveInfoParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/CommunityRetrieveInfoParams.kt index 8932949..620a02d 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/CommunityRetrieveInfoParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/CommunityRetrieveInfoParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get community details */ +/** Get community name, description and member count */ class CommunityRetrieveInfoParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/CommunityRetrieveMembersParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/CommunityRetrieveMembersParams.kt index 86bbaa4..2c88d8b 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/CommunityRetrieveMembersParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/CommunityRetrieveMembersParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get community members */ +/** List members of a community */ class CommunityRetrieveMembersParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/CommunityRetrieveModeratorsParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/CommunityRetrieveModeratorsParams.kt index a4a087b..3228fba 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/CommunityRetrieveModeratorsParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/CommunityRetrieveModeratorsParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get community moderators */ +/** List moderators of a community */ class CommunityRetrieveModeratorsParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/CommunityRetrieveSearchParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/CommunityRetrieveSearchParams.kt index d44f20d..120265e 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/CommunityRetrieveSearchParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/CommunityRetrieveSearchParams.kt @@ -10,7 +10,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Search tweets across communities */ +/** Search for communities by keyword */ class CommunityRetrieveSearchParams private constructor( private val q: String, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/tweets/TweetListByCommunityParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/tweets/TweetListByCommunityParams.kt index 1c53e5f..3ef173a 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/tweets/TweetListByCommunityParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/tweets/TweetListByCommunityParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get community tweets */ +/** List tweets posted in a community */ class TweetListByCommunityParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/tweets/TweetListParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/tweets/TweetListParams.kt index a90aee5..46b5ea9 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/tweets/TweetListParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/communities/tweets/TweetListParams.kt @@ -10,7 +10,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Search tweets across all communities */ +/** List tweets across all communities */ class TweetListParams private constructor( private val q: String, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/followers/FollowerCheckParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/followers/FollowerCheckParams.kt index e74d12f..79d9542 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/followers/FollowerCheckParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/followers/FollowerCheckParams.kt @@ -8,7 +8,7 @@ import com.x_twitter_scraper.api.core.http.Headers import com.x_twitter_scraper.api.core.http.QueryParams import java.util.Objects -/** Check follow relationship */ +/** Check if one user follows another */ class FollowerCheckParams private constructor( private val source: String, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/lists/ListRetrieveFollowersParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/lists/ListRetrieveFollowersParams.kt index 4342b44..4f1eb90 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/lists/ListRetrieveFollowersParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/lists/ListRetrieveFollowersParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get list followers */ +/** List followers of an X List */ class ListRetrieveFollowersParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/lists/ListRetrieveMembersParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/lists/ListRetrieveMembersParams.kt index 513c702..d99d101 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/lists/ListRetrieveMembersParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/lists/ListRetrieveMembersParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get list members */ +/** List members of an X List */ class ListRetrieveMembersParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/lists/ListRetrieveTweetsParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/lists/ListRetrieveTweetsParams.kt index 1ebcb62..0aac8af 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/lists/ListRetrieveTweetsParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/lists/ListRetrieveTweetsParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get list tweets */ +/** List tweets from an X List */ class ListRetrieveTweetsParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/media/MediaDownloadParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/media/MediaDownloadParams.kt index 73891d7..4d7d503 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/media/MediaDownloadParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/media/MediaDownloadParams.kt @@ -21,7 +21,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Download tweet media */ +/** Download images and videos from tweets */ class MediaDownloadParams private constructor( private val body: Body, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetCreateParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetCreateParams.kt index 96855b5..419a378 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetCreateParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetCreateParams.kt @@ -38,12 +38,6 @@ private constructor( */ fun account(): String = body.account() - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun text(): String = body.text() - /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -63,6 +57,16 @@ private constructor( fun isNoteTweet(): Optional = body.isNoteTweet() /** + * Array of media URLs to attach (mutually exclusive with media_ids) + * + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun media(): Optional> = body.media() + + /** + * Array of media IDs to attach (mutually exclusive with media) + * * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ @@ -75,18 +79,19 @@ private constructor( fun replyToTweetId(): Optional = body.replyToTweetId() /** - * Returns the raw JSON value of [account]. + * Tweet text (optional when media is provided) * - * Unlike [account], this method doesn't throw if the JSON field has an unexpected type. + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). */ - fun _account(): JsonField = body._account() + fun text(): Optional = body.text() /** - * Returns the raw JSON value of [text]. + * Returns the raw JSON value of [account]. * - * Unlike [text], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [account], this method doesn't throw if the JSON field has an unexpected type. */ - fun _text(): JsonField = body._text() + fun _account(): JsonField = body._account() /** * Returns the raw JSON value of [attachmentUrl]. @@ -109,6 +114,13 @@ private constructor( */ fun _isNoteTweet(): JsonField = body._isNoteTweet() + /** + * Returns the raw JSON value of [media]. + * + * Unlike [media], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _media(): JsonField> = body._media() + /** * Returns the raw JSON value of [mediaIds]. * @@ -123,6 +135,13 @@ private constructor( */ fun _replyToTweetId(): JsonField = body._replyToTweetId() + /** + * Returns the raw JSON value of [text]. + * + * Unlike [text], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _text(): JsonField = body._text() + fun _additionalBodyProperties(): Map = body._additionalProperties() /** Additional headers to send with the request. */ @@ -141,7 +160,6 @@ private constructor( * The following fields are required: * ```java * .account() - * .text() * ``` */ @JvmStatic fun builder() = Builder() @@ -167,10 +185,10 @@ private constructor( * This is generally only useful if you are already constructing the body separately. * Otherwise, it's more convenient to use the top-level setters instead: * - [account] - * - [text] * - [attachmentUrl] * - [communityId] * - [isNoteTweet] + * - [media] * - etc. */ fun body(body: Body) = apply { this.body = body.toBuilder() } @@ -186,16 +204,6 @@ private constructor( */ fun account(account: JsonField) = apply { body.account(account) } - fun text(text: String) = apply { body.text(text) } - - /** - * Sets [Builder.text] to an arbitrary JSON value. - * - * You should usually call [Builder.text] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun text(text: JsonField) = apply { body.text(text) } - fun attachmentUrl(attachmentUrl: String) = apply { body.attachmentUrl(attachmentUrl) } /** @@ -231,6 +239,26 @@ private constructor( */ fun isNoteTweet(isNoteTweet: JsonField) = apply { body.isNoteTweet(isNoteTweet) } + /** Array of media URLs to attach (mutually exclusive with media_ids) */ + fun media(media: List) = apply { body.media(media) } + + /** + * Sets [Builder.media] to an arbitrary JSON value. + * + * You should usually call [Builder.media] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun media(media: JsonField>) = apply { body.media(media) } + + /** + * Adds a single [String] to [Builder.media]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addMedia(media: String) = apply { body.addMedia(media) } + + /** Array of media IDs to attach (mutually exclusive with media) */ fun mediaIds(mediaIds: List) = apply { body.mediaIds(mediaIds) } /** @@ -262,6 +290,17 @@ private constructor( body.replyToTweetId(replyToTweetId) } + /** Tweet text (optional when media is provided) */ + fun text(text: String) = apply { body.text(text) } + + /** + * Sets [Builder.text] to an arbitrary JSON value. + * + * You should usually call [Builder.text] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun text(text: JsonField) = apply { body.text(text) } + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { body.additionalProperties(additionalBodyProperties) } @@ -387,7 +426,6 @@ private constructor( * The following fields are required: * ```java * .account() - * .text() * ``` * * @throws IllegalStateException if any required field is unset. @@ -410,19 +448,19 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val account: JsonField, - private val text: JsonField, private val attachmentUrl: JsonField, private val communityId: JsonField, private val isNoteTweet: JsonField, + private val media: JsonField>, private val mediaIds: JsonField>, private val replyToTweetId: JsonField, + private val text: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( @JsonProperty("account") @ExcludeMissing account: JsonField = JsonMissing.of(), - @JsonProperty("text") @ExcludeMissing text: JsonField = JsonMissing.of(), @JsonProperty("attachment_url") @ExcludeMissing attachmentUrl: JsonField = JsonMissing.of(), @@ -432,20 +470,25 @@ private constructor( @JsonProperty("is_note_tweet") @ExcludeMissing isNoteTweet: JsonField = JsonMissing.of(), + @JsonProperty("media") + @ExcludeMissing + media: JsonField> = JsonMissing.of(), @JsonProperty("media_ids") @ExcludeMissing mediaIds: JsonField> = JsonMissing.of(), @JsonProperty("reply_to_tweet_id") @ExcludeMissing replyToTweetId: JsonField = JsonMissing.of(), + @JsonProperty("text") @ExcludeMissing text: JsonField = JsonMissing.of(), ) : this( account, - text, attachmentUrl, communityId, isNoteTweet, + media, mediaIds, replyToTweetId, + text, mutableMapOf(), ) @@ -458,13 +501,6 @@ private constructor( */ fun account(): String = account.getRequired("account") - /** - * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun text(): String = text.getRequired("text") - /** * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -484,6 +520,16 @@ private constructor( fun isNoteTweet(): Optional = isNoteTweet.getOptional("is_note_tweet") /** + * Array of media URLs to attach (mutually exclusive with media_ids) + * + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun media(): Optional> = media.getOptional("media") + + /** + * Array of media IDs to attach (mutually exclusive with media) + * * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ @@ -496,18 +542,19 @@ private constructor( fun replyToTweetId(): Optional = replyToTweetId.getOptional("reply_to_tweet_id") /** - * Returns the raw JSON value of [account]. + * Tweet text (optional when media is provided) * - * Unlike [account], this method doesn't throw if the JSON field has an unexpected type. + * @throws XTwitterScraperInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - @JsonProperty("account") @ExcludeMissing fun _account(): JsonField = account + fun text(): Optional = text.getOptional("text") /** - * Returns the raw JSON value of [text]. + * Returns the raw JSON value of [account]. * - * Unlike [text], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [account], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("text") @ExcludeMissing fun _text(): JsonField = text + @JsonProperty("account") @ExcludeMissing fun _account(): JsonField = account /** * Returns the raw JSON value of [attachmentUrl]. @@ -537,6 +584,13 @@ private constructor( @ExcludeMissing fun _isNoteTweet(): JsonField = isNoteTweet + /** + * Returns the raw JSON value of [media]. + * + * Unlike [media], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("media") @ExcludeMissing fun _media(): JsonField> = media + /** * Returns the raw JSON value of [mediaIds]. * @@ -556,6 +610,13 @@ private constructor( @ExcludeMissing fun _replyToTweetId(): JsonField = replyToTweetId + /** + * Returns the raw JSON value of [text]. + * + * Unlike [text], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("text") @ExcludeMissing fun _text(): JsonField = text + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -576,7 +637,6 @@ private constructor( * The following fields are required: * ```java * .account() - * .text() * ``` */ @JvmStatic fun builder() = Builder() @@ -586,23 +646,25 @@ private constructor( class Builder internal constructor() { private var account: JsonField? = null - private var text: JsonField? = null private var attachmentUrl: JsonField = JsonMissing.of() private var communityId: JsonField = JsonMissing.of() private var isNoteTweet: JsonField = JsonMissing.of() + private var media: JsonField>? = null private var mediaIds: JsonField>? = null private var replyToTweetId: JsonField = JsonMissing.of() + private var text: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(body: Body) = apply { account = body.account - text = body.text attachmentUrl = body.attachmentUrl communityId = body.communityId isNoteTweet = body.isNoteTweet + media = body.media.map { it.toMutableList() } mediaIds = body.mediaIds.map { it.toMutableList() } replyToTweetId = body.replyToTweetId + text = body.text additionalProperties = body.additionalProperties.toMutableMap() } @@ -618,17 +680,6 @@ private constructor( */ fun account(account: JsonField) = apply { this.account = account } - fun text(text: String) = text(JsonField.of(text)) - - /** - * Sets [Builder.text] to an arbitrary JSON value. - * - * You should usually call [Builder.text] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun text(text: JsonField) = apply { this.text = text } - fun attachmentUrl(attachmentUrl: String) = attachmentUrl(JsonField.of(attachmentUrl)) /** @@ -668,6 +719,33 @@ private constructor( this.isNoteTweet = isNoteTweet } + /** Array of media URLs to attach (mutually exclusive with media_ids) */ + fun media(media: List) = media(JsonField.of(media)) + + /** + * Sets [Builder.media] to an arbitrary JSON value. + * + * You should usually call [Builder.media] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun media(media: JsonField>) = apply { + this.media = media.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [Builder.media]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addMedia(media: String) = apply { + this.media = + (this.media ?: JsonField.of(mutableListOf())).also { + checkKnown("media", it).add(media) + } + } + + /** Array of media IDs to attach (mutually exclusive with media) */ fun mediaIds(mediaIds: List) = mediaIds(JsonField.of(mediaIds)) /** @@ -707,6 +785,18 @@ private constructor( this.replyToTweetId = replyToTweetId } + /** Tweet text (optional when media is provided) */ + fun text(text: String) = text(JsonField.of(text)) + + /** + * Sets [Builder.text] to an arbitrary JSON value. + * + * You should usually call [Builder.text] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun text(text: JsonField) = apply { this.text = text } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -734,7 +824,6 @@ private constructor( * The following fields are required: * ```java * .account() - * .text() * ``` * * @throws IllegalStateException if any required field is unset. @@ -742,12 +831,13 @@ private constructor( fun build(): Body = Body( checkRequired("account", account), - checkRequired("text", text), attachmentUrl, communityId, isNoteTweet, + (media ?: JsonMissing.of()).map { it.toImmutable() }, (mediaIds ?: JsonMissing.of()).map { it.toImmutable() }, replyToTweetId, + text, additionalProperties.toMutableMap(), ) } @@ -760,12 +850,13 @@ private constructor( } account() - text() attachmentUrl() communityId() isNoteTweet() + media() mediaIds() replyToTweetId() + text() validated = true } @@ -786,12 +877,13 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (account.asKnown().isPresent) 1 else 0) + - (if (text.asKnown().isPresent) 1 else 0) + (if (attachmentUrl.asKnown().isPresent) 1 else 0) + (if (communityId.asKnown().isPresent) 1 else 0) + (if (isNoteTweet.asKnown().isPresent) 1 else 0) + + (media.asKnown().getOrNull()?.size ?: 0) + (mediaIds.asKnown().getOrNull()?.size ?: 0) + - (if (replyToTweetId.asKnown().isPresent) 1 else 0) + (if (replyToTweetId.asKnown().isPresent) 1 else 0) + + (if (text.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -800,24 +892,26 @@ private constructor( return other is Body && account == other.account && - text == other.text && attachmentUrl == other.attachmentUrl && communityId == other.communityId && isNoteTweet == other.isNoteTweet && + media == other.media && mediaIds == other.mediaIds && replyToTweetId == other.replyToTweetId && + text == other.text && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( account, - text, attachmentUrl, communityId, isNoteTweet, + media, mediaIds, replyToTweetId, + text, additionalProperties, ) } @@ -825,7 +919,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Body{account=$account, text=$text, attachmentUrl=$attachmentUrl, communityId=$communityId, isNoteTweet=$isNoteTweet, mediaIds=$mediaIds, replyToTweetId=$replyToTweetId, additionalProperties=$additionalProperties}" + "Body{account=$account, attachmentUrl=$attachmentUrl, communityId=$communityId, isNoteTweet=$isNoteTweet, media=$media, mediaIds=$mediaIds, replyToTweetId=$replyToTweetId, text=$text, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetGetFavoritersParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetGetFavoritersParams.kt index 595011c..4e37cb6 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetGetFavoritersParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetGetFavoritersParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get users who liked a tweet */ +/** List users who liked a tweet */ class TweetGetFavoritersParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetGetQuotesParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetGetQuotesParams.kt index ef872dc..fb31ae5 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetGetQuotesParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetGetQuotesParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get quote tweets of a tweet */ +/** List quote tweets of a tweet */ class TweetGetQuotesParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetGetRepliesParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetGetRepliesParams.kt index 66d93b6..ec45c72 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetGetRepliesParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetGetRepliesParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get replies to a tweet */ +/** List replies to a tweet */ class TweetGetRepliesParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetGetRetweetersParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetGetRetweetersParams.kt index b964411..a9d8a59 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetGetRetweetersParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetGetRetweetersParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get users who retweeted a tweet */ +/** List users who retweeted a tweet */ class TweetGetRetweetersParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetGetThreadParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetGetThreadParams.kt index a58f7dc..2d1d074 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetGetThreadParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetGetThreadParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get thread context for a tweet */ +/** Get full conversation thread for a tweet */ class TweetGetThreadParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetRetrieveParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetRetrieveParams.kt index dc12b49..1ba5e2a 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetRetrieveParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetRetrieveParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Look up tweet */ +/** Get tweet with full text, author, metrics and media */ class TweetRetrieveParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetSearchParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetSearchParams.kt index 0535b90..19da33d 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetSearchParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetSearchParams.kt @@ -14,7 +14,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Search tweets */ +/** Search tweets with X query operators and pagination */ class TweetSearchParams private constructor( private val q: String, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveBatchParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveBatchParams.kt index 416a6b1..b561495 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveBatchParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveBatchParams.kt @@ -8,7 +8,7 @@ import com.x_twitter_scraper.api.core.http.Headers import com.x_twitter_scraper.api.core.http.QueryParams import java.util.Objects -/** Get multiple users by IDs */ +/** Look up multiple users by IDs in one call */ class UserRetrieveBatchParams private constructor( private val ids: String, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveFollowersParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveFollowersParams.kt index de5767f..d7adf02 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveFollowersParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveFollowersParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get user followers */ +/** List followers of a user */ class UserRetrieveFollowersParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveFollowersYouKnowParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveFollowersYouKnowParams.kt index a481ec2..58be91e 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveFollowersYouKnowParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveFollowersYouKnowParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get followers you know for a user */ +/** List mutual followers between you and a user */ class UserRetrieveFollowersYouKnowParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveFollowingParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveFollowingParams.kt index aa24e7e..8b578be 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveFollowingParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveFollowingParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get users this user follows */ +/** List accounts a user follows */ class UserRetrieveFollowingParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveLikesParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveLikesParams.kt index 23dce02..695625f 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveLikesParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveLikesParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get tweets liked by a user */ +/** List tweets liked by a user */ class UserRetrieveLikesParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveMediaParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveMediaParams.kt index 2391280..239a225 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveMediaParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveMediaParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get media tweets by a user */ +/** List media tweets posted by a user */ class UserRetrieveMediaParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveMentionsParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveMentionsParams.kt index 0c71e3c..58bc9da 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveMentionsParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveMentionsParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get tweets mentioning a user */ +/** List tweets mentioning a user */ class UserRetrieveMentionsParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveParams.kt index 663a911..b6751ba 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Look up X user */ +/** Get user profile with follower counts and verification */ class UserRetrieveParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveTweetsParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveTweetsParams.kt index af8621c..08b6b22 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveTweetsParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveTweetsParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get recent tweets by a user */ +/** List recent tweets posted by a user */ class UserRetrieveTweetsParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveVerifiedFollowersParams.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveVerifiedFollowersParams.kt index acf35e4..023d021 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveVerifiedFollowersParams.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/models/x/users/UserRetrieveVerifiedFollowersParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get verified followers */ +/** List verified followers of a user */ class UserRetrieveVerifiedFollowersParams private constructor( private val id: String?, diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/AccountServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/AccountServiceAsync.kt index 0d8baf7..9871f0b 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/AccountServiceAsync.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/AccountServiceAsync.kt @@ -14,7 +14,7 @@ import com.x_twitter_scraper.api.models.account.AccountUpdateLocaleResponse import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** Account info & settings */ +/** Account info and settings */ interface AccountServiceAsync { /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/AccountServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/AccountServiceAsyncImpl.kt index f18a2d0..4a7c412 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/AccountServiceAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/AccountServiceAsyncImpl.kt @@ -4,7 +4,6 @@ package com.x_twitter_scraper.api.services.async import com.x_twitter_scraper.api.core.ClientOptions import com.x_twitter_scraper.api.core.RequestOptions -import com.x_twitter_scraper.api.core.SecurityOptions import com.x_twitter_scraper.api.core.handlers.errorBodyHandler import com.x_twitter_scraper.api.core.handlers.errorHandler import com.x_twitter_scraper.api.core.handlers.jsonHandler @@ -25,7 +24,7 @@ import com.x_twitter_scraper.api.models.account.AccountUpdateLocaleResponse import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** Account info & settings */ +/** Account info and settings */ class AccountServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : AccountServiceAsync { @@ -85,11 +84,7 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl .baseUrl(clientOptions.baseUrl()) .addPathSegments("account") .build() - .prepareAsync( - clientOptions, - params, - SecurityOptions.builder().apiKey(true).build(), - ) + .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } @@ -151,11 +146,7 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl .addPathSegments("account") .body(json(clientOptions.jsonMapper, params._body())) .build() - .prepareAsync( - clientOptions, - params, - SecurityOptions.builder().apiKey(true).build(), - ) + .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/ApiKeyServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/ApiKeyServiceAsyncImpl.kt index 4b30a08..a067cba 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/ApiKeyServiceAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/ApiKeyServiceAsyncImpl.kt @@ -4,7 +4,6 @@ package com.x_twitter_scraper.api.services.async import com.x_twitter_scraper.api.core.ClientOptions import com.x_twitter_scraper.api.core.RequestOptions -import com.x_twitter_scraper.api.core.SecurityOptions import com.x_twitter_scraper.api.core.checkRequired import com.x_twitter_scraper.api.core.handlers.errorBodyHandler import com.x_twitter_scraper.api.core.handlers.errorHandler @@ -88,11 +87,7 @@ class ApiKeyServiceAsyncImpl internal constructor(private val clientOptions: Cli .addPathSegments("api-keys") .body(json(clientOptions.jsonMapper, params._body())) .build() - .prepareAsync( - clientOptions, - params, - SecurityOptions.builder().apiKey(true).build(), - ) + .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } @@ -122,11 +117,7 @@ class ApiKeyServiceAsyncImpl internal constructor(private val clientOptions: Cli .baseUrl(clientOptions.baseUrl()) .addPathSegments("api-keys") .build() - .prepareAsync( - clientOptions, - params, - SecurityOptions.builder().apiKey(true).build(), - ) + .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } @@ -160,11 +151,7 @@ class ApiKeyServiceAsyncImpl internal constructor(private val clientOptions: Cli .addPathSegments("api-keys", params._pathParam(0)) .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() - .prepareAsync( - clientOptions, - params, - SecurityOptions.builder().apiKey(true).build(), - ) + .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/BotServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/BotServiceAsync.kt deleted file mode 100644 index 425589a..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/BotServiceAsync.kt +++ /dev/null @@ -1,37 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.services.async - -import com.x_twitter_scraper.api.core.ClientOptions -import com.x_twitter_scraper.api.services.async.bot.PlatformLinkServiceAsync -import java.util.function.Consumer - -interface BotServiceAsync { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): BotServiceAsync - - fun platformLinks(): PlatformLinkServiceAsync - - /** A view of [BotServiceAsync] that provides access to raw HTTP responses for each method. */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): BotServiceAsync.WithRawResponse - - fun platformLinks(): PlatformLinkServiceAsync.WithRawResponse - } -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/BotServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/BotServiceAsyncImpl.kt deleted file mode 100644 index f318b47..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/BotServiceAsyncImpl.kt +++ /dev/null @@ -1,44 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.services.async - -import com.x_twitter_scraper.api.core.ClientOptions -import com.x_twitter_scraper.api.services.async.bot.PlatformLinkServiceAsync -import com.x_twitter_scraper.api.services.async.bot.PlatformLinkServiceAsyncImpl -import java.util.function.Consumer - -class BotServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : - BotServiceAsync { - - private val withRawResponse: BotServiceAsync.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - private val platformLinks: PlatformLinkServiceAsync by lazy { - PlatformLinkServiceAsyncImpl(clientOptions) - } - - override fun withRawResponse(): BotServiceAsync.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): BotServiceAsync = - BotServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun platformLinks(): PlatformLinkServiceAsync = platformLinks - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - BotServiceAsync.WithRawResponse { - - private val platformLinks: PlatformLinkServiceAsync.WithRawResponse by lazy { - PlatformLinkServiceAsyncImpl.WithRawResponseImpl(clientOptions) - } - - override fun withOptions( - modifier: Consumer - ): BotServiceAsync.WithRawResponse = - BotServiceAsyncImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - override fun platformLinks(): PlatformLinkServiceAsync.WithRawResponse = platformLinks - } -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/ComposeServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/ComposeServiceAsync.kt index 1f66795..98f8929 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/ComposeServiceAsync.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/ComposeServiceAsync.kt @@ -10,7 +10,7 @@ import com.x_twitter_scraper.api.models.compose.ComposeCreateResponse import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** Tweet composition, drafts, writing styles & radar */ +/** AI tweet composition, drafts, writing styles, and radar */ interface ComposeServiceAsync { /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/ComposeServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/ComposeServiceAsyncImpl.kt index 3f31219..1017de4 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/ComposeServiceAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/ComposeServiceAsyncImpl.kt @@ -20,7 +20,7 @@ import com.x_twitter_scraper.api.models.compose.ComposeCreateResponse import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** Tweet composition, drafts, writing styles & radar */ +/** AI tweet composition, drafts, writing styles, and radar */ class ComposeServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : ComposeServiceAsync { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/CreditServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/CreditServiceAsync.kt index ac378b8..eb720d8 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/CreditServiceAsync.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/CreditServiceAsync.kt @@ -12,7 +12,7 @@ import com.x_twitter_scraper.api.models.credits.CreditTopupBalanceResponse import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** Subscription & billing */ +/** Subscription, billing, and credits */ interface CreditServiceAsync { /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/CreditServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/CreditServiceAsyncImpl.kt index 5535732..a6022f4 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/CreditServiceAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/CreditServiceAsyncImpl.kt @@ -22,7 +22,7 @@ import com.x_twitter_scraper.api.models.credits.CreditTopupBalanceResponse import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** Subscription & billing */ +/** Subscription, billing, and credits */ class CreditServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : CreditServiceAsync { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/DraftServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/DraftServiceAsync.kt index ef2a86e..718a816 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/DraftServiceAsync.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/DraftServiceAsync.kt @@ -15,7 +15,7 @@ import com.x_twitter_scraper.api.models.drafts.DraftRetrieveParams import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** Tweet composition, drafts, writing styles & radar */ +/** AI tweet composition, drafts, writing styles, and radar */ interface DraftServiceAsync { /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/DraftServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/DraftServiceAsyncImpl.kt index fbb9125..4cb06eb 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/DraftServiceAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/DraftServiceAsyncImpl.kt @@ -27,7 +27,7 @@ import java.util.concurrent.CompletableFuture import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull -/** Tweet composition, drafts, writing styles & radar */ +/** AI tweet composition, drafts, writing styles, and radar */ class DraftServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : DraftServiceAsync { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/EventServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/EventServiceAsyncImpl.kt index 6a36121..08d2e2d 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/EventServiceAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/EventServiceAsyncImpl.kt @@ -4,7 +4,6 @@ package com.x_twitter_scraper.api.services.async import com.x_twitter_scraper.api.core.ClientOptions import com.x_twitter_scraper.api.core.RequestOptions -import com.x_twitter_scraper.api.core.SecurityOptions import com.x_twitter_scraper.api.core.checkRequired import com.x_twitter_scraper.api.core.handlers.errorBodyHandler import com.x_twitter_scraper.api.core.handlers.errorHandler @@ -110,11 +109,7 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie .baseUrl(clientOptions.baseUrl()) .addPathSegments("events") .build() - .prepareAsync( - clientOptions, - params, - SecurityOptions.builder().apiKey(true).build(), - ) + .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/IntegrationServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/IntegrationServiceAsync.kt deleted file mode 100644 index d357947..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/IntegrationServiceAsync.kt +++ /dev/null @@ -1,496 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.services.async - -import com.x_twitter_scraper.api.core.ClientOptions -import com.x_twitter_scraper.api.core.RequestOptions -import com.x_twitter_scraper.api.core.http.HttpResponseFor -import com.x_twitter_scraper.api.models.integrations.Integration -import com.x_twitter_scraper.api.models.integrations.IntegrationCreateParams -import com.x_twitter_scraper.api.models.integrations.IntegrationDeleteParams -import com.x_twitter_scraper.api.models.integrations.IntegrationDeleteResponse -import com.x_twitter_scraper.api.models.integrations.IntegrationListDeliveriesParams -import com.x_twitter_scraper.api.models.integrations.IntegrationListDeliveriesResponse -import com.x_twitter_scraper.api.models.integrations.IntegrationListParams -import com.x_twitter_scraper.api.models.integrations.IntegrationListResponse -import com.x_twitter_scraper.api.models.integrations.IntegrationRetrieveParams -import com.x_twitter_scraper.api.models.integrations.IntegrationSendTestParams -import com.x_twitter_scraper.api.models.integrations.IntegrationSendTestResponse -import com.x_twitter_scraper.api.models.integrations.IntegrationUpdateParams -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer - -/** Push notification integrations (Telegram) */ -interface IntegrationServiceAsync { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): IntegrationServiceAsync - - /** Create integration */ - fun create(params: IntegrationCreateParams): CompletableFuture = - create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: IntegrationCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** Get integration details */ - fun retrieve(id: String): CompletableFuture = - retrieve(id, IntegrationRetrieveParams.none()) - - /** @see retrieve */ - fun retrieve( - id: String, - params: IntegrationRetrieveParams = IntegrationRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = retrieve(params.toBuilder().id(id).build(), requestOptions) - - /** @see retrieve */ - fun retrieve( - id: String, - params: IntegrationRetrieveParams = IntegrationRetrieveParams.none(), - ): CompletableFuture = retrieve(id, params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - params: IntegrationRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see retrieve */ - fun retrieve(params: IntegrationRetrieveParams): CompletableFuture = - retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve(id: String, requestOptions: RequestOptions): CompletableFuture = - retrieve(id, IntegrationRetrieveParams.none(), requestOptions) - - /** Update integration */ - fun update(id: String): CompletableFuture = - update(id, IntegrationUpdateParams.none()) - - /** @see update */ - fun update( - id: String, - params: IntegrationUpdateParams = IntegrationUpdateParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = update(params.toBuilder().id(id).build(), requestOptions) - - /** @see update */ - fun update( - id: String, - params: IntegrationUpdateParams = IntegrationUpdateParams.none(), - ): CompletableFuture = update(id, params, RequestOptions.none()) - - /** @see update */ - fun update( - params: IntegrationUpdateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see update */ - fun update(params: IntegrationUpdateParams): CompletableFuture = - update(params, RequestOptions.none()) - - /** @see update */ - fun update(id: String, requestOptions: RequestOptions): CompletableFuture = - update(id, IntegrationUpdateParams.none(), requestOptions) - - /** List integrations */ - fun list(): CompletableFuture = list(IntegrationListParams.none()) - - /** @see list */ - fun list( - params: IntegrationListParams = IntegrationListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see list */ - fun list( - params: IntegrationListParams = IntegrationListParams.none() - ): CompletableFuture = list(params, RequestOptions.none()) - - /** @see list */ - fun list(requestOptions: RequestOptions): CompletableFuture = - list(IntegrationListParams.none(), requestOptions) - - /** Delete integration */ - fun delete(id: String): CompletableFuture = - delete(id, IntegrationDeleteParams.none()) - - /** @see delete */ - fun delete( - id: String, - params: IntegrationDeleteParams = IntegrationDeleteParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - delete(params.toBuilder().id(id).build(), requestOptions) - - /** @see delete */ - fun delete( - id: String, - params: IntegrationDeleteParams = IntegrationDeleteParams.none(), - ): CompletableFuture = delete(id, params, RequestOptions.none()) - - /** @see delete */ - fun delete( - params: IntegrationDeleteParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see delete */ - fun delete(params: IntegrationDeleteParams): CompletableFuture = - delete(params, RequestOptions.none()) - - /** @see delete */ - fun delete( - id: String, - requestOptions: RequestOptions, - ): CompletableFuture = - delete(id, IntegrationDeleteParams.none(), requestOptions) - - /** List integration delivery history */ - fun listDeliveries(id: String): CompletableFuture = - listDeliveries(id, IntegrationListDeliveriesParams.none()) - - /** @see listDeliveries */ - fun listDeliveries( - id: String, - params: IntegrationListDeliveriesParams = IntegrationListDeliveriesParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - listDeliveries(params.toBuilder().id(id).build(), requestOptions) - - /** @see listDeliveries */ - fun listDeliveries( - id: String, - params: IntegrationListDeliveriesParams = IntegrationListDeliveriesParams.none(), - ): CompletableFuture = - listDeliveries(id, params, RequestOptions.none()) - - /** @see listDeliveries */ - fun listDeliveries( - params: IntegrationListDeliveriesParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see listDeliveries */ - fun listDeliveries( - params: IntegrationListDeliveriesParams - ): CompletableFuture = - listDeliveries(params, RequestOptions.none()) - - /** @see listDeliveries */ - fun listDeliveries( - id: String, - requestOptions: RequestOptions, - ): CompletableFuture = - listDeliveries(id, IntegrationListDeliveriesParams.none(), requestOptions) - - /** Send test delivery */ - fun sendTest(id: String): CompletableFuture = - sendTest(id, IntegrationSendTestParams.none()) - - /** @see sendTest */ - fun sendTest( - id: String, - params: IntegrationSendTestParams = IntegrationSendTestParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - sendTest(params.toBuilder().id(id).build(), requestOptions) - - /** @see sendTest */ - fun sendTest( - id: String, - params: IntegrationSendTestParams = IntegrationSendTestParams.none(), - ): CompletableFuture = sendTest(id, params, RequestOptions.none()) - - /** @see sendTest */ - fun sendTest( - params: IntegrationSendTestParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see sendTest */ - fun sendTest( - params: IntegrationSendTestParams - ): CompletableFuture = sendTest(params, RequestOptions.none()) - - /** @see sendTest */ - fun sendTest( - id: String, - requestOptions: RequestOptions, - ): CompletableFuture = - sendTest(id, IntegrationSendTestParams.none(), requestOptions) - - /** - * A view of [IntegrationServiceAsync] that provides access to raw HTTP responses for each - * method. - */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions( - modifier: Consumer - ): IntegrationServiceAsync.WithRawResponse - - /** - * Returns a raw HTTP response for `post /integrations`, but is otherwise the same as - * [IntegrationServiceAsync.create]. - */ - fun create( - params: IntegrationCreateParams - ): CompletableFuture> = create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: IntegrationCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** - * Returns a raw HTTP response for `get /integrations/{id}`, but is otherwise the same as - * [IntegrationServiceAsync.retrieve]. - */ - fun retrieve(id: String): CompletableFuture> = - retrieve(id, IntegrationRetrieveParams.none()) - - /** @see retrieve */ - fun retrieve( - id: String, - params: IntegrationRetrieveParams = IntegrationRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - retrieve(params.toBuilder().id(id).build(), requestOptions) - - /** @see retrieve */ - fun retrieve( - id: String, - params: IntegrationRetrieveParams = IntegrationRetrieveParams.none(), - ): CompletableFuture> = - retrieve(id, params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - params: IntegrationRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see retrieve */ - fun retrieve( - params: IntegrationRetrieveParams - ): CompletableFuture> = retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - id: String, - requestOptions: RequestOptions, - ): CompletableFuture> = - retrieve(id, IntegrationRetrieveParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `patch /integrations/{id}`, but is otherwise the same as - * [IntegrationServiceAsync.update]. - */ - fun update(id: String): CompletableFuture> = - update(id, IntegrationUpdateParams.none()) - - /** @see update */ - fun update( - id: String, - params: IntegrationUpdateParams = IntegrationUpdateParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - update(params.toBuilder().id(id).build(), requestOptions) - - /** @see update */ - fun update( - id: String, - params: IntegrationUpdateParams = IntegrationUpdateParams.none(), - ): CompletableFuture> = - update(id, params, RequestOptions.none()) - - /** @see update */ - fun update( - params: IntegrationUpdateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see update */ - fun update( - params: IntegrationUpdateParams - ): CompletableFuture> = update(params, RequestOptions.none()) - - /** @see update */ - fun update( - id: String, - requestOptions: RequestOptions, - ): CompletableFuture> = - update(id, IntegrationUpdateParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get /integrations`, but is otherwise the same as - * [IntegrationServiceAsync.list]. - */ - fun list(): CompletableFuture> = - list(IntegrationListParams.none()) - - /** @see list */ - fun list( - params: IntegrationListParams = IntegrationListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see list */ - fun list( - params: IntegrationListParams = IntegrationListParams.none() - ): CompletableFuture> = - list(params, RequestOptions.none()) - - /** @see list */ - fun list( - requestOptions: RequestOptions - ): CompletableFuture> = - list(IntegrationListParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `delete /integrations/{id}`, but is otherwise the same as - * [IntegrationServiceAsync.delete]. - */ - fun delete(id: String): CompletableFuture> = - delete(id, IntegrationDeleteParams.none()) - - /** @see delete */ - fun delete( - id: String, - params: IntegrationDeleteParams = IntegrationDeleteParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - delete(params.toBuilder().id(id).build(), requestOptions) - - /** @see delete */ - fun delete( - id: String, - params: IntegrationDeleteParams = IntegrationDeleteParams.none(), - ): CompletableFuture> = - delete(id, params, RequestOptions.none()) - - /** @see delete */ - fun delete( - params: IntegrationDeleteParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see delete */ - fun delete( - params: IntegrationDeleteParams - ): CompletableFuture> = - delete(params, RequestOptions.none()) - - /** @see delete */ - fun delete( - id: String, - requestOptions: RequestOptions, - ): CompletableFuture> = - delete(id, IntegrationDeleteParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get /integrations/{id}/deliveries`, but is otherwise the - * same as [IntegrationServiceAsync.listDeliveries]. - */ - fun listDeliveries( - id: String - ): CompletableFuture> = - listDeliveries(id, IntegrationListDeliveriesParams.none()) - - /** @see listDeliveries */ - fun listDeliveries( - id: String, - params: IntegrationListDeliveriesParams = IntegrationListDeliveriesParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - listDeliveries(params.toBuilder().id(id).build(), requestOptions) - - /** @see listDeliveries */ - fun listDeliveries( - id: String, - params: IntegrationListDeliveriesParams = IntegrationListDeliveriesParams.none(), - ): CompletableFuture> = - listDeliveries(id, params, RequestOptions.none()) - - /** @see listDeliveries */ - fun listDeliveries( - params: IntegrationListDeliveriesParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see listDeliveries */ - fun listDeliveries( - params: IntegrationListDeliveriesParams - ): CompletableFuture> = - listDeliveries(params, RequestOptions.none()) - - /** @see listDeliveries */ - fun listDeliveries( - id: String, - requestOptions: RequestOptions, - ): CompletableFuture> = - listDeliveries(id, IntegrationListDeliveriesParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `post /integrations/{id}/test`, but is otherwise the same - * as [IntegrationServiceAsync.sendTest]. - */ - fun sendTest(id: String): CompletableFuture> = - sendTest(id, IntegrationSendTestParams.none()) - - /** @see sendTest */ - fun sendTest( - id: String, - params: IntegrationSendTestParams = IntegrationSendTestParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - sendTest(params.toBuilder().id(id).build(), requestOptions) - - /** @see sendTest */ - fun sendTest( - id: String, - params: IntegrationSendTestParams = IntegrationSendTestParams.none(), - ): CompletableFuture> = - sendTest(id, params, RequestOptions.none()) - - /** @see sendTest */ - fun sendTest( - params: IntegrationSendTestParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see sendTest */ - fun sendTest( - params: IntegrationSendTestParams - ): CompletableFuture> = - sendTest(params, RequestOptions.none()) - - /** @see sendTest */ - fun sendTest( - id: String, - requestOptions: RequestOptions, - ): CompletableFuture> = - sendTest(id, IntegrationSendTestParams.none(), requestOptions) - } -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/IntegrationServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/IntegrationServiceAsyncImpl.kt deleted file mode 100644 index 09a4a35..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/IntegrationServiceAsyncImpl.kt +++ /dev/null @@ -1,339 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.services.async - -import com.x_twitter_scraper.api.core.ClientOptions -import com.x_twitter_scraper.api.core.RequestOptions -import com.x_twitter_scraper.api.core.checkRequired -import com.x_twitter_scraper.api.core.handlers.errorBodyHandler -import com.x_twitter_scraper.api.core.handlers.errorHandler -import com.x_twitter_scraper.api.core.handlers.jsonHandler -import com.x_twitter_scraper.api.core.http.HttpMethod -import com.x_twitter_scraper.api.core.http.HttpRequest -import com.x_twitter_scraper.api.core.http.HttpResponse -import com.x_twitter_scraper.api.core.http.HttpResponse.Handler -import com.x_twitter_scraper.api.core.http.HttpResponseFor -import com.x_twitter_scraper.api.core.http.json -import com.x_twitter_scraper.api.core.http.parseable -import com.x_twitter_scraper.api.core.prepareAsync -import com.x_twitter_scraper.api.models.integrations.Integration -import com.x_twitter_scraper.api.models.integrations.IntegrationCreateParams -import com.x_twitter_scraper.api.models.integrations.IntegrationDeleteParams -import com.x_twitter_scraper.api.models.integrations.IntegrationDeleteResponse -import com.x_twitter_scraper.api.models.integrations.IntegrationListDeliveriesParams -import com.x_twitter_scraper.api.models.integrations.IntegrationListDeliveriesResponse -import com.x_twitter_scraper.api.models.integrations.IntegrationListParams -import com.x_twitter_scraper.api.models.integrations.IntegrationListResponse -import com.x_twitter_scraper.api.models.integrations.IntegrationRetrieveParams -import com.x_twitter_scraper.api.models.integrations.IntegrationSendTestParams -import com.x_twitter_scraper.api.models.integrations.IntegrationSendTestResponse -import com.x_twitter_scraper.api.models.integrations.IntegrationUpdateParams -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull - -/** Push notification integrations (Telegram) */ -class IntegrationServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : - IntegrationServiceAsync { - - private val withRawResponse: IntegrationServiceAsync.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): IntegrationServiceAsync.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): IntegrationServiceAsync = - IntegrationServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun create( - params: IntegrationCreateParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /integrations - withRawResponse().create(params, requestOptions).thenApply { it.parse() } - - override fun retrieve( - params: IntegrationRetrieveParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /integrations/{id} - withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } - - override fun update( - params: IntegrationUpdateParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // patch /integrations/{id} - withRawResponse().update(params, requestOptions).thenApply { it.parse() } - - override fun list( - params: IntegrationListParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /integrations - withRawResponse().list(params, requestOptions).thenApply { it.parse() } - - override fun delete( - params: IntegrationDeleteParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // delete /integrations/{id} - withRawResponse().delete(params, requestOptions).thenApply { it.parse() } - - override fun listDeliveries( - params: IntegrationListDeliveriesParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /integrations/{id}/deliveries - withRawResponse().listDeliveries(params, requestOptions).thenApply { it.parse() } - - override fun sendTest( - params: IntegrationSendTestParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /integrations/{id}/test - withRawResponse().sendTest(params, requestOptions).thenApply { it.parse() } - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - IntegrationServiceAsync.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): IntegrationServiceAsync.WithRawResponse = - IntegrationServiceAsyncImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun create( - params: IntegrationCreateParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("integrations") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun retrieve( - params: IntegrationRetrieveParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("id", params.id().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("integrations", params._pathParam(0)) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun update( - params: IntegrationUpdateParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("id", params.id().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.PATCH) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("integrations", params._pathParam(0)) - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { updateHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun list( - params: IntegrationListParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("integrations") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - - private val deleteHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun delete( - params: IntegrationDeleteParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("id", params.id().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.DELETE) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("integrations", params._pathParam(0)) - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { deleteHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - - private val listDeliveriesHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun listDeliveries( - params: IntegrationListDeliveriesParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("id", params.id().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("integrations", params._pathParam(0), "deliveries") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { listDeliveriesHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - - private val sendTestHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun sendTest( - params: IntegrationSendTestParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("id", params.id().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("integrations", params._pathParam(0), "test") - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { sendTestHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - } -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/RadarServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/RadarServiceAsync.kt index 4c8cfe7..c84a4bc 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/RadarServiceAsync.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/RadarServiceAsync.kt @@ -10,7 +10,7 @@ import com.x_twitter_scraper.api.models.radar.RadarRetrieveTrendingTopicsRespons import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** Tweet composition, drafts, writing styles & radar */ +/** AI tweet composition, drafts, writing styles, and radar */ interface RadarServiceAsync { /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/RadarServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/RadarServiceAsyncImpl.kt index f84ab35..d9d89ce 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/RadarServiceAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/RadarServiceAsyncImpl.kt @@ -19,7 +19,7 @@ import com.x_twitter_scraper.api.models.radar.RadarRetrieveTrendingTopicsRespons import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** Tweet composition, drafts, writing styles & radar */ +/** AI tweet composition, drafts, writing styles, and radar */ class RadarServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : RadarServiceAsync { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/StyleServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/StyleServiceAsync.kt index 22896af..b4dd020 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/StyleServiceAsync.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/StyleServiceAsync.kt @@ -20,7 +20,7 @@ import com.x_twitter_scraper.api.models.styles.StyleUpdateParams import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** Tweet composition, drafts, writing styles & radar */ +/** AI tweet composition, drafts, writing styles, and radar */ interface StyleServiceAsync { /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/StyleServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/StyleServiceAsyncImpl.kt index abf6320..9f62b80 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/StyleServiceAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/StyleServiceAsyncImpl.kt @@ -32,7 +32,7 @@ import java.util.concurrent.CompletableFuture import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull -/** Tweet composition, drafts, writing styles & radar */ +/** AI tweet composition, drafts, writing styles, and radar */ class StyleServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : StyleServiceAsync { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/SubscribeServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/SubscribeServiceAsync.kt index 0c91b47..e81a00e 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/SubscribeServiceAsync.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/SubscribeServiceAsync.kt @@ -10,7 +10,7 @@ import com.x_twitter_scraper.api.models.subscribe.SubscribeCreateResponse import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** Subscription & billing */ +/** Subscription, billing, and credits */ interface SubscribeServiceAsync { /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/SubscribeServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/SubscribeServiceAsyncImpl.kt index 72056bd..ea511a7 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/SubscribeServiceAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/SubscribeServiceAsyncImpl.kt @@ -20,7 +20,7 @@ import com.x_twitter_scraper.api.models.subscribe.SubscribeCreateResponse import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** Subscription & billing */ +/** Subscription, billing, and credits */ class SubscribeServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : SubscribeServiceAsync { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/TrendServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/TrendServiceAsync.kt index 3cb522b..7109691 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/TrendServiceAsync.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/TrendServiceAsync.kt @@ -10,7 +10,7 @@ import com.x_twitter_scraper.api.models.trends.TrendListResponse import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** Trending topics by region */ +/** Trending topics and hashtags by region */ interface TrendServiceAsync { /** @@ -25,7 +25,7 @@ interface TrendServiceAsync { */ fun withOptions(modifier: Consumer): TrendServiceAsync - /** Get regional trending topics */ + /** Get trending hashtags and topics by region (alias) */ fun list(): CompletableFuture = list(TrendListParams.none()) /** @see list */ diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/TrendServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/TrendServiceAsyncImpl.kt index 45c30e8..71b94ff 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/TrendServiceAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/TrendServiceAsyncImpl.kt @@ -19,7 +19,7 @@ import com.x_twitter_scraper.api.models.trends.TrendListResponse import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** Trending topics by region */ +/** Trending topics and hashtags by region */ class TrendServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : TrendServiceAsync { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/WebhookServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/WebhookServiceAsync.kt index 9e3e887..575953b 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/WebhookServiceAsync.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/WebhookServiceAsync.kt @@ -20,7 +20,7 @@ import com.x_twitter_scraper.api.models.webhooks.WebhookUpdateParams import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** Webhook endpoint management & delivery */ +/** Webhook endpoint management and delivery */ interface WebhookServiceAsync { /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/WebhookServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/WebhookServiceAsyncImpl.kt index 8609569..6e81e76 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/WebhookServiceAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/WebhookServiceAsyncImpl.kt @@ -32,7 +32,7 @@ import java.util.concurrent.CompletableFuture import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull -/** Webhook endpoint management & delivery */ +/** Webhook endpoint management and delivery */ class WebhookServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : WebhookServiceAsync { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/XServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/XServiceAsync.kt index 6a69b8f..ac773de 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/XServiceAsync.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/XServiceAsync.kt @@ -26,7 +26,6 @@ import com.x_twitter_scraper.api.services.async.x.UserServiceAsync import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** X data lookups (subscription required) */ interface XServiceAsync { /** @@ -43,15 +42,15 @@ interface XServiceAsync { fun tweets(): TweetServiceAsync - /** X data lookups (subscription required) */ + /** Look up, search, and explore user profiles and relationships */ fun users(): UserServiceAsync - /** X data lookups (subscription required) */ + /** Look up, search, and explore user profiles and relationships */ fun followers(): FollowerServiceAsync fun dm(): DmServiceAsync - /** Media upload & download */ + /** Media upload and download */ fun media(): MediaServiceAsync /** X write actions (tweets, likes, follows, DMs) */ @@ -62,10 +61,10 @@ interface XServiceAsync { /** Connected X account management */ fun accounts(): AccountServiceAsync - /** X data lookups (subscription required) */ + /** Look up, search, and analyze individual tweets */ fun bookmarks(): BookmarkServiceAsync - /** X data lookups (subscription required) */ + /** X List followers, members, and tweets */ fun lists(): ListServiceAsync /** Retrieve the full content of an X Article (long-form post) by tweet ID. */ @@ -144,7 +143,7 @@ interface XServiceAsync { ): CompletableFuture = getNotifications(XGetNotificationsParams.none(), requestOptions) - /** Get trending topics */ + /** Get trending hashtags and topics from X by region */ fun getTrends(): CompletableFuture = getTrends(XGetTrendsParams.none()) /** @see getTrends */ @@ -174,15 +173,15 @@ interface XServiceAsync { fun tweets(): TweetServiceAsync.WithRawResponse - /** X data lookups (subscription required) */ + /** Look up, search, and explore user profiles and relationships */ fun users(): UserServiceAsync.WithRawResponse - /** X data lookups (subscription required) */ + /** Look up, search, and explore user profiles and relationships */ fun followers(): FollowerServiceAsync.WithRawResponse fun dm(): DmServiceAsync.WithRawResponse - /** Media upload & download */ + /** Media upload and download */ fun media(): MediaServiceAsync.WithRawResponse /** X write actions (tweets, likes, follows, DMs) */ @@ -193,10 +192,10 @@ interface XServiceAsync { /** Connected X account management */ fun accounts(): AccountServiceAsync.WithRawResponse - /** X data lookups (subscription required) */ + /** Look up, search, and analyze individual tweets */ fun bookmarks(): BookmarkServiceAsync.WithRawResponse - /** X data lookups (subscription required) */ + /** X List followers, members, and tweets */ fun lists(): ListServiceAsync.WithRawResponse /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/XServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/XServiceAsyncImpl.kt index a81a1d3..a07c44b 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/XServiceAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/XServiceAsyncImpl.kt @@ -47,7 +47,6 @@ import java.util.concurrent.CompletableFuture import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull -/** X data lookups (subscription required) */ class XServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : XServiceAsync { @@ -84,15 +83,15 @@ class XServiceAsyncImpl internal constructor(private val clientOptions: ClientOp override fun tweets(): TweetServiceAsync = tweets - /** X data lookups (subscription required) */ + /** Look up, search, and explore user profiles and relationships */ override fun users(): UserServiceAsync = users - /** X data lookups (subscription required) */ + /** Look up, search, and explore user profiles and relationships */ override fun followers(): FollowerServiceAsync = followers override fun dm(): DmServiceAsync = dm - /** Media upload & download */ + /** Media upload and download */ override fun media(): MediaServiceAsync = media /** X write actions (tweets, likes, follows, DMs) */ @@ -103,10 +102,10 @@ class XServiceAsyncImpl internal constructor(private val clientOptions: ClientOp /** Connected X account management */ override fun accounts(): AccountServiceAsync = accounts - /** X data lookups (subscription required) */ + /** Look up, search, and analyze individual tweets */ override fun bookmarks(): BookmarkServiceAsync = bookmarks - /** X data lookups (subscription required) */ + /** X List followers, members, and tweets */ override fun lists(): ListServiceAsync = lists override fun getArticle( @@ -192,15 +191,15 @@ class XServiceAsyncImpl internal constructor(private val clientOptions: ClientOp override fun tweets(): TweetServiceAsync.WithRawResponse = tweets - /** X data lookups (subscription required) */ + /** Look up, search, and explore user profiles and relationships */ override fun users(): UserServiceAsync.WithRawResponse = users - /** X data lookups (subscription required) */ + /** Look up, search, and explore user profiles and relationships */ override fun followers(): FollowerServiceAsync.WithRawResponse = followers override fun dm(): DmServiceAsync.WithRawResponse = dm - /** Media upload & download */ + /** Media upload and download */ override fun media(): MediaServiceAsync.WithRawResponse = media /** X write actions (tweets, likes, follows, DMs) */ @@ -211,10 +210,10 @@ class XServiceAsyncImpl internal constructor(private val clientOptions: ClientOp /** Connected X account management */ override fun accounts(): AccountServiceAsync.WithRawResponse = accounts - /** X data lookups (subscription required) */ + /** Look up, search, and analyze individual tweets */ override fun bookmarks(): BookmarkServiceAsync.WithRawResponse = bookmarks - /** X data lookups (subscription required) */ + /** X List followers, members, and tweets */ override fun lists(): ListServiceAsync.WithRawResponse = lists private val getArticleHandler: Handler = diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/bot/PlatformLinkServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/bot/PlatformLinkServiceAsync.kt deleted file mode 100644 index 46f142a..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/bot/PlatformLinkServiceAsync.kt +++ /dev/null @@ -1,37 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.services.async.bot - -import com.x_twitter_scraper.api.core.ClientOptions -import java.util.function.Consumer - -interface PlatformLinkServiceAsync { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): PlatformLinkServiceAsync - - /** - * A view of [PlatformLinkServiceAsync] that provides access to raw HTTP responses for each - * method. - */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions( - modifier: Consumer - ): PlatformLinkServiceAsync.WithRawResponse - } -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/bot/PlatformLinkServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/bot/PlatformLinkServiceAsyncImpl.kt deleted file mode 100644 index 6f66b26..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/bot/PlatformLinkServiceAsyncImpl.kt +++ /dev/null @@ -1,30 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.services.async.bot - -import com.x_twitter_scraper.api.core.ClientOptions -import java.util.function.Consumer - -class PlatformLinkServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : - PlatformLinkServiceAsync { - - private val withRawResponse: PlatformLinkServiceAsync.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): PlatformLinkServiceAsync.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): PlatformLinkServiceAsync = - PlatformLinkServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - PlatformLinkServiceAsync.WithRawResponse { - - override fun withOptions( - modifier: Consumer - ): PlatformLinkServiceAsync.WithRawResponse = - PlatformLinkServiceAsyncImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - } -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/AccountServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/AccountServiceAsyncImpl.kt index fc3046b..d226641 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/AccountServiceAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/AccountServiceAsyncImpl.kt @@ -4,7 +4,6 @@ package com.x_twitter_scraper.api.services.async.x import com.x_twitter_scraper.api.core.ClientOptions import com.x_twitter_scraper.api.core.RequestOptions -import com.x_twitter_scraper.api.core.SecurityOptions import com.x_twitter_scraper.api.core.checkRequired import com.x_twitter_scraper.api.core.handlers.errorBodyHandler import com.x_twitter_scraper.api.core.handlers.errorHandler @@ -115,11 +114,7 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl .addPathSegments("x", "accounts") .body(json(clientOptions.jsonMapper, params._body())) .build() - .prepareAsync( - clientOptions, - params, - SecurityOptions.builder().apiKey(true).build(), - ) + .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } @@ -152,11 +147,7 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl .baseUrl(clientOptions.baseUrl()) .addPathSegments("x", "accounts", params._pathParam(0)) .build() - .prepareAsync( - clientOptions, - params, - SecurityOptions.builder().apiKey(true).build(), - ) + .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } @@ -186,11 +177,7 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl .baseUrl(clientOptions.baseUrl()) .addPathSegments("x", "accounts") .build() - .prepareAsync( - clientOptions, - params, - SecurityOptions.builder().apiKey(true).build(), - ) + .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } @@ -224,11 +211,7 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl .addPathSegments("x", "accounts", params._pathParam(0)) .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() - .prepareAsync( - clientOptions, - params, - SecurityOptions.builder().apiKey(true).build(), - ) + .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } @@ -259,11 +242,7 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl .addPathSegments("x", "accounts", "bulk-retry") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() - .prepareAsync( - clientOptions, - params, - SecurityOptions.builder().apiKey(true).build(), - ) + .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } @@ -297,11 +276,7 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl .addPathSegments("x", "accounts", params._pathParam(0), "reauth") .body(json(clientOptions.jsonMapper, params._body())) .build() - .prepareAsync( - clientOptions, - params, - SecurityOptions.builder().apiKey(true).build(), - ) + .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/BookmarkServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/BookmarkServiceAsync.kt index ca3b261..af60051 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/BookmarkServiceAsync.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/BookmarkServiceAsync.kt @@ -12,7 +12,7 @@ import com.x_twitter_scraper.api.models.x.bookmarks.BookmarkRetrieveFoldersRespo import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** X data lookups (subscription required) */ +/** Look up, search, and analyze individual tweets */ interface BookmarkServiceAsync { /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/BookmarkServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/BookmarkServiceAsyncImpl.kt index 90c411b..3efa039 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/BookmarkServiceAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/BookmarkServiceAsyncImpl.kt @@ -21,7 +21,7 @@ import com.x_twitter_scraper.api.models.x.bookmarks.BookmarkRetrieveFoldersRespo import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** X data lookups (subscription required) */ +/** Look up, search, and analyze individual tweets */ class BookmarkServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : BookmarkServiceAsync { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/CommunityServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/CommunityServiceAsync.kt index 4321622..cf20003 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/CommunityServiceAsync.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/CommunityServiceAsync.kt @@ -38,7 +38,7 @@ interface CommunityServiceAsync { /** X write actions (tweets, likes, follows, DMs) */ fun join(): JoinServiceAsync - /** X data lookups (subscription required) */ + /** X Community info, members, and tweets */ fun tweets(): TweetServiceAsync /** Create community */ @@ -75,7 +75,7 @@ interface CommunityServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Get community details */ + /** Get community name, description and member count */ fun retrieveInfo(id: String): CompletableFuture = retrieveInfo(id, CommunityRetrieveInfoParams.none()) @@ -113,7 +113,7 @@ interface CommunityServiceAsync { ): CompletableFuture = retrieveInfo(id, CommunityRetrieveInfoParams.none(), requestOptions) - /** Get community members */ + /** List members of a community */ fun retrieveMembers(id: String): CompletableFuture = retrieveMembers(id, CommunityRetrieveMembersParams.none()) @@ -148,7 +148,7 @@ interface CommunityServiceAsync { ): CompletableFuture = retrieveMembers(id, CommunityRetrieveMembersParams.none(), requestOptions) - /** Get community moderators */ + /** List moderators of a community */ fun retrieveModerators(id: String): CompletableFuture = retrieveModerators(id, CommunityRetrieveModeratorsParams.none()) @@ -184,7 +184,7 @@ interface CommunityServiceAsync { ): CompletableFuture = retrieveModerators(id, CommunityRetrieveModeratorsParams.none(), requestOptions) - /** Search tweets across communities */ + /** Search for communities by keyword */ fun retrieveSearch(params: CommunityRetrieveSearchParams): CompletableFuture = retrieveSearch(params, RequestOptions.none()) @@ -211,7 +211,7 @@ interface CommunityServiceAsync { /** X write actions (tweets, likes, follows, DMs) */ fun join(): JoinServiceAsync.WithRawResponse - /** X data lookups (subscription required) */ + /** X Community info, members, and tweets */ fun tweets(): TweetServiceAsync.WithRawResponse /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/CommunityServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/CommunityServiceAsyncImpl.kt index efbf1c8..549cbd0 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/CommunityServiceAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/CommunityServiceAsyncImpl.kt @@ -54,7 +54,7 @@ class CommunityServiceAsyncImpl internal constructor(private val clientOptions: /** X write actions (tweets, likes, follows, DMs) */ override fun join(): JoinServiceAsync = join - /** X data lookups (subscription required) */ + /** X Community info, members, and tweets */ override fun tweets(): TweetServiceAsync = tweets override fun create( @@ -123,7 +123,7 @@ class CommunityServiceAsyncImpl internal constructor(private val clientOptions: /** X write actions (tweets, likes, follows, DMs) */ override fun join(): JoinServiceAsync.WithRawResponse = join - /** X data lookups (subscription required) */ + /** X Community info, members, and tweets */ override fun tweets(): TweetServiceAsync.WithRawResponse = tweets private val createHandler: Handler = diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/FollowerServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/FollowerServiceAsync.kt index 1e2761b..64449b1 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/FollowerServiceAsync.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/FollowerServiceAsync.kt @@ -10,7 +10,7 @@ import com.x_twitter_scraper.api.models.x.followers.FollowerCheckResponse import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** X data lookups (subscription required) */ +/** Look up, search, and explore user profiles and relationships */ interface FollowerServiceAsync { /** @@ -25,7 +25,7 @@ interface FollowerServiceAsync { */ fun withOptions(modifier: Consumer): FollowerServiceAsync - /** Check follow relationship */ + /** Check if one user follows another */ fun check(params: FollowerCheckParams): CompletableFuture = check(params, RequestOptions.none()) diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/FollowerServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/FollowerServiceAsyncImpl.kt index c5e5bfc..e1f777f 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/FollowerServiceAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/FollowerServiceAsyncImpl.kt @@ -19,7 +19,7 @@ import com.x_twitter_scraper.api.models.x.followers.FollowerCheckResponse import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** X data lookups (subscription required) */ +/** Look up, search, and explore user profiles and relationships */ class FollowerServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : FollowerServiceAsync { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/ListServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/ListServiceAsync.kt index 0c031f3..b66f7de 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/ListServiceAsync.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/ListServiceAsync.kt @@ -13,7 +13,7 @@ import com.x_twitter_scraper.api.models.x.lists.ListRetrieveTweetsParams import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** X data lookups (subscription required) */ +/** X List followers, members, and tweets */ interface ListServiceAsync { /** @@ -28,7 +28,7 @@ interface ListServiceAsync { */ fun withOptions(modifier: Consumer): ListServiceAsync - /** Get list followers */ + /** List followers of an X List */ fun retrieveFollowers(id: String): CompletableFuture = retrieveFollowers(id, ListRetrieveFollowersParams.none()) @@ -63,7 +63,7 @@ interface ListServiceAsync { ): CompletableFuture = retrieveFollowers(id, ListRetrieveFollowersParams.none(), requestOptions) - /** Get list members */ + /** List members of an X List */ fun retrieveMembers(id: String): CompletableFuture = retrieveMembers(id, ListRetrieveMembersParams.none()) @@ -98,7 +98,7 @@ interface ListServiceAsync { ): CompletableFuture = retrieveMembers(id, ListRetrieveMembersParams.none(), requestOptions) - /** Get list tweets */ + /** List tweets from an X List */ fun retrieveTweets(id: String): CompletableFuture = retrieveTweets(id, ListRetrieveTweetsParams.none()) diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/ListServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/ListServiceAsyncImpl.kt index d4de64b..7292f92 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/ListServiceAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/ListServiceAsyncImpl.kt @@ -24,7 +24,7 @@ import java.util.concurrent.CompletableFuture import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull -/** X data lookups (subscription required) */ +/** X List followers, members, and tweets */ class ListServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : ListServiceAsync { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/MediaServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/MediaServiceAsync.kt index 3cc9fb0..8faf462 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/MediaServiceAsync.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/MediaServiceAsync.kt @@ -12,7 +12,7 @@ import com.x_twitter_scraper.api.models.x.media.MediaUploadResponse import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** Media upload & download */ +/** Media upload and download */ interface MediaServiceAsync { /** @@ -27,7 +27,7 @@ interface MediaServiceAsync { */ fun withOptions(modifier: Consumer): MediaServiceAsync - /** Download tweet media */ + /** Download images and videos from tweets */ fun download(): CompletableFuture = download(MediaDownloadParams.none()) /** @see download */ diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/MediaServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/MediaServiceAsyncImpl.kt index 8b26439..bd52d8c 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/MediaServiceAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/MediaServiceAsyncImpl.kt @@ -23,7 +23,7 @@ import com.x_twitter_scraper.api.models.x.media.MediaUploadResponse import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** Media upload & download */ +/** Media upload and download */ class MediaServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : MediaServiceAsync { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/TweetServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/TweetServiceAsync.kt index 96217df..61e4439 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/TweetServiceAsync.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/TweetServiceAsync.kt @@ -55,7 +55,7 @@ interface TweetServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Look up tweet */ + /** Get tweet with full text, author, metrics and media */ fun retrieve(id: String): CompletableFuture = retrieve(id, TweetRetrieveParams.none()) @@ -122,7 +122,7 @@ interface TweetServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Get users who liked a tweet */ + /** List users who liked a tweet */ fun getFavoriters(id: String): CompletableFuture = getFavoriters(id, TweetGetFavoritersParams.none()) @@ -157,7 +157,7 @@ interface TweetServiceAsync { ): CompletableFuture = getFavoriters(id, TweetGetFavoritersParams.none(), requestOptions) - /** Get quote tweets of a tweet */ + /** List quote tweets of a tweet */ fun getQuotes(id: String): CompletableFuture = getQuotes(id, TweetGetQuotesParams.none()) @@ -189,7 +189,7 @@ interface TweetServiceAsync { fun getQuotes(id: String, requestOptions: RequestOptions): CompletableFuture = getQuotes(id, TweetGetQuotesParams.none(), requestOptions) - /** Get replies to a tweet */ + /** List replies to a tweet */ fun getReplies(id: String): CompletableFuture = getReplies(id, TweetGetRepliesParams.none()) @@ -221,7 +221,7 @@ interface TweetServiceAsync { fun getReplies(id: String, requestOptions: RequestOptions): CompletableFuture = getReplies(id, TweetGetRepliesParams.none(), requestOptions) - /** Get users who retweeted a tweet */ + /** List users who retweeted a tweet */ fun getRetweeters(id: String): CompletableFuture = getRetweeters(id, TweetGetRetweetersParams.none()) @@ -256,7 +256,7 @@ interface TweetServiceAsync { ): CompletableFuture = getRetweeters(id, TweetGetRetweetersParams.none(), requestOptions) - /** Get thread context for a tweet */ + /** Get full conversation thread for a tweet */ fun getThread(id: String): CompletableFuture = getThread(id, TweetGetThreadParams.none()) @@ -288,7 +288,7 @@ interface TweetServiceAsync { fun getThread(id: String, requestOptions: RequestOptions): CompletableFuture = getThread(id, TweetGetThreadParams.none(), requestOptions) - /** Search tweets */ + /** Search tweets with X query operators and pagination */ fun search(params: TweetSearchParams): CompletableFuture = search(params, RequestOptions.none()) diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/UserServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/UserServiceAsync.kt index 92bb75b..ed61749 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/UserServiceAsync.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/UserServiceAsync.kt @@ -7,7 +7,7 @@ import com.x_twitter_scraper.api.core.RequestOptions import com.x_twitter_scraper.api.core.http.HttpResponseFor import com.x_twitter_scraper.api.models.PaginatedTweets import com.x_twitter_scraper.api.models.PaginatedUsers -import com.x_twitter_scraper.api.models.x.users.UserProfile +import com.x_twitter_scraper.api.models.UserProfile import com.x_twitter_scraper.api.models.x.users.UserRetrieveBatchParams import com.x_twitter_scraper.api.models.x.users.UserRetrieveFollowersParams import com.x_twitter_scraper.api.models.x.users.UserRetrieveFollowersYouKnowParams @@ -23,7 +23,7 @@ import com.x_twitter_scraper.api.services.async.x.users.FollowServiceAsync import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** X data lookups (subscription required) */ +/** Look up, search, and explore user profiles and relationships */ interface UserServiceAsync { /** @@ -41,7 +41,7 @@ interface UserServiceAsync { /** X write actions (tweets, likes, follows, DMs) */ fun follow(): FollowServiceAsync - /** Look up X user */ + /** Get user profile with follower counts and verification */ fun retrieve(id: String): CompletableFuture = retrieve(id, UserRetrieveParams.none()) @@ -72,7 +72,7 @@ interface UserServiceAsync { fun retrieve(id: String, requestOptions: RequestOptions): CompletableFuture = retrieve(id, UserRetrieveParams.none(), requestOptions) - /** Get multiple users by IDs */ + /** Look up multiple users by IDs in one call */ fun retrieveBatch(params: UserRetrieveBatchParams): CompletableFuture = retrieveBatch(params, RequestOptions.none()) @@ -82,7 +82,7 @@ interface UserServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Get user followers */ + /** List followers of a user */ fun retrieveFollowers(id: String): CompletableFuture = retrieveFollowers(id, UserRetrieveFollowersParams.none()) @@ -117,7 +117,7 @@ interface UserServiceAsync { ): CompletableFuture = retrieveFollowers(id, UserRetrieveFollowersParams.none(), requestOptions) - /** Get followers you know for a user */ + /** List mutual followers between you and a user */ fun retrieveFollowersYouKnow(id: String): CompletableFuture = retrieveFollowersYouKnow(id, UserRetrieveFollowersYouKnowParams.none()) @@ -154,7 +154,7 @@ interface UserServiceAsync { ): CompletableFuture = retrieveFollowersYouKnow(id, UserRetrieveFollowersYouKnowParams.none(), requestOptions) - /** Get users this user follows */ + /** List accounts a user follows */ fun retrieveFollowing(id: String): CompletableFuture = retrieveFollowing(id, UserRetrieveFollowingParams.none()) @@ -189,7 +189,7 @@ interface UserServiceAsync { ): CompletableFuture = retrieveFollowing(id, UserRetrieveFollowingParams.none(), requestOptions) - /** Get tweets liked by a user */ + /** List tweets liked by a user */ fun retrieveLikes(id: String): CompletableFuture = retrieveLikes(id, UserRetrieveLikesParams.none()) @@ -224,7 +224,7 @@ interface UserServiceAsync { ): CompletableFuture = retrieveLikes(id, UserRetrieveLikesParams.none(), requestOptions) - /** Get media tweets by a user */ + /** List media tweets posted by a user */ fun retrieveMedia(id: String): CompletableFuture = retrieveMedia(id, UserRetrieveMediaParams.none()) @@ -259,7 +259,7 @@ interface UserServiceAsync { ): CompletableFuture = retrieveMedia(id, UserRetrieveMediaParams.none(), requestOptions) - /** Get tweets mentioning a user */ + /** List tweets mentioning a user */ fun retrieveMentions(id: String): CompletableFuture = retrieveMentions(id, UserRetrieveMentionsParams.none()) @@ -304,7 +304,7 @@ interface UserServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Get recent tweets by a user */ + /** List recent tweets posted by a user */ fun retrieveTweets(id: String): CompletableFuture = retrieveTweets(id, UserRetrieveTweetsParams.none()) @@ -339,7 +339,7 @@ interface UserServiceAsync { ): CompletableFuture = retrieveTweets(id, UserRetrieveTweetsParams.none(), requestOptions) - /** Get verified followers */ + /** List verified followers of a user */ fun retrieveVerifiedFollowers(id: String): CompletableFuture = retrieveVerifiedFollowers(id, UserRetrieveVerifiedFollowersParams.none()) diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/UserServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/UserServiceAsyncImpl.kt index b1a59fa..5746f33 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/UserServiceAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/UserServiceAsyncImpl.kt @@ -17,7 +17,7 @@ import com.x_twitter_scraper.api.core.http.parseable import com.x_twitter_scraper.api.core.prepareAsync import com.x_twitter_scraper.api.models.PaginatedTweets import com.x_twitter_scraper.api.models.PaginatedUsers -import com.x_twitter_scraper.api.models.x.users.UserProfile +import com.x_twitter_scraper.api.models.UserProfile import com.x_twitter_scraper.api.models.x.users.UserRetrieveBatchParams import com.x_twitter_scraper.api.models.x.users.UserRetrieveFollowersParams import com.x_twitter_scraper.api.models.x.users.UserRetrieveFollowersYouKnowParams @@ -35,7 +35,7 @@ import java.util.concurrent.CompletableFuture import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull -/** X data lookups (subscription required) */ +/** Look up, search, and explore user profiles and relationships */ class UserServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : UserServiceAsync { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/communities/TweetServiceAsync.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/communities/TweetServiceAsync.kt index c1cae96..d34dcc7 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/communities/TweetServiceAsync.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/communities/TweetServiceAsync.kt @@ -11,7 +11,7 @@ import com.x_twitter_scraper.api.models.x.communities.tweets.TweetListParams import java.util.concurrent.CompletableFuture import java.util.function.Consumer -/** X data lookups (subscription required) */ +/** X Community info, members, and tweets */ interface TweetServiceAsync { /** @@ -26,7 +26,7 @@ interface TweetServiceAsync { */ fun withOptions(modifier: Consumer): TweetServiceAsync - /** Search tweets across all communities */ + /** List tweets across all communities */ fun list(params: TweetListParams): CompletableFuture = list(params, RequestOptions.none()) @@ -36,7 +36,7 @@ interface TweetServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Get community tweets */ + /** List tweets posted in a community */ fun listByCommunity(id: String): CompletableFuture = listByCommunity(id, TweetListByCommunityParams.none()) diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/communities/TweetServiceAsyncImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/communities/TweetServiceAsyncImpl.kt index 59761eb..24d6769 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/communities/TweetServiceAsyncImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/async/x/communities/TweetServiceAsyncImpl.kt @@ -22,7 +22,7 @@ import java.util.concurrent.CompletableFuture import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull -/** X data lookups (subscription required) */ +/** X Community info, members, and tweets */ class TweetServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : TweetServiceAsync { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/AccountService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/AccountService.kt index 2eef3e1..83237f5 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/AccountService.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/AccountService.kt @@ -14,7 +14,7 @@ import com.x_twitter_scraper.api.models.account.AccountUpdateLocaleParams import com.x_twitter_scraper.api.models.account.AccountUpdateLocaleResponse import java.util.function.Consumer -/** Account info & settings */ +/** Account info and settings */ interface AccountService { /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/AccountServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/AccountServiceImpl.kt index 1b9c9e5..b2ea34d 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/AccountServiceImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/AccountServiceImpl.kt @@ -4,7 +4,6 @@ package com.x_twitter_scraper.api.services.blocking import com.x_twitter_scraper.api.core.ClientOptions import com.x_twitter_scraper.api.core.RequestOptions -import com.x_twitter_scraper.api.core.SecurityOptions import com.x_twitter_scraper.api.core.handlers.errorBodyHandler import com.x_twitter_scraper.api.core.handlers.errorHandler import com.x_twitter_scraper.api.core.handlers.jsonHandler @@ -24,7 +23,7 @@ import com.x_twitter_scraper.api.models.account.AccountUpdateLocaleParams import com.x_twitter_scraper.api.models.account.AccountUpdateLocaleResponse import java.util.function.Consumer -/** Account info & settings */ +/** Account info and settings */ class AccountServiceImpl internal constructor(private val clientOptions: ClientOptions) : AccountService { @@ -84,7 +83,7 @@ class AccountServiceImpl internal constructor(private val clientOptions: ClientO .baseUrl(clientOptions.baseUrl()) .addPathSegments("account") .build() - .prepare(clientOptions, params, SecurityOptions.builder().apiKey(true).build()) + .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return errorHandler.handle(response).parseable { @@ -140,7 +139,7 @@ class AccountServiceImpl internal constructor(private val clientOptions: ClientO .addPathSegments("account") .body(json(clientOptions.jsonMapper, params._body())) .build() - .prepare(clientOptions, params, SecurityOptions.builder().apiKey(true).build()) + .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return errorHandler.handle(response).parseable { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/ApiKeyServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/ApiKeyServiceImpl.kt index 4ac35de..cd503d8 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/ApiKeyServiceImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/ApiKeyServiceImpl.kt @@ -4,7 +4,6 @@ package com.x_twitter_scraper.api.services.blocking import com.x_twitter_scraper.api.core.ClientOptions import com.x_twitter_scraper.api.core.RequestOptions -import com.x_twitter_scraper.api.core.SecurityOptions import com.x_twitter_scraper.api.core.checkRequired import com.x_twitter_scraper.api.core.handlers.errorBodyHandler import com.x_twitter_scraper.api.core.handlers.errorHandler @@ -87,7 +86,7 @@ class ApiKeyServiceImpl internal constructor(private val clientOptions: ClientOp .addPathSegments("api-keys") .body(json(clientOptions.jsonMapper, params._body())) .build() - .prepare(clientOptions, params, SecurityOptions.builder().apiKey(true).build()) + .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return errorHandler.handle(response).parseable { @@ -114,7 +113,7 @@ class ApiKeyServiceImpl internal constructor(private val clientOptions: ClientOp .baseUrl(clientOptions.baseUrl()) .addPathSegments("api-keys") .build() - .prepare(clientOptions, params, SecurityOptions.builder().apiKey(true).build()) + .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return errorHandler.handle(response).parseable { @@ -145,7 +144,7 @@ class ApiKeyServiceImpl internal constructor(private val clientOptions: ClientOp .addPathSegments("api-keys", params._pathParam(0)) .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() - .prepare(clientOptions, params, SecurityOptions.builder().apiKey(true).build()) + .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return errorHandler.handle(response).parseable { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/BotService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/BotService.kt deleted file mode 100644 index b301c18..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/BotService.kt +++ /dev/null @@ -1,37 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.services.blocking - -import com.x_twitter_scraper.api.core.ClientOptions -import com.x_twitter_scraper.api.services.blocking.bot.PlatformLinkService -import java.util.function.Consumer - -interface BotService { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): BotService - - fun platformLinks(): PlatformLinkService - - /** A view of [BotService] that provides access to raw HTTP responses for each method. */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): BotService.WithRawResponse - - fun platformLinks(): PlatformLinkService.WithRawResponse - } -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/BotServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/BotServiceImpl.kt deleted file mode 100644 index cb670e6..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/BotServiceImpl.kt +++ /dev/null @@ -1,43 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.services.blocking - -import com.x_twitter_scraper.api.core.ClientOptions -import com.x_twitter_scraper.api.services.blocking.bot.PlatformLinkService -import com.x_twitter_scraper.api.services.blocking.bot.PlatformLinkServiceImpl -import java.util.function.Consumer - -class BotServiceImpl internal constructor(private val clientOptions: ClientOptions) : BotService { - - private val withRawResponse: BotService.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - private val platformLinks: PlatformLinkService by lazy { - PlatformLinkServiceImpl(clientOptions) - } - - override fun withRawResponse(): BotService.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): BotService = - BotServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun platformLinks(): PlatformLinkService = platformLinks - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - BotService.WithRawResponse { - - private val platformLinks: PlatformLinkService.WithRawResponse by lazy { - PlatformLinkServiceImpl.WithRawResponseImpl(clientOptions) - } - - override fun withOptions( - modifier: Consumer - ): BotService.WithRawResponse = - BotServiceImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - override fun platformLinks(): PlatformLinkService.WithRawResponse = platformLinks - } -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/ComposeService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/ComposeService.kt index 99e3ec2..513bff9 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/ComposeService.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/ComposeService.kt @@ -10,7 +10,7 @@ import com.x_twitter_scraper.api.models.compose.ComposeCreateParams import com.x_twitter_scraper.api.models.compose.ComposeCreateResponse import java.util.function.Consumer -/** Tweet composition, drafts, writing styles & radar */ +/** AI tweet composition, drafts, writing styles, and radar */ interface ComposeService { /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/ComposeServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/ComposeServiceImpl.kt index 2f0e4fd..4924a92 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/ComposeServiceImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/ComposeServiceImpl.kt @@ -19,7 +19,7 @@ import com.x_twitter_scraper.api.models.compose.ComposeCreateParams import com.x_twitter_scraper.api.models.compose.ComposeCreateResponse import java.util.function.Consumer -/** Tweet composition, drafts, writing styles & radar */ +/** AI tweet composition, drafts, writing styles, and radar */ class ComposeServiceImpl internal constructor(private val clientOptions: ClientOptions) : ComposeService { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/CreditService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/CreditService.kt index 735a759..2dc21bc 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/CreditService.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/CreditService.kt @@ -12,7 +12,7 @@ import com.x_twitter_scraper.api.models.credits.CreditTopupBalanceParams import com.x_twitter_scraper.api.models.credits.CreditTopupBalanceResponse import java.util.function.Consumer -/** Subscription & billing */ +/** Subscription, billing, and credits */ interface CreditService { /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/CreditServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/CreditServiceImpl.kt index 132edde..cfe90e5 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/CreditServiceImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/CreditServiceImpl.kt @@ -21,7 +21,7 @@ import com.x_twitter_scraper.api.models.credits.CreditTopupBalanceParams import com.x_twitter_scraper.api.models.credits.CreditTopupBalanceResponse import java.util.function.Consumer -/** Subscription & billing */ +/** Subscription, billing, and credits */ class CreditServiceImpl internal constructor(private val clientOptions: ClientOptions) : CreditService { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/DraftService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/DraftService.kt index c688be1..7ada5e6 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/DraftService.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/DraftService.kt @@ -15,7 +15,7 @@ import com.x_twitter_scraper.api.models.drafts.DraftListResponse import com.x_twitter_scraper.api.models.drafts.DraftRetrieveParams import java.util.function.Consumer -/** Tweet composition, drafts, writing styles & radar */ +/** AI tweet composition, drafts, writing styles, and radar */ interface DraftService { /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/DraftServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/DraftServiceImpl.kt index 0eb003e..db7f295 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/DraftServiceImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/DraftServiceImpl.kt @@ -26,7 +26,7 @@ import com.x_twitter_scraper.api.models.drafts.DraftRetrieveParams import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull -/** Tweet composition, drafts, writing styles & radar */ +/** AI tweet composition, drafts, writing styles, and radar */ class DraftServiceImpl internal constructor(private val clientOptions: ClientOptions) : DraftService { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/EventServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/EventServiceImpl.kt index 5cf17bc..6737f1d 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/EventServiceImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/EventServiceImpl.kt @@ -4,7 +4,6 @@ package com.x_twitter_scraper.api.services.blocking import com.x_twitter_scraper.api.core.ClientOptions import com.x_twitter_scraper.api.core.RequestOptions -import com.x_twitter_scraper.api.core.SecurityOptions import com.x_twitter_scraper.api.core.checkRequired import com.x_twitter_scraper.api.core.handlers.errorBodyHandler import com.x_twitter_scraper.api.core.handlers.errorHandler @@ -103,7 +102,7 @@ class EventServiceImpl internal constructor(private val clientOptions: ClientOpt .baseUrl(clientOptions.baseUrl()) .addPathSegments("events") .build() - .prepare(clientOptions, params, SecurityOptions.builder().apiKey(true).build()) + .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return errorHandler.handle(response).parseable { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/IntegrationService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/IntegrationService.kt deleted file mode 100644 index 07d8489..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/IntegrationService.kt +++ /dev/null @@ -1,492 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.services.blocking - -import com.google.errorprone.annotations.MustBeClosed -import com.x_twitter_scraper.api.core.ClientOptions -import com.x_twitter_scraper.api.core.RequestOptions -import com.x_twitter_scraper.api.core.http.HttpResponseFor -import com.x_twitter_scraper.api.models.integrations.Integration -import com.x_twitter_scraper.api.models.integrations.IntegrationCreateParams -import com.x_twitter_scraper.api.models.integrations.IntegrationDeleteParams -import com.x_twitter_scraper.api.models.integrations.IntegrationDeleteResponse -import com.x_twitter_scraper.api.models.integrations.IntegrationListDeliveriesParams -import com.x_twitter_scraper.api.models.integrations.IntegrationListDeliveriesResponse -import com.x_twitter_scraper.api.models.integrations.IntegrationListParams -import com.x_twitter_scraper.api.models.integrations.IntegrationListResponse -import com.x_twitter_scraper.api.models.integrations.IntegrationRetrieveParams -import com.x_twitter_scraper.api.models.integrations.IntegrationSendTestParams -import com.x_twitter_scraper.api.models.integrations.IntegrationSendTestResponse -import com.x_twitter_scraper.api.models.integrations.IntegrationUpdateParams -import java.util.function.Consumer - -/** Push notification integrations (Telegram) */ -interface IntegrationService { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): IntegrationService - - /** Create integration */ - fun create(params: IntegrationCreateParams): Integration = create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: IntegrationCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): Integration - - /** Get integration details */ - fun retrieve(id: String): Integration = retrieve(id, IntegrationRetrieveParams.none()) - - /** @see retrieve */ - fun retrieve( - id: String, - params: IntegrationRetrieveParams = IntegrationRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): Integration = retrieve(params.toBuilder().id(id).build(), requestOptions) - - /** @see retrieve */ - fun retrieve( - id: String, - params: IntegrationRetrieveParams = IntegrationRetrieveParams.none(), - ): Integration = retrieve(id, params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - params: IntegrationRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): Integration - - /** @see retrieve */ - fun retrieve(params: IntegrationRetrieveParams): Integration = - retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve(id: String, requestOptions: RequestOptions): Integration = - retrieve(id, IntegrationRetrieveParams.none(), requestOptions) - - /** Update integration */ - fun update(id: String): Integration = update(id, IntegrationUpdateParams.none()) - - /** @see update */ - fun update( - id: String, - params: IntegrationUpdateParams = IntegrationUpdateParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): Integration = update(params.toBuilder().id(id).build(), requestOptions) - - /** @see update */ - fun update( - id: String, - params: IntegrationUpdateParams = IntegrationUpdateParams.none(), - ): Integration = update(id, params, RequestOptions.none()) - - /** @see update */ - fun update( - params: IntegrationUpdateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): Integration - - /** @see update */ - fun update(params: IntegrationUpdateParams): Integration = update(params, RequestOptions.none()) - - /** @see update */ - fun update(id: String, requestOptions: RequestOptions): Integration = - update(id, IntegrationUpdateParams.none(), requestOptions) - - /** List integrations */ - fun list(): IntegrationListResponse = list(IntegrationListParams.none()) - - /** @see list */ - fun list( - params: IntegrationListParams = IntegrationListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): IntegrationListResponse - - /** @see list */ - fun list( - params: IntegrationListParams = IntegrationListParams.none() - ): IntegrationListResponse = list(params, RequestOptions.none()) - - /** @see list */ - fun list(requestOptions: RequestOptions): IntegrationListResponse = - list(IntegrationListParams.none(), requestOptions) - - /** Delete integration */ - fun delete(id: String): IntegrationDeleteResponse = delete(id, IntegrationDeleteParams.none()) - - /** @see delete */ - fun delete( - id: String, - params: IntegrationDeleteParams = IntegrationDeleteParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): IntegrationDeleteResponse = delete(params.toBuilder().id(id).build(), requestOptions) - - /** @see delete */ - fun delete( - id: String, - params: IntegrationDeleteParams = IntegrationDeleteParams.none(), - ): IntegrationDeleteResponse = delete(id, params, RequestOptions.none()) - - /** @see delete */ - fun delete( - params: IntegrationDeleteParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): IntegrationDeleteResponse - - /** @see delete */ - fun delete(params: IntegrationDeleteParams): IntegrationDeleteResponse = - delete(params, RequestOptions.none()) - - /** @see delete */ - fun delete(id: String, requestOptions: RequestOptions): IntegrationDeleteResponse = - delete(id, IntegrationDeleteParams.none(), requestOptions) - - /** List integration delivery history */ - fun listDeliveries(id: String): IntegrationListDeliveriesResponse = - listDeliveries(id, IntegrationListDeliveriesParams.none()) - - /** @see listDeliveries */ - fun listDeliveries( - id: String, - params: IntegrationListDeliveriesParams = IntegrationListDeliveriesParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): IntegrationListDeliveriesResponse = - listDeliveries(params.toBuilder().id(id).build(), requestOptions) - - /** @see listDeliveries */ - fun listDeliveries( - id: String, - params: IntegrationListDeliveriesParams = IntegrationListDeliveriesParams.none(), - ): IntegrationListDeliveriesResponse = listDeliveries(id, params, RequestOptions.none()) - - /** @see listDeliveries */ - fun listDeliveries( - params: IntegrationListDeliveriesParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): IntegrationListDeliveriesResponse - - /** @see listDeliveries */ - fun listDeliveries(params: IntegrationListDeliveriesParams): IntegrationListDeliveriesResponse = - listDeliveries(params, RequestOptions.none()) - - /** @see listDeliveries */ - fun listDeliveries( - id: String, - requestOptions: RequestOptions, - ): IntegrationListDeliveriesResponse = - listDeliveries(id, IntegrationListDeliveriesParams.none(), requestOptions) - - /** Send test delivery */ - fun sendTest(id: String): IntegrationSendTestResponse = - sendTest(id, IntegrationSendTestParams.none()) - - /** @see sendTest */ - fun sendTest( - id: String, - params: IntegrationSendTestParams = IntegrationSendTestParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): IntegrationSendTestResponse = sendTest(params.toBuilder().id(id).build(), requestOptions) - - /** @see sendTest */ - fun sendTest( - id: String, - params: IntegrationSendTestParams = IntegrationSendTestParams.none(), - ): IntegrationSendTestResponse = sendTest(id, params, RequestOptions.none()) - - /** @see sendTest */ - fun sendTest( - params: IntegrationSendTestParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): IntegrationSendTestResponse - - /** @see sendTest */ - fun sendTest(params: IntegrationSendTestParams): IntegrationSendTestResponse = - sendTest(params, RequestOptions.none()) - - /** @see sendTest */ - fun sendTest(id: String, requestOptions: RequestOptions): IntegrationSendTestResponse = - sendTest(id, IntegrationSendTestParams.none(), requestOptions) - - /** - * A view of [IntegrationService] that provides access to raw HTTP responses for each method. - */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions( - modifier: Consumer - ): IntegrationService.WithRawResponse - - /** - * Returns a raw HTTP response for `post /integrations`, but is otherwise the same as - * [IntegrationService.create]. - */ - @MustBeClosed - fun create(params: IntegrationCreateParams): HttpResponseFor = - create(params, RequestOptions.none()) - - /** @see create */ - @MustBeClosed - fun create( - params: IntegrationCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** - * Returns a raw HTTP response for `get /integrations/{id}`, but is otherwise the same as - * [IntegrationService.retrieve]. - */ - @MustBeClosed - fun retrieve(id: String): HttpResponseFor = - retrieve(id, IntegrationRetrieveParams.none()) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - id: String, - params: IntegrationRetrieveParams = IntegrationRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - retrieve(params.toBuilder().id(id).build(), requestOptions) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - id: String, - params: IntegrationRetrieveParams = IntegrationRetrieveParams.none(), - ): HttpResponseFor = retrieve(id, params, RequestOptions.none()) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - params: IntegrationRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see retrieve */ - @MustBeClosed - fun retrieve(params: IntegrationRetrieveParams): HttpResponseFor = - retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - @MustBeClosed - fun retrieve(id: String, requestOptions: RequestOptions): HttpResponseFor = - retrieve(id, IntegrationRetrieveParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `patch /integrations/{id}`, but is otherwise the same as - * [IntegrationService.update]. - */ - @MustBeClosed - fun update(id: String): HttpResponseFor = - update(id, IntegrationUpdateParams.none()) - - /** @see update */ - @MustBeClosed - fun update( - id: String, - params: IntegrationUpdateParams = IntegrationUpdateParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = update(params.toBuilder().id(id).build(), requestOptions) - - /** @see update */ - @MustBeClosed - fun update( - id: String, - params: IntegrationUpdateParams = IntegrationUpdateParams.none(), - ): HttpResponseFor = update(id, params, RequestOptions.none()) - - /** @see update */ - @MustBeClosed - fun update( - params: IntegrationUpdateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see update */ - @MustBeClosed - fun update(params: IntegrationUpdateParams): HttpResponseFor = - update(params, RequestOptions.none()) - - /** @see update */ - @MustBeClosed - fun update(id: String, requestOptions: RequestOptions): HttpResponseFor = - update(id, IntegrationUpdateParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get /integrations`, but is otherwise the same as - * [IntegrationService.list]. - */ - @MustBeClosed - fun list(): HttpResponseFor = list(IntegrationListParams.none()) - - /** @see list */ - @MustBeClosed - fun list( - params: IntegrationListParams = IntegrationListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see list */ - @MustBeClosed - fun list( - params: IntegrationListParams = IntegrationListParams.none() - ): HttpResponseFor = list(params, RequestOptions.none()) - - /** @see list */ - @MustBeClosed - fun list(requestOptions: RequestOptions): HttpResponseFor = - list(IntegrationListParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `delete /integrations/{id}`, but is otherwise the same as - * [IntegrationService.delete]. - */ - @MustBeClosed - fun delete(id: String): HttpResponseFor = - delete(id, IntegrationDeleteParams.none()) - - /** @see delete */ - @MustBeClosed - fun delete( - id: String, - params: IntegrationDeleteParams = IntegrationDeleteParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - delete(params.toBuilder().id(id).build(), requestOptions) - - /** @see delete */ - @MustBeClosed - fun delete( - id: String, - params: IntegrationDeleteParams = IntegrationDeleteParams.none(), - ): HttpResponseFor = delete(id, params, RequestOptions.none()) - - /** @see delete */ - @MustBeClosed - fun delete( - params: IntegrationDeleteParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see delete */ - @MustBeClosed - fun delete(params: IntegrationDeleteParams): HttpResponseFor = - delete(params, RequestOptions.none()) - - /** @see delete */ - @MustBeClosed - fun delete( - id: String, - requestOptions: RequestOptions, - ): HttpResponseFor = - delete(id, IntegrationDeleteParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get /integrations/{id}/deliveries`, but is otherwise the - * same as [IntegrationService.listDeliveries]. - */ - @MustBeClosed - fun listDeliveries(id: String): HttpResponseFor = - listDeliveries(id, IntegrationListDeliveriesParams.none()) - - /** @see listDeliveries */ - @MustBeClosed - fun listDeliveries( - id: String, - params: IntegrationListDeliveriesParams = IntegrationListDeliveriesParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - listDeliveries(params.toBuilder().id(id).build(), requestOptions) - - /** @see listDeliveries */ - @MustBeClosed - fun listDeliveries( - id: String, - params: IntegrationListDeliveriesParams = IntegrationListDeliveriesParams.none(), - ): HttpResponseFor = - listDeliveries(id, params, RequestOptions.none()) - - /** @see listDeliveries */ - @MustBeClosed - fun listDeliveries( - params: IntegrationListDeliveriesParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see listDeliveries */ - @MustBeClosed - fun listDeliveries( - params: IntegrationListDeliveriesParams - ): HttpResponseFor = - listDeliveries(params, RequestOptions.none()) - - /** @see listDeliveries */ - @MustBeClosed - fun listDeliveries( - id: String, - requestOptions: RequestOptions, - ): HttpResponseFor = - listDeliveries(id, IntegrationListDeliveriesParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `post /integrations/{id}/test`, but is otherwise the same - * as [IntegrationService.sendTest]. - */ - @MustBeClosed - fun sendTest(id: String): HttpResponseFor = - sendTest(id, IntegrationSendTestParams.none()) - - /** @see sendTest */ - @MustBeClosed - fun sendTest( - id: String, - params: IntegrationSendTestParams = IntegrationSendTestParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - sendTest(params.toBuilder().id(id).build(), requestOptions) - - /** @see sendTest */ - @MustBeClosed - fun sendTest( - id: String, - params: IntegrationSendTestParams = IntegrationSendTestParams.none(), - ): HttpResponseFor = - sendTest(id, params, RequestOptions.none()) - - /** @see sendTest */ - @MustBeClosed - fun sendTest( - params: IntegrationSendTestParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see sendTest */ - @MustBeClosed - fun sendTest( - params: IntegrationSendTestParams - ): HttpResponseFor = sendTest(params, RequestOptions.none()) - - /** @see sendTest */ - @MustBeClosed - fun sendTest( - id: String, - requestOptions: RequestOptions, - ): HttpResponseFor = - sendTest(id, IntegrationSendTestParams.none(), requestOptions) - } -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/IntegrationServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/IntegrationServiceImpl.kt deleted file mode 100644 index a22f239..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/IntegrationServiceImpl.kt +++ /dev/null @@ -1,317 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.services.blocking - -import com.x_twitter_scraper.api.core.ClientOptions -import com.x_twitter_scraper.api.core.RequestOptions -import com.x_twitter_scraper.api.core.checkRequired -import com.x_twitter_scraper.api.core.handlers.errorBodyHandler -import com.x_twitter_scraper.api.core.handlers.errorHandler -import com.x_twitter_scraper.api.core.handlers.jsonHandler -import com.x_twitter_scraper.api.core.http.HttpMethod -import com.x_twitter_scraper.api.core.http.HttpRequest -import com.x_twitter_scraper.api.core.http.HttpResponse -import com.x_twitter_scraper.api.core.http.HttpResponse.Handler -import com.x_twitter_scraper.api.core.http.HttpResponseFor -import com.x_twitter_scraper.api.core.http.json -import com.x_twitter_scraper.api.core.http.parseable -import com.x_twitter_scraper.api.core.prepare -import com.x_twitter_scraper.api.models.integrations.Integration -import com.x_twitter_scraper.api.models.integrations.IntegrationCreateParams -import com.x_twitter_scraper.api.models.integrations.IntegrationDeleteParams -import com.x_twitter_scraper.api.models.integrations.IntegrationDeleteResponse -import com.x_twitter_scraper.api.models.integrations.IntegrationListDeliveriesParams -import com.x_twitter_scraper.api.models.integrations.IntegrationListDeliveriesResponse -import com.x_twitter_scraper.api.models.integrations.IntegrationListParams -import com.x_twitter_scraper.api.models.integrations.IntegrationListResponse -import com.x_twitter_scraper.api.models.integrations.IntegrationRetrieveParams -import com.x_twitter_scraper.api.models.integrations.IntegrationSendTestParams -import com.x_twitter_scraper.api.models.integrations.IntegrationSendTestResponse -import com.x_twitter_scraper.api.models.integrations.IntegrationUpdateParams -import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull - -/** Push notification integrations (Telegram) */ -class IntegrationServiceImpl internal constructor(private val clientOptions: ClientOptions) : - IntegrationService { - - private val withRawResponse: IntegrationService.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): IntegrationService.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): IntegrationService = - IntegrationServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun create( - params: IntegrationCreateParams, - requestOptions: RequestOptions, - ): Integration = - // post /integrations - withRawResponse().create(params, requestOptions).parse() - - override fun retrieve( - params: IntegrationRetrieveParams, - requestOptions: RequestOptions, - ): Integration = - // get /integrations/{id} - withRawResponse().retrieve(params, requestOptions).parse() - - override fun update( - params: IntegrationUpdateParams, - requestOptions: RequestOptions, - ): Integration = - // patch /integrations/{id} - withRawResponse().update(params, requestOptions).parse() - - override fun list( - params: IntegrationListParams, - requestOptions: RequestOptions, - ): IntegrationListResponse = - // get /integrations - withRawResponse().list(params, requestOptions).parse() - - override fun delete( - params: IntegrationDeleteParams, - requestOptions: RequestOptions, - ): IntegrationDeleteResponse = - // delete /integrations/{id} - withRawResponse().delete(params, requestOptions).parse() - - override fun listDeliveries( - params: IntegrationListDeliveriesParams, - requestOptions: RequestOptions, - ): IntegrationListDeliveriesResponse = - // get /integrations/{id}/deliveries - withRawResponse().listDeliveries(params, requestOptions).parse() - - override fun sendTest( - params: IntegrationSendTestParams, - requestOptions: RequestOptions, - ): IntegrationSendTestResponse = - // post /integrations/{id}/test - withRawResponse().sendTest(params, requestOptions).parse() - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - IntegrationService.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): IntegrationService.WithRawResponse = - IntegrationServiceImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun create( - params: IntegrationCreateParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("integrations") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun retrieve( - params: IntegrationRetrieveParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("id", params.id().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("integrations", params._pathParam(0)) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun update( - params: IntegrationUpdateParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("id", params.id().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.PATCH) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("integrations", params._pathParam(0)) - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { updateHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun list( - params: IntegrationListParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("integrations") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - - private val deleteHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun delete( - params: IntegrationDeleteParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("id", params.id().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.DELETE) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("integrations", params._pathParam(0)) - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { deleteHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - - private val listDeliveriesHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun listDeliveries( - params: IntegrationListDeliveriesParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("id", params.id().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("integrations", params._pathParam(0), "deliveries") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { listDeliveriesHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - - private val sendTestHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun sendTest( - params: IntegrationSendTestParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("id", params.id().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("integrations", params._pathParam(0), "test") - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { sendTestHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/RadarService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/RadarService.kt index 8f5c006..10c32ec 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/RadarService.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/RadarService.kt @@ -10,7 +10,7 @@ import com.x_twitter_scraper.api.models.radar.RadarRetrieveTrendingTopicsParams import com.x_twitter_scraper.api.models.radar.RadarRetrieveTrendingTopicsResponse import java.util.function.Consumer -/** Tweet composition, drafts, writing styles & radar */ +/** AI tweet composition, drafts, writing styles, and radar */ interface RadarService { /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/RadarServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/RadarServiceImpl.kt index 5a23a87..c7fb387 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/RadarServiceImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/RadarServiceImpl.kt @@ -18,7 +18,7 @@ import com.x_twitter_scraper.api.models.radar.RadarRetrieveTrendingTopicsParams import com.x_twitter_scraper.api.models.radar.RadarRetrieveTrendingTopicsResponse import java.util.function.Consumer -/** Tweet composition, drafts, writing styles & radar */ +/** AI tweet composition, drafts, writing styles, and radar */ class RadarServiceImpl internal constructor(private val clientOptions: ClientOptions) : RadarService { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/StyleService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/StyleService.kt index aced778..2e1d4b1 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/StyleService.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/StyleService.kt @@ -20,7 +20,7 @@ import com.x_twitter_scraper.api.models.styles.StyleRetrieveParams import com.x_twitter_scraper.api.models.styles.StyleUpdateParams import java.util.function.Consumer -/** Tweet composition, drafts, writing styles & radar */ +/** AI tweet composition, drafts, writing styles, and radar */ interface StyleService { /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/StyleServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/StyleServiceImpl.kt index 98c5565..4c21840 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/StyleServiceImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/StyleServiceImpl.kt @@ -31,7 +31,7 @@ import com.x_twitter_scraper.api.models.styles.StyleUpdateParams import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull -/** Tweet composition, drafts, writing styles & radar */ +/** AI tweet composition, drafts, writing styles, and radar */ class StyleServiceImpl internal constructor(private val clientOptions: ClientOptions) : StyleService { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/SubscribeService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/SubscribeService.kt index 5486128..c6c32cf 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/SubscribeService.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/SubscribeService.kt @@ -10,7 +10,7 @@ import com.x_twitter_scraper.api.models.subscribe.SubscribeCreateParams import com.x_twitter_scraper.api.models.subscribe.SubscribeCreateResponse import java.util.function.Consumer -/** Subscription & billing */ +/** Subscription, billing, and credits */ interface SubscribeService { /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/SubscribeServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/SubscribeServiceImpl.kt index 518028a..946b017 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/SubscribeServiceImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/SubscribeServiceImpl.kt @@ -19,7 +19,7 @@ import com.x_twitter_scraper.api.models.subscribe.SubscribeCreateParams import com.x_twitter_scraper.api.models.subscribe.SubscribeCreateResponse import java.util.function.Consumer -/** Subscription & billing */ +/** Subscription, billing, and credits */ class SubscribeServiceImpl internal constructor(private val clientOptions: ClientOptions) : SubscribeService { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/TrendService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/TrendService.kt index fe2b59e..ed0a98e 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/TrendService.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/TrendService.kt @@ -10,7 +10,7 @@ import com.x_twitter_scraper.api.models.trends.TrendListParams import com.x_twitter_scraper.api.models.trends.TrendListResponse import java.util.function.Consumer -/** Trending topics by region */ +/** Trending topics and hashtags by region */ interface TrendService { /** @@ -25,7 +25,7 @@ interface TrendService { */ fun withOptions(modifier: Consumer): TrendService - /** Get regional trending topics */ + /** Get trending hashtags and topics by region (alias) */ fun list(): TrendListResponse = list(TrendListParams.none()) /** @see list */ diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/TrendServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/TrendServiceImpl.kt index 1d006bc..cda82fb 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/TrendServiceImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/TrendServiceImpl.kt @@ -18,7 +18,7 @@ import com.x_twitter_scraper.api.models.trends.TrendListParams import com.x_twitter_scraper.api.models.trends.TrendListResponse import java.util.function.Consumer -/** Trending topics by region */ +/** Trending topics and hashtags by region */ class TrendServiceImpl internal constructor(private val clientOptions: ClientOptions) : TrendService { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/WebhookService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/WebhookService.kt index 1e4e8e6..53f426b 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/WebhookService.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/WebhookService.kt @@ -20,7 +20,7 @@ import com.x_twitter_scraper.api.models.webhooks.WebhookTestResponse import com.x_twitter_scraper.api.models.webhooks.WebhookUpdateParams import java.util.function.Consumer -/** Webhook endpoint management & delivery */ +/** Webhook endpoint management and delivery */ interface WebhookService { /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/WebhookServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/WebhookServiceImpl.kt index ec7a3d0..7d69051 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/WebhookServiceImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/WebhookServiceImpl.kt @@ -31,7 +31,7 @@ import com.x_twitter_scraper.api.models.webhooks.WebhookUpdateParams import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull -/** Webhook endpoint management & delivery */ +/** Webhook endpoint management and delivery */ class WebhookServiceImpl internal constructor(private val clientOptions: ClientOptions) : WebhookService { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/XService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/XService.kt index c6c76d2..0a53ea1 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/XService.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/XService.kt @@ -26,7 +26,6 @@ import com.x_twitter_scraper.api.services.blocking.x.TweetService import com.x_twitter_scraper.api.services.blocking.x.UserService import java.util.function.Consumer -/** X data lookups (subscription required) */ interface XService { /** @@ -43,15 +42,15 @@ interface XService { fun tweets(): TweetService - /** X data lookups (subscription required) */ + /** Look up, search, and explore user profiles and relationships */ fun users(): UserService - /** X data lookups (subscription required) */ + /** Look up, search, and explore user profiles and relationships */ fun followers(): FollowerService fun dm(): DmService - /** Media upload & download */ + /** Media upload and download */ fun media(): MediaService /** X write actions (tweets, likes, follows, DMs) */ @@ -62,10 +61,10 @@ interface XService { /** Connected X account management */ fun accounts(): AccountService - /** X data lookups (subscription required) */ + /** Look up, search, and analyze individual tweets */ fun bookmarks(): BookmarkService - /** X data lookups (subscription required) */ + /** X List followers, members, and tweets */ fun lists(): ListService /** Retrieve the full content of an X Article (long-form post) by tweet ID. */ @@ -136,7 +135,7 @@ interface XService { fun getNotifications(requestOptions: RequestOptions): XGetNotificationsResponse = getNotifications(XGetNotificationsParams.none(), requestOptions) - /** Get trending topics */ + /** Get trending hashtags and topics from X by region */ fun getTrends(): XGetTrendsResponse = getTrends(XGetTrendsParams.none()) /** @see getTrends */ @@ -165,15 +164,15 @@ interface XService { fun tweets(): TweetService.WithRawResponse - /** X data lookups (subscription required) */ + /** Look up, search, and explore user profiles and relationships */ fun users(): UserService.WithRawResponse - /** X data lookups (subscription required) */ + /** Look up, search, and explore user profiles and relationships */ fun followers(): FollowerService.WithRawResponse fun dm(): DmService.WithRawResponse - /** Media upload & download */ + /** Media upload and download */ fun media(): MediaService.WithRawResponse /** X write actions (tweets, likes, follows, DMs) */ @@ -184,10 +183,10 @@ interface XService { /** Connected X account management */ fun accounts(): AccountService.WithRawResponse - /** X data lookups (subscription required) */ + /** Look up, search, and analyze individual tweets */ fun bookmarks(): BookmarkService.WithRawResponse - /** X data lookups (subscription required) */ + /** X List followers, members, and tweets */ fun lists(): ListService.WithRawResponse /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/XServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/XServiceImpl.kt index 78708be..4e0116c 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/XServiceImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/XServiceImpl.kt @@ -46,7 +46,6 @@ import com.x_twitter_scraper.api.services.blocking.x.UserServiceImpl import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull -/** X data lookups (subscription required) */ class XServiceImpl internal constructor(private val clientOptions: ClientOptions) : XService { private val withRawResponse: XService.WithRawResponse by lazy { @@ -80,15 +79,15 @@ class XServiceImpl internal constructor(private val clientOptions: ClientOptions override fun tweets(): TweetService = tweets - /** X data lookups (subscription required) */ + /** Look up, search, and explore user profiles and relationships */ override fun users(): UserService = users - /** X data lookups (subscription required) */ + /** Look up, search, and explore user profiles and relationships */ override fun followers(): FollowerService = followers override fun dm(): DmService = dm - /** Media upload & download */ + /** Media upload and download */ override fun media(): MediaService = media /** X write actions (tweets, likes, follows, DMs) */ @@ -99,10 +98,10 @@ class XServiceImpl internal constructor(private val clientOptions: ClientOptions /** Connected X account management */ override fun accounts(): AccountService = accounts - /** X data lookups (subscription required) */ + /** Look up, search, and analyze individual tweets */ override fun bookmarks(): BookmarkService = bookmarks - /** X data lookups (subscription required) */ + /** X List followers, members, and tweets */ override fun lists(): ListService = lists override fun getArticle( @@ -188,15 +187,15 @@ class XServiceImpl internal constructor(private val clientOptions: ClientOptions override fun tweets(): TweetService.WithRawResponse = tweets - /** X data lookups (subscription required) */ + /** Look up, search, and explore user profiles and relationships */ override fun users(): UserService.WithRawResponse = users - /** X data lookups (subscription required) */ + /** Look up, search, and explore user profiles and relationships */ override fun followers(): FollowerService.WithRawResponse = followers override fun dm(): DmService.WithRawResponse = dm - /** Media upload & download */ + /** Media upload and download */ override fun media(): MediaService.WithRawResponse = media /** X write actions (tweets, likes, follows, DMs) */ @@ -207,10 +206,10 @@ class XServiceImpl internal constructor(private val clientOptions: ClientOptions /** Connected X account management */ override fun accounts(): AccountService.WithRawResponse = accounts - /** X data lookups (subscription required) */ + /** Look up, search, and analyze individual tweets */ override fun bookmarks(): BookmarkService.WithRawResponse = bookmarks - /** X data lookups (subscription required) */ + /** X List followers, members, and tweets */ override fun lists(): ListService.WithRawResponse = lists private val getArticleHandler: Handler = diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/bot/PlatformLinkService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/bot/PlatformLinkService.kt deleted file mode 100644 index 7a82b92..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/bot/PlatformLinkService.kt +++ /dev/null @@ -1,36 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.services.blocking.bot - -import com.x_twitter_scraper.api.core.ClientOptions -import java.util.function.Consumer - -interface PlatformLinkService { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): PlatformLinkService - - /** - * A view of [PlatformLinkService] that provides access to raw HTTP responses for each method. - */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions( - modifier: Consumer - ): PlatformLinkService.WithRawResponse - } -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/bot/PlatformLinkServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/bot/PlatformLinkServiceImpl.kt deleted file mode 100644 index 702983e..0000000 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/bot/PlatformLinkServiceImpl.kt +++ /dev/null @@ -1,30 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.services.blocking.bot - -import com.x_twitter_scraper.api.core.ClientOptions -import java.util.function.Consumer - -class PlatformLinkServiceImpl internal constructor(private val clientOptions: ClientOptions) : - PlatformLinkService { - - private val withRawResponse: PlatformLinkService.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): PlatformLinkService.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): PlatformLinkService = - PlatformLinkServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - PlatformLinkService.WithRawResponse { - - override fun withOptions( - modifier: Consumer - ): PlatformLinkService.WithRawResponse = - PlatformLinkServiceImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - } -} diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/AccountServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/AccountServiceImpl.kt index 5e3f782..d6f825d 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/AccountServiceImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/AccountServiceImpl.kt @@ -4,7 +4,6 @@ package com.x_twitter_scraper.api.services.blocking.x import com.x_twitter_scraper.api.core.ClientOptions import com.x_twitter_scraper.api.core.RequestOptions -import com.x_twitter_scraper.api.core.SecurityOptions import com.x_twitter_scraper.api.core.checkRequired import com.x_twitter_scraper.api.core.handlers.errorBodyHandler import com.x_twitter_scraper.api.core.handlers.errorHandler @@ -114,7 +113,7 @@ class AccountServiceImpl internal constructor(private val clientOptions: ClientO .addPathSegments("x", "accounts") .body(json(clientOptions.jsonMapper, params._body())) .build() - .prepare(clientOptions, params, SecurityOptions.builder().apiKey(true).build()) + .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return errorHandler.handle(response).parseable { @@ -144,7 +143,7 @@ class AccountServiceImpl internal constructor(private val clientOptions: ClientO .baseUrl(clientOptions.baseUrl()) .addPathSegments("x", "accounts", params._pathParam(0)) .build() - .prepare(clientOptions, params, SecurityOptions.builder().apiKey(true).build()) + .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return errorHandler.handle(response).parseable { @@ -171,7 +170,7 @@ class AccountServiceImpl internal constructor(private val clientOptions: ClientO .baseUrl(clientOptions.baseUrl()) .addPathSegments("x", "accounts") .build() - .prepare(clientOptions, params, SecurityOptions.builder().apiKey(true).build()) + .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return errorHandler.handle(response).parseable { @@ -202,7 +201,7 @@ class AccountServiceImpl internal constructor(private val clientOptions: ClientO .addPathSegments("x", "accounts", params._pathParam(0)) .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() - .prepare(clientOptions, params, SecurityOptions.builder().apiKey(true).build()) + .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return errorHandler.handle(response).parseable { @@ -230,7 +229,7 @@ class AccountServiceImpl internal constructor(private val clientOptions: ClientO .addPathSegments("x", "accounts", "bulk-retry") .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } .build() - .prepare(clientOptions, params, SecurityOptions.builder().apiKey(true).build()) + .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return errorHandler.handle(response).parseable { @@ -261,7 +260,7 @@ class AccountServiceImpl internal constructor(private val clientOptions: ClientO .addPathSegments("x", "accounts", params._pathParam(0), "reauth") .body(json(clientOptions.jsonMapper, params._body())) .build() - .prepare(clientOptions, params, SecurityOptions.builder().apiKey(true).build()) + .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return errorHandler.handle(response).parseable { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/BookmarkService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/BookmarkService.kt index d991de0..c414183 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/BookmarkService.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/BookmarkService.kt @@ -12,7 +12,7 @@ import com.x_twitter_scraper.api.models.x.bookmarks.BookmarkRetrieveFoldersParam import com.x_twitter_scraper.api.models.x.bookmarks.BookmarkRetrieveFoldersResponse import java.util.function.Consumer -/** X data lookups (subscription required) */ +/** Look up, search, and analyze individual tweets */ interface BookmarkService { /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/BookmarkServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/BookmarkServiceImpl.kt index 04a308e..37b4297 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/BookmarkServiceImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/BookmarkServiceImpl.kt @@ -20,7 +20,7 @@ import com.x_twitter_scraper.api.models.x.bookmarks.BookmarkRetrieveFoldersParam import com.x_twitter_scraper.api.models.x.bookmarks.BookmarkRetrieveFoldersResponse import java.util.function.Consumer -/** X data lookups (subscription required) */ +/** Look up, search, and analyze individual tweets */ class BookmarkServiceImpl internal constructor(private val clientOptions: ClientOptions) : BookmarkService { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/CommunityService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/CommunityService.kt index 25411e2..268cc83 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/CommunityService.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/CommunityService.kt @@ -38,7 +38,7 @@ interface CommunityService { /** X write actions (tweets, likes, follows, DMs) */ fun join(): JoinService - /** X data lookups (subscription required) */ + /** X Community info, members, and tweets */ fun tweets(): TweetService /** Create community */ @@ -72,7 +72,7 @@ interface CommunityService { requestOptions: RequestOptions = RequestOptions.none(), ): CommunityDeleteResponse - /** Get community details */ + /** Get community name, description and member count */ fun retrieveInfo(id: String): CommunityRetrieveInfoResponse = retrieveInfo(id, CommunityRetrieveInfoParams.none()) @@ -104,7 +104,7 @@ interface CommunityService { fun retrieveInfo(id: String, requestOptions: RequestOptions): CommunityRetrieveInfoResponse = retrieveInfo(id, CommunityRetrieveInfoParams.none(), requestOptions) - /** Get community members */ + /** List members of a community */ fun retrieveMembers(id: String): PaginatedUsers = retrieveMembers(id, CommunityRetrieveMembersParams.none()) @@ -135,7 +135,7 @@ interface CommunityService { fun retrieveMembers(id: String, requestOptions: RequestOptions): PaginatedUsers = retrieveMembers(id, CommunityRetrieveMembersParams.none(), requestOptions) - /** Get community moderators */ + /** List moderators of a community */ fun retrieveModerators(id: String): PaginatedUsers = retrieveModerators(id, CommunityRetrieveModeratorsParams.none()) @@ -166,7 +166,7 @@ interface CommunityService { fun retrieveModerators(id: String, requestOptions: RequestOptions): PaginatedUsers = retrieveModerators(id, CommunityRetrieveModeratorsParams.none(), requestOptions) - /** Search tweets across communities */ + /** Search for communities by keyword */ fun retrieveSearch(params: CommunityRetrieveSearchParams): PaginatedTweets = retrieveSearch(params, RequestOptions.none()) @@ -189,7 +189,7 @@ interface CommunityService { /** X write actions (tweets, likes, follows, DMs) */ fun join(): JoinService.WithRawResponse - /** X data lookups (subscription required) */ + /** X Community info, members, and tweets */ fun tweets(): TweetService.WithRawResponse /** diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/CommunityServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/CommunityServiceImpl.kt index 8f67027..2e20582 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/CommunityServiceImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/CommunityServiceImpl.kt @@ -53,7 +53,7 @@ class CommunityServiceImpl internal constructor(private val clientOptions: Clien /** X write actions (tweets, likes, follows, DMs) */ override fun join(): JoinService = join - /** X data lookups (subscription required) */ + /** X Community info, members, and tweets */ override fun tweets(): TweetService = tweets override fun create( @@ -122,7 +122,7 @@ class CommunityServiceImpl internal constructor(private val clientOptions: Clien /** X write actions (tweets, likes, follows, DMs) */ override fun join(): JoinService.WithRawResponse = join - /** X data lookups (subscription required) */ + /** X Community info, members, and tweets */ override fun tweets(): TweetService.WithRawResponse = tweets private val createHandler: Handler = diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/FollowerService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/FollowerService.kt index c82182b..0f34f25 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/FollowerService.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/FollowerService.kt @@ -10,7 +10,7 @@ import com.x_twitter_scraper.api.models.x.followers.FollowerCheckParams import com.x_twitter_scraper.api.models.x.followers.FollowerCheckResponse import java.util.function.Consumer -/** X data lookups (subscription required) */ +/** Look up, search, and explore user profiles and relationships */ interface FollowerService { /** @@ -25,7 +25,7 @@ interface FollowerService { */ fun withOptions(modifier: Consumer): FollowerService - /** Check follow relationship */ + /** Check if one user follows another */ fun check(params: FollowerCheckParams): FollowerCheckResponse = check(params, RequestOptions.none()) diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/FollowerServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/FollowerServiceImpl.kt index ed75ec5..1198ba4 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/FollowerServiceImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/FollowerServiceImpl.kt @@ -18,7 +18,7 @@ import com.x_twitter_scraper.api.models.x.followers.FollowerCheckParams import com.x_twitter_scraper.api.models.x.followers.FollowerCheckResponse import java.util.function.Consumer -/** X data lookups (subscription required) */ +/** Look up, search, and explore user profiles and relationships */ class FollowerServiceImpl internal constructor(private val clientOptions: ClientOptions) : FollowerService { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/ListService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/ListService.kt index d0c4330..e9b976e 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/ListService.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/ListService.kt @@ -13,7 +13,7 @@ import com.x_twitter_scraper.api.models.x.lists.ListRetrieveMembersParams import com.x_twitter_scraper.api.models.x.lists.ListRetrieveTweetsParams import java.util.function.Consumer -/** X data lookups (subscription required) */ +/** X List followers, members, and tweets */ interface ListService { /** @@ -28,7 +28,7 @@ interface ListService { */ fun withOptions(modifier: Consumer): ListService - /** Get list followers */ + /** List followers of an X List */ fun retrieveFollowers(id: String): PaginatedUsers = retrieveFollowers(id, ListRetrieveFollowersParams.none()) @@ -59,7 +59,7 @@ interface ListService { fun retrieveFollowers(id: String, requestOptions: RequestOptions): PaginatedUsers = retrieveFollowers(id, ListRetrieveFollowersParams.none(), requestOptions) - /** Get list members */ + /** List members of an X List */ fun retrieveMembers(id: String): PaginatedUsers = retrieveMembers(id, ListRetrieveMembersParams.none()) @@ -90,7 +90,7 @@ interface ListService { fun retrieveMembers(id: String, requestOptions: RequestOptions): PaginatedUsers = retrieveMembers(id, ListRetrieveMembersParams.none(), requestOptions) - /** Get list tweets */ + /** List tweets from an X List */ fun retrieveTweets(id: String): PaginatedTweets = retrieveTweets(id, ListRetrieveTweetsParams.none()) diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/ListServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/ListServiceImpl.kt index c4f8cff..d991351 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/ListServiceImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/ListServiceImpl.kt @@ -23,7 +23,7 @@ import com.x_twitter_scraper.api.models.x.lists.ListRetrieveTweetsParams import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull -/** X data lookups (subscription required) */ +/** X List followers, members, and tweets */ class ListServiceImpl internal constructor(private val clientOptions: ClientOptions) : ListService { private val withRawResponse: ListService.WithRawResponse by lazy { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/MediaService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/MediaService.kt index f583d0f..31baea9 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/MediaService.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/MediaService.kt @@ -12,7 +12,7 @@ import com.x_twitter_scraper.api.models.x.media.MediaUploadParams import com.x_twitter_scraper.api.models.x.media.MediaUploadResponse import java.util.function.Consumer -/** Media upload & download */ +/** Media upload and download */ interface MediaService { /** @@ -27,7 +27,7 @@ interface MediaService { */ fun withOptions(modifier: Consumer): MediaService - /** Download tweet media */ + /** Download images and videos from tweets */ fun download(): MediaDownloadResponse = download(MediaDownloadParams.none()) /** @see download */ diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/MediaServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/MediaServiceImpl.kt index be666c9..19e53ad 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/MediaServiceImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/MediaServiceImpl.kt @@ -22,7 +22,7 @@ import com.x_twitter_scraper.api.models.x.media.MediaUploadParams import com.x_twitter_scraper.api.models.x.media.MediaUploadResponse import java.util.function.Consumer -/** Media upload & download */ +/** Media upload and download */ class MediaServiceImpl internal constructor(private val clientOptions: ClientOptions) : MediaService { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/TweetService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/TweetService.kt index 1f64035..8ddfbf7 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/TweetService.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/TweetService.kt @@ -55,7 +55,7 @@ interface TweetService { requestOptions: RequestOptions = RequestOptions.none(), ): TweetCreateResponse - /** Look up tweet */ + /** Get tweet with full text, author, metrics and media */ fun retrieve(id: String): TweetRetrieveResponse = retrieve(id, TweetRetrieveParams.none()) /** @see retrieve */ @@ -115,7 +115,7 @@ interface TweetService { requestOptions: RequestOptions = RequestOptions.none(), ): TweetDeleteResponse - /** Get users who liked a tweet */ + /** List users who liked a tweet */ fun getFavoriters(id: String): PaginatedUsers = getFavoriters(id, TweetGetFavoritersParams.none()) @@ -146,7 +146,7 @@ interface TweetService { fun getFavoriters(id: String, requestOptions: RequestOptions): PaginatedUsers = getFavoriters(id, TweetGetFavoritersParams.none(), requestOptions) - /** Get quote tweets of a tweet */ + /** List quote tweets of a tweet */ fun getQuotes(id: String): PaginatedTweets = getQuotes(id, TweetGetQuotesParams.none()) /** @see getQuotes */ @@ -176,7 +176,7 @@ interface TweetService { fun getQuotes(id: String, requestOptions: RequestOptions): PaginatedTweets = getQuotes(id, TweetGetQuotesParams.none(), requestOptions) - /** Get replies to a tweet */ + /** List replies to a tweet */ fun getReplies(id: String): PaginatedTweets = getReplies(id, TweetGetRepliesParams.none()) /** @see getReplies */ @@ -206,7 +206,7 @@ interface TweetService { fun getReplies(id: String, requestOptions: RequestOptions): PaginatedTweets = getReplies(id, TweetGetRepliesParams.none(), requestOptions) - /** Get users who retweeted a tweet */ + /** List users who retweeted a tweet */ fun getRetweeters(id: String): PaginatedUsers = getRetweeters(id, TweetGetRetweetersParams.none()) @@ -237,7 +237,7 @@ interface TweetService { fun getRetweeters(id: String, requestOptions: RequestOptions): PaginatedUsers = getRetweeters(id, TweetGetRetweetersParams.none(), requestOptions) - /** Get thread context for a tweet */ + /** Get full conversation thread for a tweet */ fun getThread(id: String): PaginatedTweets = getThread(id, TweetGetThreadParams.none()) /** @see getThread */ @@ -267,7 +267,7 @@ interface TweetService { fun getThread(id: String, requestOptions: RequestOptions): PaginatedTweets = getThread(id, TweetGetThreadParams.none(), requestOptions) - /** Search tweets */ + /** Search tweets with X query operators and pagination */ fun search(params: TweetSearchParams): PaginatedTweets = search(params, RequestOptions.none()) /** @see search */ diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/UserService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/UserService.kt index c243ea7..acef3ff 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/UserService.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/UserService.kt @@ -8,7 +8,7 @@ import com.x_twitter_scraper.api.core.RequestOptions import com.x_twitter_scraper.api.core.http.HttpResponseFor import com.x_twitter_scraper.api.models.PaginatedTweets import com.x_twitter_scraper.api.models.PaginatedUsers -import com.x_twitter_scraper.api.models.x.users.UserProfile +import com.x_twitter_scraper.api.models.UserProfile import com.x_twitter_scraper.api.models.x.users.UserRetrieveBatchParams import com.x_twitter_scraper.api.models.x.users.UserRetrieveFollowersParams import com.x_twitter_scraper.api.models.x.users.UserRetrieveFollowersYouKnowParams @@ -23,7 +23,7 @@ import com.x_twitter_scraper.api.models.x.users.UserRetrieveVerifiedFollowersPar import com.x_twitter_scraper.api.services.blocking.x.users.FollowService import java.util.function.Consumer -/** X data lookups (subscription required) */ +/** Look up, search, and explore user profiles and relationships */ interface UserService { /** @@ -41,7 +41,7 @@ interface UserService { /** X write actions (tweets, likes, follows, DMs) */ fun follow(): FollowService - /** Look up X user */ + /** Get user profile with follower counts and verification */ fun retrieve(id: String): UserProfile = retrieve(id, UserRetrieveParams.none()) /** @see retrieve */ @@ -68,7 +68,7 @@ interface UserService { fun retrieve(id: String, requestOptions: RequestOptions): UserProfile = retrieve(id, UserRetrieveParams.none(), requestOptions) - /** Get multiple users by IDs */ + /** Look up multiple users by IDs in one call */ fun retrieveBatch(params: UserRetrieveBatchParams): PaginatedUsers = retrieveBatch(params, RequestOptions.none()) @@ -78,7 +78,7 @@ interface UserService { requestOptions: RequestOptions = RequestOptions.none(), ): PaginatedUsers - /** Get user followers */ + /** List followers of a user */ fun retrieveFollowers(id: String): PaginatedUsers = retrieveFollowers(id, UserRetrieveFollowersParams.none()) @@ -109,7 +109,7 @@ interface UserService { fun retrieveFollowers(id: String, requestOptions: RequestOptions): PaginatedUsers = retrieveFollowers(id, UserRetrieveFollowersParams.none(), requestOptions) - /** Get followers you know for a user */ + /** List mutual followers between you and a user */ fun retrieveFollowersYouKnow(id: String): PaginatedUsers = retrieveFollowersYouKnow(id, UserRetrieveFollowersYouKnowParams.none()) @@ -140,7 +140,7 @@ interface UserService { fun retrieveFollowersYouKnow(id: String, requestOptions: RequestOptions): PaginatedUsers = retrieveFollowersYouKnow(id, UserRetrieveFollowersYouKnowParams.none(), requestOptions) - /** Get users this user follows */ + /** List accounts a user follows */ fun retrieveFollowing(id: String): PaginatedUsers = retrieveFollowing(id, UserRetrieveFollowingParams.none()) @@ -171,7 +171,7 @@ interface UserService { fun retrieveFollowing(id: String, requestOptions: RequestOptions): PaginatedUsers = retrieveFollowing(id, UserRetrieveFollowingParams.none(), requestOptions) - /** Get tweets liked by a user */ + /** List tweets liked by a user */ fun retrieveLikes(id: String): PaginatedTweets = retrieveLikes(id, UserRetrieveLikesParams.none()) @@ -202,7 +202,7 @@ interface UserService { fun retrieveLikes(id: String, requestOptions: RequestOptions): PaginatedTweets = retrieveLikes(id, UserRetrieveLikesParams.none(), requestOptions) - /** Get media tweets by a user */ + /** List media tweets posted by a user */ fun retrieveMedia(id: String): PaginatedTweets = retrieveMedia(id, UserRetrieveMediaParams.none()) @@ -233,7 +233,7 @@ interface UserService { fun retrieveMedia(id: String, requestOptions: RequestOptions): PaginatedTweets = retrieveMedia(id, UserRetrieveMediaParams.none(), requestOptions) - /** Get tweets mentioning a user */ + /** List tweets mentioning a user */ fun retrieveMentions(id: String): PaginatedTweets = retrieveMentions(id, UserRetrieveMentionsParams.none()) @@ -274,7 +274,7 @@ interface UserService { requestOptions: RequestOptions = RequestOptions.none(), ): PaginatedUsers - /** Get recent tweets by a user */ + /** List recent tweets posted by a user */ fun retrieveTweets(id: String): PaginatedTweets = retrieveTweets(id, UserRetrieveTweetsParams.none()) @@ -305,7 +305,7 @@ interface UserService { fun retrieveTweets(id: String, requestOptions: RequestOptions): PaginatedTweets = retrieveTweets(id, UserRetrieveTweetsParams.none(), requestOptions) - /** Get verified followers */ + /** List verified followers of a user */ fun retrieveVerifiedFollowers(id: String): PaginatedUsers = retrieveVerifiedFollowers(id, UserRetrieveVerifiedFollowersParams.none()) diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/UserServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/UserServiceImpl.kt index 6679d95..c61b2c0 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/UserServiceImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/UserServiceImpl.kt @@ -17,7 +17,7 @@ import com.x_twitter_scraper.api.core.http.parseable import com.x_twitter_scraper.api.core.prepare import com.x_twitter_scraper.api.models.PaginatedTweets import com.x_twitter_scraper.api.models.PaginatedUsers -import com.x_twitter_scraper.api.models.x.users.UserProfile +import com.x_twitter_scraper.api.models.UserProfile import com.x_twitter_scraper.api.models.x.users.UserRetrieveBatchParams import com.x_twitter_scraper.api.models.x.users.UserRetrieveFollowersParams import com.x_twitter_scraper.api.models.x.users.UserRetrieveFollowersYouKnowParams @@ -34,7 +34,7 @@ import com.x_twitter_scraper.api.services.blocking.x.users.FollowServiceImpl import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull -/** X data lookups (subscription required) */ +/** Look up, search, and explore user profiles and relationships */ class UserServiceImpl internal constructor(private val clientOptions: ClientOptions) : UserService { private val withRawResponse: UserService.WithRawResponse by lazy { diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/communities/TweetService.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/communities/TweetService.kt index c5f931b..12b05a6 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/communities/TweetService.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/communities/TweetService.kt @@ -11,7 +11,7 @@ import com.x_twitter_scraper.api.models.x.communities.tweets.TweetListByCommunit import com.x_twitter_scraper.api.models.x.communities.tweets.TweetListParams import java.util.function.Consumer -/** X data lookups (subscription required) */ +/** X Community info, members, and tweets */ interface TweetService { /** @@ -26,7 +26,7 @@ interface TweetService { */ fun withOptions(modifier: Consumer): TweetService - /** Search tweets across all communities */ + /** List tweets across all communities */ fun list(params: TweetListParams): PaginatedTweets = list(params, RequestOptions.none()) /** @see list */ @@ -35,7 +35,7 @@ interface TweetService { requestOptions: RequestOptions = RequestOptions.none(), ): PaginatedTweets - /** Get community tweets */ + /** List tweets posted in a community */ fun listByCommunity(id: String): PaginatedTweets = listByCommunity(id, TweetListByCommunityParams.none()) diff --git a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/communities/TweetServiceImpl.kt b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/communities/TweetServiceImpl.kt index fa8e3be..c3ca374 100644 --- a/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/communities/TweetServiceImpl.kt +++ b/x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/services/blocking/x/communities/TweetServiceImpl.kt @@ -21,7 +21,7 @@ import com.x_twitter_scraper.api.models.x.communities.tweets.TweetListParams import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull -/** X data lookups (subscription required) */ +/** X Community info, members, and tweets */ class TweetServiceImpl internal constructor(private val clientOptions: ClientOptions) : TweetService { diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/core/ClientOptionsTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/core/ClientOptionsTest.kt index 1d38437..81658ac 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/core/ClientOptionsTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/core/ClientOptionsTest.kt @@ -23,20 +23,25 @@ internal class ClientOptionsTest { .httpClient(httpClient) .putHeader("User-Agent", "My User Agent") .apiKey("My API Key") - .bearerToken("My Bearer Token") .build() assertThat(clientOptions.headers.values("User-Agent")).containsExactly("My User Agent") } + @Test + fun toBuilder_apiKeyCanBeUpdated() { + var clientOptions = + ClientOptions.builder().httpClient(httpClient).apiKey("My API Key").build() + + clientOptions = clientOptions.toBuilder().apiKey("another My API Key").build() + + assertThat(clientOptions.headers.values("X-Api-Key")).containsExactly("another My API Key") + } + @Test fun toBuilder_whenOriginalClientOptionsGarbageCollected_doesNotCloseOriginalClient() { var clientOptions = - ClientOptions.builder() - .httpClient(httpClient) - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + ClientOptions.builder().httpClient(httpClient).apiKey("My API Key").build() verify(httpClient, never()).close() // Overwrite the `clientOptions` variable so that the original `ClientOptions` is GC'd. diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/PaginatedTweetsTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/PaginatedTweetsTest.kt index a8e9c25..27841c4 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/PaginatedTweetsTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/PaginatedTweetsTest.kt @@ -4,7 +4,6 @@ package com.x_twitter_scraper.api.models import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.x_twitter_scraper.api.core.jsonMapper -import com.x_twitter_scraper.api.models.x.tweets.SearchTweet import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/PaginatedUsersTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/PaginatedUsersTest.kt index 80d5426..ac651f0 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/PaginatedUsersTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/PaginatedUsersTest.kt @@ -4,7 +4,6 @@ package com.x_twitter_scraper.api.models import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.x_twitter_scraper.api.core.jsonMapper -import com.x_twitter_scraper.api.models.x.users.UserProfile import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/tweets/SearchTweetTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/SearchTweetTest.kt similarity index 98% rename from x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/tweets/SearchTweetTest.kt rename to x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/SearchTweetTest.kt index 141813e..13baa93 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/tweets/SearchTweetTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/SearchTweetTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.x_twitter_scraper.api.models.x.tweets +package com.x_twitter_scraper.api.models import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.x_twitter_scraper.api.core.jsonMapper diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/users/UserProfileTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/UserProfileTest.kt similarity index 98% rename from x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/users/UserProfileTest.kt rename to x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/UserProfileTest.kt index 39c41fa..40584aa 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/users/UserProfileTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/UserProfileTest.kt @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. -package com.x_twitter_scraper.api.models.x.users +package com.x_twitter_scraper.api.models import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.x_twitter_scraper.api.core.jsonMapper diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/account/AccountRetrieveResponseTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/account/AccountRetrieveResponseTest.kt index 16782c2..172cdbc 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/account/AccountRetrieveResponseTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/account/AccountRetrieveResponseTest.kt @@ -4,7 +4,6 @@ package com.x_twitter_scraper.api.models.account import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.x_twitter_scraper.api.core.jsonMapper -import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -17,11 +16,12 @@ internal class AccountRetrieveResponseTest { .monitorsAllowed(10L) .monitorsUsed(3L) .plan(AccountRetrieveResponse.Plan.ACTIVE) - .currentPeriod( - AccountRetrieveResponse.CurrentPeriod.builder() - .end(OffsetDateTime.parse("2025-02-01T00:00:00Z")) - .start(OffsetDateTime.parse("2025-01-01T00:00:00Z")) - .usagePercent(42.5) + .creditInfo( + AccountRetrieveResponse.CreditInfo.builder() + .autoTopupEnabled(false) + .balance(50000L) + .lifetimePurchased(140000L) + .lifetimeUsed(90000L) .build() ) .build() @@ -29,12 +29,13 @@ internal class AccountRetrieveResponseTest { assertThat(accountRetrieveResponse.monitorsAllowed()).isEqualTo(10L) assertThat(accountRetrieveResponse.monitorsUsed()).isEqualTo(3L) assertThat(accountRetrieveResponse.plan()).isEqualTo(AccountRetrieveResponse.Plan.ACTIVE) - assertThat(accountRetrieveResponse.currentPeriod()) + assertThat(accountRetrieveResponse.creditInfo()) .contains( - AccountRetrieveResponse.CurrentPeriod.builder() - .end(OffsetDateTime.parse("2025-02-01T00:00:00Z")) - .start(OffsetDateTime.parse("2025-01-01T00:00:00Z")) - .usagePercent(42.5) + AccountRetrieveResponse.CreditInfo.builder() + .autoTopupEnabled(false) + .balance(50000L) + .lifetimePurchased(140000L) + .lifetimeUsed(90000L) .build() ) } @@ -47,11 +48,12 @@ internal class AccountRetrieveResponseTest { .monitorsAllowed(10L) .monitorsUsed(3L) .plan(AccountRetrieveResponse.Plan.ACTIVE) - .currentPeriod( - AccountRetrieveResponse.CurrentPeriod.builder() - .end(OffsetDateTime.parse("2025-02-01T00:00:00Z")) - .start(OffsetDateTime.parse("2025-01-01T00:00:00Z")) - .usagePercent(42.5) + .creditInfo( + AccountRetrieveResponse.CreditInfo.builder() + .autoTopupEnabled(false) + .balance(50000L) + .lifetimePurchased(140000L) + .lifetimeUsed(90000L) .build() ) .build() diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/extractions/ExtractionEstimateCostResponseTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/extractions/ExtractionEstimateCostResponseTest.kt index 917e197..fa86c31 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/extractions/ExtractionEstimateCostResponseTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/extractions/ExtractionEstimateCostResponseTest.kt @@ -14,17 +14,19 @@ internal class ExtractionEstimateCostResponseTest { val extractionEstimateCostResponse = ExtractionEstimateCostResponse.builder() .allowed(true) + .creditsAvailable("50000") + .creditsRequired("500") .estimatedResults(500L) - .projectedPercent(30.0) - .source("api_count") - .usagePercent(25.0) + .source("replyCount") + .resolvedXUserId("123456") .build() assertThat(extractionEstimateCostResponse.allowed()).isEqualTo(true) + assertThat(extractionEstimateCostResponse.creditsAvailable()).isEqualTo("50000") + assertThat(extractionEstimateCostResponse.creditsRequired()).isEqualTo("500") assertThat(extractionEstimateCostResponse.estimatedResults()).isEqualTo(500L) - assertThat(extractionEstimateCostResponse.projectedPercent()).isEqualTo(30.0) - assertThat(extractionEstimateCostResponse.source()).isEqualTo("api_count") - assertThat(extractionEstimateCostResponse.usagePercent()).isEqualTo(25.0) + assertThat(extractionEstimateCostResponse.source()).isEqualTo("replyCount") + assertThat(extractionEstimateCostResponse.resolvedXUserId()).contains("123456") } @Test @@ -33,10 +35,11 @@ internal class ExtractionEstimateCostResponseTest { val extractionEstimateCostResponse = ExtractionEstimateCostResponse.builder() .allowed(true) + .creditsAvailable("50000") + .creditsRequired("500") .estimatedResults(500L) - .projectedPercent(30.0) - .source("api_count") - .usagePercent(25.0) + .source("replyCount") + .resolvedXUserId("123456") .build() val roundtrippedExtractionEstimateCostResponse = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationCreateParamsTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationCreateParamsTest.kt deleted file mode 100644 index 65c8361..0000000 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationCreateParamsTest.kt +++ /dev/null @@ -1,39 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.x_twitter_scraper.api.models.EventType -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class IntegrationCreateParamsTest { - - @Test - fun create() { - IntegrationCreateParams.builder() - .config(IntegrationCreateParams.Config.builder().chatId("-1001234567890").build()) - .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) - .name("My Telegram Bot") - .build() - } - - @Test - fun body() { - val params = - IntegrationCreateParams.builder() - .config(IntegrationCreateParams.Config.builder().chatId("-1001234567890").build()) - .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) - .name("My Telegram Bot") - .build() - - val body = params._body() - - assertThat(body.config()) - .isEqualTo(IntegrationCreateParams.Config.builder().chatId("-1001234567890").build()) - assertThat(body.eventTypes()) - .containsExactly(EventType.TWEET_NEW, EventType.FOLLOWER_GAINED) - assertThat(body.name()).isEqualTo("My Telegram Bot") - } -} diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationDeleteParamsTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationDeleteParamsTest.kt deleted file mode 100644 index 98d9cbf..0000000 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationDeleteParamsTest.kt +++ /dev/null @@ -1,23 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class IntegrationDeleteParamsTest { - - @Test - fun create() { - IntegrationDeleteParams.builder().id("id").build() - } - - @Test - fun pathParams() { - val params = IntegrationDeleteParams.builder().id("id").build() - - assertThat(params._pathParam(0)).isEqualTo("id") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } -} diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationDeleteResponseTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationDeleteResponseTest.kt deleted file mode 100644 index 3a39455..0000000 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationDeleteResponseTest.kt +++ /dev/null @@ -1,30 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.x_twitter_scraper.api.core.jsonMapper -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class IntegrationDeleteResponseTest { - - @Test - fun create() { - val integrationDeleteResponse = IntegrationDeleteResponse.builder().build() - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val integrationDeleteResponse = IntegrationDeleteResponse.builder().build() - - val roundtrippedIntegrationDeleteResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(integrationDeleteResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedIntegrationDeleteResponse).isEqualTo(integrationDeleteResponse) - } -} diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationDeliveryTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationDeliveryTest.kt deleted file mode 100644 index 7a5e422..0000000 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationDeliveryTest.kt +++ /dev/null @@ -1,68 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.x_twitter_scraper.api.core.jsonMapper -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class IntegrationDeliveryTest { - - @Test - fun create() { - val integrationDelivery = - IntegrationDelivery.builder() - .id("42") - .attempts(1L) - .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) - .eventType("tweet.new") - .status("delivered") - .deliveredAt(OffsetDateTime.parse("2025-01-15T12:00:01Z")) - .lastError("") - .lastStatusCode(200L) - .sourceId("100") - .sourceType("monitor") - .build() - - assertThat(integrationDelivery.id()).isEqualTo("42") - assertThat(integrationDelivery.attempts()).isEqualTo(1L) - assertThat(integrationDelivery.createdAt()) - .isEqualTo(OffsetDateTime.parse("2025-01-15T12:00:00Z")) - assertThat(integrationDelivery.eventType()).isEqualTo("tweet.new") - assertThat(integrationDelivery.status()).isEqualTo("delivered") - assertThat(integrationDelivery.deliveredAt()) - .contains(OffsetDateTime.parse("2025-01-15T12:00:01Z")) - assertThat(integrationDelivery.lastError()).contains("") - assertThat(integrationDelivery.lastStatusCode()).contains(200L) - assertThat(integrationDelivery.sourceId()).contains("100") - assertThat(integrationDelivery.sourceType()).contains("monitor") - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val integrationDelivery = - IntegrationDelivery.builder() - .id("42") - .attempts(1L) - .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) - .eventType("tweet.new") - .status("delivered") - .deliveredAt(OffsetDateTime.parse("2025-01-15T12:00:01Z")) - .lastError("") - .lastStatusCode(200L) - .sourceId("100") - .sourceType("monitor") - .build() - - val roundtrippedIntegrationDelivery = - jsonMapper.readValue( - jsonMapper.writeValueAsString(integrationDelivery), - jacksonTypeRef(), - ) - - assertThat(roundtrippedIntegrationDelivery).isEqualTo(integrationDelivery) - } -} diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListDeliveriesParamsTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListDeliveriesParamsTest.kt deleted file mode 100644 index 0689d40..0000000 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListDeliveriesParamsTest.kt +++ /dev/null @@ -1,42 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.x_twitter_scraper.api.core.http.QueryParams -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class IntegrationListDeliveriesParamsTest { - - @Test - fun create() { - IntegrationListDeliveriesParams.builder().id("id").limit(1L).build() - } - - @Test - fun pathParams() { - val params = IntegrationListDeliveriesParams.builder().id("id").build() - - assertThat(params._pathParam(0)).isEqualTo("id") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } - - @Test - fun queryParams() { - val params = IntegrationListDeliveriesParams.builder().id("id").limit(1L).build() - - val queryParams = params._queryParams() - - assertThat(queryParams).isEqualTo(QueryParams.builder().put("limit", "1").build()) - } - - @Test - fun queryParamsWithoutOptionalFields() { - val params = IntegrationListDeliveriesParams.builder().id("id").build() - - val queryParams = params._queryParams() - - assertThat(queryParams).isEqualTo(QueryParams.builder().build()) - } -} diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListDeliveriesResponseTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListDeliveriesResponseTest.kt deleted file mode 100644 index 7599f3e..0000000 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListDeliveriesResponseTest.kt +++ /dev/null @@ -1,80 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.x_twitter_scraper.api.core.jsonMapper -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class IntegrationListDeliveriesResponseTest { - - @Test - fun create() { - val integrationListDeliveriesResponse = - IntegrationListDeliveriesResponse.builder() - .addDelivery( - IntegrationDelivery.builder() - .id("42") - .attempts(1L) - .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) - .eventType("tweet.new") - .status("delivered") - .deliveredAt(OffsetDateTime.parse("2025-01-15T12:00:01Z")) - .lastError("") - .lastStatusCode(200L) - .sourceId("100") - .sourceType("monitor") - .build() - ) - .build() - - assertThat(integrationListDeliveriesResponse.deliveries()) - .containsExactly( - IntegrationDelivery.builder() - .id("42") - .attempts(1L) - .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) - .eventType("tweet.new") - .status("delivered") - .deliveredAt(OffsetDateTime.parse("2025-01-15T12:00:01Z")) - .lastError("") - .lastStatusCode(200L) - .sourceId("100") - .sourceType("monitor") - .build() - ) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val integrationListDeliveriesResponse = - IntegrationListDeliveriesResponse.builder() - .addDelivery( - IntegrationDelivery.builder() - .id("42") - .attempts(1L) - .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) - .eventType("tweet.new") - .status("delivered") - .deliveredAt(OffsetDateTime.parse("2025-01-15T12:00:01Z")) - .lastError("") - .lastStatusCode(200L) - .sourceId("100") - .sourceType("monitor") - .build() - ) - .build() - - val roundtrippedIntegrationListDeliveriesResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(integrationListDeliveriesResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedIntegrationListDeliveriesResponse) - .isEqualTo(integrationListDeliveriesResponse) - } -} diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListParamsTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListParamsTest.kt deleted file mode 100644 index 1810669..0000000 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListParamsTest.kt +++ /dev/null @@ -1,13 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import org.junit.jupiter.api.Test - -internal class IntegrationListParamsTest { - - @Test - fun create() { - IntegrationListParams.builder().build() - } -} diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListResponseTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListResponseTest.kt deleted file mode 100644 index 61e863a..0000000 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationListResponseTest.kt +++ /dev/null @@ -1,108 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.x_twitter_scraper.api.core.JsonValue -import com.x_twitter_scraper.api.core.jsonMapper -import com.x_twitter_scraper.api.models.EventType -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class IntegrationListResponseTest { - - @Test - fun create() { - val integrationListResponse = - IntegrationListResponse.builder() - .addIntegration( - Integration.builder() - .id("42") - .config( - Integration.Config.builder() - .putAdditionalProperty("chatId", JsonValue.from("bar")) - .build() - ) - .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) - .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) - .isActive(true) - .name("My Telegram Bot") - .filters( - Integration.Filters.builder() - .putAdditionalProperty("minFollowers", JsonValue.from("bar")) - .build() - ) - .messageTemplate("New event: {{event.type}}") - .scopeAllMonitors(true) - .silentPush(false) - .build() - ) - .build() - - assertThat(integrationListResponse.integrations()) - .containsExactly( - Integration.builder() - .id("42") - .config( - Integration.Config.builder() - .putAdditionalProperty("chatId", JsonValue.from("bar")) - .build() - ) - .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) - .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) - .isActive(true) - .name("My Telegram Bot") - .filters( - Integration.Filters.builder() - .putAdditionalProperty("minFollowers", JsonValue.from("bar")) - .build() - ) - .messageTemplate("New event: {{event.type}}") - .scopeAllMonitors(true) - .silentPush(false) - .build() - ) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val integrationListResponse = - IntegrationListResponse.builder() - .addIntegration( - Integration.builder() - .id("42") - .config( - Integration.Config.builder() - .putAdditionalProperty("chatId", JsonValue.from("bar")) - .build() - ) - .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) - .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) - .isActive(true) - .name("My Telegram Bot") - .filters( - Integration.Filters.builder() - .putAdditionalProperty("minFollowers", JsonValue.from("bar")) - .build() - ) - .messageTemplate("New event: {{event.type}}") - .scopeAllMonitors(true) - .silentPush(false) - .build() - ) - .build() - - val roundtrippedIntegrationListResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(integrationListResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedIntegrationListResponse).isEqualTo(integrationListResponse) - } -} diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationRetrieveParamsTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationRetrieveParamsTest.kt deleted file mode 100644 index e910cde..0000000 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationRetrieveParamsTest.kt +++ /dev/null @@ -1,23 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class IntegrationRetrieveParamsTest { - - @Test - fun create() { - IntegrationRetrieveParams.builder().id("id").build() - } - - @Test - fun pathParams() { - val params = IntegrationRetrieveParams.builder().id("id").build() - - assertThat(params._pathParam(0)).isEqualTo("id") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } -} diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationSendTestParamsTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationSendTestParamsTest.kt deleted file mode 100644 index e92bfcb..0000000 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationSendTestParamsTest.kt +++ /dev/null @@ -1,23 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class IntegrationSendTestParamsTest { - - @Test - fun create() { - IntegrationSendTestParams.builder().id("id").build() - } - - @Test - fun pathParams() { - val params = IntegrationSendTestParams.builder().id("id").build() - - assertThat(params._pathParam(0)).isEqualTo("id") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } -} diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationSendTestResponseTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationSendTestResponseTest.kt deleted file mode 100644 index e9df433..0000000 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationSendTestResponseTest.kt +++ /dev/null @@ -1,30 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.x_twitter_scraper.api.core.jsonMapper -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class IntegrationSendTestResponseTest { - - @Test - fun create() { - val integrationSendTestResponse = IntegrationSendTestResponse.builder().build() - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val integrationSendTestResponse = IntegrationSendTestResponse.builder().build() - - val roundtrippedIntegrationSendTestResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(integrationSendTestResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedIntegrationSendTestResponse).isEqualTo(integrationSendTestResponse) - } -} diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationTest.kt deleted file mode 100644 index 363caf2..0000000 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationTest.kt +++ /dev/null @@ -1,97 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.x_twitter_scraper.api.core.JsonValue -import com.x_twitter_scraper.api.core.jsonMapper -import com.x_twitter_scraper.api.models.EventType -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class IntegrationTest { - - @Test - fun create() { - val integration = - Integration.builder() - .id("42") - .config( - Integration.Config.builder() - .putAdditionalProperty("chatId", JsonValue.from("bar")) - .build() - ) - .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) - .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) - .isActive(true) - .name("My Telegram Bot") - .filters( - Integration.Filters.builder() - .putAdditionalProperty("minFollowers", JsonValue.from("bar")) - .build() - ) - .messageTemplate("New event: {{event.type}}") - .scopeAllMonitors(true) - .silentPush(false) - .build() - - assertThat(integration.id()).isEqualTo("42") - assertThat(integration.config()) - .isEqualTo( - Integration.Config.builder() - .putAdditionalProperty("chatId", JsonValue.from("bar")) - .build() - ) - assertThat(integration.createdAt()).isEqualTo(OffsetDateTime.parse("2025-01-15T12:00:00Z")) - assertThat(integration.eventTypes()) - .containsExactly(EventType.TWEET_NEW, EventType.FOLLOWER_GAINED) - assertThat(integration.isActive()).isEqualTo(true) - assertThat(integration.name()).isEqualTo("My Telegram Bot") - assertThat(integration.filters()) - .contains( - Integration.Filters.builder() - .putAdditionalProperty("minFollowers", JsonValue.from("bar")) - .build() - ) - assertThat(integration.messageTemplate()).contains("New event: {{event.type}}") - assertThat(integration.scopeAllMonitors()).contains(true) - assertThat(integration.silentPush()).contains(false) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val integration = - Integration.builder() - .id("42") - .config( - Integration.Config.builder() - .putAdditionalProperty("chatId", JsonValue.from("bar")) - .build() - ) - .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) - .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) - .isActive(true) - .name("My Telegram Bot") - .filters( - Integration.Filters.builder() - .putAdditionalProperty("minFollowers", JsonValue.from("bar")) - .build() - ) - .messageTemplate("New event: {{event.type}}") - .scopeAllMonitors(true) - .silentPush(false) - .build() - - val roundtrippedIntegration = - jsonMapper.readValue( - jsonMapper.writeValueAsString(integration), - jacksonTypeRef(), - ) - - assertThat(roundtrippedIntegration).isEqualTo(integration) - } -} diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationUpdateParamsTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationUpdateParamsTest.kt deleted file mode 100644 index 54c2ee2..0000000 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/integrations/IntegrationUpdateParamsTest.kt +++ /dev/null @@ -1,67 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.models.integrations - -import com.x_twitter_scraper.api.models.EventType -import kotlin.jvm.optionals.getOrNull -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class IntegrationUpdateParamsTest { - - @Test - fun create() { - IntegrationUpdateParams.builder() - .id("id") - .addEventType(EventType.TWEET_NEW) - .filters(IntegrationUpdateParams.Filters.builder().build()) - .isActive(true) - .messageTemplate(IntegrationUpdateParams.MessageTemplate.builder().build()) - .name("My Telegram Bot") - .scopeAllMonitors(true) - .silentPush(false) - .build() - } - - @Test - fun pathParams() { - val params = IntegrationUpdateParams.builder().id("id").build() - - assertThat(params._pathParam(0)).isEqualTo("id") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } - - @Test - fun body() { - val params = - IntegrationUpdateParams.builder() - .id("id") - .addEventType(EventType.TWEET_NEW) - .filters(IntegrationUpdateParams.Filters.builder().build()) - .isActive(true) - .messageTemplate(IntegrationUpdateParams.MessageTemplate.builder().build()) - .name("My Telegram Bot") - .scopeAllMonitors(true) - .silentPush(false) - .build() - - val body = params._body() - - assertThat(body.eventTypes().getOrNull()).containsExactly(EventType.TWEET_NEW) - assertThat(body.filters()).contains(IntegrationUpdateParams.Filters.builder().build()) - assertThat(body.isActive()).contains(true) - assertThat(body.messageTemplate()) - .contains(IntegrationUpdateParams.MessageTemplate.builder().build()) - assertThat(body.name()).contains("My Telegram Bot") - assertThat(body.scopeAllMonitors()).contains(true) - assertThat(body.silentPush()).contains(false) - } - - @Test - fun bodyWithoutOptionalFields() { - val params = IntegrationUpdateParams.builder().id("id").build() - - val body = params._body() - } -} diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/monitors/MonitorCreateParamsTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/monitors/MonitorCreateParamsTest.kt index 51fbad5..1c41ee6 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/monitors/MonitorCreateParamsTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/monitors/MonitorCreateParamsTest.kt @@ -12,7 +12,7 @@ internal class MonitorCreateParamsTest { fun create() { MonitorCreateParams.builder() .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .username("elonmusk") .build() } @@ -22,14 +22,13 @@ internal class MonitorCreateParamsTest { val params = MonitorCreateParams.builder() .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .username("elonmusk") .build() val body = params._body() - assertThat(body.eventTypes()) - .containsExactly(EventType.TWEET_NEW, EventType.FOLLOWER_GAINED) + assertThat(body.eventTypes()).containsExactly(EventType.TWEET_NEW, EventType.TWEET_REPLY) assertThat(body.username()).isEqualTo("elonmusk") } } diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/monitors/MonitorCreateResponseTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/monitors/MonitorCreateResponseTest.kt index e03f6d7..e68e7ae 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/monitors/MonitorCreateResponseTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/monitors/MonitorCreateResponseTest.kt @@ -18,7 +18,7 @@ internal class MonitorCreateResponseTest { .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .username("elonmusk") .xUserId("1234567890") .build() @@ -27,7 +27,7 @@ internal class MonitorCreateResponseTest { assertThat(monitorCreateResponse.createdAt()) .isEqualTo(OffsetDateTime.parse("2025-01-15T12:00:00Z")) assertThat(monitorCreateResponse.eventTypes()) - .containsExactly(EventType.TWEET_NEW, EventType.FOLLOWER_GAINED) + .containsExactly(EventType.TWEET_NEW, EventType.TWEET_REPLY) assertThat(monitorCreateResponse.username()).isEqualTo("elonmusk") assertThat(monitorCreateResponse.xUserId()).isEqualTo("1234567890") } @@ -40,7 +40,7 @@ internal class MonitorCreateResponseTest { .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .username("elonmusk") .xUserId("1234567890") .build() diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/monitors/MonitorListResponseTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/monitors/MonitorListResponseTest.kt index 2ac09a6..4d69ea6 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/monitors/MonitorListResponseTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/monitors/MonitorListResponseTest.kt @@ -20,7 +20,7 @@ internal class MonitorListResponseTest { .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .isActive(true) .username("elonmusk") .xUserId("9876543210") @@ -35,7 +35,7 @@ internal class MonitorListResponseTest { .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .isActive(true) .username("elonmusk") .xUserId("9876543210") @@ -54,7 +54,7 @@ internal class MonitorListResponseTest { .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .isActive(true) .username("elonmusk") .xUserId("9876543210") diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/monitors/MonitorTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/monitors/MonitorTest.kt index 57b932e..c33921f 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/monitors/MonitorTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/monitors/MonitorTest.kt @@ -18,7 +18,7 @@ internal class MonitorTest { .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .isActive(true) .username("elonmusk") .xUserId("9876543210") @@ -26,8 +26,7 @@ internal class MonitorTest { assertThat(monitor.id()).isEqualTo("42") assertThat(monitor.createdAt()).isEqualTo(OffsetDateTime.parse("2025-01-15T12:00:00Z")) - assertThat(monitor.eventTypes()) - .containsExactly(EventType.TWEET_NEW, EventType.FOLLOWER_GAINED) + assertThat(monitor.eventTypes()).containsExactly(EventType.TWEET_NEW, EventType.TWEET_REPLY) assertThat(monitor.isActive()).isEqualTo(true) assertThat(monitor.username()).isEqualTo("elonmusk") assertThat(monitor.xUserId()).isEqualTo("9876543210") @@ -41,7 +40,7 @@ internal class MonitorTest { .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .isActive(true) .username("elonmusk") .xUserId("9876543210") diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/radar/RadarItemTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/radar/RadarItemTest.kt index 3587855..52980e5 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/radar/RadarItemTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/radar/RadarItemTest.kt @@ -3,6 +3,7 @@ package com.x_twitter_scraper.api.models.radar import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.x_twitter_scraper.api.core.JsonValue import com.x_twitter_scraper.api.core.jsonMapper import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat @@ -14,22 +15,41 @@ internal class RadarItemTest { fun create() { val radarItem = RadarItem.builder() - .category("Technology") + .id("4712") + .category(RadarItem.Category.TECH) + .createdAt(OffsetDateTime.parse("2025-01-15T12:01:00Z")) + .language("en") + .metadata( + RadarItem.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) .publishedAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) - .region("US") + .region("global") .score(95.5) - .source("X") + .source(RadarItem.Source.TRUSTMRR) + .sourceId("trustmrr_acme") .title("AI Revolution in 2025") .description("AI is transforming every industry") .imageUrl("https://example.com/images/ai.jpg") .url("https://example.com/article/ai-revolution") .build() - assertThat(radarItem.category()).isEqualTo("Technology") + assertThat(radarItem.id()).isEqualTo("4712") + assertThat(radarItem.category()).isEqualTo(RadarItem.Category.TECH) + assertThat(radarItem.createdAt()).isEqualTo(OffsetDateTime.parse("2025-01-15T12:01:00Z")) + assertThat(radarItem.language()).isEqualTo("en") + assertThat(radarItem.metadata()) + .isEqualTo( + RadarItem.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) assertThat(radarItem.publishedAt()).isEqualTo(OffsetDateTime.parse("2025-01-15T12:00:00Z")) - assertThat(radarItem.region()).isEqualTo("US") + assertThat(radarItem.region()).isEqualTo("global") assertThat(radarItem.score()).isEqualTo(95.5) - assertThat(radarItem.source()).isEqualTo("X") + assertThat(radarItem.source()).isEqualTo(RadarItem.Source.TRUSTMRR) + assertThat(radarItem.sourceId()).isEqualTo("trustmrr_acme") assertThat(radarItem.title()).isEqualTo("AI Revolution in 2025") assertThat(radarItem.description()).contains("AI is transforming every industry") assertThat(radarItem.imageUrl()).contains("https://example.com/images/ai.jpg") @@ -41,11 +61,20 @@ internal class RadarItemTest { val jsonMapper = jsonMapper() val radarItem = RadarItem.builder() - .category("Technology") + .id("4712") + .category(RadarItem.Category.TECH) + .createdAt(OffsetDateTime.parse("2025-01-15T12:01:00Z")) + .language("en") + .metadata( + RadarItem.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) .publishedAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) - .region("US") + .region("global") .score(95.5) - .source("X") + .source(RadarItem.Source.TRUSTMRR) + .sourceId("trustmrr_acme") .title("AI Revolution in 2025") .description("AI is transforming every industry") .imageUrl("https://example.com/images/ai.jpg") diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/radar/RadarRetrieveTrendingTopicsParamsTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/radar/RadarRetrieveTrendingTopicsParamsTest.kt index 7ff3ba6..511de39 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/radar/RadarRetrieveTrendingTopicsParamsTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/radar/RadarRetrieveTrendingTopicsParamsTest.kt @@ -11,9 +11,10 @@ internal class RadarRetrieveTrendingTopicsParamsTest { @Test fun create() { RadarRetrieveTrendingTopicsParams.builder() - .category("category") - .count(0L) - .hours(0L) + .after("after") + .category(RadarRetrieveTrendingTopicsParams.Category.GENERAL) + .hours(1L) + .limit(1L) .region("region") .source(RadarRetrieveTrendingTopicsParams.Source.GITHUB) .build() @@ -23,9 +24,10 @@ internal class RadarRetrieveTrendingTopicsParamsTest { fun queryParams() { val params = RadarRetrieveTrendingTopicsParams.builder() - .category("category") - .count(0L) - .hours(0L) + .after("after") + .category(RadarRetrieveTrendingTopicsParams.Category.GENERAL) + .hours(1L) + .limit(1L) .region("region") .source(RadarRetrieveTrendingTopicsParams.Source.GITHUB) .build() @@ -35,9 +37,10 @@ internal class RadarRetrieveTrendingTopicsParamsTest { assertThat(queryParams) .isEqualTo( QueryParams.builder() - .put("category", "category") - .put("count", "0") - .put("hours", "0") + .put("after", "after") + .put("category", "general") + .put("hours", "1") + .put("limit", "1") .put("region", "region") .put("source", "github") .build() diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/radar/RadarRetrieveTrendingTopicsResponseTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/radar/RadarRetrieveTrendingTopicsResponseTest.kt index 0a74247..db84849 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/radar/RadarRetrieveTrendingTopicsResponseTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/radar/RadarRetrieveTrendingTopicsResponseTest.kt @@ -3,6 +3,7 @@ package com.x_twitter_scraper.api.models.radar import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.x_twitter_scraper.api.core.JsonValue import com.x_twitter_scraper.api.core.jsonMapper import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat @@ -14,37 +15,57 @@ internal class RadarRetrieveTrendingTopicsResponseTest { fun create() { val radarRetrieveTrendingTopicsResponse = RadarRetrieveTrendingTopicsResponse.builder() + .hasMore(false) .addItem( RadarItem.builder() - .category("Technology") + .id("4712") + .category(RadarItem.Category.TECH) + .createdAt(OffsetDateTime.parse("2025-01-15T12:01:00Z")) + .language("en") + .metadata( + RadarItem.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) .publishedAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) - .region("US") + .region("global") .score(95.5) - .source("X") + .source(RadarItem.Source.TRUSTMRR) + .sourceId("trustmrr_acme") .title("AI Revolution in 2025") .description("AI is transforming every industry") .imageUrl("https://example.com/images/ai.jpg") .url("https://example.com/article/ai-revolution") .build() ) - .total(0L) + .nextCursor("nextCursor") .build() + assertThat(radarRetrieveTrendingTopicsResponse.hasMore()).isEqualTo(false) assertThat(radarRetrieveTrendingTopicsResponse.items()) .containsExactly( RadarItem.builder() - .category("Technology") + .id("4712") + .category(RadarItem.Category.TECH) + .createdAt(OffsetDateTime.parse("2025-01-15T12:01:00Z")) + .language("en") + .metadata( + RadarItem.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) .publishedAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) - .region("US") + .region("global") .score(95.5) - .source("X") + .source(RadarItem.Source.TRUSTMRR) + .sourceId("trustmrr_acme") .title("AI Revolution in 2025") .description("AI is transforming every industry") .imageUrl("https://example.com/images/ai.jpg") .url("https://example.com/article/ai-revolution") .build() ) - assertThat(radarRetrieveTrendingTopicsResponse.total()).isEqualTo(0L) + assertThat(radarRetrieveTrendingTopicsResponse.nextCursor()).contains("nextCursor") } @Test @@ -52,20 +73,30 @@ internal class RadarRetrieveTrendingTopicsResponseTest { val jsonMapper = jsonMapper() val radarRetrieveTrendingTopicsResponse = RadarRetrieveTrendingTopicsResponse.builder() + .hasMore(false) .addItem( RadarItem.builder() - .category("Technology") + .id("4712") + .category(RadarItem.Category.TECH) + .createdAt(OffsetDateTime.parse("2025-01-15T12:01:00Z")) + .language("en") + .metadata( + RadarItem.Metadata.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) .publishedAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) - .region("US") + .region("global") .score(95.5) - .source("X") + .source(RadarItem.Source.TRUSTMRR) + .sourceId("trustmrr_acme") .title("AI Revolution in 2025") .description("AI is transforming every industry") .imageUrl("https://example.com/images/ai.jpg") .url("https://example.com/article/ai-revolution") .build() ) - .total(0L) + .nextCursor("nextCursor") .build() val roundtrippedRadarRetrieveTrendingTopicsResponse = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/webhooks/WebhookCreateParamsTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/webhooks/WebhookCreateParamsTest.kt index e71d78d..2199d73 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/webhooks/WebhookCreateParamsTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/webhooks/WebhookCreateParamsTest.kt @@ -12,7 +12,7 @@ internal class WebhookCreateParamsTest { fun create() { WebhookCreateParams.builder() .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .url("https://example.com/webhook") .build() } @@ -22,14 +22,13 @@ internal class WebhookCreateParamsTest { val params = WebhookCreateParams.builder() .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .url("https://example.com/webhook") .build() val body = params._body() - assertThat(body.eventTypes()) - .containsExactly(EventType.TWEET_NEW, EventType.FOLLOWER_GAINED) + assertThat(body.eventTypes()).containsExactly(EventType.TWEET_NEW, EventType.TWEET_REPLY) assertThat(body.url()).isEqualTo("https://example.com/webhook") } } diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/webhooks/WebhookCreateResponseTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/webhooks/WebhookCreateResponseTest.kt index 7bf04fd..f205d61 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/webhooks/WebhookCreateResponseTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/webhooks/WebhookCreateResponseTest.kt @@ -18,7 +18,7 @@ internal class WebhookCreateResponseTest { .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .secret("whsec_abc123def456") .url("https://example.com/webhook") .build() @@ -27,7 +27,7 @@ internal class WebhookCreateResponseTest { assertThat(webhookCreateResponse.createdAt()) .isEqualTo(OffsetDateTime.parse("2025-01-15T12:00:00Z")) assertThat(webhookCreateResponse.eventTypes()) - .containsExactly(EventType.TWEET_NEW, EventType.FOLLOWER_GAINED) + .containsExactly(EventType.TWEET_NEW, EventType.TWEET_REPLY) assertThat(webhookCreateResponse.secret()).isEqualTo("whsec_abc123def456") assertThat(webhookCreateResponse.url()).isEqualTo("https://example.com/webhook") } @@ -40,7 +40,7 @@ internal class WebhookCreateResponseTest { .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .secret("whsec_abc123def456") .url("https://example.com/webhook") .build() diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/webhooks/WebhookListResponseTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/webhooks/WebhookListResponseTest.kt index 30bfe6d..927e09d 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/webhooks/WebhookListResponseTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/webhooks/WebhookListResponseTest.kt @@ -20,7 +20,7 @@ internal class WebhookListResponseTest { .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .isActive(true) .url("https://example.com/webhooks/xquik") .build() @@ -33,7 +33,7 @@ internal class WebhookListResponseTest { .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .isActive(true) .url("https://example.com/webhooks/xquik") .build() @@ -50,7 +50,7 @@ internal class WebhookListResponseTest { .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .isActive(true) .url("https://example.com/webhooks/xquik") .build() diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/webhooks/WebhookTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/webhooks/WebhookTest.kt index 3eea272..fc62454 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/webhooks/WebhookTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/webhooks/WebhookTest.kt @@ -18,15 +18,14 @@ internal class WebhookTest { .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .isActive(true) .url("https://example.com/webhooks/xquik") .build() assertThat(webhook.id()).isEqualTo("42") assertThat(webhook.createdAt()).isEqualTo(OffsetDateTime.parse("2025-01-15T12:00:00Z")) - assertThat(webhook.eventTypes()) - .containsExactly(EventType.TWEET_NEW, EventType.FOLLOWER_GAINED) + assertThat(webhook.eventTypes()).containsExactly(EventType.TWEET_NEW, EventType.TWEET_REPLY) assertThat(webhook.isActive()).isEqualTo(true) assertThat(webhook.url()).isEqualTo("https://example.com/webhooks/xquik") } @@ -39,7 +38,7 @@ internal class WebhookTest { .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .isActive(true) .url("https://example.com/webhooks/xquik") .build() diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/XGetTrendsParamsTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/XGetTrendsParamsTest.kt index 8e24b74..3787209 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/XGetTrendsParamsTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/XGetTrendsParamsTest.kt @@ -2,12 +2,33 @@ package com.x_twitter_scraper.api.models.x +import com.x_twitter_scraper.api.core.http.QueryParams +import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test internal class XGetTrendsParamsTest { @Test fun create() { - XGetTrendsParams.builder().build() + XGetTrendsParams.builder().count(1L).woeid(0L).build() + } + + @Test + fun queryParams() { + val params = XGetTrendsParams.builder().count(1L).woeid(0L).build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo(QueryParams.builder().put("count", "1").put("woeid", "0").build()) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = XGetTrendsParams.builder().build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) } } diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountCreateResponseTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountCreateResponseTest.kt index ab5983e..2492090 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountCreateResponseTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountCreateResponseTest.kt @@ -4,6 +4,7 @@ package com.x_twitter_scraper.api.models.x.accounts import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.x_twitter_scraper.api.core.jsonMapper +import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -14,15 +15,22 @@ internal class AccountCreateResponseTest { val accountCreateResponse = AccountCreateResponse.builder() .id("42") + .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) + .health(AccountCreateResponse.Health.HEALTHY) .status("active") .xUserId("9876543210") .xUsername("elonmusk") + .loginCountry("US") .build() assertThat(accountCreateResponse.id()).isEqualTo("42") + assertThat(accountCreateResponse.createdAt()) + .isEqualTo(OffsetDateTime.parse("2025-01-15T12:00:00Z")) + assertThat(accountCreateResponse.health()).isEqualTo(AccountCreateResponse.Health.HEALTHY) assertThat(accountCreateResponse.status()).isEqualTo("active") assertThat(accountCreateResponse.xUserId()).isEqualTo("9876543210") assertThat(accountCreateResponse.xUsername()).isEqualTo("elonmusk") + assertThat(accountCreateResponse.loginCountry()).contains("US") } @Test @@ -31,9 +39,12 @@ internal class AccountCreateResponseTest { val accountCreateResponse = AccountCreateResponse.builder() .id("42") + .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) + .health(AccountCreateResponse.Health.HEALTHY) .status("active") .xUserId("9876543210") .xUsername("elonmusk") + .loginCountry("US") .build() val roundtrippedAccountCreateResponse = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountListResponseTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountListResponseTest.kt index 194e9ed..21ce5f1 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountListResponseTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountListResponseTest.kt @@ -18,6 +18,7 @@ internal class AccountListResponseTest { XAccount.builder() .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) + .health(XAccount.Health.HEALTHY) .status("active") .xUserId("9876543210") .xUsername("elonmusk") @@ -30,6 +31,7 @@ internal class AccountListResponseTest { XAccount.builder() .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) + .health(XAccount.Health.HEALTHY) .status("active") .xUserId("9876543210") .xUsername("elonmusk") @@ -46,6 +48,7 @@ internal class AccountListResponseTest { XAccount.builder() .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) + .health(XAccount.Health.HEALTHY) .status("active") .xUserId("9876543210") .xUsername("elonmusk") diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountReauthParamsTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountReauthParamsTest.kt index d80de6c..589cc74 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountReauthParamsTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountReauthParamsTest.kt @@ -12,6 +12,8 @@ internal class AccountReauthParamsTest { AccountReauthParams.builder() .id("id") .password("password_value") + .email("user@example.com") + .proxyCountry("US") .totpSecret("totp_secret_value") .build() } @@ -31,12 +33,16 @@ internal class AccountReauthParamsTest { AccountReauthParams.builder() .id("id") .password("password_value") + .email("user@example.com") + .proxyCountry("US") .totpSecret("totp_secret_value") .build() val body = params._body() assertThat(body.password()).isEqualTo("password_value") + assertThat(body.email()).contains("user@example.com") + assertThat(body.proxyCountry()).contains("US") assertThat(body.totpSecret()).contains("totp_secret_value") } diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountReauthResponseTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountReauthResponseTest.kt index 3fa84f2..a061b16 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountReauthResponseTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/AccountReauthResponseTest.kt @@ -4,6 +4,7 @@ package com.x_twitter_scraper.api.models.x.accounts import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.x_twitter_scraper.api.core.jsonMapper +import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -12,18 +13,39 @@ internal class AccountReauthResponseTest { @Test fun create() { val accountReauthResponse = - AccountReauthResponse.builder().id("42").status("active").xUsername("elonmusk").build() + AccountReauthResponse.builder() + .id("42") + .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) + .health(AccountReauthResponse.Health.HEALTHY) + .status("active") + .xUserId("9876543210") + .xUsername("elonmusk") + .loginCountry("US") + .build() assertThat(accountReauthResponse.id()).isEqualTo("42") + assertThat(accountReauthResponse.createdAt()) + .isEqualTo(OffsetDateTime.parse("2025-01-15T12:00:00Z")) + assertThat(accountReauthResponse.health()).isEqualTo(AccountReauthResponse.Health.HEALTHY) assertThat(accountReauthResponse.status()).isEqualTo("active") + assertThat(accountReauthResponse.xUserId()).isEqualTo("9876543210") assertThat(accountReauthResponse.xUsername()).isEqualTo("elonmusk") + assertThat(accountReauthResponse.loginCountry()).contains("US") } @Test fun roundtrip() { val jsonMapper = jsonMapper() val accountReauthResponse = - AccountReauthResponse.builder().id("42").status("active").xUsername("elonmusk").build() + AccountReauthResponse.builder() + .id("42") + .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) + .health(AccountReauthResponse.Health.HEALTHY) + .status("active") + .xUserId("9876543210") + .xUsername("elonmusk") + .loginCountry("US") + .build() val roundtrippedAccountReauthResponse = jsonMapper.readValue( diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/XAccountDetailTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/XAccountDetailTest.kt index fe488ce..ca4133c 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/XAccountDetailTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/XAccountDetailTest.kt @@ -16,6 +16,7 @@ internal class XAccountDetailTest { XAccountDetail.builder() .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) + .health(XAccountDetail.Health.HEALTHY) .status("active") .xUserId("9876543210") .xUsername("elonmusk") @@ -27,6 +28,7 @@ internal class XAccountDetailTest { assertThat(xAccountDetail.id()).isEqualTo("42") assertThat(xAccountDetail.createdAt()) .isEqualTo(OffsetDateTime.parse("2025-01-15T12:00:00Z")) + assertThat(xAccountDetail.health()).isEqualTo(XAccountDetail.Health.HEALTHY) assertThat(xAccountDetail.status()).isEqualTo("active") assertThat(xAccountDetail.xUserId()).isEqualTo("9876543210") assertThat(xAccountDetail.xUsername()).isEqualTo("elonmusk") @@ -44,6 +46,7 @@ internal class XAccountDetailTest { XAccountDetail.builder() .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) + .health(XAccountDetail.Health.HEALTHY) .status("active") .xUserId("9876543210") .xUsername("elonmusk") diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/XAccountTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/XAccountTest.kt index 1a63e2a..47ff11a 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/XAccountTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/accounts/XAccountTest.kt @@ -16,6 +16,7 @@ internal class XAccountTest { XAccount.builder() .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) + .health(XAccount.Health.HEALTHY) .status("active") .xUserId("9876543210") .xUsername("elonmusk") @@ -23,6 +24,7 @@ internal class XAccountTest { assertThat(xAccount.id()).isEqualTo("42") assertThat(xAccount.createdAt()).isEqualTo(OffsetDateTime.parse("2025-01-15T12:00:00Z")) + assertThat(xAccount.health()).isEqualTo(XAccount.Health.HEALTHY) assertThat(xAccount.status()).isEqualTo("active") assertThat(xAccount.xUserId()).isEqualTo("9876543210") assertThat(xAccount.xUsername()).isEqualTo("elonmusk") @@ -35,6 +37,7 @@ internal class XAccountTest { XAccount.builder() .id("42") .createdAt(OffsetDateTime.parse("2025-01-15T12:00:00Z")) + .health(XAccount.Health.HEALTHY) .status("active") .xUserId("9876543210") .xUsername("elonmusk") diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetCreateParamsTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetCreateParamsTest.kt index 942e966..c161544 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetCreateParamsTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/models/x/tweets/TweetCreateParamsTest.kt @@ -12,12 +12,13 @@ internal class TweetCreateParamsTest { fun create() { TweetCreateParams.builder() .account("@elonmusk") - .text("Just launched our new feature!") .attachmentUrl("https://x.com/elonmusk/status/1234567890") .communityId("1500000000000000000") .isNoteTweet(false) + .addMedia("https://example.com/image.jpg") .addMediaId("1234567890123456789") .replyToTweetId("1234567890") + .text("Just launched our new feature!") .build() } @@ -26,36 +27,33 @@ internal class TweetCreateParamsTest { val params = TweetCreateParams.builder() .account("@elonmusk") - .text("Just launched our new feature!") .attachmentUrl("https://x.com/elonmusk/status/1234567890") .communityId("1500000000000000000") .isNoteTweet(false) + .addMedia("https://example.com/image.jpg") .addMediaId("1234567890123456789") .replyToTweetId("1234567890") + .text("Just launched our new feature!") .build() val body = params._body() assertThat(body.account()).isEqualTo("@elonmusk") - assertThat(body.text()).isEqualTo("Just launched our new feature!") assertThat(body.attachmentUrl()).contains("https://x.com/elonmusk/status/1234567890") assertThat(body.communityId()).contains("1500000000000000000") assertThat(body.isNoteTweet()).contains(false) + assertThat(body.media().getOrNull()).containsExactly("https://example.com/image.jpg") assertThat(body.mediaIds().getOrNull()).containsExactly("1234567890123456789") assertThat(body.replyToTweetId()).contains("1234567890") + assertThat(body.text()).contains("Just launched our new feature!") } @Test fun bodyWithoutOptionalFields() { - val params = - TweetCreateParams.builder() - .account("@elonmusk") - .text("Just launched our new feature!") - .build() + val params = TweetCreateParams.builder().account("@elonmusk").build() val body = params._body() assertThat(body.account()).isEqualTo("@elonmusk") - assertThat(body.text()).isEqualTo("Just launched our new feature!") } } diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/ErrorHandlingTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/ErrorHandlingTest.kt index ee7e57d..08f180a 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/ErrorHandlingTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/ErrorHandlingTest.kt @@ -55,7 +55,6 @@ internal class ErrorHandlingTest { XTwitterScraperOkHttpClient.builder() .baseUrl(wmRuntimeInfo.httpBaseUrl) .apiKey("My API Key") - .bearerToken("My Bearer Token") .build() } diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/ServiceParamsTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/ServiceParamsTest.kt index 10e9628..4848e05 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/ServiceParamsTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/ServiceParamsTest.kt @@ -31,7 +31,6 @@ internal class ServiceParamsTest { XTwitterScraperOkHttpClient.builder() .baseUrl(wmRuntimeInfo.httpBaseUrl) .apiKey("My API Key") - .bearerToken("My Bearer Token") .build() } diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/AccountServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/AccountServiceAsyncTest.kt index 00d8ce3..f24b582 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/AccountServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/AccountServiceAsyncTest.kt @@ -13,11 +13,7 @@ internal class AccountServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val accountServiceAsync = client.account() val accountFuture = accountServiceAsync.retrieve() @@ -29,11 +25,7 @@ internal class AccountServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun setXUsername() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val accountServiceAsync = client.account() val responseFuture = @@ -48,11 +40,7 @@ internal class AccountServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun updateLocale() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val accountServiceAsync = client.account() val responseFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/ApiKeyServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/ApiKeyServiceAsyncTest.kt index c6972b9..6e8992a 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/ApiKeyServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/ApiKeyServiceAsyncTest.kt @@ -12,11 +12,7 @@ internal class ApiKeyServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val apiKeyServiceAsync = client.apiKeys() val apiKeyFuture = @@ -29,11 +25,7 @@ internal class ApiKeyServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val apiKeyServiceAsync = client.apiKeys() val apiKeysFuture = apiKeyServiceAsync.list() @@ -45,11 +37,7 @@ internal class ApiKeyServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun revoke() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val apiKeyServiceAsync = client.apiKeys() val responseFuture = apiKeyServiceAsync.revoke("id") diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/ComposeServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/ComposeServiceAsyncTest.kt index b12a563..8c4013d 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/ComposeServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/ComposeServiceAsyncTest.kt @@ -12,11 +12,7 @@ internal class ComposeServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val composeServiceAsync = client.compose() val composeFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/CreditServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/CreditServiceAsyncTest.kt index c4af183..793dbca 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/CreditServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/CreditServiceAsyncTest.kt @@ -12,11 +12,7 @@ internal class CreditServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveBalance() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val creditServiceAsync = client.credits() val responseFuture = creditServiceAsync.retrieveBalance() @@ -28,11 +24,7 @@ internal class CreditServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun topupBalance() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val creditServiceAsync = client.credits() val responseFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/DraftServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/DraftServiceAsyncTest.kt index 8b1a8a7..63a342a 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/DraftServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/DraftServiceAsyncTest.kt @@ -13,11 +13,7 @@ internal class DraftServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val draftServiceAsync = client.drafts() val draftDetailFuture = @@ -36,11 +32,7 @@ internal class DraftServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val draftServiceAsync = client.drafts() val draftDetailFuture = draftServiceAsync.retrieve("id") @@ -52,11 +44,7 @@ internal class DraftServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val draftServiceAsync = client.drafts() val draftsFuture = @@ -71,11 +59,7 @@ internal class DraftServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun delete() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val draftServiceAsync = client.drafts() val future = draftServiceAsync.delete("id") diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/DrawServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/DrawServiceAsyncTest.kt index 5814bdc..3860125 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/DrawServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/DrawServiceAsyncTest.kt @@ -24,11 +24,7 @@ internal class DrawServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val drawServiceAsync = client.draws() val drawFuture = drawServiceAsync.retrieve("id") @@ -40,11 +36,7 @@ internal class DrawServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val drawServiceAsync = client.draws() val drawsFuture = @@ -60,7 +52,6 @@ internal class DrawServiceAsyncTest { XTwitterScraperOkHttpClientAsync.builder() .baseUrl(wmRuntimeInfo.httpBaseUrl) .apiKey("My API Key") - .bearerToken("My Bearer Token") .build() val drawServiceAsync = client.draws() stubFor(get(anyUrl()).willReturn(ok().withBody("abc"))) @@ -81,11 +72,7 @@ internal class DrawServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun run() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val drawServiceAsync = client.draws() val responseFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/EventServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/EventServiceAsyncTest.kt index db94f12..4f99651 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/EventServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/EventServiceAsyncTest.kt @@ -13,11 +13,7 @@ internal class EventServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val eventServiceAsync = client.events() val eventDetailFuture = eventServiceAsync.retrieve("id") @@ -29,11 +25,7 @@ internal class EventServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val eventServiceAsync = client.events() val eventsFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/ExtractionServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/ExtractionServiceAsyncTest.kt index 3feaf38..3761549 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/ExtractionServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/ExtractionServiceAsyncTest.kt @@ -26,11 +26,7 @@ internal class ExtractionServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val extractionServiceAsync = client.extractions() val extractionFuture = @@ -45,11 +41,7 @@ internal class ExtractionServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val extractionServiceAsync = client.extractions() val extractionsFuture = @@ -69,11 +61,7 @@ internal class ExtractionServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun estimateCost() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val extractionServiceAsync = client.extractions() val responseFuture = @@ -102,7 +90,6 @@ internal class ExtractionServiceAsyncTest { XTwitterScraperOkHttpClientAsync.builder() .baseUrl(wmRuntimeInfo.httpBaseUrl) .apiKey("My API Key") - .bearerToken("My Bearer Token") .build() val extractionServiceAsync = client.extractions() stubFor(get(anyUrl()).willReturn(ok().withBody("abc"))) @@ -122,11 +109,7 @@ internal class ExtractionServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun run() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val extractionServiceAsync = client.extractions() val responseFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/IntegrationServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/IntegrationServiceAsyncTest.kt deleted file mode 100644 index f978ce8..0000000 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/IntegrationServiceAsyncTest.kt +++ /dev/null @@ -1,151 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.services.async - -import com.x_twitter_scraper.api.client.okhttp.XTwitterScraperOkHttpClientAsync -import com.x_twitter_scraper.api.models.EventType -import com.x_twitter_scraper.api.models.integrations.IntegrationCreateParams -import com.x_twitter_scraper.api.models.integrations.IntegrationListDeliveriesParams -import com.x_twitter_scraper.api.models.integrations.IntegrationUpdateParams -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test - -internal class IntegrationServiceAsyncTest { - - @Disabled("Mock server tests are disabled") - @Test - fun create() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() - val integrationServiceAsync = client.integrations() - - val integrationFuture = - integrationServiceAsync.create( - IntegrationCreateParams.builder() - .config( - IntegrationCreateParams.Config.builder().chatId("-1001234567890").build() - ) - .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) - .name("My Telegram Bot") - .build() - ) - - val integration = integrationFuture.get() - integration.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun retrieve() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() - val integrationServiceAsync = client.integrations() - - val integrationFuture = integrationServiceAsync.retrieve("id") - - val integration = integrationFuture.get() - integration.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun update() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() - val integrationServiceAsync = client.integrations() - - val integrationFuture = - integrationServiceAsync.update( - IntegrationUpdateParams.builder() - .id("id") - .addEventType(EventType.TWEET_NEW) - .filters(IntegrationUpdateParams.Filters.builder().build()) - .isActive(true) - .messageTemplate(IntegrationUpdateParams.MessageTemplate.builder().build()) - .name("My Telegram Bot") - .scopeAllMonitors(true) - .silentPush(false) - .build() - ) - - val integration = integrationFuture.get() - integration.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun list() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() - val integrationServiceAsync = client.integrations() - - val integrationsFuture = integrationServiceAsync.list() - - val integrations = integrationsFuture.get() - integrations.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun delete() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() - val integrationServiceAsync = client.integrations() - - val integrationFuture = integrationServiceAsync.delete("id") - - val integration = integrationFuture.get() - integration.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun listDeliveries() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() - val integrationServiceAsync = client.integrations() - - val responseFuture = - integrationServiceAsync.listDeliveries( - IntegrationListDeliveriesParams.builder().id("id").limit(1L).build() - ) - - val response = responseFuture.get() - response.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun sendTest() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() - val integrationServiceAsync = client.integrations() - - val responseFuture = integrationServiceAsync.sendTest("id") - - val response = responseFuture.get() - response.validate() - } -} diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/MonitorServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/MonitorServiceAsyncTest.kt index 9feaeea..5658527 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/MonitorServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/MonitorServiceAsyncTest.kt @@ -14,18 +14,14 @@ internal class MonitorServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val monitorServiceAsync = client.monitors() val monitorFuture = monitorServiceAsync.create( MonitorCreateParams.builder() .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .username("elonmusk") .build() ) @@ -37,11 +33,7 @@ internal class MonitorServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val monitorServiceAsync = client.monitors() val monitorFuture = monitorServiceAsync.retrieve("id") @@ -53,11 +45,7 @@ internal class MonitorServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun update() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val monitorServiceAsync = client.monitors() val monitorFuture = @@ -76,11 +64,7 @@ internal class MonitorServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val monitorServiceAsync = client.monitors() val monitorsFuture = monitorServiceAsync.list() @@ -92,11 +76,7 @@ internal class MonitorServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun deactivate() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val monitorServiceAsync = client.monitors() val responseFuture = monitorServiceAsync.deactivate("id") diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/RadarServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/RadarServiceAsyncTest.kt index 5da1d08..41dad8d 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/RadarServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/RadarServiceAsyncTest.kt @@ -12,19 +12,16 @@ internal class RadarServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveTrendingTopics() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val radarServiceAsync = client.radar() val responseFuture = radarServiceAsync.retrieveTrendingTopics( RadarRetrieveTrendingTopicsParams.builder() - .category("category") - .count(0L) - .hours(0L) + .after("after") + .category(RadarRetrieveTrendingTopicsParams.Category.GENERAL) + .hours(1L) + .limit(1L) .region("region") .source(RadarRetrieveTrendingTopicsParams.Source.GITHUB) .build() diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/StyleServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/StyleServiceAsyncTest.kt index da81183..7c8e0b9 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/StyleServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/StyleServiceAsyncTest.kt @@ -14,11 +14,7 @@ internal class StyleServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val styleServiceAsync = client.styles() val styleProfileFuture = styleServiceAsync.retrieve("id") @@ -30,11 +26,7 @@ internal class StyleServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun update() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val styleServiceAsync = client.styles() val styleProfileFuture = @@ -57,11 +49,7 @@ internal class StyleServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val styleServiceAsync = client.styles() val stylesFuture = styleServiceAsync.list() @@ -73,11 +61,7 @@ internal class StyleServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun delete() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val styleServiceAsync = client.styles() val future = styleServiceAsync.delete("id") @@ -88,11 +72,7 @@ internal class StyleServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun analyze() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val styleServiceAsync = client.styles() val styleProfileFuture = @@ -105,11 +85,7 @@ internal class StyleServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun compare() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val styleServiceAsync = client.styles() val responseFuture = @@ -124,11 +100,7 @@ internal class StyleServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun getPerformance() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val styleServiceAsync = client.styles() val responseFuture = styleServiceAsync.getPerformance("id") diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/SubscribeServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/SubscribeServiceAsyncTest.kt index ca7e580..0e4274c 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/SubscribeServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/SubscribeServiceAsyncTest.kt @@ -11,11 +11,7 @@ internal class SubscribeServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val subscribeServiceAsync = client.subscribe() val subscribeFuture = subscribeServiceAsync.create() diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/TrendServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/TrendServiceAsyncTest.kt index 315960f..d023dc7 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/TrendServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/TrendServiceAsyncTest.kt @@ -12,11 +12,7 @@ internal class TrendServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val trendServiceAsync = client.trends() val trendsFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/WebhookServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/WebhookServiceAsyncTest.kt index b0087e0..76bc326 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/WebhookServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/WebhookServiceAsyncTest.kt @@ -14,18 +14,14 @@ internal class WebhookServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val webhookServiceAsync = client.webhooks() val webhookFuture = webhookServiceAsync.create( WebhookCreateParams.builder() .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .url("https://example.com/webhook") .build() ) @@ -37,11 +33,7 @@ internal class WebhookServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun update() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val webhookServiceAsync = client.webhooks() val webhookFuture = @@ -61,11 +53,7 @@ internal class WebhookServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val webhookServiceAsync = client.webhooks() val webhooksFuture = webhookServiceAsync.list() @@ -77,11 +65,7 @@ internal class WebhookServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun deactivate() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val webhookServiceAsync = client.webhooks() val responseFuture = webhookServiceAsync.deactivate("id") @@ -93,11 +77,7 @@ internal class WebhookServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun listDeliveries() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val webhookServiceAsync = client.webhooks() val responseFuture = webhookServiceAsync.listDeliveries("id") @@ -109,11 +89,7 @@ internal class WebhookServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun test() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val webhookServiceAsync = client.webhooks() val responseFuture = webhookServiceAsync.test("id") diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/XServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/XServiceAsyncTest.kt index bd5160b..9580888 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/XServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/XServiceAsyncTest.kt @@ -5,6 +5,7 @@ package com.x_twitter_scraper.api.services.async import com.x_twitter_scraper.api.client.okhttp.XTwitterScraperOkHttpClientAsync import com.x_twitter_scraper.api.models.x.XGetHomeTimelineParams import com.x_twitter_scraper.api.models.x.XGetNotificationsParams +import com.x_twitter_scraper.api.models.x.XGetTrendsParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test @@ -13,11 +14,7 @@ internal class XServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun getArticle() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val xServiceAsync = client.x() val responseFuture = xServiceAsync.getArticle("tweetId") @@ -29,11 +26,7 @@ internal class XServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun getHomeTimeline() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val xServiceAsync = client.x() val paginatedTweetsFuture = @@ -51,11 +44,7 @@ internal class XServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun getNotifications() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val xServiceAsync = client.x() val responseFuture = @@ -73,14 +62,11 @@ internal class XServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun getTrends() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val xServiceAsync = client.x() - val responseFuture = xServiceAsync.getTrends() + val responseFuture = + xServiceAsync.getTrends(XGetTrendsParams.builder().count(1L).woeid(0L).build()) val response = responseFuture.get() response.validate() diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/support/TicketServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/support/TicketServiceAsyncTest.kt index 954d9b0..78d456d 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/support/TicketServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/support/TicketServiceAsyncTest.kt @@ -14,11 +14,7 @@ internal class TicketServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val ticketServiceAsync = client.support().tickets() val ticketFuture = @@ -36,11 +32,7 @@ internal class TicketServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val ticketServiceAsync = client.support().tickets() val ticketFuture = ticketServiceAsync.retrieve("messages_value") @@ -52,11 +44,7 @@ internal class TicketServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun update() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val ticketServiceAsync = client.support().tickets() val ticketFuture = @@ -74,11 +62,7 @@ internal class TicketServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val ticketServiceAsync = client.support().tickets() val ticketsFuture = ticketServiceAsync.list() @@ -90,11 +74,7 @@ internal class TicketServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun reply() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val ticketServiceAsync = client.support().tickets() val responseFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/AccountServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/AccountServiceAsyncTest.kt index d672179..4dc79b8 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/AccountServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/AccountServiceAsyncTest.kt @@ -13,11 +13,7 @@ internal class AccountServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val accountServiceAsync = client.x().accounts() val accountFuture = @@ -38,11 +34,7 @@ internal class AccountServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val accountServiceAsync = client.x().accounts() val xAccountDetailFuture = accountServiceAsync.retrieve("id") @@ -54,11 +46,7 @@ internal class AccountServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val accountServiceAsync = client.x().accounts() val accountsFuture = accountServiceAsync.list() @@ -70,11 +58,7 @@ internal class AccountServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun delete() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val accountServiceAsync = client.x().accounts() val accountFuture = accountServiceAsync.delete("id") @@ -86,11 +70,7 @@ internal class AccountServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun bulkRetry() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val accountServiceAsync = client.x().accounts() val responseFuture = accountServiceAsync.bulkRetry() @@ -102,11 +82,7 @@ internal class AccountServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun reauth() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val accountServiceAsync = client.x().accounts() val responseFuture = @@ -114,6 +90,8 @@ internal class AccountServiceAsyncTest { AccountReauthParams.builder() .id("id") .password("password_value") + .email("user@example.com") + .proxyCountry("US") .totpSecret("totp_secret_value") .build() ) diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/BookmarkServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/BookmarkServiceAsyncTest.kt index 95a0148..5a67ab9 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/BookmarkServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/BookmarkServiceAsyncTest.kt @@ -12,11 +12,7 @@ internal class BookmarkServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val bookmarkServiceAsync = client.x().bookmarks() val paginatedTweetsFuture = @@ -31,11 +27,7 @@ internal class BookmarkServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveFolders() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val bookmarkServiceAsync = client.x().bookmarks() val responseFuture = bookmarkServiceAsync.retrieveFolders() diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/CommunityServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/CommunityServiceAsyncTest.kt index 00b9855..c475f23 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/CommunityServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/CommunityServiceAsyncTest.kt @@ -16,11 +16,7 @@ internal class CommunityServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val communityServiceAsync = client.x().communities() val communityFuture = @@ -39,11 +35,7 @@ internal class CommunityServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun delete() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val communityServiceAsync = client.x().communities() val communityFuture = @@ -62,11 +54,7 @@ internal class CommunityServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveInfo() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val communityServiceAsync = client.x().communities() val responseFuture = communityServiceAsync.retrieveInfo("id") @@ -78,11 +66,7 @@ internal class CommunityServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveMembers() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val communityServiceAsync = client.x().communities() val paginatedUsersFuture = @@ -97,11 +81,7 @@ internal class CommunityServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveModerators() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val communityServiceAsync = client.x().communities() val paginatedUsersFuture = @@ -116,11 +96,7 @@ internal class CommunityServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveSearch() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val communityServiceAsync = client.x().communities() val paginatedTweetsFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/DmServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/DmServiceAsyncTest.kt index 932bdda..e00f9b0 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/DmServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/DmServiceAsyncTest.kt @@ -13,11 +13,7 @@ internal class DmServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveHistory() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val dmServiceAsync = client.x().dm() val responseFuture = @@ -36,11 +32,7 @@ internal class DmServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun send() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val dmServiceAsync = client.x().dm() val responseFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/FollowerServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/FollowerServiceAsyncTest.kt index 922710b..c14e87c 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/FollowerServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/FollowerServiceAsyncTest.kt @@ -12,11 +12,7 @@ internal class FollowerServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun check() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val followerServiceAsync = client.x().followers() val responseFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/ListServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/ListServiceAsyncTest.kt index 3e4ec67..6a3573c 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/ListServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/ListServiceAsyncTest.kt @@ -14,11 +14,7 @@ internal class ListServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveFollowers() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val listServiceAsync = client.x().lists() val paginatedUsersFuture = @@ -33,11 +29,7 @@ internal class ListServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveMembers() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val listServiceAsync = client.x().lists() val paginatedUsersFuture = @@ -52,11 +44,7 @@ internal class ListServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveTweets() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val listServiceAsync = client.x().lists() val paginatedTweetsFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/MediaServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/MediaServiceAsyncTest.kt index fe181cf..64e0668 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/MediaServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/MediaServiceAsyncTest.kt @@ -13,11 +13,7 @@ internal class MediaServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun download() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val mediaServiceAsync = client.x().media() val responseFuture = @@ -36,11 +32,7 @@ internal class MediaServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun upload() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val mediaServiceAsync = client.x().media() val responseFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/ProfileServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/ProfileServiceAsyncTest.kt index 3bf1ce7..2b08a9b 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/ProfileServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/ProfileServiceAsyncTest.kt @@ -14,11 +14,7 @@ internal class ProfileServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun update() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val profileServiceAsync = client.x().profile() val profileFuture = @@ -39,11 +35,7 @@ internal class ProfileServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun updateAvatar() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val profileServiceAsync = client.x().profile() val responseFuture = @@ -61,11 +53,7 @@ internal class ProfileServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun updateBanner() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val profileServiceAsync = client.x().profile() val responseFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/TweetServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/TweetServiceAsyncTest.kt index dc0168b..33249a1 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/TweetServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/TweetServiceAsyncTest.kt @@ -20,23 +20,20 @@ internal class TweetServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val tweetServiceAsync = client.x().tweets() val tweetFuture = tweetServiceAsync.create( TweetCreateParams.builder() .account("@elonmusk") - .text("Just launched our new feature!") .attachmentUrl("https://x.com/elonmusk/status/1234567890") .communityId("1500000000000000000") .isNoteTweet(false) + .addMedia("https://example.com/image.jpg") .addMediaId("1234567890123456789") .replyToTweetId("1234567890") + .text("Just launched our new feature!") .build() ) @@ -47,11 +44,7 @@ internal class TweetServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val tweetServiceAsync = client.x().tweets() val tweetFuture = tweetServiceAsync.retrieve("id") @@ -63,11 +56,7 @@ internal class TweetServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val tweetServiceAsync = client.x().tweets() val paginatedTweetsFuture = @@ -80,11 +69,7 @@ internal class TweetServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun delete() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val tweetServiceAsync = client.x().tweets() val tweetFuture = @@ -99,11 +84,7 @@ internal class TweetServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun getFavoriters() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val tweetServiceAsync = client.x().tweets() val paginatedUsersFuture = @@ -118,11 +99,7 @@ internal class TweetServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun getQuotes() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val tweetServiceAsync = client.x().tweets() val paginatedTweetsFuture = @@ -143,11 +120,7 @@ internal class TweetServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun getReplies() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val tweetServiceAsync = client.x().tweets() val paginatedTweetsFuture = @@ -167,11 +140,7 @@ internal class TweetServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun getRetweeters() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val tweetServiceAsync = client.x().tweets() val paginatedUsersFuture = @@ -186,11 +155,7 @@ internal class TweetServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun getThread() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val tweetServiceAsync = client.x().tweets() val paginatedTweetsFuture = @@ -205,11 +170,7 @@ internal class TweetServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun search() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val tweetServiceAsync = client.x().tweets() val paginatedTweetsFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/UserServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/UserServiceAsyncTest.kt index fb677ad..d0a2533 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/UserServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/UserServiceAsyncTest.kt @@ -21,11 +21,7 @@ internal class UserServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val userServiceAsync = client.x().users() val userProfileFuture = userServiceAsync.retrieve("id") @@ -37,11 +33,7 @@ internal class UserServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveBatch() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val userServiceAsync = client.x().users() val paginatedUsersFuture = @@ -54,11 +46,7 @@ internal class UserServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveFollowers() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val userServiceAsync = client.x().users() val paginatedUsersFuture = @@ -73,11 +61,7 @@ internal class UserServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveFollowersYouKnow() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val userServiceAsync = client.x().users() val paginatedUsersFuture = @@ -92,11 +76,7 @@ internal class UserServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveFollowing() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val userServiceAsync = client.x().users() val paginatedUsersFuture = @@ -111,11 +91,7 @@ internal class UserServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveLikes() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val userServiceAsync = client.x().users() val paginatedTweetsFuture = @@ -130,11 +106,7 @@ internal class UserServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveMedia() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val userServiceAsync = client.x().users() val paginatedTweetsFuture = @@ -149,11 +121,7 @@ internal class UserServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveMentions() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val userServiceAsync = client.x().users() val paginatedTweetsFuture = @@ -173,11 +141,7 @@ internal class UserServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveSearch() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val userServiceAsync = client.x().users() val paginatedUsersFuture = @@ -192,11 +156,7 @@ internal class UserServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveTweets() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val userServiceAsync = client.x().users() val paginatedTweetsFuture = @@ -216,11 +176,7 @@ internal class UserServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun retrieveVerifiedFollowers() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val userServiceAsync = client.x().users() val paginatedUsersFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/communities/JoinServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/communities/JoinServiceAsyncTest.kt index 2c207e4..201fab6 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/communities/JoinServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/communities/JoinServiceAsyncTest.kt @@ -13,11 +13,7 @@ internal class JoinServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val joinServiceAsync = client.x().communities().join() val communityActionResultFuture = @@ -32,11 +28,7 @@ internal class JoinServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun deleteAll() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val joinServiceAsync = client.x().communities().join() val communityActionResultFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/communities/TweetServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/communities/TweetServiceAsyncTest.kt index 163ec75..cd86441 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/communities/TweetServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/communities/TweetServiceAsyncTest.kt @@ -13,11 +13,7 @@ internal class TweetServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val tweetServiceAsync = client.x().communities().tweets() val paginatedTweetsFuture = @@ -32,11 +28,7 @@ internal class TweetServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun listByCommunity() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val tweetServiceAsync = client.x().communities().tweets() val paginatedTweetsFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/tweets/LikeServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/tweets/LikeServiceAsyncTest.kt index 9b347e0..4b03676 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/tweets/LikeServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/tweets/LikeServiceAsyncTest.kt @@ -13,11 +13,7 @@ internal class LikeServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val likeServiceAsync = client.x().tweets().like() val likeFuture = @@ -32,11 +28,7 @@ internal class LikeServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun delete() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val likeServiceAsync = client.x().tweets().like() val likeFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/tweets/RetweetServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/tweets/RetweetServiceAsyncTest.kt index 8076882..e19fc12 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/tweets/RetweetServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/tweets/RetweetServiceAsyncTest.kt @@ -13,11 +13,7 @@ internal class RetweetServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val retweetServiceAsync = client.x().tweets().retweet() val retweetFuture = @@ -32,11 +28,7 @@ internal class RetweetServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun delete() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val retweetServiceAsync = client.x().tweets().retweet() val retweetFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/users/FollowServiceAsyncTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/users/FollowServiceAsyncTest.kt index b43691b..137e8da 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/users/FollowServiceAsyncTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/async/x/users/FollowServiceAsyncTest.kt @@ -13,11 +13,7 @@ internal class FollowServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val followServiceAsync = client.x().users().follow() val followFuture = @@ -32,11 +28,7 @@ internal class FollowServiceAsyncTest { @Disabled("Mock server tests are disabled") @Test fun deleteAll() { - val client = - XTwitterScraperOkHttpClientAsync.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClientAsync.builder().apiKey("My API Key").build() val followServiceAsync = client.x().users().follow() val responseFuture = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/AccountServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/AccountServiceTest.kt index 949e341..40e260b 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/AccountServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/AccountServiceTest.kt @@ -13,11 +13,7 @@ internal class AccountServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val accountService = client.account() val account = accountService.retrieve() @@ -28,11 +24,7 @@ internal class AccountServiceTest { @Disabled("Mock server tests are disabled") @Test fun setXUsername() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val accountService = client.account() val response = @@ -46,11 +38,7 @@ internal class AccountServiceTest { @Disabled("Mock server tests are disabled") @Test fun updateLocale() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val accountService = client.account() val response = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/ApiKeyServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/ApiKeyServiceTest.kt index 5edbc5c..24a01fd 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/ApiKeyServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/ApiKeyServiceTest.kt @@ -12,11 +12,7 @@ internal class ApiKeyServiceTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val apiKeyService = client.apiKeys() val apiKey = apiKeyService.create(ApiKeyCreateParams.builder().name("My API Key").build()) @@ -27,11 +23,7 @@ internal class ApiKeyServiceTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val apiKeyService = client.apiKeys() val apiKeys = apiKeyService.list() @@ -42,11 +34,7 @@ internal class ApiKeyServiceTest { @Disabled("Mock server tests are disabled") @Test fun revoke() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val apiKeyService = client.apiKeys() val response = apiKeyService.revoke("id") diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/ComposeServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/ComposeServiceTest.kt index 219a3f3..c64aa5a 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/ComposeServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/ComposeServiceTest.kt @@ -12,11 +12,7 @@ internal class ComposeServiceTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val composeService = client.compose() val compose = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/CreditServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/CreditServiceTest.kt index f24d1ef..7da940b 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/CreditServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/CreditServiceTest.kt @@ -12,11 +12,7 @@ internal class CreditServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveBalance() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val creditService = client.credits() val response = creditService.retrieveBalance() @@ -27,11 +23,7 @@ internal class CreditServiceTest { @Disabled("Mock server tests are disabled") @Test fun topupBalance() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val creditService = client.credits() val response = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/DraftServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/DraftServiceTest.kt index d276725..339575a 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/DraftServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/DraftServiceTest.kt @@ -13,11 +13,7 @@ internal class DraftServiceTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val draftService = client.drafts() val draftDetail = @@ -35,11 +31,7 @@ internal class DraftServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val draftService = client.drafts() val draftDetail = draftService.retrieve("id") @@ -50,11 +42,7 @@ internal class DraftServiceTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val draftService = client.drafts() val drafts = @@ -68,11 +56,7 @@ internal class DraftServiceTest { @Disabled("Mock server tests are disabled") @Test fun delete() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val draftService = client.drafts() draftService.delete("id") diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/DrawServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/DrawServiceTest.kt index d3f084f..c6bd436 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/DrawServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/DrawServiceTest.kt @@ -24,11 +24,7 @@ internal class DrawServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val drawService = client.draws() val draw = drawService.retrieve("id") @@ -39,11 +35,7 @@ internal class DrawServiceTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val drawService = client.draws() val draws = drawService.list(DrawListParams.builder().after("after").limit(1L).build()) @@ -57,7 +49,6 @@ internal class DrawServiceTest { XTwitterScraperOkHttpClient.builder() .baseUrl(wmRuntimeInfo.httpBaseUrl) .apiKey("My API Key") - .bearerToken("My Bearer Token") .build() val drawService = client.draws() stubFor(get(anyUrl()).willReturn(ok().withBody("abc"))) @@ -77,11 +68,7 @@ internal class DrawServiceTest { @Disabled("Mock server tests are disabled") @Test fun run() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val drawService = client.draws() val response = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/EventServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/EventServiceTest.kt index ebeebcf..72e69c9 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/EventServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/EventServiceTest.kt @@ -13,11 +13,7 @@ internal class EventServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val eventService = client.events() val eventDetail = eventService.retrieve("id") @@ -28,11 +24,7 @@ internal class EventServiceTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val eventService = client.events() val events = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/ExtractionServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/ExtractionServiceTest.kt index 8390c94..2024e81 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/ExtractionServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/ExtractionServiceTest.kt @@ -26,11 +26,7 @@ internal class ExtractionServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val extractionService = client.extractions() val extraction = @@ -44,11 +40,7 @@ internal class ExtractionServiceTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val extractionService = client.extractions() val extractions = @@ -67,11 +59,7 @@ internal class ExtractionServiceTest { @Disabled("Mock server tests are disabled") @Test fun estimateCost() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val extractionService = client.extractions() val response = @@ -99,7 +87,6 @@ internal class ExtractionServiceTest { XTwitterScraperOkHttpClient.builder() .baseUrl(wmRuntimeInfo.httpBaseUrl) .apiKey("My API Key") - .bearerToken("My Bearer Token") .build() val extractionService = client.extractions() stubFor(get(anyUrl()).willReturn(ok().withBody("abc"))) @@ -118,11 +105,7 @@ internal class ExtractionServiceTest { @Disabled("Mock server tests are disabled") @Test fun run() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val extractionService = client.extractions() val response = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/IntegrationServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/IntegrationServiceTest.kt deleted file mode 100644 index 34196fd..0000000 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/IntegrationServiceTest.kt +++ /dev/null @@ -1,144 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.x_twitter_scraper.api.services.blocking - -import com.x_twitter_scraper.api.client.okhttp.XTwitterScraperOkHttpClient -import com.x_twitter_scraper.api.models.EventType -import com.x_twitter_scraper.api.models.integrations.IntegrationCreateParams -import com.x_twitter_scraper.api.models.integrations.IntegrationListDeliveriesParams -import com.x_twitter_scraper.api.models.integrations.IntegrationUpdateParams -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test - -internal class IntegrationServiceTest { - - @Disabled("Mock server tests are disabled") - @Test - fun create() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() - val integrationService = client.integrations() - - val integration = - integrationService.create( - IntegrationCreateParams.builder() - .config( - IntegrationCreateParams.Config.builder().chatId("-1001234567890").build() - ) - .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) - .name("My Telegram Bot") - .build() - ) - - integration.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun retrieve() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() - val integrationService = client.integrations() - - val integration = integrationService.retrieve("id") - - integration.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun update() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() - val integrationService = client.integrations() - - val integration = - integrationService.update( - IntegrationUpdateParams.builder() - .id("id") - .addEventType(EventType.TWEET_NEW) - .filters(IntegrationUpdateParams.Filters.builder().build()) - .isActive(true) - .messageTemplate(IntegrationUpdateParams.MessageTemplate.builder().build()) - .name("My Telegram Bot") - .scopeAllMonitors(true) - .silentPush(false) - .build() - ) - - integration.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun list() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() - val integrationService = client.integrations() - - val integrations = integrationService.list() - - integrations.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun delete() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() - val integrationService = client.integrations() - - val integration = integrationService.delete("id") - - integration.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun listDeliveries() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() - val integrationService = client.integrations() - - val response = - integrationService.listDeliveries( - IntegrationListDeliveriesParams.builder().id("id").limit(1L).build() - ) - - response.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun sendTest() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() - val integrationService = client.integrations() - - val response = integrationService.sendTest("id") - - response.validate() - } -} diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/MonitorServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/MonitorServiceTest.kt index f648f87..284ad63 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/MonitorServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/MonitorServiceTest.kt @@ -14,18 +14,14 @@ internal class MonitorServiceTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val monitorService = client.monitors() val monitor = monitorService.create( MonitorCreateParams.builder() .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .username("elonmusk") .build() ) @@ -36,11 +32,7 @@ internal class MonitorServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val monitorService = client.monitors() val monitor = monitorService.retrieve("id") @@ -51,11 +43,7 @@ internal class MonitorServiceTest { @Disabled("Mock server tests are disabled") @Test fun update() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val monitorService = client.monitors() val monitor = @@ -73,11 +61,7 @@ internal class MonitorServiceTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val monitorService = client.monitors() val monitors = monitorService.list() @@ -88,11 +72,7 @@ internal class MonitorServiceTest { @Disabled("Mock server tests are disabled") @Test fun deactivate() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val monitorService = client.monitors() val response = monitorService.deactivate("id") diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/RadarServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/RadarServiceTest.kt index 0cbc254..0faa972 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/RadarServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/RadarServiceTest.kt @@ -12,19 +12,16 @@ internal class RadarServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveTrendingTopics() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val radarService = client.radar() val response = radarService.retrieveTrendingTopics( RadarRetrieveTrendingTopicsParams.builder() - .category("category") - .count(0L) - .hours(0L) + .after("after") + .category(RadarRetrieveTrendingTopicsParams.Category.GENERAL) + .hours(1L) + .limit(1L) .region("region") .source(RadarRetrieveTrendingTopicsParams.Source.GITHUB) .build() diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/StyleServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/StyleServiceTest.kt index e459853..a2c3d5b 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/StyleServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/StyleServiceTest.kt @@ -14,11 +14,7 @@ internal class StyleServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val styleService = client.styles() val styleProfile = styleService.retrieve("id") @@ -29,11 +25,7 @@ internal class StyleServiceTest { @Disabled("Mock server tests are disabled") @Test fun update() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val styleService = client.styles() val styleProfile = @@ -55,11 +47,7 @@ internal class StyleServiceTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val styleService = client.styles() val styles = styleService.list() @@ -70,11 +58,7 @@ internal class StyleServiceTest { @Disabled("Mock server tests are disabled") @Test fun delete() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val styleService = client.styles() styleService.delete("id") @@ -83,11 +67,7 @@ internal class StyleServiceTest { @Disabled("Mock server tests are disabled") @Test fun analyze() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val styleService = client.styles() val styleProfile = @@ -99,11 +79,7 @@ internal class StyleServiceTest { @Disabled("Mock server tests are disabled") @Test fun compare() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val styleService = client.styles() val response = @@ -117,11 +93,7 @@ internal class StyleServiceTest { @Disabled("Mock server tests are disabled") @Test fun getPerformance() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val styleService = client.styles() val response = styleService.getPerformance("id") diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/SubscribeServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/SubscribeServiceTest.kt index 21abc3b..a60f869 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/SubscribeServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/SubscribeServiceTest.kt @@ -11,11 +11,7 @@ internal class SubscribeServiceTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val subscribeService = client.subscribe() val subscribe = subscribeService.create() diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/TrendServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/TrendServiceTest.kt index 91ba1f1..e0b9ea4 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/TrendServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/TrendServiceTest.kt @@ -12,11 +12,7 @@ internal class TrendServiceTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val trendService = client.trends() val trends = trendService.list(TrendListParams.builder().count(1L).woeid(0L).build()) diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/WebhookServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/WebhookServiceTest.kt index 99296f9..2d18539 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/WebhookServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/WebhookServiceTest.kt @@ -14,18 +14,14 @@ internal class WebhookServiceTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val webhookService = client.webhooks() val webhook = webhookService.create( WebhookCreateParams.builder() .addEventType(EventType.TWEET_NEW) - .addEventType(EventType.FOLLOWER_GAINED) + .addEventType(EventType.TWEET_REPLY) .url("https://example.com/webhook") .build() ) @@ -36,11 +32,7 @@ internal class WebhookServiceTest { @Disabled("Mock server tests are disabled") @Test fun update() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val webhookService = client.webhooks() val webhook = @@ -59,11 +51,7 @@ internal class WebhookServiceTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val webhookService = client.webhooks() val webhooks = webhookService.list() @@ -74,11 +62,7 @@ internal class WebhookServiceTest { @Disabled("Mock server tests are disabled") @Test fun deactivate() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val webhookService = client.webhooks() val response = webhookService.deactivate("id") @@ -89,11 +73,7 @@ internal class WebhookServiceTest { @Disabled("Mock server tests are disabled") @Test fun listDeliveries() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val webhookService = client.webhooks() val response = webhookService.listDeliveries("id") @@ -104,11 +84,7 @@ internal class WebhookServiceTest { @Disabled("Mock server tests are disabled") @Test fun test() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val webhookService = client.webhooks() val response = webhookService.test("id") diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/XServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/XServiceTest.kt index 7747814..215a91c 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/XServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/XServiceTest.kt @@ -5,6 +5,7 @@ package com.x_twitter_scraper.api.services.blocking import com.x_twitter_scraper.api.client.okhttp.XTwitterScraperOkHttpClient import com.x_twitter_scraper.api.models.x.XGetHomeTimelineParams import com.x_twitter_scraper.api.models.x.XGetNotificationsParams +import com.x_twitter_scraper.api.models.x.XGetTrendsParams import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test @@ -13,11 +14,7 @@ internal class XServiceTest { @Disabled("Mock server tests are disabled") @Test fun getArticle() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val xService = client.x() val response = xService.getArticle("tweetId") @@ -28,11 +25,7 @@ internal class XServiceTest { @Disabled("Mock server tests are disabled") @Test fun getHomeTimeline() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val xService = client.x() val paginatedTweets = @@ -49,11 +42,7 @@ internal class XServiceTest { @Disabled("Mock server tests are disabled") @Test fun getNotifications() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val xService = client.x() val response = @@ -70,14 +59,10 @@ internal class XServiceTest { @Disabled("Mock server tests are disabled") @Test fun getTrends() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val xService = client.x() - val response = xService.getTrends() + val response = xService.getTrends(XGetTrendsParams.builder().count(1L).woeid(0L).build()) response.validate() } diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/support/TicketServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/support/TicketServiceTest.kt index 5af2627..9c615b5 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/support/TicketServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/support/TicketServiceTest.kt @@ -14,11 +14,7 @@ internal class TicketServiceTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val ticketService = client.support().tickets() val ticket = @@ -35,11 +31,7 @@ internal class TicketServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val ticketService = client.support().tickets() val ticket = ticketService.retrieve("messages_value") @@ -50,11 +42,7 @@ internal class TicketServiceTest { @Disabled("Mock server tests are disabled") @Test fun update() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val ticketService = client.support().tickets() val ticket = @@ -71,11 +59,7 @@ internal class TicketServiceTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val ticketService = client.support().tickets() val tickets = ticketService.list() @@ -86,11 +70,7 @@ internal class TicketServiceTest { @Disabled("Mock server tests are disabled") @Test fun reply() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val ticketService = client.support().tickets() val response = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/AccountServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/AccountServiceTest.kt index ea55098..eeb0e92 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/AccountServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/AccountServiceTest.kt @@ -13,11 +13,7 @@ internal class AccountServiceTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val accountService = client.x().accounts() val account = @@ -37,11 +33,7 @@ internal class AccountServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val accountService = client.x().accounts() val xAccountDetail = accountService.retrieve("id") @@ -52,11 +44,7 @@ internal class AccountServiceTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val accountService = client.x().accounts() val accounts = accountService.list() @@ -67,11 +55,7 @@ internal class AccountServiceTest { @Disabled("Mock server tests are disabled") @Test fun delete() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val accountService = client.x().accounts() val account = accountService.delete("id") @@ -82,11 +66,7 @@ internal class AccountServiceTest { @Disabled("Mock server tests are disabled") @Test fun bulkRetry() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val accountService = client.x().accounts() val response = accountService.bulkRetry() @@ -97,11 +77,7 @@ internal class AccountServiceTest { @Disabled("Mock server tests are disabled") @Test fun reauth() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val accountService = client.x().accounts() val response = @@ -109,6 +85,8 @@ internal class AccountServiceTest { AccountReauthParams.builder() .id("id") .password("password_value") + .email("user@example.com") + .proxyCountry("US") .totpSecret("totp_secret_value") .build() ) diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/BookmarkServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/BookmarkServiceTest.kt index 250d6b1..529648c 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/BookmarkServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/BookmarkServiceTest.kt @@ -12,11 +12,7 @@ internal class BookmarkServiceTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val bookmarkService = client.x().bookmarks() val paginatedTweets = @@ -30,11 +26,7 @@ internal class BookmarkServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveFolders() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val bookmarkService = client.x().bookmarks() val response = bookmarkService.retrieveFolders() diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/CommunityServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/CommunityServiceTest.kt index 925e1d1..283cfc8 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/CommunityServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/CommunityServiceTest.kt @@ -16,11 +16,7 @@ internal class CommunityServiceTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val communityService = client.x().communities() val community = @@ -38,11 +34,7 @@ internal class CommunityServiceTest { @Disabled("Mock server tests are disabled") @Test fun delete() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val communityService = client.x().communities() val community = @@ -60,11 +52,7 @@ internal class CommunityServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveInfo() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val communityService = client.x().communities() val response = communityService.retrieveInfo("id") @@ -75,11 +63,7 @@ internal class CommunityServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveMembers() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val communityService = client.x().communities() val paginatedUsers = @@ -93,11 +77,7 @@ internal class CommunityServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveModerators() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val communityService = client.x().communities() val paginatedUsers = @@ -111,11 +91,7 @@ internal class CommunityServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveSearch() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val communityService = client.x().communities() val paginatedTweets = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/DmServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/DmServiceTest.kt index 6082cf4..2716bba 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/DmServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/DmServiceTest.kt @@ -13,11 +13,7 @@ internal class DmServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveHistory() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val dmService = client.x().dm() val response = @@ -35,11 +31,7 @@ internal class DmServiceTest { @Disabled("Mock server tests are disabled") @Test fun send() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val dmService = client.x().dm() val response = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/FollowerServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/FollowerServiceTest.kt index a097091..c338944 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/FollowerServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/FollowerServiceTest.kt @@ -12,11 +12,7 @@ internal class FollowerServiceTest { @Disabled("Mock server tests are disabled") @Test fun check() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val followerService = client.x().followers() val response = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/ListServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/ListServiceTest.kt index ad0c886..342b680 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/ListServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/ListServiceTest.kt @@ -14,11 +14,7 @@ internal class ListServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveFollowers() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val listService = client.x().lists() val paginatedUsers = @@ -32,11 +28,7 @@ internal class ListServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveMembers() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val listService = client.x().lists() val paginatedUsers = @@ -50,11 +42,7 @@ internal class ListServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveTweets() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val listService = client.x().lists() val paginatedTweets = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/MediaServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/MediaServiceTest.kt index bfc87cf..2a1a45a 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/MediaServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/MediaServiceTest.kt @@ -13,11 +13,7 @@ internal class MediaServiceTest { @Disabled("Mock server tests are disabled") @Test fun download() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val mediaService = client.x().media() val response = @@ -35,11 +31,7 @@ internal class MediaServiceTest { @Disabled("Mock server tests are disabled") @Test fun upload() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val mediaService = client.x().media() val response = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/ProfileServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/ProfileServiceTest.kt index 5eaf84f..953a85e 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/ProfileServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/ProfileServiceTest.kt @@ -14,11 +14,7 @@ internal class ProfileServiceTest { @Disabled("Mock server tests are disabled") @Test fun update() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val profileService = client.x().profile() val profile = @@ -38,11 +34,7 @@ internal class ProfileServiceTest { @Disabled("Mock server tests are disabled") @Test fun updateAvatar() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val profileService = client.x().profile() val response = @@ -59,11 +51,7 @@ internal class ProfileServiceTest { @Disabled("Mock server tests are disabled") @Test fun updateBanner() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val profileService = client.x().profile() val response = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/TweetServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/TweetServiceTest.kt index fcf04f2..d3a50ea 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/TweetServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/TweetServiceTest.kt @@ -20,23 +20,20 @@ internal class TweetServiceTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val tweetService = client.x().tweets() val tweet = tweetService.create( TweetCreateParams.builder() .account("@elonmusk") - .text("Just launched our new feature!") .attachmentUrl("https://x.com/elonmusk/status/1234567890") .communityId("1500000000000000000") .isNoteTweet(false) + .addMedia("https://example.com/image.jpg") .addMediaId("1234567890123456789") .replyToTweetId("1234567890") + .text("Just launched our new feature!") .build() ) @@ -46,11 +43,7 @@ internal class TweetServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val tweetService = client.x().tweets() val tweet = tweetService.retrieve("id") @@ -61,11 +54,7 @@ internal class TweetServiceTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val tweetService = client.x().tweets() val paginatedTweets = tweetService.list(TweetListParams.builder().ids("ids").build()) @@ -76,11 +65,7 @@ internal class TweetServiceTest { @Disabled("Mock server tests are disabled") @Test fun delete() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val tweetService = client.x().tweets() val tweet = @@ -92,11 +77,7 @@ internal class TweetServiceTest { @Disabled("Mock server tests are disabled") @Test fun getFavoriters() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val tweetService = client.x().tweets() val paginatedUsers = @@ -110,11 +91,7 @@ internal class TweetServiceTest { @Disabled("Mock server tests are disabled") @Test fun getQuotes() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val tweetService = client.x().tweets() val paginatedTweets = @@ -134,11 +111,7 @@ internal class TweetServiceTest { @Disabled("Mock server tests are disabled") @Test fun getReplies() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val tweetService = client.x().tweets() val paginatedTweets = @@ -157,11 +130,7 @@ internal class TweetServiceTest { @Disabled("Mock server tests are disabled") @Test fun getRetweeters() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val tweetService = client.x().tweets() val paginatedUsers = @@ -175,11 +144,7 @@ internal class TweetServiceTest { @Disabled("Mock server tests are disabled") @Test fun getThread() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val tweetService = client.x().tweets() val paginatedTweets = @@ -191,11 +156,7 @@ internal class TweetServiceTest { @Disabled("Mock server tests are disabled") @Test fun search() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val tweetService = client.x().tweets() val paginatedTweets = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/UserServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/UserServiceTest.kt index 7955ba2..0eebc9d 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/UserServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/UserServiceTest.kt @@ -21,11 +21,7 @@ internal class UserServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieve() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val userService = client.x().users() val userProfile = userService.retrieve("id") @@ -36,11 +32,7 @@ internal class UserServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveBatch() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val userService = client.x().users() val paginatedUsers = @@ -52,11 +44,7 @@ internal class UserServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveFollowers() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val userService = client.x().users() val paginatedUsers = @@ -70,11 +58,7 @@ internal class UserServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveFollowersYouKnow() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val userService = client.x().users() val paginatedUsers = @@ -88,11 +72,7 @@ internal class UserServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveFollowing() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val userService = client.x().users() val paginatedUsers = @@ -106,11 +86,7 @@ internal class UserServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveLikes() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val userService = client.x().users() val paginatedTweets = @@ -124,11 +100,7 @@ internal class UserServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveMedia() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val userService = client.x().users() val paginatedTweets = @@ -142,11 +114,7 @@ internal class UserServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveMentions() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val userService = client.x().users() val paginatedTweets = @@ -165,11 +133,7 @@ internal class UserServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveSearch() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val userService = client.x().users() val paginatedUsers = @@ -183,11 +147,7 @@ internal class UserServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveTweets() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val userService = client.x().users() val paginatedTweets = @@ -206,11 +166,7 @@ internal class UserServiceTest { @Disabled("Mock server tests are disabled") @Test fun retrieveVerifiedFollowers() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val userService = client.x().users() val paginatedUsers = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/communities/JoinServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/communities/JoinServiceTest.kt index dd18493..d225dc0 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/communities/JoinServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/communities/JoinServiceTest.kt @@ -13,11 +13,7 @@ internal class JoinServiceTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val joinService = client.x().communities().join() val communityActionResult = @@ -29,11 +25,7 @@ internal class JoinServiceTest { @Disabled("Mock server tests are disabled") @Test fun deleteAll() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val joinService = client.x().communities().join() val communityActionResult = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/communities/TweetServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/communities/TweetServiceTest.kt index aa2abcf..26bd049 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/communities/TweetServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/communities/TweetServiceTest.kt @@ -13,11 +13,7 @@ internal class TweetServiceTest { @Disabled("Mock server tests are disabled") @Test fun list() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val tweetService = client.x().communities().tweets() val paginatedTweets = @@ -31,11 +27,7 @@ internal class TweetServiceTest { @Disabled("Mock server tests are disabled") @Test fun listByCommunity() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val tweetService = client.x().communities().tweets() val paginatedTweets = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/tweets/LikeServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/tweets/LikeServiceTest.kt index 2b5f04d..492a73d 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/tweets/LikeServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/tweets/LikeServiceTest.kt @@ -13,11 +13,7 @@ internal class LikeServiceTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val likeService = client.x().tweets().like() val like = @@ -29,11 +25,7 @@ internal class LikeServiceTest { @Disabled("Mock server tests are disabled") @Test fun delete() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val likeService = client.x().tweets().like() val like = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/tweets/RetweetServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/tweets/RetweetServiceTest.kt index 533c4ea..dfb36d8 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/tweets/RetweetServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/tweets/RetweetServiceTest.kt @@ -13,11 +13,7 @@ internal class RetweetServiceTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val retweetService = client.x().tweets().retweet() val retweet = @@ -31,11 +27,7 @@ internal class RetweetServiceTest { @Disabled("Mock server tests are disabled") @Test fun delete() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val retweetService = client.x().tweets().retweet() val retweet = diff --git a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/users/FollowServiceTest.kt b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/users/FollowServiceTest.kt index 5cfa228..8f929aa 100644 --- a/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/users/FollowServiceTest.kt +++ b/x-twitter-scraper-java-core/src/test/kotlin/com/x_twitter_scraper/api/services/blocking/x/users/FollowServiceTest.kt @@ -13,11 +13,7 @@ internal class FollowServiceTest { @Disabled("Mock server tests are disabled") @Test fun create() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val followService = client.x().users().follow() val follow = @@ -29,11 +25,7 @@ internal class FollowServiceTest { @Disabled("Mock server tests are disabled") @Test fun deleteAll() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() val followService = client.x().users().follow() val response = diff --git a/x-twitter-scraper-java-proguard-test/src/test/kotlin/com/x_twitter_scraper/api/proguard/ProGuardCompatibilityTest.kt b/x-twitter-scraper-java-proguard-test/src/test/kotlin/com/x_twitter_scraper/api/proguard/ProGuardCompatibilityTest.kt index 48be3db..7d195af 100644 --- a/x-twitter-scraper-java-proguard-test/src/test/kotlin/com/x_twitter_scraper/api/proguard/ProGuardCompatibilityTest.kt +++ b/x-twitter-scraper-java-proguard-test/src/test/kotlin/com/x_twitter_scraper/api/proguard/ProGuardCompatibilityTest.kt @@ -6,7 +6,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.x_twitter_scraper.api.client.okhttp.XTwitterScraperOkHttpClient import com.x_twitter_scraper.api.core.jsonMapper import com.x_twitter_scraper.api.models.EventType -import com.x_twitter_scraper.api.models.x.tweets.SearchTweet +import com.x_twitter_scraper.api.models.x.tweets.TweetAuthor import kotlin.reflect.full.memberFunctions import kotlin.reflect.jvm.javaMethod import org.assertj.core.api.Assertions.assertThat @@ -47,11 +47,7 @@ internal class ProGuardCompatibilityTest { @Test fun client() { - val client = - XTwitterScraperOkHttpClient.builder() - .apiKey("My API Key") - .bearerToken("My Bearer Token") - .build() + val client = XTwitterScraperOkHttpClient.builder().apiKey("My API Key").build() assertThat(client).isNotNull() assertThat(client.account()).isNotNull() @@ -66,46 +62,31 @@ internal class ProGuardCompatibilityTest { assertThat(client.extractions()).isNotNull() assertThat(client.draws()).isNotNull() assertThat(client.webhooks()).isNotNull() - assertThat(client.integrations()).isNotNull() assertThat(client.x()).isNotNull() assertThat(client.trends()).isNotNull() - assertThat(client.bot()).isNotNull() assertThat(client.support()).isNotNull() assertThat(client.credits()).isNotNull() } @Test - fun searchTweetRoundtrip() { + fun tweetAuthorRoundtrip() { val jsonMapper = jsonMapper() - val searchTweet = - SearchTweet.builder() - .id("1234567890") - .text("Just launched our new feature!") - .author( - SearchTweet.Author.builder() - .id("9876543210") - .name("Elon Musk") - .username("elonmusk") - .verified(true) - .build() - ) - .bookmarkCount(2L) - .createdAt("2025-01-15T12:00:00Z") - .isNoteTweet(false) - .likeCount(42L) - .quoteCount(1L) - .replyCount(3L) - .retweetCount(5L) - .viewCount(1500L) + val tweetAuthor = + TweetAuthor.builder() + .id("9876543210") + .followers(150000000L) + .username("elonmusk") + .verified(true) + .profilePicture("https://pbs.twimg.com/profile_images/example.jpg") .build() - val roundtrippedSearchTweet = + val roundtrippedTweetAuthor = jsonMapper.readValue( - jsonMapper.writeValueAsString(searchTweet), - jacksonTypeRef(), + jsonMapper.writeValueAsString(tweetAuthor), + jacksonTypeRef(), ) - assertThat(roundtrippedSearchTweet).isEqualTo(searchTweet) + assertThat(roundtrippedTweetAuthor).isEqualTo(tweetAuthor) } @Test