From ea05123e415116b4529686a0da1bc9ebafcd1e82 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 13 Nov 2026 15:28:48 +0000 Subject: [PATCH 01/11] feat: sync with Apify OpenAPI spec v2-2026-11-13T143025Z Documentation-only spec revision: Server Actor charge and usage wording, show-once API token docs. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_017ocuAJ6an2FrPuYqCvUoaA --- CHANGELOG.md | 6 ++++++ README.md | 10 +++++----- docs/README.md | 6 ++++-- pom.xml | 2 +- src/main/java/com/apify/client/ApifyClientBuilder.java | 6 +++++- src/main/java/com/apify/client/Version.java | 4 ++-- src/main/java/com/apify/client/actor/Actor.java | 7 ++++++- src/main/java/com/apify/client/run/ActorRun.java | 7 ++++++- src/main/java/com/apify/client/run/RunClient.java | 9 ++++++++- 9 files changed, 43 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f72713f..0e642a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to the Apify Java client are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.14.1] - 2026-11-13 + +### Changed + +- Updated to Apify OpenAPI specification `v2-2026-11-13T143025Z`, a documentation-only revision: Javadoc of `RunClient.charge`, `ActorRun.getUsageUsd` and `Actor.getActorStandby` follows the new Server Actors wording, and API token docs state that Apify Console shows a token only once. + ## [0.14.0] - 2026-11-10 ### Added diff --git a/README.md b/README.md index bc9f6b1..94fe5ce 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Maven (Maven Central is a default repository, so no extra configuration is neede com.apify apify-client - 0.14.0 + 0.14.1 ``` @@ -35,7 +35,7 @@ repositories { } dependencies { - implementation 'com.apify:apify-client:0.14.0' + implementation 'com.apify:apify-client:0.14.1' } ``` @@ -50,7 +50,7 @@ import com.apify.client.actor.ActorStartOptions; class HelloApify { public static void main(String[] args) { - // Your API token from https://console.apify.com/settings/integrations + // An API token created at https://console.apify.com/settings/integrations (shown only once) ApifyClient client = ApifyClient.create(System.getenv("APIFY_TOKEN")); ActorRun run = client.actor("apify/hello-world").call(null, new ActorStartOptions(), 120L).join(); System.out.println("Run " + run.getId() + " finished with status " + run.getStatus()); @@ -437,10 +437,10 @@ try { The public `com.apify.client.Version` class (`import com.apify.client.Version;`) exposes two constants: -- `Version.CLIENT_VERSION`: the semantic version of this client (`0.14.0`). +- `Version.CLIENT_VERSION`: the semantic version of this client (`0.14.1`). - `Version.API_SPEC_VERSION`: the version of the [Apify OpenAPI specification](https://docs.apify.com/api/openapi.json) (its `info.version` field) that this client's endpoints, parameters, and models were last generated - and checked against (`v2-2026-11-09T143926Z`). It is a snapshot, not a live compatibility + and checked against (`v2-2026-11-13T143025Z`). It is a snapshot, not a live compatibility guarantee: the client keeps working against newer, backward-compatible spec revisions, but a feature added to the API after this snapshot has no corresponding method here yet. diff --git a/docs/README.md b/docs/README.md index 3a3a093..703a7fb 100644 --- a/docs/README.md +++ b/docs/README.md @@ -21,8 +21,10 @@ compression, default headers, user-agent suffix, custom HTTP transport). `client returns a client that sends every request with a different timeout (see [Timeouts](../README.md#timeouts)). -Get your API token from the -[Apify Console → Settings → API & Integrations](https://console.apify.com/settings/integrations). +Create an API token on the +[Apify Console → Settings → API & Integrations](https://console.apify.com/settings/integrations) +page. The Console shows the token only once, right after you create or rotate it, so copy it and +store it somewhere safe. Every network-calling method returns a `CompletableFuture` (`java.util.concurrent.CompletableFuture`) rather than blocking the calling thread; see [Asynchronous API](../README.md#asynchronous-api) in diff --git a/pom.xml b/pom.xml index 8e65c37..baf59cd 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.apify apify-client - 0.14.0 + 0.14.1 jar Apify Java Client diff --git a/src/main/java/com/apify/client/ApifyClientBuilder.java b/src/main/java/com/apify/client/ApifyClientBuilder.java index 4223c1e..b6028c1 100644 --- a/src/main/java/com/apify/client/ApifyClientBuilder.java +++ b/src/main/java/com/apify/client/ApifyClientBuilder.java @@ -48,7 +48,11 @@ public final class ApifyClientBuilder { ApifyClientBuilder() {} - /** Sets the API token used for authentication (sent as a Bearer token). */ + /** + * Sets the API token used for authentication (sent as a Bearer token). Create a token on the Integrations page in Apify Console, + * which shows it only once, right after you create or rotate it. + */ public ApifyClientBuilder token(String token) { this.token = token; return this; diff --git a/src/main/java/com/apify/client/Version.java b/src/main/java/com/apify/client/Version.java index 7ab5ea0..765e3ca 100644 --- a/src/main/java/com/apify/client/Version.java +++ b/src/main/java/com/apify/client/Version.java @@ -13,13 +13,13 @@ public final class Version { * The semantic version of this client library (see SemVer). * Changes to the public interface other than additive ones are considered breaking changes. */ - public static final String CLIENT_VERSION = "0.14.0"; + public static final String CLIENT_VERSION = "0.14.1"; /** * The version of the Apify OpenAPI specification this client was generated and verified against. * Corresponds to the {@code info.version} field of the Apify OpenAPI document. */ - public static final String API_SPEC_VERSION = "v2-2026-11-09T143926Z"; + public static final String API_SPEC_VERSION = "v2-2026-11-13T143025Z"; private Version() {} } diff --git a/src/main/java/com/apify/client/actor/Actor.java b/src/main/java/com/apify/client/actor/Actor.java index a5778ee..ef449cb 100644 --- a/src/main/java/com/apify/client/actor/Actor.java +++ b/src/main/java/com/apify/client/actor/Actor.java @@ -138,7 +138,12 @@ public List getCategories() { return categories == null ? List.of() : Collections.unmodifiableList(categories); } - /** Standby-mode configuration for this Actor, if standby mode has ever been configured. */ + /** + * Standby-mode configuration for this Actor, if standby mode has ever been configured. For + * details, see Develop + * Server Actors. + */ public ActorStandby getActorStandby() { return actorStandby; } diff --git a/src/main/java/com/apify/client/run/ActorRun.java b/src/main/java/com/apify/client/run/ActorRun.java index 194de9c..8f6ced3 100644 --- a/src/main/java/com/apify/client/run/ActorRun.java +++ b/src/main/java/com/apify/client/run/ActorRun.java @@ -152,7 +152,12 @@ public ActorRunUsage getUsage() { return usage; } - /** As {@link #getUsage()}, converted to USD; only present where {@link #getUsage()} is. */ + /** + * Platform usage costs in USD, broken down by billable unit. Only present if you own the run and + * pay for platform usage (pay per usage, or pay per event with usage costs, such as runs of + * single-tenant Server Actors). Not available for standard pay-per-event Actors, and requires an + * authentication token. + */ public ActorRunUsage getUsageUsd() { return usageUsd; } diff --git a/src/main/java/com/apify/client/run/RunClient.java b/src/main/java/com/apify/client/run/RunClient.java index 7bcc127..a9b4680 100644 --- a/src/main/java/com/apify/client/run/RunClient.java +++ b/src/main/java/com/apify/client/run/RunClient.java @@ -159,7 +159,14 @@ public CompletableFuture resurrect(RunResurrectOptions options) { /** * Charges for a pay-per-event Actor run: records occurrences of a named event. Only meaningful - * for runs of pay-per-event Actors. + * for runs of pay-per-event Actors. Call it from the Actor run itself, with the API token the run + * received at startup in the {@code APIFY_TOKEN} environment variable. + * + *

To charge a request to a multi-tenant Server Actor, set {@link + * RunChargeOptions#requestId(String)} to the {@code X-Actor-Request-ID} header value of the + * request. See Charge + * for a request. * *

An idempotency key is always sent (generated if not provided), so a retried charge is * applied at most once. From e85580be3f1f53d4e1f337ef15107465ae98670e Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 13 Nov 2026 15:38:57 +0000 Subject: [PATCH 02/11] docs: document charge usage in runs guide and shorten 0.14.1 changelog Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_017ocuAJ6an2FrPuYqCvUoaA --- CHANGELOG.md | 4 +++- docs/runs.md | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e642a3..e5e0ef5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,9 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Changed -- Updated to Apify OpenAPI specification `v2-2026-11-13T143025Z`, a documentation-only revision: Javadoc of `RunClient.charge`, `ActorRun.getUsageUsd` and `Actor.getActorStandby` follows the new Server Actors wording, and API token docs state that Apify Console shows a token only once. +- Updated to Apify OpenAPI specification `v2-2026-11-13T143025Z` (documentation only). +- Javadoc of `RunClient.charge`, `ActorRun.getUsageUsd`, and `Actor.getActorStandby` uses the Server Actors wording. +- API token docs say that Apify Console shows a token only once. ## [0.14.0] - 2026-11-10 diff --git a/docs/runs.md b/docs/runs.md index 5f533a8..d0d9080 100644 --- a/docs/runs.md +++ b/docs/runs.md @@ -174,10 +174,14 @@ nullable), `getMemoryMbytes()` (`Long`, nullable), `getDiskMbytes()` (`Long`, nu `getMaxItems()` (`Long`, nullable), `getMaxTotalChargeUsd()` (`Double`, nullable), `getRestartOnError()` (`Boolean`, nullable). +Call `charge` from inside the Actor run, with the API token the run received at startup in the +`APIFY_TOKEN` environment variable. + `RunChargeOptions` (constructed with the required event name) uses plain values: `count(Long)`, `idempotencyKey(String)`, auto-generated when unset so a transport-retried charge is applied at most once, and `requestId(String)`, the `X-Actor-Request-ID` of the Server Actor request being -charged (required for multi-tenant Server Actor runs, omitted otherwise). +charged (required for multi-tenant Server Actor runs, omitted otherwise). See +[Charge for a request](https://docs.apify.com/platform/actors/monetize/server-actors#charge-for-a-request). ```java client.run("RUN_ID").charge(new RunChargeOptions("my-event").count(3L)).join(); From 53fd21479bac9ada7be5eb822e26751dc7190044 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 13 Nov 2026 15:42:25 +0000 Subject: [PATCH 03/11] docs: use ACTOR_RUN_ID in charge example and note charge guidance in changelog Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_017ocuAJ6an2FrPuYqCvUoaA --- CHANGELOG.md | 1 + docs/runs.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5e0ef5..98c2fe4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Updated to Apify OpenAPI specification `v2-2026-11-13T143025Z` (documentation only). - Javadoc of `RunClient.charge`, `ActorRun.getUsageUsd`, and `Actor.getActorStandby` uses the Server Actors wording. +- `RunClient.charge` docs say to call it from inside the Actor run, with the `APIFY_TOKEN` token the run received. - API token docs say that Apify Console shows a token only once. ## [0.14.0] - 2026-11-10 diff --git a/docs/runs.md b/docs/runs.md index d0d9080..fb2d890 100644 --- a/docs/runs.md +++ b/docs/runs.md @@ -184,7 +184,7 @@ charged (required for multi-tenant Server Actor runs, omitted otherwise). See [Charge for a request](https://docs.apify.com/platform/actors/monetize/server-actors#charge-for-a-request). ```java -client.run("RUN_ID").charge(new RunChargeOptions("my-event").count(3L)).join(); +client.run(System.getenv("ACTOR_RUN_ID")).charge(new RunChargeOptions("my-event").count(3L)).join(); ``` `MetamorphOptions` uses plain values `build(String)` and `contentType(String)`. From 31cdf63ff0eb8407dfbedec75c249e1c8bc0af93 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 13 Nov 2026 15:47:01 +0000 Subject: [PATCH 04/11] docs: correct last-run mutating methods, usageUsd availability and charge guidance Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_017ocuAJ6an2FrPuYqCvUoaA --- CHANGELOG.md | 6 ++++-- docs/runs.md | 18 ++++++++++-------- .../java/com/apify/client/run/RunClient.java | 4 ++-- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98c2fe4..be6b081 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,8 +10,10 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Changed - Updated to Apify OpenAPI specification `v2-2026-11-13T143025Z` (documentation only). -- Javadoc of `RunClient.charge`, `ActorRun.getUsageUsd`, and `Actor.getActorStandby` uses the Server Actors wording. -- `RunClient.charge` docs say to call it from inside the Actor run, with the `APIFY_TOKEN` token the run received. +- Javadoc of `RunClient.charge` and `Actor.getActorStandby` uses the Server Actors wording. +- `RunClient.charge` docs say to call it from inside the Actor run, with the run's `APIFY_TOKEN`. +- `ActorRun.getUsageUsd` docs say when the field is present: runs you own that pay for platform usage, not standard pay-per-event Actors. +- `docs/runs.md` states that `abort`, `reboot`, and `metamorph` work on a `lastRun()` client. - API token docs say that Apify Console shows a token only once. ## [0.14.0] - 2026-11-10 diff --git a/docs/runs.md b/docs/runs.md index fb2d890..0ee9677 100644 --- a/docs/runs.md +++ b/docs/runs.md @@ -117,10 +117,12 @@ client.run("RUN_ID").update(Map.of("statusMessage", "half way there", "isStatusM > **`lastRun()` clients are for reads.** A `RunClient` obtained via `actor(id).lastRun(...)` / > `task(id).lastRun(...)` targets the `runs/last` path and is intended for reading (`get`, -> `dataset()`/`keyValueStore()`/`requestQueue()`, `log()`). The mutating methods (`abort`, `reboot`, -> `resurrect`, `metamorph`, `charge`, `update`, `delete`) require a concrete run and have no -> `runs/last` endpoint; resolve the id first (`lastRun(...).get().join()` then `client.run(id)`). The type -> exposes them uniformly, but calling them on a last-run client fails server-side. +> `dataset()`/`keyValueStore()`/`requestQueue()`, `log()`). `abort`, `reboot`, and `metamorph` on +> a last-run client call the documented `runs/last/abort`, `runs/last/reboot`, and +> `runs/last/metamorph` endpoints with the same `status` and `origin` filters. The other mutating +> methods (`resurrect`, `charge`, `update`, `delete`) require a concrete run and have no +> `runs/last` endpoint; resolve the id first (`lastRun(...).get().join()` then `client.run(id)`). The +> type exposes them uniformly, but calling them on a last-run client fails server-side. `ActorRun` fields include `getId()`, `getActId()`, `getUserId()`, `getStatus()`, `getStatusMessage()`, `getStartedAt()`, `getFinishedAt()`, `getBuildId()`, `getDefaultDatasetId()`, @@ -143,7 +145,8 @@ owning it, e.g. `"ANYONE_WITH_ID_CAN_READ"`, `"RESTRICTED"`, or `null` to follow default), `getChargedEventCounts()` (`Map`; per-event-type charge counts for pay-per-event Actors, `null` otherwise), `getPricingInfo()` (`JsonNode`; shape depends on the Actor's pricing model), `getUsage()` / `getUsageUsd()` (`ActorRunUsage`; per-billable-unit resource -consumption, the latter as its USD cost; see below), `getUsageTotalUsd()` (`Double`; the run's +consumption, the latter as its USD cost and only for runs you own that pay for platform usage, +`null` for standard pay-per-event Actors; see below), `getUsageTotalUsd()` (`Double`; the run's total cost in USD, combining platform usage and/or event costs depending on pricing model), `getStats()` (`ActorRunStats`; runtime metrics; `getInputBodyLen()`, `getMigrationCount()`, `getRebootCount()`, `getRestartCount()`, `getResurrectCount()`, @@ -174,14 +177,13 @@ nullable), `getMemoryMbytes()` (`Long`, nullable), `getDiskMbytes()` (`Long`, nu `getMaxItems()` (`Long`, nullable), `getMaxTotalChargeUsd()` (`Double`, nullable), `getRestartOnError()` (`Boolean`, nullable). -Call `charge` from inside the Actor run, with the API token the run received at startup in the -`APIFY_TOKEN` environment variable. - `RunChargeOptions` (constructed with the required event name) uses plain values: `count(Long)`, `idempotencyKey(String)`, auto-generated when unset so a transport-retried charge is applied at most once, and `requestId(String)`, the `X-Actor-Request-ID` of the Server Actor request being charged (required for multi-tenant Server Actor runs, omitted otherwise). See [Charge for a request](https://docs.apify.com/platform/actors/monetize/server-actors#charge-for-a-request). +Call `charge` from inside the Actor run, with the API token the run received at startup in the +`APIFY_TOKEN` environment variable. ```java client.run(System.getenv("ACTOR_RUN_ID")).charge(new RunChargeOptions("my-event").count(3L)).join(); diff --git a/src/main/java/com/apify/client/run/RunClient.java b/src/main/java/com/apify/client/run/RunClient.java index a9b4680..4b7ead6 100644 --- a/src/main/java/com/apify/client/run/RunClient.java +++ b/src/main/java/com/apify/client/run/RunClient.java @@ -189,8 +189,8 @@ public CompletableFuture charge(RunChargeOptions options) { body.put("requestId", requestId); } Map headers = Map.of(CHARGE_IDEMPOTENCY_HEADER, idempotencyKey); - // Route through mergedParams like the run's other actions, so a last-run-seeded context charges - // the same run its read methods resolve to (its pinned status/origin filters are preserved). + // Route through mergedParams like the run's other actions, so the context's query parameters + // are preserved. String url = ctx.mergedParams(new QueryParams()).applyToUrl(ctx.subUrl("charge")); return ctx.http .call( From a50b0cb49bdf406537f4871c677b8b6373b181af Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 13 Nov 2026 15:52:04 +0000 Subject: [PATCH 05/11] test: cover last-run abort, reboot and metamorph, and clarify last-run docs Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_017ocuAJ6an2FrPuYqCvUoaA --- docs/runs.md | 8 ++--- .../java/com/apify/client/run/RunClient.java | 3 +- .../client/ClientBehaviourRegressionTest.java | 35 +++++++++++++++++++ 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/docs/runs.md b/docs/runs.md index 0ee9677..1be1d08 100644 --- a/docs/runs.md +++ b/docs/runs.md @@ -115,10 +115,10 @@ To update the status message of a run other than the current one, call `update() client.run("RUN_ID").update(Map.of("statusMessage", "half way there", "isStatusMessageTerminal", false)).join(); ``` -> **`lastRun()` clients are for reads.** A `RunClient` obtained via `actor(id).lastRun(...)` / -> `task(id).lastRun(...)` targets the `runs/last` path and is intended for reading (`get`, -> `dataset()`/`keyValueStore()`/`requestQueue()`, `log()`). `abort`, `reboot`, and `metamorph` on -> a last-run client call the documented `runs/last/abort`, `runs/last/reboot`, and +> **Not every method works on a `lastRun()` client.** A `RunClient` obtained via +> `actor(id).lastRun(...)` / `task(id).lastRun(...)` targets the `runs/last` path. Reads (`get`, +> `dataset()`/`keyValueStore()`/`requestQueue()`, `log()`) are supported, and so are `abort`, +> `reboot`, and `metamorph`, which call the documented `runs/last/abort`, `runs/last/reboot`, and > `runs/last/metamorph` endpoints with the same `status` and `origin` filters. The other mutating > methods (`resurrect`, `charge`, `update`, `delete`) require a concrete run and have no > `runs/last` endpoint; resolve the id first (`lastRun(...).get().join()` then `client.run(id)`). The diff --git a/src/main/java/com/apify/client/run/RunClient.java b/src/main/java/com/apify/client/run/RunClient.java index 4b7ead6..b3e48ff 100644 --- a/src/main/java/com/apify/client/run/RunClient.java +++ b/src/main/java/com/apify/client/run/RunClient.java @@ -189,8 +189,7 @@ public CompletableFuture charge(RunChargeOptions options) { body.put("requestId", requestId); } Map headers = Map.of(CHARGE_IDEMPOTENCY_HEADER, idempotencyKey); - // Route through mergedParams like the run's other actions, so the context's query parameters - // are preserved. + // Kept consistent with the other actions; there is no runs/last/charge endpoint. String url = ctx.mergedParams(new QueryParams()).applyToUrl(ctx.subUrl("charge")); return ctx.http .call( diff --git a/src/test/java/com/apify/client/ClientBehaviourRegressionTest.java b/src/test/java/com/apify/client/ClientBehaviourRegressionTest.java index af28293..fb0d768 100644 --- a/src/test/java/com/apify/client/ClientBehaviourRegressionTest.java +++ b/src/test/java/com/apify/client/ClientBehaviourRegressionTest.java @@ -103,6 +103,41 @@ void lastRunForwardsStatusFilterToNestedStorages() { assertTrue(log.lastUrl.contains("origin=API"), log.lastUrl); } + @Test + void lastRunAbortRebootAndMetamorphCallTheLastRunEndpointsWithTheFilters() { + // The spec documents runs/last/{abort,reboot,metamorph} for Actors and tasks, so these calls on + // a + // filtered last-run client must keep the pinned status and origin filters. + LastRunOptions filters = new LastRunOptions().status("RUNNING").origin("API"); + String runBody = "{\"data\":{\"id\":\"run123\"}}"; + + MockTransport abort = MockTransport.ofConstant(200, runBody); + client(abort).actor("me/x").lastRun(filters).abort(null).join(); + assertLastRunUrl(abort.lastUrl, "actors/me~x/runs/last/abort"); + + MockTransport reboot = MockTransport.ofConstant(200, runBody); + client(reboot).actor("me/x").lastRun(filters).reboot().join(); + assertLastRunUrl(reboot.lastUrl, "actors/me~x/runs/last/reboot"); + + MockTransport metamorph = MockTransport.ofConstant(200, runBody); + client(metamorph) + .actor("me/x") + .lastRun(filters) + .metamorph("apify/other-actor", Map.of("foo", "bar"), new MetamorphOptions()) + .join(); + assertLastRunUrl(metamorph.lastUrl, "actors/me~x/runs/last/metamorph"); + + MockTransport taskAbort = MockTransport.ofConstant(200, runBody); + client(taskAbort).task("me/t").lastRun(filters).abort(null).join(); + assertLastRunUrl(taskAbort.lastUrl, "actor-tasks/me~t/runs/last/abort"); + } + + private static void assertLastRunUrl(String url, String expectedPath) { + assertTrue(url.contains(expectedPath), url); + assertTrue(url.contains("status=RUNNING"), url); + assertTrue(url.contains("origin=API"), url); + } + @Test void plainRunNestedStoragesCarryNoInheritedFilter() { // A non-last-run client has no pinned params, so nested accessors stay filter-free. From 165f1c0ed850b7413c2a7b0a239bd92136ef853c Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 13 Nov 2026 15:55:35 +0000 Subject: [PATCH 06/11] style: rejoin wrapped test comment Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_017ocuAJ6an2FrPuYqCvUoaA --- .../java/com/apify/client/ClientBehaviourRegressionTest.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/apify/client/ClientBehaviourRegressionTest.java b/src/test/java/com/apify/client/ClientBehaviourRegressionTest.java index fb0d768..7c5c38f 100644 --- a/src/test/java/com/apify/client/ClientBehaviourRegressionTest.java +++ b/src/test/java/com/apify/client/ClientBehaviourRegressionTest.java @@ -105,9 +105,8 @@ void lastRunForwardsStatusFilterToNestedStorages() { @Test void lastRunAbortRebootAndMetamorphCallTheLastRunEndpointsWithTheFilters() { - // The spec documents runs/last/{abort,reboot,metamorph} for Actors and tasks, so these calls on - // a - // filtered last-run client must keep the pinned status and origin filters. + // The spec documents runs/last/{abort,reboot,metamorph} for Actors and tasks, so these calls + // on a filtered last-run client must keep the pinned status and origin filters. LastRunOptions filters = new LastRunOptions().status("RUNNING").origin("API"); String runBody = "{\"data\":{\"id\":\"run123\"}}"; From 898bf3e97a149f38b0e5528a0923bd39004046bc Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 15:36:09 +0000 Subject: [PATCH 07/11] docs: sync with Apify OpenAPI spec v2-2026-11-18T151559Z Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_017ocuAJ4DtkSFFSnhddsYup --- CHANGELOG.md | 2 +- README.md | 2 +- docs/misc.md | 5 +++++ src/main/java/com/apify/client/Version.java | 2 +- src/main/java/com/apify/client/user/User.java | 12 ++++++++---- .../java/com/apify/client/user/UserClient.java | 3 ++- .../java/com/apify/client/ClientInputTest.java | 15 +++++++++++++++ 7 files changed, 33 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be6b081..f490fc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Changed -- Updated to Apify OpenAPI specification `v2-2026-11-13T143025Z` (documentation only). +- Updated to Apify OpenAPI specification `v2-2026-11-18T151559Z`: a user authenticated with an Apify Proxy password gets reduced data (documented on `User`), and a schedule's `uiState` can be `null`. - Javadoc of `RunClient.charge` and `Actor.getActorStandby` uses the Server Actors wording. - `RunClient.charge` docs say to call it from inside the Actor run, with the run's `APIFY_TOKEN`. - `ActorRun.getUsageUsd` docs say when the field is present: runs you own that pay for platform usage, not standard pay-per-event Actors. diff --git a/README.md b/README.md index 94fe5ce..5b0f45f 100644 --- a/README.md +++ b/README.md @@ -440,7 +440,7 @@ constants: - `Version.CLIENT_VERSION`: the semantic version of this client (`0.14.1`). - `Version.API_SPEC_VERSION`: the version of the [Apify OpenAPI specification](https://docs.apify.com/api/openapi.json) (its `info.version` field) that this client's endpoints, parameters, and models were last generated - and checked against (`v2-2026-11-13T143025Z`). It is a snapshot, not a live compatibility + and checked against (`v2-2026-11-18T151559Z`). It is a snapshot, not a live compatibility guarantee: the client keeps working against newer, backward-compatible spec revisions, but a feature added to the API after this snapshot has no corresponding method here yet. diff --git a/docs/misc.md b/docs/misc.md index 9adaab3..c193801 100644 --- a/docs/misc.md +++ b/docs/misc.md @@ -58,6 +58,11 @@ me.ifPresent( JsonNode usage = client.me().monthlyUsage().join(); ``` +A request authenticated with an Apify Proxy password (`PROXY_PASSWORD` or +`ACTOR_RUN_PROXY_PASSWORD`) gets reduced data: only `getPlan()` (with just +`getAvailableProxyGroups()`), `getEffectivePlatformFeatures()` and `getIsPaying()` are set, and +`getId()` and `getUsername()` are `null`. + `User` fields: `getId()`, `getUsername()`, `getProfile()` (`UserProfile`: `getBio()`, `getReadme()`, `getName()`, `getPictureUrl()`, `getGithubUsername()`, `getWebsiteUrl()`, `getTwitterUsername()`, all nullable). diff --git a/src/main/java/com/apify/client/Version.java b/src/main/java/com/apify/client/Version.java index 765e3ca..0654df4 100644 --- a/src/main/java/com/apify/client/Version.java +++ b/src/main/java/com/apify/client/Version.java @@ -19,7 +19,7 @@ public final class Version { * The version of the Apify OpenAPI specification this client was generated and verified against. * Corresponds to the {@code info.version} field of the Apify OpenAPI document. */ - public static final String API_SPEC_VERSION = "v2-2026-11-13T143025Z"; + public static final String API_SPEC_VERSION = "v2-2026-11-18T151559Z"; private Version() {} } diff --git a/src/main/java/com/apify/client/user/User.java b/src/main/java/com/apify/client/user/User.java index 17494d7..ef43f15 100644 --- a/src/main/java/com/apify/client/user/User.java +++ b/src/main/java/com/apify/client/user/User.java @@ -5,10 +5,14 @@ import tools.jackson.databind.JsonNode; /** - * An Apify user account. Private account details (available only for {@code me}) are typed below - * where reasonably finite; {@link #getEffectivePlatformFeatures()} stays raw JSON (a fixed set of - * feature-name keys, each with its own limits sub-object) and any other unmodelled field is still - * reachable via {@link #getExtra()}. + * An Apify user account. A request authenticated with an Apify Proxy password ({@code + * PROXY_PASSWORD} or {@code ACTOR_RUN_PROXY_PASSWORD}) gets reduced data: only {@link #getPlan()} + * (with just {@link UserPlan#getAvailableProxyGroups()}), {@link #getEffectivePlatformFeatures()} + * and {@link #getIsPaying()} are set, and {@link #getId()} and {@link #getUsername()} are {@code + * null}. Private account details (available only for {@code me}) are typed below where reasonably + * finite; {@link #getEffectivePlatformFeatures()} stays raw JSON (a fixed set of feature-name keys, + * each with its own limits sub-object) and any other unmodelled field is still reachable via {@link + * #getExtra()}. */ public final class User extends ApifyResource { private String id; diff --git a/src/main/java/com/apify/client/user/UserClient.java b/src/main/java/com/apify/client/user/UserClient.java index 5bc9ff6..6c8e731 100644 --- a/src/main/java/com/apify/client/user/UserClient.java +++ b/src/main/java/com/apify/client/user/UserClient.java @@ -30,7 +30,8 @@ public UserClient(HttpClientCore http, String baseUrl, String id) { /** * Fetches the user. For {@code me} it returns private account details (via {@link * User#getExtra()}); for other users it returns the public profile. Returns empty if the user - * does not exist. + * does not exist. A request authenticated with an Apify Proxy password gets reduced data; see + * {@link User}. */ public CompletableFuture> get() { return ctx.getResource("", new QueryParams(), User.class); diff --git a/src/test/java/com/apify/client/ClientInputTest.java b/src/test/java/com/apify/client/ClientInputTest.java index d3cf95f..fdf7fa3 100644 --- a/src/test/java/com/apify/client/ClientInputTest.java +++ b/src/test/java/com/apify/client/ClientInputTest.java @@ -241,6 +241,21 @@ void scheduleToleratesANullUiState() { assertEquals("advanced", schedule.getUiState().get("mode").asString()); } + @Test + void userAuthenticatedWithAProxyPasswordHasOnlyTheReducedFields() { + MockTransport backend = + MockTransport.ofConstant( + 200, + "{\"data\":{\"plan\":{\"availableProxyGroups\":[\"GOOGLE_SERP\"]}," + + "\"effectivePlatformFeatures\":{},\"isPaying\":true}}"); + var user = client(backend).me().get().join().orElseThrow(); + assertEquals(null, user.getId()); + assertEquals(null, user.getUsername()); + assertEquals("GOOGLE_SERP", user.getPlan().getAvailableProxyGroups().get(0).asString()); + assertTrue(user.getEffectivePlatformFeatures().isObject()); + assertTrue(user.getIsPaying()); + } + @Test void aPendingRequestKeepsANullHandledAt() { MockTransport backend = From 0a6b17c53531be0b33cb5824655912119483427c Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 15:45:57 +0000 Subject: [PATCH 08/11] docs: describe which user fields are set and fix reviewer items Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_017ocuAJ4DtkSFFSnhddsYup --- CHANGELOG.md | 5 +-- docs/misc.md | 24 +++++++++----- src/main/java/com/apify/client/user/User.java | 33 +++++++++++-------- .../com/apify/client/user/UserClient.java | 7 ++-- .../com/apify/client/ClientInputTest.java | 4 +-- .../com/apify/client/examples/GetAccount.java | 2 +- 6 files changed, 44 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f490fc1..b2e0c02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,12 @@ All notable changes to the Apify Java client are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.14.1] - 2026-11-13 +## [0.14.1] - 2026-11-20 ### Changed -- Updated to Apify OpenAPI specification `v2-2026-11-18T151559Z`: a user authenticated with an Apify Proxy password gets reduced data (documented on `User`), and a schedule's `uiState` can be `null`. +- Updated to Apify OpenAPI specification `v2-2026-11-18T151559Z`. +- `User` and `UserClient.get` docs describe which user fields are set, including the reduced data for an Apify Proxy password. - Javadoc of `RunClient.charge` and `Actor.getActorStandby` uses the Server Actors wording. - `RunClient.charge` docs say to call it from inside the Actor run, with the run's `APIFY_TOKEN`. - `ActorRun.getUsageUsd` docs say when the field is present: runs you own that pay for platform usage, not standard pay-per-event Actors. diff --git a/docs/misc.md b/docs/misc.md index c193801..53c21ce 100644 --- a/docs/misc.md +++ b/docs/misc.md @@ -38,7 +38,7 @@ still available via the inherited `getExtra()` (see | Method | Description | |---|---| -| `get()` | Fetch the user. Completes with `Optional` (private details for `me()` via `getExtra()`). | +| `get()` | Fetch the user. Completes with `Optional` (public profile, plus private account details for `me()` or when the token belongs to that user). | | `monthlyUsage()` / `monthlyUsage(String date)` | The user's monthly usage. `date` (any day within the target month, formatted `YYYY-MM-DD`) reports that month; `null`/empty reports the current month. Completes with `JsonNode`. | | `limits()` | The user's account and usage limits. Completes with `JsonNode`. | | `updateLimits(Object)` | Update the user's account and usage limits. Completes with no value (`CompletableFuture`). | @@ -51,22 +51,28 @@ Optional me = client.me().get().join(); me.ifPresent( u -> { System.out.println("Account: " + u.getId()); - // email/plan/proxy/... are only populated for me() (not user(id)); use getExtra() for any - // remaining account field not modelled directly. + // email/plan/proxy/... are private fields: see "Which fields are set" below. System.out.println("Email: " + u.getEmail()); }); JsonNode usage = client.me().monthlyUsage().join(); ``` -A request authenticated with an Apify Proxy password (`PROXY_PASSWORD` or -`ACTOR_RUN_PROXY_PASSWORD`) gets reduced data: only `getPlan()` (with just -`getAvailableProxyGroups()`), `getEffectivePlatformFeatures()` and `getIsPaying()` are set, and -`getId()` and `getUsername()` are `null`. +Which fields are set: + +- The public fields (`getId()`, `getUsername()`, `getProfile()`) are always set. +- The private fields (listed below) are set for `me()`, and for `user(id)` only when the API token + belongs to that user or impersonates it. +- `getPlan()`, `getEmail()`, and `getProfile()` are omitted when the request is made from an Actor + run. +- A request authenticated with an Apify Proxy password (`PROXY_PASSWORD` or + `ACTOR_RUN_PROXY_PASSWORD`) gets reduced data on both endpoints: only `getPlan()` (with just + `getAvailableProxyGroups()`), `getEffectivePlatformFeatures()`, and `getIsPaying()` are set, and + `getId()` and `getUsername()` are `null`. `User` fields: `getId()`, `getUsername()`, `getProfile()` (`UserProfile`: `getBio()`, `getReadme()`, `getName()`, `getPictureUrl()`, `getGithubUsername()`, `getWebsiteUrl()`, `getTwitterUsername()`, all nullable). -Only present for `me()`: `getEmail()`, `getProxy()` (`UserProxy`: `getPassword()`, `getGroups()` +Private fields: `getEmail()`, `getProxy()` (`UserProxy`: `getPassword()`, `getGroups()` as `List`, each with `getName()`/`getDescription()`/`getAvailableCount()` as `Long`), `getPlan()` (`UserPlan`: `getId()`, `getDescription()`, `getIsEnabled()`, `getMonthlyBasePriceUsd()`/`getMonthlyUsageCreditsUsd()`/`getUsageDiscountPercent()`/ @@ -77,7 +83,7 @@ as `List`, each with `getName()`/`getDescription()`/`getAvailableCou `getTeamAccountSeatCount()` as `Long`, `getAvailableProxyGroups()` as `JsonNode`, `getSupportLevel()`, `getAvailableAddOns()` as `List`), `getEffectivePlatformFeatures()` (`JsonNode`), `getCreatedAt()` (`Instant`), `getIsPaying()` (`Boolean`). Plus `getExtra()`, a -`Map` carrying any account field not modelled directly. +`Map` carrying any account field not modeled directly. ## Logs: `client.log(id)` diff --git a/src/main/java/com/apify/client/user/User.java b/src/main/java/com/apify/client/user/User.java index ef43f15..4f22722 100644 --- a/src/main/java/com/apify/client/user/User.java +++ b/src/main/java/com/apify/client/user/User.java @@ -5,13 +5,17 @@ import tools.jackson.databind.JsonNode; /** - * An Apify user account. A request authenticated with an Apify Proxy password ({@code - * PROXY_PASSWORD} or {@code ACTOR_RUN_PROXY_PASSWORD}) gets reduced data: only {@link #getPlan()} - * (with just {@link UserPlan#getAvailableProxyGroups()}), {@link #getEffectivePlatformFeatures()} - * and {@link #getIsPaying()} are set, and {@link #getId()} and {@link #getUsername()} are {@code - * null}. Private account details (available only for {@code me}) are typed below where reasonably - * finite; {@link #getEffectivePlatformFeatures()} stays raw JSON (a fixed set of feature-name keys, - * each with its own limits sub-object) and any other unmodelled field is still reachable via {@link + * An Apify user account. The public fields are always set. The private fields ({@link #getEmail()}, + * {@link #getProxy()}, {@link #getPlan()}, {@link #getEffectivePlatformFeatures()}, {@link + * #getCreatedAt()} and {@link #getIsPaying()}) are set for {@code me}, and for another user only + * when the API token belongs to that user or impersonates it. {@link #getPlan()}, {@link + * #getEmail()} and {@link #getProfile()} are omitted when the request is made from an Actor run. A + * request authenticated with an Apify Proxy password ({@code PROXY_PASSWORD} or {@code + * ACTOR_RUN_PROXY_PASSWORD}) gets reduced data on both endpoints: only {@link #getPlan()} (with + * just {@link UserPlan#getAvailableProxyGroups()}), {@link #getEffectivePlatformFeatures()}, and + * {@link #getIsPaying()} are set, and {@link #getId()} and {@link #getUsername()} are {@code null}. + * {@link #getEffectivePlatformFeatures()} stays raw JSON (a fixed set of feature-name keys, each + * with its own limits sub-object), and any other unmodeled field is still reachable via {@link * #getExtra()}. */ public final class User extends ApifyResource { @@ -40,35 +44,38 @@ public UserProfile getProfile() { return profile; } - /** The user's email address. Only present for {@code me}. */ + /** The user's email address. Private field; see the class description. */ public String getEmail() { return email; } - /** The user's Apify Proxy credentials and available proxy groups. Only present for {@code me}. */ + /** + * The user's Apify Proxy credentials and available proxy groups. Private field; see the class + * description. + */ public UserProxy getProxy() { return proxy; } - /** The user's subscription plan. Only present for {@code me}. */ + /** The user's subscription plan. Private field; see the class description. */ public UserPlan getPlan() { return plan; } /** * The platform features actually available to the user right now (accounting for plan limits and - * current usage), as raw JSON. Only present for {@code me}. + * current usage), as raw JSON. Private field; see the class description. */ public JsonNode getEffectivePlatformFeatures() { return effectivePlatformFeatures; } - /** When the user account was created. Only present for {@code me}. */ + /** When the user account was created. Private field; see the class description. */ public Instant getCreatedAt() { return createdAt; } - /** Whether the user is on a paid plan. Only present for {@code me}. */ + /** Whether the user is on a paid plan. Private field; see the class description. */ public Boolean getIsPaying() { return isPaying; } diff --git a/src/main/java/com/apify/client/user/UserClient.java b/src/main/java/com/apify/client/user/UserClient.java index 6c8e731..4523e08 100644 --- a/src/main/java/com/apify/client/user/UserClient.java +++ b/src/main/java/com/apify/client/user/UserClient.java @@ -28,10 +28,9 @@ public UserClient(HttpClientCore http, String baseUrl, String id) { } /** - * Fetches the user. For {@code me} it returns private account details (via {@link - * User#getExtra()}); for other users it returns the public profile. Returns empty if the user - * does not exist. A request authenticated with an Apify Proxy password gets reduced data; see - * {@link User}. + * Fetches the user: the public profile, plus the private account details for {@code me} or when + * the API token belongs to that user. Which fields are set is described on {@link User}. Returns + * empty if the user does not exist. */ public CompletableFuture> get() { return ctx.getResource("", new QueryParams(), User.class); diff --git a/src/test/java/com/apify/client/ClientInputTest.java b/src/test/java/com/apify/client/ClientInputTest.java index fdf7fa3..b797fc5 100644 --- a/src/test/java/com/apify/client/ClientInputTest.java +++ b/src/test/java/com/apify/client/ClientInputTest.java @@ -246,12 +246,12 @@ void userAuthenticatedWithAProxyPasswordHasOnlyTheReducedFields() { MockTransport backend = MockTransport.ofConstant( 200, - "{\"data\":{\"plan\":{\"availableProxyGroups\":[\"GOOGLE_SERP\"]}," + "{\"data\":{\"plan\":{\"availableProxyGroups\":{\"GOOGLE_SERP\":200}}," + "\"effectivePlatformFeatures\":{},\"isPaying\":true}}"); var user = client(backend).me().get().join().orElseThrow(); assertEquals(null, user.getId()); assertEquals(null, user.getUsername()); - assertEquals("GOOGLE_SERP", user.getPlan().getAvailableProxyGroups().get(0).asString()); + assertEquals(200, user.getPlan().getAvailableProxyGroups().get("GOOGLE_SERP").asLong()); assertTrue(user.getEffectivePlatformFeatures().isObject()); assertTrue(user.getIsPaying()); } diff --git a/src/test/java/com/apify/client/examples/GetAccount.java b/src/test/java/com/apify/client/examples/GetAccount.java index 1d7dea5..ffe5f4b 100644 --- a/src/test/java/com/apify/client/examples/GetAccount.java +++ b/src/test/java/com/apify/client/examples/GetAccount.java @@ -20,7 +20,7 @@ public static void main(String[] args) { } System.out.println("Account ID: " + user.get().getId()); System.out.println("Username: " + user.get().getUsername()); - // email/plan/proxy/... are only populated for me() (not user(id)); any remaining unmodelled + // email/plan/proxy/... are private fields that are set for me(); any remaining unmodeled // account field is still available via the untyped extras map that getExtra() returns. System.out.println("Email: " + user.get().getEmail()); } From f976e73b84e932bb6fe8d7d3f894ab5a8f187206 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 15:50:45 +0000 Subject: [PATCH 09/11] docs: correct which user fields are set Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_017ocuAJ4DtkSFFSnhddsYup --- docs/misc.md | 15 ++++++++------- src/main/java/com/apify/client/user/User.java | 16 +++++++++------- .../java/com/apify/client/user/UserClient.java | 6 +++--- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/docs/misc.md b/docs/misc.md index 53c21ce..56bb8a3 100644 --- a/docs/misc.md +++ b/docs/misc.md @@ -38,7 +38,7 @@ still available via the inherited `getExtra()` (see | Method | Description | |---|---| -| `get()` | Fetch the user. Completes with `Optional` (public profile, plus private account details for `me()` or when the token belongs to that user). | +| `get()` | Fetch the user. Completes with `Optional` (public profile, plus private account details for `me()` or when a full-permission token of that user is used). | | `monthlyUsage()` / `monthlyUsage(String date)` | The user's monthly usage. `date` (any day within the target month, formatted `YYYY-MM-DD`) reports that month; `null`/empty reports the current month. Completes with `JsonNode`. | | `limits()` | The user's account and usage limits. Completes with `JsonNode`. | | `updateLimits(Object)` | Update the user's account and usage limits. Completes with no value (`CompletableFuture`). | @@ -59,20 +59,21 @@ JsonNode usage = client.me().monthlyUsage().join(); Which fields are set: -- The public fields (`getId()`, `getUsername()`, `getProfile()`) are always set. -- The private fields (listed below) are set for `me()`, and for `user(id)` only when the API token - belongs to that user or impersonates it. -- `getPlan()`, `getEmail()`, and `getProfile()` are omitted when the request is made from an Actor +- `getUsername()` is set, except for a proxy-password request (below), and `getProfile()` may be + absent. +- The private fields (listed below, including `getId()`) are set for `me()`, and for `user(id)` only + when the request uses a full-permission API token of that user or a token that impersonates it. +- `getPlan()`, `getEmail()`, and `getProfile()` are omitted when `me()` is requested from an Actor run. - A request authenticated with an Apify Proxy password (`PROXY_PASSWORD` or `ACTOR_RUN_PROXY_PASSWORD`) gets reduced data on both endpoints: only `getPlan()` (with just `getAvailableProxyGroups()`), `getEffectivePlatformFeatures()`, and `getIsPaying()` are set, and `getId()` and `getUsername()` are `null`. -`User` fields: `getId()`, `getUsername()`, `getProfile()` (`UserProfile`: `getBio()`, `getReadme()`, +`User` fields: `getUsername()`, `getProfile()` (`UserProfile`: `getBio()`, `getReadme()`, `getName()`, `getPictureUrl()`, `getGithubUsername()`, `getWebsiteUrl()`, `getTwitterUsername()`, all nullable). -Private fields: `getEmail()`, `getProxy()` (`UserProxy`: `getPassword()`, `getGroups()` +Private fields: `getId()`, `getEmail()`, `getProxy()` (`UserProxy`: `getPassword()`, `getGroups()` as `List`, each with `getName()`/`getDescription()`/`getAvailableCount()` as `Long`), `getPlan()` (`UserPlan`: `getId()`, `getDescription()`, `getIsEnabled()`, `getMonthlyBasePriceUsd()`/`getMonthlyUsageCreditsUsd()`/`getUsageDiscountPercent()`/ diff --git a/src/main/java/com/apify/client/user/User.java b/src/main/java/com/apify/client/user/User.java index 4f22722..5818100 100644 --- a/src/main/java/com/apify/client/user/User.java +++ b/src/main/java/com/apify/client/user/User.java @@ -5,12 +5,14 @@ import tools.jackson.databind.JsonNode; /** - * An Apify user account. The public fields are always set. The private fields ({@link #getEmail()}, - * {@link #getProxy()}, {@link #getPlan()}, {@link #getEffectivePlatformFeatures()}, {@link - * #getCreatedAt()} and {@link #getIsPaying()}) are set for {@code me}, and for another user only - * when the API token belongs to that user or impersonates it. {@link #getPlan()}, {@link - * #getEmail()} and {@link #getProfile()} are omitted when the request is made from an Actor run. A - * request authenticated with an Apify Proxy password ({@code PROXY_PASSWORD} or {@code + * An Apify user account. {@link #getUsername()} is set, except for a request authenticated with an + * Apify Proxy password, and {@link #getProfile()} may be absent. The private fields ({@link + * #getId()}, {@link #getEmail()}, {@link #getProxy()}, {@link #getPlan()}, {@link + * #getEffectivePlatformFeatures()}, {@link #getCreatedAt()}, and {@link #getIsPaying()}) are set + * for {@code me}, and for another user only when the request uses a full-permission API token of + * that user or a token that impersonates it. {@link #getPlan()}, {@link #getEmail()}, and {@link + * #getProfile()} are omitted when {@code me} is requested from an Actor run. A request + * authenticated with an Apify Proxy password ({@code PROXY_PASSWORD} or {@code * ACTOR_RUN_PROXY_PASSWORD}) gets reduced data on both endpoints: only {@link #getPlan()} (with * just {@link UserPlan#getAvailableProxyGroups()}), {@link #getEffectivePlatformFeatures()}, and * {@link #getIsPaying()} are set, and {@link #getId()} and {@link #getUsername()} are {@code null}. @@ -29,7 +31,7 @@ public final class User extends ApifyResource { private Instant createdAt; private Boolean isPaying; - /** The unique user ID. */ + /** The unique user ID. Private field; see the class description. */ public String getId() { return id; } diff --git a/src/main/java/com/apify/client/user/UserClient.java b/src/main/java/com/apify/client/user/UserClient.java index 4523e08..9284ac8 100644 --- a/src/main/java/com/apify/client/user/UserClient.java +++ b/src/main/java/com/apify/client/user/UserClient.java @@ -28,9 +28,9 @@ public UserClient(HttpClientCore http, String baseUrl, String id) { } /** - * Fetches the user: the public profile, plus the private account details for {@code me} or when - * the API token belongs to that user. Which fields are set is described on {@link User}. Returns - * empty if the user does not exist. + * Fetches the user: the public profile, plus the private account details for {@code me} or when a + * full-permission token of that user (or one that impersonates it) is used. Which fields are set + * is described on {@link User}. Returns empty if the user does not exist. */ public CompletableFuture> get() { return ctx.getResource("", new QueryParams(), User.class); From d0297d05f0c81b7d1365bd9e576df275d113efdb Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 15:55:30 +0000 Subject: [PATCH 10/11] docs: align user get() wording with the spec Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_017ocuAJ4DtkSFFSnhddsYup --- docs/misc.md | 2 +- .../com/apify/client/integration/UserIntegrationTest.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/misc.md b/docs/misc.md index 56bb8a3..65450de 100644 --- a/docs/misc.md +++ b/docs/misc.md @@ -38,7 +38,7 @@ still available via the inherited `getExtra()` (see | Method | Description | |---|---| -| `get()` | Fetch the user. Completes with `Optional` (public profile, plus private account details for `me()` or when a full-permission token of that user is used). | +| `get()` | Fetch the user. Completes with `Optional` (public profile, plus private account details for `me()` or when a full-permission token of that user, or one that impersonates it, is used). | | `monthlyUsage()` / `monthlyUsage(String date)` | The user's monthly usage. `date` (any day within the target month, formatted `YYYY-MM-DD`) reports that month; `null`/empty reports the current month. Completes with `JsonNode`. | | `limits()` | The user's account and usage limits. Completes with `JsonNode`. | | `updateLimits(Object)` | Update the user's account and usage limits. Completes with no value (`CompletableFuture`). | diff --git a/src/test/java/com/apify/client/integration/UserIntegrationTest.java b/src/test/java/com/apify/client/integration/UserIntegrationTest.java index 658fa59..67605ec 100644 --- a/src/test/java/com/apify/client/integration/UserIntegrationTest.java +++ b/src/test/java/com/apify/client/integration/UserIntegrationTest.java @@ -21,8 +21,9 @@ void getUserById() { ApifyClient client = requireClient(); var me = client.me().get().join(); assertTrue(me.isPresent()); - // The account's own id is always a valid target for the by-id accessor (public profile view), - // covering `ApifyClient.user(id)` in addition to the `me()` convenience already exercised + // The account's own id is always a valid target for the by-id accessor (the account's own token + // also gets the private data), covering `ApifyClient.user(id)` in addition to the `me()` + // convenience already exercised // above. var byId = client.user(me.get().getId()).get().join(); assertTrue(byId.isPresent()); From 57de48340274d38c99b2884ecc9a6e0c7f86498e Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 15:59:16 +0000 Subject: [PATCH 11/11] docs: make the by-id test comment unconditional-claim free Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_017ocuAJ4DtkSFFSnhddsYup --- .../com/apify/client/integration/UserIntegrationTest.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/test/java/com/apify/client/integration/UserIntegrationTest.java b/src/test/java/com/apify/client/integration/UserIntegrationTest.java index 67605ec..6e8d784 100644 --- a/src/test/java/com/apify/client/integration/UserIntegrationTest.java +++ b/src/test/java/com/apify/client/integration/UserIntegrationTest.java @@ -21,10 +21,8 @@ void getUserById() { ApifyClient client = requireClient(); var me = client.me().get().join(); assertTrue(me.isPresent()); - // The account's own id is always a valid target for the by-id accessor (the account's own token - // also gets the private data), covering `ApifyClient.user(id)` in addition to the `me()` - // convenience already exercised - // above. + // The account's own id is always a valid target for the by-id accessor, covering + // `ApifyClient.user(id)` in addition to the `me()` convenience already exercised above. var byId = client.user(me.get().getId()).get().join(); assertTrue(byId.isPresent()); }