Skip to content

Latest commit

 

History

History
92 lines (76 loc) · 5.65 KB

misc.md

File metadata and controls

92 lines (76 loc) · 5.65 KB

Store, users & logs

Apify Store: client.store()

Browse public Actors in the Apify Store. client.store() returns a StoreCollectionClient.

Method Description
list(StoreListOptions) A page of Store Actors. Completes with PaginationList<ActorStoreListItem>.
iterate(StoreListOptions, Long chunkSize) A lazy Flow.Publisher<ActorStoreListItem> over all matches, fetching pages on demand. The options' limit caps the total number of rows read, which are the Actors yielded unless the API drops entries after counting them (null/unset or non-positive = all); chunkSize is the per-request page size (null = server default).

StoreListOptions fields: offset (number of Actors to skip), limit (maximum number of Actors to return), search (full-text search query), sortBy (the sort field, e.g. popularity, newest), category (filter Actors by category), username (filter Actors by owner username), pricingModel (filter by pricing model: FREE, PRICE_PER_DATASET_ITEM, PAY_PER_EVENT; the deprecated rental model FLAT_PRICE_PER_MONTH is no longer listed), includeUnrunnableActors (include Actors the current user cannot run), allowsAgenticUsers (only Actors that allow agentic users), responseFormat (the response shape: full or agent).

// Publishers.collect() drains the whole publisher; fine here since `limit` already caps it.
// To stop early without fetching further pages, subscribe with your own Flow.Subscriber instead
// (request(1) at a time, cancel() once you have enough); see IterateStore.java in the examples.
List<ActorStoreListItem> items =
    Publishers.collect(client.store().iterate(new StoreListOptions().search("crawler").limit(20L), 10L))
        .join();
items.forEach(item -> System.out.println(item.getUsername() + "/" + item.getName()));

ActorStoreListItem fields: getId(), getName(), getUsername(), getTitle(), getDescription(), getStats() (ActorStats; see Actors), getCurrentPricingInfo() (PricingInfo: getPricingModel()), getPictureUrl(), getUserPictureUrl(), getUrl(), getReadmeSummary(). Any field not covered by a typed getter is still available via the inherited getExtra() (see the docs index).

Users: client.me() / client.user(id)

Method Description
get() Fetch the user. Completes with Optional<User> (private details for me() via getExtra()).
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<Void>).

The usage/limits methods work on me() and on user(id) (/v2/users/{userId}/usage/monthly and /v2/users/{userId}/limits), subject to what the API token may access.

Optional<User> 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.
      System.out.println("Email: " + u.getEmail());
    });
JsonNode usage = client.me().monthlyUsage().join();

User fields: getId(), getUsername(), getProfile() (UserProfile: getBio(), getReadme(), getName(), getPictureUrl(), getGithubUsername(), getWebsiteUrl(), getTwitterUsername(), all nullable). Only present for me(): getEmail(), getProxy() (UserProxy: getPassword(), getGroups() as List<ProxyGroup>, each with getName()/getDescription()/getAvailableCount() as Long), getPlan() (UserPlan: getId(), getDescription(), getIsEnabled(), getMonthlyBasePriceUsd()/getMonthlyUsageCreditsUsd()/getUsageDiscountPercent()/ getMaxMonthlyUsageUsd()/getMaxActorMemoryGbytes()/getMaxMonthlyActorComputeUnits()/ getMaxMonthlyResidentialProxyGbytes()/getMaxMonthlyProxySerps()/ getMaxMonthlyExternalDataTransferGbytes() as Double, getEnabledPlatformFeatures() as List<String>, getMaxActorCount()/getMaxActorTaskCount()/getDataRetentionDays()/ getTeamAccountSeatCount() as Long, getAvailableProxyGroups() as JsonNode, getSupportLevel(), getAvailableAddOns() as List<JsonNode>), getEffectivePlatformFeatures() (JsonNode), getCreatedAt() (Instant), getIsPaying() (Boolean). Plus getExtra(), a Map<String, Object> carrying any account field not modelled directly.

Logs: client.log(id)

Access a build's or run's log directly, or via client.run(id).log() / client.build(id).log().

Method Description
get() / get(LogOptions) The whole log as text. Completes with Optional<String> when addressed by an explicit id (client.log(id)); on run.log()/build.log() (no log id of its own), a 404 is ambiguous and throws NotFoundError instead; see Fetching single resources.
getAsBytes() / getAsBytes(LogOptions) As get(), but completes with Optional<byte[]> (the raw bytes, not decoded as text). Same 404 handling as get().
stream() / stream(LogOptions) A live InputStream over the log (for redirection). Completes with InputStream; throws on any error response, including a 404.

LogOptions fields: raw(Boolean), download(Boolean).

Optional<String> log = client.log("RUN_OR_BUILD_ID").get().join();
log.ifPresent(System.out::println);