From be4ee863866fc3554bb8a607252dd74d641b0399 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 1 Dec 2025 19:11:33 +0000 Subject: [PATCH 1/4] Initial plan From 1b1ef9559ecf16fa8d6e391c133d8efd2c74b2c3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 1 Dec 2025 19:26:41 +0000 Subject: [PATCH 2/4] Fix JSDoc tag ordering: move @param, @returns, @see to end of comments Co-authored-by: B4nan <615580+B4nan@users.noreply.github.com> --- src/apify_client.ts | 52 +++++------ src/resource_clients/actor.ts | 78 ++++++++-------- src/resource_clients/actor_collection.ts | 17 ++-- .../actor_env_var_collection.ts | 17 ++-- .../actor_version_collection.ts | 17 ++-- src/resource_clients/build_collection.ts | 17 ++-- src/resource_clients/dataset_collection.ts | 17 ++-- src/resource_clients/key_value_store.ts | 72 +++++++-------- .../key_value_store_collection.ts | 17 ++-- .../request_queue_collection.ts | 17 ++-- src/resource_clients/run.ts | 92 +++++++++---------- src/resource_clients/run_collection.ts | 17 ++-- src/resource_clients/schedule_collection.ts | 17 ++-- src/resource_clients/store_collection.ts | 17 ++-- src/resource_clients/task_collection.ts | 17 ++-- src/resource_clients/webhook_collection.ts | 17 ++-- .../webhook_dispatch_collection.ts | 17 ++-- 17 files changed, 277 insertions(+), 238 deletions(-) diff --git a/src/apify_client.ts b/src/apify_client.ts index d0efc4b7..66c34973 100644 --- a/src/apify_client.ts +++ b/src/apify_client.ts @@ -142,15 +142,15 @@ export class ApifyClient { * Use this to get, update, delete, start, or call an Actor, as well as manage its builds, * runs, versions, and webhooks. * - * @param id - Actor ID or username/name - * @returns A client for the specific Actor - * @see https://docs.apify.com/api/v2/act-get - * * @example * ```javascript * // Call an Actor and wait for it to finish * const run = await client.actor('apify/web-scraper').call({ url: 'https://example.com' }); * ``` + * + * @param id - Actor ID or username/name + * @returns A client for the specific Actor + * @see https://docs.apify.com/api/v2/act-get */ actor(id: string): ActorClient { ow(id, ow.string.nonEmpty); @@ -209,11 +209,6 @@ export class ApifyClient { * Use this to read, write, and manage items in the dataset. Datasets contain structured * data stored as individual items (records). * - * @template Data - Type of items stored in the dataset - * @param id - Dataset ID or name - * @returns A client for the specific Dataset - * @see https://docs.apify.com/api/v2/dataset-get - * * @example * ```javascript * // Push items to a dataset @@ -225,6 +220,11 @@ export class ApifyClient { * // Retrieve items * const { items } = await client.dataset('my-dataset').listItems(); * ``` + * + * @template Data - Type of items stored in the dataset + * @param id - Dataset ID or name + * @returns A client for the specific Dataset + * @see https://docs.apify.com/api/v2/dataset-get */ dataset = Record>( id: string, @@ -255,10 +255,6 @@ export class ApifyClient { * Use this to read, write, and delete records in the store. Key-value stores can hold * any type of data including text, JSON, images, and other files. * - * @param id - Key-value store ID or name - * @returns A client for the specific key-value store - * @see https://docs.apify.com/api/v2/key-value-store-get - * * @example * ```javascript * // Save a record @@ -267,6 +263,10 @@ export class ApifyClient { * // Get a record * const record = await client.keyValueStore('my-store').getRecord('OUTPUT'); * ``` + * + * @param id - Key-value store ID or name + * @returns A client for the specific key-value store + * @see https://docs.apify.com/api/v2/key-value-store-get */ keyValueStore(id: string): KeyValueStoreClient { ow(id, ow.string.nonEmpty); @@ -311,11 +311,6 @@ export class ApifyClient { * Use this to add, retrieve, and manage requests in the queue. Request queues are used * by web crawlers to manage URLs that need to be visited. * - * @param id - Request queue ID or name - * @param options - Configuration options for the request queue client - * @returns A client for the specific Request queue - * @see https://docs.apify.com/api/v2/request-queue-get - * * @example * ```javascript * // Add requests to a queue @@ -325,6 +320,11 @@ export class ApifyClient { * // Get and lock the next request * const { items } = await queue.listAndLockHead({ lockSecs: 60 }); * ``` + * + * @param id - Request queue ID or name + * @param options - Configuration options for the request queue client + * @returns A client for the specific Request queue + * @see https://docs.apify.com/api/v2/request-queue-get */ requestQueue(id: string, options: RequestQueueUserOptions = {}): RequestQueueClient { ow(id, ow.string.nonEmpty); @@ -364,10 +364,6 @@ export class ApifyClient { * Use this to get details about a run, wait for it to finish, abort it, or access its * dataset, key-value store, and request queue. * - * @param id - Run ID - * @returns A client for the specified run - * @see https://docs.apify.com/api/v2/actor-run-get - * * @example * ```javascript * // Wait for a run to finish @@ -376,6 +372,10 @@ export class ApifyClient { * // Access run's dataset * const { items } = await client.run('run-id').dataset().listItems(); * ``` + * + * @param id - Run ID + * @returns A client for the specified run + * @see https://docs.apify.com/api/v2/actor-run-get */ run(id: string): RunClient { ow(id, ow.string.nonEmpty); @@ -403,15 +403,15 @@ export class ApifyClient { * * Use this to get, update, delete, or run a task with pre-configured input. * - * @param id - Task ID or username/task-name - * @returns A client for the specified task - * @see https://docs.apify.com/api/v2/actor-task-get - * * @example * ```javascript * // Run a task and wait for it to finish * const run = await client.task('my-task').call(); * ``` + * + * @param id - Task ID or username/task-name + * @returns A client for the specified task + * @see https://docs.apify.com/api/v2/actor-task-get */ task(id: string): TaskClient { ow(id, ow.string.nonEmpty); diff --git a/src/resource_clients/actor.ts b/src/resource_clients/actor.ts index bd6d46c8..b3d881f7 100644 --- a/src/resource_clients/actor.ts +++ b/src/resource_clients/actor.ts @@ -89,6 +89,19 @@ export class ActorClient extends ResourceClient { * asynchronously and this method returns immediately without waiting for completion. * Use the {@link call} method if you want to wait for the Actor to finish. * + * @example + * ```javascript + * // Start Actor with simple input + * const run = await client.actor('my-actor').start({ url: 'https://example.com' }); + * console.log(`Run started with ID: ${run.id}, status: ${run.status}`); + * + * // Start Actor with specific build and memory + * const run = await client.actor('my-actor').start( + * { url: 'https://example.com' }, + * { build: '0.1.2', memory: 512, timeout: 300 } + * ); + * ``` + * * @param input - Input for the Actor. Can be any JSON-serializable value (object, array, string, number). * If `contentType` is specified in options, input should be a string or Buffer. * @param options - Run configuration options @@ -102,19 +115,6 @@ export class ActorClient extends ResourceClient { * @param options.contentType - Content type of the input. If specified, input must be a string or Buffer. * @returns The Actor run object with status, usage, and storage IDs * @see https://docs.apify.com/api/v2/act-runs-post - * - * @example - * ```javascript - * // Start Actor with simple input - * const run = await client.actor('my-actor').start({ url: 'https://example.com' }); - * console.log(`Run started with ID: ${run.id}, status: ${run.status}`); - * - * // Start Actor with specific build and memory - * const run = await client.actor('my-actor').start( - * { url: 'https://example.com' }, - * { build: '0.1.2', memory: 512, timeout: 300 } - * ); - * ``` */ async start(input?: unknown, options: ActorStartOptions = {}): Promise { // input can be anything, so no point in validating it. E.g. if you set content-type to application/pdf @@ -187,17 +187,6 @@ export class ActorClient extends ResourceClient { * by polling the run status. It optionally streams logs to the console or a custom Log instance. * By default, it waits indefinitely unless the `waitSecs` option is provided. * - * @param input - Input for the Actor. Can be any JSON-serializable value (object, array, string, number). - * If `contentType` is specified in options, input should be a string or Buffer. - * @param options - Run configuration options (extends all options from {@link start}) - * @param options.waitSecs - Maximum time to wait for the run to finish, in seconds. If omitted, waits indefinitely. - * @param options.log - Log instance for streaming run logs. Use `'default'` for console output, `null` to disable logging, or provide a custom Log instance. - * @param options.build - Tag or number of the build to run (e.g., `'beta'` or `'1.2.345'`). - * @param options.memory - Memory in megabytes allocated for the run. - * @param options.timeout - Maximum run duration in seconds. - * @returns The finished Actor run object with final status (`SUCCEEDED`, `FAILED`, `ABORTED`, or `TIMED-OUT`) - * @see https://docs.apify.com/api/v2/act-runs-post - * * @example * ```javascript * // Run an Actor and wait for it to finish @@ -216,6 +205,17 @@ export class ActorClient extends ResourceClient { * const log = new Log({ prefix: 'My Actor' }); * const run = await client.actor('my-actor').call({ url: 'https://example.com' }, { log }); * ``` + * + * @param input - Input for the Actor. Can be any JSON-serializable value (object, array, string, number). + * If `contentType` is specified in options, input should be a string or Buffer. + * @param options - Run configuration options (extends all options from {@link start}) + * @param options.waitSecs - Maximum time to wait for the run to finish, in seconds. If omitted, waits indefinitely. + * @param options.log - Log instance for streaming run logs. Use `'default'` for console output, `null` to disable logging, or provide a custom Log instance. + * @param options.build - Tag or number of the build to run (e.g., `'beta'` or `'1.2.345'`). + * @param options.memory - Memory in megabytes allocated for the run. + * @param options.timeout - Maximum run duration in seconds. + * @returns The finished Actor run object with final status (`SUCCEEDED`, `FAILED`, `ABORTED`, or `TIMED-OUT`) + * @see https://docs.apify.com/api/v2/act-runs-post */ async call(input?: unknown, options: ActorCallOptions = {}): Promise { // input can be anything, so no point in validating it. E.g. if you set content-type to application/pdf @@ -261,15 +261,6 @@ export class ActorClient extends ResourceClient { * Creates a new build of the specified Actor version. The build compiles the Actor's * source code, installs dependencies, and prepares it for execution. * - * @param versionNumber - Version number or tag to build (e.g., `'0.1'`, `'0.2'`, `'latest'`) - * @param options - Build configuration options - * @param options.betaPackages - If `true`, the build uses beta versions of Apify NPM packages. - * @param options.tag - Tag to be applied to the build (e.g., `'latest'`, `'beta'`). Existing tag with the same name will be replaced. - * @param options.useCache - If `false`, Docker build cache will be ignored. Default is `true`. - * @param options.waitForFinish - Maximum time to wait (in seconds, max 60s) for the build to finish on the API side before returning. Default is 0 (returns immediately). - * @returns The Build object with status and build details - * @see https://docs.apify.com/api/v2/act-builds-post - * * @example * ```javascript * // Start a build and return immediately @@ -283,6 +274,15 @@ export class ActorClient extends ResourceClient { * useCache: true * }); * ``` + * + * @param versionNumber - Version number or tag to build (e.g., `'0.1'`, `'0.2'`, `'latest'`) + * @param options - Build configuration options + * @param options.betaPackages - If `true`, the build uses beta versions of Apify NPM packages. + * @param options.tag - Tag to be applied to the build (e.g., `'latest'`, `'beta'`). Existing tag with the same name will be replaced. + * @param options.useCache - If `false`, Docker build cache will be ignored. Default is `true`. + * @param options.waitForFinish - Maximum time to wait (in seconds, max 60s) for the build to finish on the API side before returning. Default is 0 (returns immediately). + * @returns The Build object with status and build details + * @see https://docs.apify.com/api/v2/act-builds-post */ async build(versionNumber: string, options: ActorBuildOptions = {}): Promise { ow(versionNumber, ow.string); @@ -338,17 +338,17 @@ export class ActorClient extends ResourceClient { * * Provides access to the most recent Actor run, optionally filtered by status or origin. * - * @param options - Options to filter the last run - * @param options.status - Filter by run status (e.g., `'SUCCEEDED'`, `'FAILED'`, `'RUNNING'`, `'ABORTED'`, `'TIMED-OUT'`). - * @param options.origin - Filter by run origin (e.g., `'DEVELOPMENT'`, `'WEB'`, `'API'`, `'SCHEDULER'`). - * @returns A client for the last run - * @see https://docs.apify.com/api/v2/act-runs-last-get - * * @example * ```javascript * // Get the last successful run * const lastRun = await client.actor('my-actor').lastRun({ status: 'SUCCEEDED' }).get(); * ``` + * + * @param options - Options to filter the last run + * @param options.status - Filter by run status (e.g., `'SUCCEEDED'`, `'FAILED'`, `'RUNNING'`, `'ABORTED'`, `'TIMED-OUT'`). + * @param options.origin - Filter by run origin (e.g., `'DEVELOPMENT'`, `'WEB'`, `'API'`, `'SCHEDULER'`). + * @returns A client for the last run + * @see https://docs.apify.com/api/v2/act-runs-last-get */ lastRun(options: ActorLastRunOptions = {}): RunClient { ow( diff --git a/src/resource_clients/actor_collection.ts b/src/resource_clients/actor_collection.ts index e9b0997c..2782747e 100644 --- a/src/resource_clients/actor_collection.ts +++ b/src/resource_clients/actor_collection.ts @@ -43,22 +43,25 @@ export class ActorCollectionClient extends ResourceCollectionClient { /** * Lists all Actors. * - * @param options - Pagination options. - * @returns A paginated iterator of Actors. - * @see https://docs.apify.com/api/v2/acts-get - * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * ```javascript - * const paginatedList = await client.list(options); - *``` * * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @example + * ```javascript + * const paginatedList = await client.list(options); + * ``` + * + * @example * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination options. + * @returns A paginated iterator of Actors. + * @see https://docs.apify.com/api/v2/acts-get */ list(options: ActorCollectionListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/actor_env_var_collection.ts b/src/resource_clients/actor_env_var_collection.ts index 9126fd9a..cd64b86e 100644 --- a/src/resource_clients/actor_env_var_collection.ts +++ b/src/resource_clients/actor_env_var_collection.ts @@ -45,22 +45,25 @@ export class ActorEnvVarCollectionClient extends ResourceCollectionClient { /** * Lists all environment variables of this Actor version. * - * @param options - Pagination options. - * @returns A paginated iterator of environment variables. - * @see https://docs.apify.com/api/v2/act-version-env-vars-get - * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * ```javascript - * const paginatedList = await client.list(options); - *``` * * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @example + * ```javascript + * const paginatedList = await client.list(options); + * ``` + * + * @example * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination options. + * @returns A paginated iterator of environment variables. + * @see https://docs.apify.com/api/v2/act-version-env-vars-get */ list( options: ActorEnvVarCollectionListOptions = {}, diff --git a/src/resource_clients/actor_version_collection.ts b/src/resource_clients/actor_version_collection.ts index 0479814c..aa7d1f54 100644 --- a/src/resource_clients/actor_version_collection.ts +++ b/src/resource_clients/actor_version_collection.ts @@ -43,22 +43,25 @@ export class ActorVersionCollectionClient extends ResourceCollectionClient { /** * Lists all Actor versions. * - * @param options - Pagination options. - * @returns A paginated iterator of Actor versions. - * @see https://docs.apify.com/api/v2/act-versions-get - * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * ```javascript - * const paginatedList = await client.list(options); - *``` * * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @example + * ```javascript + * const paginatedList = await client.list(options); + * ``` + * + * @example * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination options. + * @returns A paginated iterator of Actor versions. + * @see https://docs.apify.com/api/v2/act-versions-get */ list( options: ActorVersionCollectionListOptions = {}, diff --git a/src/resource_clients/build_collection.ts b/src/resource_clients/build_collection.ts index 71498552..8114ea54 100644 --- a/src/resource_clients/build_collection.ts +++ b/src/resource_clients/build_collection.ts @@ -40,22 +40,25 @@ export class BuildCollectionClient extends ResourceCollectionClient { /** * Lists all Actor builds. * - * @param options - Pagination and sorting options. - * @returns A paginated iterator of Actor builds. - * @see https://docs.apify.com/api/v2/actor-builds-get - * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * ```javascript - * const paginatedList = await client.list(options); - *``` * * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @example + * ```javascript + * const paginatedList = await client.list(options); + * ``` + * + * @example * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination and sorting options. + * @returns A paginated iterator of Actor builds. + * @see https://docs.apify.com/api/v2/actor-builds-get */ list(options: BuildCollectionClientListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/dataset_collection.ts b/src/resource_clients/dataset_collection.ts index b9d2faba..42e40a10 100644 --- a/src/resource_clients/dataset_collection.ts +++ b/src/resource_clients/dataset_collection.ts @@ -39,22 +39,25 @@ export class DatasetCollectionClient extends ResourceCollectionClient { /** * Lists all Datasets. * - * @param options - Pagination options. - * @returns A paginated iterator of Datasets. - * @see https://docs.apify.com/api/v2/datasets-get - * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * ```javascript - * const paginatedList = await client.list(options); - *``` * * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @example + * ```javascript + * const paginatedList = await client.list(options); + * ``` + * + * @example * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination options. + * @returns A paginated iterator of Datasets. + * @see https://docs.apify.com/api/v2/datasets-get */ list(options: DatasetCollectionClientListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/key_value_store.ts b/src/resource_clients/key_value_store.ts index 9ddf0858..9821fee6 100644 --- a/src/resource_clients/key_value_store.ts +++ b/src/resource_clients/key_value_store.ts @@ -107,14 +107,6 @@ export class KeyValueStoreClient extends ResourceClient { * Returns a paginated list of all record keys in the store. Use pagination parameters * to retrieve large lists efficiently. * - * @param options - Listing options - * @param options.limit - Maximum number of keys to return. Default is 1000. - * @param options.exclusiveStartKey - Key to start listing from (for pagination). The listing starts with the next key after this one. - * @param options.collection - Filter keys by collection name. - * @param options.prefix - Filter keys that start with this prefix. - * @returns Object containing `items` array of key metadata, pagination info (`count`, `limit`, `isTruncated`, `nextExclusiveStartKey`) - * @see https://docs.apify.com/api/v2/key-value-store-keys-get - * * @example * ```javascript * // List all keys @@ -135,6 +127,14 @@ export class KeyValueStoreClient extends ResourceClient { * exclusiveStartKey = result.nextExclusiveStartKey; * } while (result.isTruncated); * ``` + * + * @param options - Listing options + * @param options.limit - Maximum number of keys to return. Default is 1000. + * @param options.exclusiveStartKey - Key to start listing from (for pagination). The listing starts with the next key after this one. + * @param options.collection - Filter keys by collection name. + * @param options.prefix - Filter keys that start with this prefix. + * @returns Object containing `items` array of key metadata, pagination info (`count`, `limit`, `isTruncated`, `nextExclusiveStartKey`) + * @see https://docs.apify.com/api/v2/key-value-store-keys-get */ async listKeys(options: KeyValueClientListKeysOptions = {}): Promise { ow( @@ -165,15 +165,15 @@ export class KeyValueStoreClient extends ResourceClient { * the URL will include a cryptographic signature for authenticated access without * requiring an API token. * - * @param key - The record key - * @returns A public URL string for accessing the record - * * @example * ```javascript * const url = await client.keyValueStore('my-store').getRecordPublicUrl('OUTPUT'); * console.log(`Public URL: ${url}`); * // You can now share this URL or use it in a browser * ``` + * + * @param key - The record key + * @returns A public URL string for accessing the record */ async getRecordPublicUrl(key: string): Promise { ow(key, ow.string.nonEmpty); @@ -196,12 +196,6 @@ export class KeyValueStoreClient extends ResourceClient { * If the client has permission to access the key-value store's URL signing key, * the URL will include a cryptographic signature which allows access without authentication. * - * @param options - URL generation options (extends all options from {@link listKeys}) - * @param options.expiresInSecs - Number of seconds until the signed URL expires. If omitted, the URL never expires. - * @param options.limit - Maximum number of keys to return. - * @param options.prefix - Filter keys by prefix. - * @returns A public URL string for accessing the keys list - * * @example * ```javascript * // Create a URL that expires in 1 hour @@ -211,6 +205,12 @@ export class KeyValueStoreClient extends ResourceClient { * }); * console.log(`Share this URL: ${url}`); * ``` + * + * @param options - URL generation options (extends all options from {@link listKeys}) + * @param options.expiresInSecs - Number of seconds until the signed URL expires. If omitted, the URL never expires. + * @param options.limit - Maximum number of keys to return. + * @param options.prefix - Filter keys by prefix. + * @returns A public URL string for accessing the keys list */ async createKeysPublicUrl(options: KeyValueClientCreateKeysUrlOptions = {}) { ow( @@ -249,10 +249,6 @@ export class KeyValueStoreClient extends ResourceClient { * * This is more efficient than {@link getRecord} when you only need to check for existence. * - * @param key - The record key to check - * @returns `true` if the record exists, `false` if it does not - * @see https://docs.apify.com/api/v2/key-value-store-record-get - * * @example * ```javascript * const exists = await client.keyValueStore('my-store').recordExists('OUTPUT'); @@ -260,6 +256,10 @@ export class KeyValueStoreClient extends ResourceClient { * console.log('OUTPUT record exists'); * } * ``` + * + * @param key - The record key to check + * @returns `true` if the record exists, `false` if it does not + * @see https://docs.apify.com/api/v2/key-value-store-record-get */ async recordExists(key: string): Promise { const requestOpts: Record = { @@ -359,18 +359,6 @@ export class KeyValueStoreClient extends ResourceClient { * the upload cannot be retried on failure or follow redirects. For reliable uploads, * buffer the entire stream into memory first. * - * @param record - The record to store - * @param record.key - Record key (unique identifier) - * @param record.value - Record value (object, string, Buffer, or Stream) - * @param record.contentType - Optional MIME type. Auto-detected if not provided: - * - Objects: `'application/json; charset=utf-8'` - * - Strings: `'text/plain; charset=utf-8'` - * - Buffers/Streams: `'application/octet-stream'` - * @param options - Storage options - * @param options.timeoutSecs - Timeout for the upload in seconds. Default varies by value size. - * @param options.doNotRetryTimeouts - If `true`, don't retry on timeout errors. Default is `false`. - * @see https://docs.apify.com/api/v2/key-value-store-record-put - * * @example * ```javascript * // Store JSON object @@ -394,6 +382,18 @@ export class KeyValueStoreClient extends ResourceClient { * contentType: 'image/png' * }); * ``` + * + * @param record - The record to store + * @param record.key - Record key (unique identifier) + * @param record.value - Record value (object, string, Buffer, or Stream) + * @param record.contentType - Optional MIME type. Auto-detected if not provided: + * - Objects: `'application/json; charset=utf-8'` + * - Strings: `'text/plain; charset=utf-8'` + * - Buffers/Streams: `'application/octet-stream'` + * @param options - Storage options + * @param options.timeoutSecs - Timeout for the upload in seconds. Default varies by value size. + * @param options.doNotRetryTimeouts - If `true`, don't retry on timeout errors. Default is `false`. + * @see https://docs.apify.com/api/v2/key-value-store-record-put */ async setRecord(record: KeyValueStoreRecord, options: KeyValueStoreRecordOptions = {}): Promise { ow( @@ -451,13 +451,13 @@ export class KeyValueStoreClient extends ResourceClient { /** * Deletes a record from the key-value store. * - * @param key - The record key to delete - * @see https://docs.apify.com/api/v2/key-value-store-record-delete - * * @example * ```javascript * await client.keyValueStore('my-store').deleteRecord('temp-data'); * ``` + * + * @param key - The record key to delete + * @see https://docs.apify.com/api/v2/key-value-store-record-delete */ async deleteRecord(key: string): Promise { ow(key, ow.string); diff --git a/src/resource_clients/key_value_store_collection.ts b/src/resource_clients/key_value_store_collection.ts index 902efcd9..8950a14d 100644 --- a/src/resource_clients/key_value_store_collection.ts +++ b/src/resource_clients/key_value_store_collection.ts @@ -39,22 +39,25 @@ export class KeyValueStoreCollectionClient extends ResourceCollectionClient { /** * Lists all Key-value stores. * - * @param options - Pagination options. - * @returns A paginated iterator of Key-value stores. - * @see https://docs.apify.com/api/v2/key-value-stores-get - * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * ```javascript - * const paginatedList = await client.list(options); - *``` * * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @example + * ```javascript + * const paginatedList = await client.list(options); + * ``` + * + * @example * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination options. + * @returns A paginated iterator of Key-value stores. + * @see https://docs.apify.com/api/v2/key-value-stores-get */ list( options: KeyValueStoreCollectionClientListOptions = {}, diff --git a/src/resource_clients/request_queue_collection.ts b/src/resource_clients/request_queue_collection.ts index f73e323f..3ad2ebfe 100644 --- a/src/resource_clients/request_queue_collection.ts +++ b/src/resource_clients/request_queue_collection.ts @@ -39,22 +39,25 @@ export class RequestQueueCollectionClient extends ResourceCollectionClient { /** * Lists all Request queues. * - * @param options - Pagination options. - * @returns A paginated iterator of Request queues. - * @see https://docs.apify.com/api/v2/request-queues-get - * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * ```javascript - * const paginatedList = await client.list(options); - *``` * * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @example + * ```javascript + * const paginatedList = await client.list(options); + * ``` + * + * @example * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination options. + * @returns A paginated iterator of Request queues. + * @see https://docs.apify.com/api/v2/request-queues-get */ list( options: RequestQueueCollectionListOptions = {}, diff --git a/src/resource_clients/run.ts b/src/resource_clients/run.ts index cf9066db..17900958 100644 --- a/src/resource_clients/run.ts +++ b/src/resource_clients/run.ts @@ -53,11 +53,6 @@ export class RunClient extends ResourceClient { /** * Gets the Actor run object from the Apify API. * - * @param options - Get options - * @param options.waitForFinish - Maximum time to wait (in seconds, max 60s) for the run to finish on the API side before returning. Default is 0 (returns immediately). - * @returns The ActorRun object, or `undefined` if it does not exist - * @see https://docs.apify.com/api/v2/actor-run-get - * * @example * ```javascript * // Get run status immediately @@ -67,6 +62,11 @@ export class RunClient extends ResourceClient { * // Wait up to 60 seconds for run to finish * const run = await client.run('run-id').get({ waitForFinish: 60 }); * ``` + * + * @param options - Get options + * @param options.waitForFinish - Maximum time to wait (in seconds, max 60s) for the run to finish on the API side before returning. Default is 0 (returns immediately). + * @returns The ActorRun object, or `undefined` if it does not exist + * @see https://docs.apify.com/api/v2/actor-run-get */ async get(options: RunGetOptions = {}): Promise { ow( @@ -82,11 +82,6 @@ export class RunClient extends ResourceClient { /** * Aborts the Actor run. * - * @param options - Abort options - * @param options.gracefully - If `true`, the Actor run will abort gracefully - it can send status messages and perform cleanup. Default is `false` (immediate abort). - * @returns The updated ActorRun object with `ABORTING` or `ABORTED` status - * @see https://docs.apify.com/api/v2/actor-run-abort-post - * * @example * ```javascript * // Abort immediately @@ -95,6 +90,11 @@ export class RunClient extends ResourceClient { * // Abort gracefully (allows cleanup) * await client.run('run-id').abort({ gracefully: true }); * ``` + * + * @param options - Abort options + * @param options.gracefully - If `true`, the Actor run will abort gracefully - it can send status messages and perform cleanup. Default is `false` (immediate abort). + * @returns The updated ActorRun object with `ABORTING` or `ABORTED` status + * @see https://docs.apify.com/api/v2/actor-run-abort-post */ async abort(options: RunAbortOptions = {}): Promise { ow( @@ -129,14 +129,6 @@ export class RunClient extends ResourceClient { * and resource allocation. The run effectively becomes a run of the target Actor with new input. * This is useful for chaining Actor executions or implementing complex workflows. * - * @param targetActorId - ID or username/name of the target Actor - * @param input - Input for the target Actor. Can be any JSON-serializable value. - * @param options - Metamorph options - * @param options.build - Tag or number of the target Actor's build to run. Default is the target Actor's default build. - * @param options.contentType - Content type of the input. If specified, input must be a string or Buffer. - * @returns The metamorphed ActorRun object (same ID, but now running the target Actor) - * @see https://docs.apify.com/api/v2/actor-run-metamorph-post - * * @example * ```javascript * // Transform current run into another Actor @@ -146,6 +138,14 @@ export class RunClient extends ResourceClient { * ); * console.log(`Run ${metamorphedRun.id} is now running ${metamorphedRun.actId}`); * ``` + * + * @param targetActorId - ID or username/name of the target Actor + * @param input - Input for the target Actor. Can be any JSON-serializable value. + * @param options - Metamorph options + * @param options.build - Tag or number of the target Actor's build to run. Default is the target Actor's default build. + * @param options.contentType - Content type of the input. If specified, input must be a string or Buffer. + * @returns The metamorphed ActorRun object (same ID, but now running the target Actor) + * @see https://docs.apify.com/api/v2/actor-run-metamorph-post */ async metamorph(targetActorId: string, input: unknown, options: RunMetamorphOptions = {}): Promise { ow(targetActorId, ow.string); @@ -194,13 +194,13 @@ export class RunClient extends ResourceClient { * This can be useful to recover from certain errors or to force the Actor to restart * with a fresh environment. * - * @returns The updated ActorRun object - * @see https://docs.apify.com/api/v2/actor-run-reboot-post - * * @example * ```javascript * const run = await client.run('run-id').reboot(); * ``` + * + * @returns The updated ActorRun object + * @see https://docs.apify.com/api/v2/actor-run-reboot-post */ async reboot(): Promise { const request: AxiosRequestConfig = { @@ -215,12 +215,6 @@ export class RunClient extends ResourceClient { /** * Updates the Actor run with specified fields. * - * @param newFields - Fields to update - * @param newFields.statusMessage - Custom status message to display (e.g., "Processing page 10/100") - * @param newFields.isStatusMessageTerminal - If `true`, the status message is final and won't be overwritten. Default is `false`. - * @param newFields.generalAccess - General resource access level ('FOLLOW_USER_SETTING', 'ANYONE_WITH_ID_CAN_READ' or 'RESTRICTED') - * @returns The updated ActorRun object - * * @example * ```javascript * // Set a status message @@ -228,6 +222,12 @@ export class RunClient extends ResourceClient { * statusMessage: 'Processing items: 50/100' * }); * ``` + * + * @param newFields - Fields to update + * @param newFields.statusMessage - Custom status message to display (e.g., "Processing page 10/100") + * @param newFields.isStatusMessageTerminal - If `true`, the status message is final and won't be overwritten. Default is `false`. + * @param newFields.generalAccess - General resource access level ('FOLLOW_USER_SETTING', 'ANYONE_WITH_ID_CAN_READ' or 'RESTRICTED') + * @returns The updated ActorRun object */ async update(newFields: RunUpdateOptions): Promise { ow(newFields, ow.object); @@ -241,6 +241,13 @@ export class RunClient extends ResourceClient { * This creates a new run with the same configuration as the original run. The original * run's storages (dataset, key-value store, request queue) are preserved and reused. * + * @example + * ```javascript + * // Resurrect a failed run with more memory + * const newRun = await client.run('failed-run-id').resurrect({ memory: 2048 }); + * console.log(`New run started: ${newRun.id}`); + * ``` + * * @param options - Resurrection options (override original run settings) * @param options.build - Tag or number of the build to use. If not provided, uses the original run's build. * @param options.memory - Memory in megabytes. If not provided, uses the original run's memory. @@ -250,13 +257,6 @@ export class RunClient extends ResourceClient { * @param options.restartOnError - Whether to restart on error. * @returns The new (resurrected) ActorRun object * @see https://docs.apify.com/api/v2/post-resurrect-run - * - * @example - * ```javascript - * // Resurrect a failed run with more memory - * const newRun = await client.run('failed-run-id').resurrect({ memory: 2048 }); - * console.log(`New run started: ${newRun.id}`); - * ``` */ async resurrect(options: RunResurrectOptions = {}): Promise { ow( @@ -363,14 +363,14 @@ export class RunClient extends ResourceClient { /** * Returns a client for the default dataset of this Actor run. * - * @returns A client for accessing the run's default dataset - * @see https://docs.apify.com/api/v2/actor-run-get - * * @example * ```javascript * // Access run's dataset * const { items } = await client.run('run-id').dataset().listItems(); * ``` + * + * @returns A client for accessing the run's default dataset + * @see https://docs.apify.com/api/v2/actor-run-get */ dataset(): DatasetClient { return new DatasetClient( @@ -383,14 +383,14 @@ export class RunClient extends ResourceClient { /** * Returns a client for the default key-value store of this Actor run. * - * @returns A client for accessing the run's default key-value store - * @see https://docs.apify.com/api/v2/actor-run-get - * * @example * ```javascript * // Access run's key-value store * const output = await client.run('run-id').keyValueStore().getRecord('OUTPUT'); * ``` + * + * @returns A client for accessing the run's default key-value store + * @see https://docs.apify.com/api/v2/actor-run-get */ keyValueStore(): KeyValueStoreClient { return new KeyValueStoreClient( @@ -403,14 +403,14 @@ export class RunClient extends ResourceClient { /** * Returns a client for the default Request queue of this Actor run. * - * @returns A client for accessing the run's default Request queue - * @see https://docs.apify.com/api/v2/actor-run-get - * * @example * ```javascript * // Access run's Request queue * const { items } = await client.run('run-id').requestQueue().listHead(); * ``` + * + * @returns A client for accessing the run's default Request queue + * @see https://docs.apify.com/api/v2/actor-run-get */ requestQueue(): RequestQueueClient { return new RequestQueueClient( @@ -423,15 +423,15 @@ export class RunClient extends ResourceClient { /** * Returns a client for accessing the log of this Actor run. * - * @returns A client for accessing the run's log - * @see https://docs.apify.com/api/v2/actor-run-get - * * @example * ```javascript * // Get run log * const log = await client.run('run-id').log().get(); * console.log(log); * ``` + * + * @returns A client for accessing the run's log + * @see https://docs.apify.com/api/v2/actor-run-get */ log(): LogClient { return new LogClient( diff --git a/src/resource_clients/run_collection.ts b/src/resource_clients/run_collection.ts index 13efe734..4e4d3cf0 100644 --- a/src/resource_clients/run_collection.ts +++ b/src/resource_clients/run_collection.ts @@ -42,22 +42,25 @@ export class RunCollectionClient extends ResourceCollectionClient { /** * Lists all Actor runs. * - * @param options - Pagination and filtering options. - * @returns A paginated iterator of Actor runs. - * @see https://docs.apify.com/api/v2/actor-runs-get - * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * ```javascript - * const paginatedList = await client.list(options); - *``` * * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @example + * ```javascript + * const paginatedList = await client.list(options); + * ``` + * + * @example * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination and filtering options. + * @returns A paginated iterator of Actor runs. + * @see https://docs.apify.com/api/v2/actor-runs-get */ list(options: RunCollectionListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/schedule_collection.ts b/src/resource_clients/schedule_collection.ts index fa0d43fa..e840bc96 100644 --- a/src/resource_clients/schedule_collection.ts +++ b/src/resource_clients/schedule_collection.ts @@ -43,22 +43,25 @@ export class ScheduleCollectionClient extends ResourceCollectionClient { /** * Lists all schedules. * - * @param options - Pagination and sorting options. - * @returns A paginated iterator of schedules. - * @see https://docs.apify.com/api/v2/schedules-get - * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * ```javascript - * const paginatedList = await client.list(options); - *``` * * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @example + * ```javascript + * const paginatedList = await client.list(options); + * ``` + * + * @example * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination and sorting options. + * @returns A paginated iterator of schedules. + * @see https://docs.apify.com/api/v2/schedules-get */ list(options: ScheduleCollectionListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/store_collection.ts b/src/resource_clients/store_collection.ts index f5ecbc88..96540bd7 100644 --- a/src/resource_clients/store_collection.ts +++ b/src/resource_clients/store_collection.ts @@ -39,22 +39,25 @@ export class StoreCollectionClient extends ResourceCollectionClient { /** * Lists Actors from the Apify Store. * - * @param options - Search and pagination options. - * @returns A paginated iterator of store Actors. - * @see https://docs.apify.com/api/v2/store-actors-get - * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * ```javascript - * const paginatedList = await client.list(options); - *``` * * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @example + * ```javascript + * const paginatedList = await client.list(options); + * ``` + * + * @example * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Search and pagination options. + * @returns A paginated iterator of store Actors. + * @see https://docs.apify.com/api/v2/store-actors-get */ list(options: StoreCollectionListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/task_collection.ts b/src/resource_clients/task_collection.ts index 0e88780c..6502e314 100644 --- a/src/resource_clients/task_collection.ts +++ b/src/resource_clients/task_collection.ts @@ -43,22 +43,25 @@ export class TaskCollectionClient extends ResourceCollectionClient { /** * Lists all Tasks. * - * @param options - Pagination and sorting options. - * @returns A paginated iterator of tasks. - * @see https://docs.apify.com/api/v2/actor-tasks-get - * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * ```javascript - * const paginatedList = await client.list(options); - *``` * * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @example + * ```javascript + * const paginatedList = await client.list(options); + * ``` + * + * @example * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination and sorting options. + * @returns A paginated iterator of tasks. + * @see https://docs.apify.com/api/v2/actor-tasks-get */ list(options: TaskCollectionListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/webhook_collection.ts b/src/resource_clients/webhook_collection.ts index f5699d8d..d1ef3d53 100644 --- a/src/resource_clients/webhook_collection.ts +++ b/src/resource_clients/webhook_collection.ts @@ -42,22 +42,25 @@ export class WebhookCollectionClient extends ResourceCollectionClient { /** * Lists all Webhooks. * - * @param options - Pagination and sorting options. - * @returns A paginated iterator of webhooks. - * @see https://docs.apify.com/api/v2/webhooks-get - * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * ```javascript - * const paginatedList = await client.list(options); - *``` * * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @example + * ```javascript + * const paginatedList = await client.list(options); + * ``` + * + * @example * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination and sorting options. + * @returns A paginated iterator of webhooks. + * @see https://docs.apify.com/api/v2/webhooks-get */ list( diff --git a/src/resource_clients/webhook_dispatch_collection.ts b/src/resource_clients/webhook_dispatch_collection.ts index 0ac947aa..71e7bdd7 100644 --- a/src/resource_clients/webhook_dispatch_collection.ts +++ b/src/resource_clients/webhook_dispatch_collection.ts @@ -37,22 +37,25 @@ export class WebhookDispatchCollectionClient extends ResourceCollectionClient { /** * Lists all webhook dispatches. * - * @param options - Pagination and sorting options. - * @returns A paginated iterator of webhook dispatches. - * @see https://docs.apify.com/api/v2/webhook-dispatches-get - * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * ```javascript - * const paginatedList = await client.list(options); - *``` * * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @example + * ```javascript + * const paginatedList = await client.list(options); + * ``` + * + * @example * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination and sorting options. + * @returns A paginated iterator of webhook dispatches. + * @see https://docs.apify.com/api/v2/webhook-dispatches-get */ list(options: WebhookDispatchCollectionListOptions = {}): PaginatedIterator { ow( From b0b9aede8ed3b39de0f77a6f380fd70737c40e05 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 1 Dec 2025 19:46:53 +0000 Subject: [PATCH 3/4] Move @example tags to the end of JSDoc comments Co-authored-by: B4nan <615580+B4nan@users.noreply.github.com> --- src/apify_client.ts | 52 +++++------ src/resource_clients/actor.ts | 78 ++++++++-------- src/resource_clients/actor_collection.ts | 8 +- .../actor_env_var_collection.ts | 8 +- .../actor_version_collection.ts | 8 +- src/resource_clients/build_collection.ts | 8 +- src/resource_clients/dataset_collection.ts | 8 +- src/resource_clients/key_value_store.ts | 72 +++++++-------- .../key_value_store_collection.ts | 8 +- .../request_queue_collection.ts | 8 +- src/resource_clients/run.ts | 92 +++++++++---------- src/resource_clients/run_collection.ts | 8 +- src/resource_clients/schedule_collection.ts | 8 +- src/resource_clients/store_collection.ts | 8 +- src/resource_clients/task_collection.ts | 8 +- src/resource_clients/webhook_collection.ts | 8 +- .../webhook_dispatch_collection.ts | 8 +- 17 files changed, 199 insertions(+), 199 deletions(-) diff --git a/src/apify_client.ts b/src/apify_client.ts index 66c34973..d0efc4b7 100644 --- a/src/apify_client.ts +++ b/src/apify_client.ts @@ -142,15 +142,15 @@ export class ApifyClient { * Use this to get, update, delete, start, or call an Actor, as well as manage its builds, * runs, versions, and webhooks. * + * @param id - Actor ID or username/name + * @returns A client for the specific Actor + * @see https://docs.apify.com/api/v2/act-get + * * @example * ```javascript * // Call an Actor and wait for it to finish * const run = await client.actor('apify/web-scraper').call({ url: 'https://example.com' }); * ``` - * - * @param id - Actor ID or username/name - * @returns A client for the specific Actor - * @see https://docs.apify.com/api/v2/act-get */ actor(id: string): ActorClient { ow(id, ow.string.nonEmpty); @@ -209,6 +209,11 @@ export class ApifyClient { * Use this to read, write, and manage items in the dataset. Datasets contain structured * data stored as individual items (records). * + * @template Data - Type of items stored in the dataset + * @param id - Dataset ID or name + * @returns A client for the specific Dataset + * @see https://docs.apify.com/api/v2/dataset-get + * * @example * ```javascript * // Push items to a dataset @@ -220,11 +225,6 @@ export class ApifyClient { * // Retrieve items * const { items } = await client.dataset('my-dataset').listItems(); * ``` - * - * @template Data - Type of items stored in the dataset - * @param id - Dataset ID or name - * @returns A client for the specific Dataset - * @see https://docs.apify.com/api/v2/dataset-get */ dataset = Record>( id: string, @@ -255,6 +255,10 @@ export class ApifyClient { * Use this to read, write, and delete records in the store. Key-value stores can hold * any type of data including text, JSON, images, and other files. * + * @param id - Key-value store ID or name + * @returns A client for the specific key-value store + * @see https://docs.apify.com/api/v2/key-value-store-get + * * @example * ```javascript * // Save a record @@ -263,10 +267,6 @@ export class ApifyClient { * // Get a record * const record = await client.keyValueStore('my-store').getRecord('OUTPUT'); * ``` - * - * @param id - Key-value store ID or name - * @returns A client for the specific key-value store - * @see https://docs.apify.com/api/v2/key-value-store-get */ keyValueStore(id: string): KeyValueStoreClient { ow(id, ow.string.nonEmpty); @@ -311,6 +311,11 @@ export class ApifyClient { * Use this to add, retrieve, and manage requests in the queue. Request queues are used * by web crawlers to manage URLs that need to be visited. * + * @param id - Request queue ID or name + * @param options - Configuration options for the request queue client + * @returns A client for the specific Request queue + * @see https://docs.apify.com/api/v2/request-queue-get + * * @example * ```javascript * // Add requests to a queue @@ -320,11 +325,6 @@ export class ApifyClient { * // Get and lock the next request * const { items } = await queue.listAndLockHead({ lockSecs: 60 }); * ``` - * - * @param id - Request queue ID or name - * @param options - Configuration options for the request queue client - * @returns A client for the specific Request queue - * @see https://docs.apify.com/api/v2/request-queue-get */ requestQueue(id: string, options: RequestQueueUserOptions = {}): RequestQueueClient { ow(id, ow.string.nonEmpty); @@ -364,6 +364,10 @@ export class ApifyClient { * Use this to get details about a run, wait for it to finish, abort it, or access its * dataset, key-value store, and request queue. * + * @param id - Run ID + * @returns A client for the specified run + * @see https://docs.apify.com/api/v2/actor-run-get + * * @example * ```javascript * // Wait for a run to finish @@ -372,10 +376,6 @@ export class ApifyClient { * // Access run's dataset * const { items } = await client.run('run-id').dataset().listItems(); * ``` - * - * @param id - Run ID - * @returns A client for the specified run - * @see https://docs.apify.com/api/v2/actor-run-get */ run(id: string): RunClient { ow(id, ow.string.nonEmpty); @@ -403,15 +403,15 @@ export class ApifyClient { * * Use this to get, update, delete, or run a task with pre-configured input. * + * @param id - Task ID or username/task-name + * @returns A client for the specified task + * @see https://docs.apify.com/api/v2/actor-task-get + * * @example * ```javascript * // Run a task and wait for it to finish * const run = await client.task('my-task').call(); * ``` - * - * @param id - Task ID or username/task-name - * @returns A client for the specified task - * @see https://docs.apify.com/api/v2/actor-task-get */ task(id: string): TaskClient { ow(id, ow.string.nonEmpty); diff --git a/src/resource_clients/actor.ts b/src/resource_clients/actor.ts index b3d881f7..bd6d46c8 100644 --- a/src/resource_clients/actor.ts +++ b/src/resource_clients/actor.ts @@ -89,19 +89,6 @@ export class ActorClient extends ResourceClient { * asynchronously and this method returns immediately without waiting for completion. * Use the {@link call} method if you want to wait for the Actor to finish. * - * @example - * ```javascript - * // Start Actor with simple input - * const run = await client.actor('my-actor').start({ url: 'https://example.com' }); - * console.log(`Run started with ID: ${run.id}, status: ${run.status}`); - * - * // Start Actor with specific build and memory - * const run = await client.actor('my-actor').start( - * { url: 'https://example.com' }, - * { build: '0.1.2', memory: 512, timeout: 300 } - * ); - * ``` - * * @param input - Input for the Actor. Can be any JSON-serializable value (object, array, string, number). * If `contentType` is specified in options, input should be a string or Buffer. * @param options - Run configuration options @@ -115,6 +102,19 @@ export class ActorClient extends ResourceClient { * @param options.contentType - Content type of the input. If specified, input must be a string or Buffer. * @returns The Actor run object with status, usage, and storage IDs * @see https://docs.apify.com/api/v2/act-runs-post + * + * @example + * ```javascript + * // Start Actor with simple input + * const run = await client.actor('my-actor').start({ url: 'https://example.com' }); + * console.log(`Run started with ID: ${run.id}, status: ${run.status}`); + * + * // Start Actor with specific build and memory + * const run = await client.actor('my-actor').start( + * { url: 'https://example.com' }, + * { build: '0.1.2', memory: 512, timeout: 300 } + * ); + * ``` */ async start(input?: unknown, options: ActorStartOptions = {}): Promise { // input can be anything, so no point in validating it. E.g. if you set content-type to application/pdf @@ -187,6 +187,17 @@ export class ActorClient extends ResourceClient { * by polling the run status. It optionally streams logs to the console or a custom Log instance. * By default, it waits indefinitely unless the `waitSecs` option is provided. * + * @param input - Input for the Actor. Can be any JSON-serializable value (object, array, string, number). + * If `contentType` is specified in options, input should be a string or Buffer. + * @param options - Run configuration options (extends all options from {@link start}) + * @param options.waitSecs - Maximum time to wait for the run to finish, in seconds. If omitted, waits indefinitely. + * @param options.log - Log instance for streaming run logs. Use `'default'` for console output, `null` to disable logging, or provide a custom Log instance. + * @param options.build - Tag or number of the build to run (e.g., `'beta'` or `'1.2.345'`). + * @param options.memory - Memory in megabytes allocated for the run. + * @param options.timeout - Maximum run duration in seconds. + * @returns The finished Actor run object with final status (`SUCCEEDED`, `FAILED`, `ABORTED`, or `TIMED-OUT`) + * @see https://docs.apify.com/api/v2/act-runs-post + * * @example * ```javascript * // Run an Actor and wait for it to finish @@ -205,17 +216,6 @@ export class ActorClient extends ResourceClient { * const log = new Log({ prefix: 'My Actor' }); * const run = await client.actor('my-actor').call({ url: 'https://example.com' }, { log }); * ``` - * - * @param input - Input for the Actor. Can be any JSON-serializable value (object, array, string, number). - * If `contentType` is specified in options, input should be a string or Buffer. - * @param options - Run configuration options (extends all options from {@link start}) - * @param options.waitSecs - Maximum time to wait for the run to finish, in seconds. If omitted, waits indefinitely. - * @param options.log - Log instance for streaming run logs. Use `'default'` for console output, `null` to disable logging, or provide a custom Log instance. - * @param options.build - Tag or number of the build to run (e.g., `'beta'` or `'1.2.345'`). - * @param options.memory - Memory in megabytes allocated for the run. - * @param options.timeout - Maximum run duration in seconds. - * @returns The finished Actor run object with final status (`SUCCEEDED`, `FAILED`, `ABORTED`, or `TIMED-OUT`) - * @see https://docs.apify.com/api/v2/act-runs-post */ async call(input?: unknown, options: ActorCallOptions = {}): Promise { // input can be anything, so no point in validating it. E.g. if you set content-type to application/pdf @@ -261,6 +261,15 @@ export class ActorClient extends ResourceClient { * Creates a new build of the specified Actor version. The build compiles the Actor's * source code, installs dependencies, and prepares it for execution. * + * @param versionNumber - Version number or tag to build (e.g., `'0.1'`, `'0.2'`, `'latest'`) + * @param options - Build configuration options + * @param options.betaPackages - If `true`, the build uses beta versions of Apify NPM packages. + * @param options.tag - Tag to be applied to the build (e.g., `'latest'`, `'beta'`). Existing tag with the same name will be replaced. + * @param options.useCache - If `false`, Docker build cache will be ignored. Default is `true`. + * @param options.waitForFinish - Maximum time to wait (in seconds, max 60s) for the build to finish on the API side before returning. Default is 0 (returns immediately). + * @returns The Build object with status and build details + * @see https://docs.apify.com/api/v2/act-builds-post + * * @example * ```javascript * // Start a build and return immediately @@ -274,15 +283,6 @@ export class ActorClient extends ResourceClient { * useCache: true * }); * ``` - * - * @param versionNumber - Version number or tag to build (e.g., `'0.1'`, `'0.2'`, `'latest'`) - * @param options - Build configuration options - * @param options.betaPackages - If `true`, the build uses beta versions of Apify NPM packages. - * @param options.tag - Tag to be applied to the build (e.g., `'latest'`, `'beta'`). Existing tag with the same name will be replaced. - * @param options.useCache - If `false`, Docker build cache will be ignored. Default is `true`. - * @param options.waitForFinish - Maximum time to wait (in seconds, max 60s) for the build to finish on the API side before returning. Default is 0 (returns immediately). - * @returns The Build object with status and build details - * @see https://docs.apify.com/api/v2/act-builds-post */ async build(versionNumber: string, options: ActorBuildOptions = {}): Promise { ow(versionNumber, ow.string); @@ -338,17 +338,17 @@ export class ActorClient extends ResourceClient { * * Provides access to the most recent Actor run, optionally filtered by status or origin. * - * @example - * ```javascript - * // Get the last successful run - * const lastRun = await client.actor('my-actor').lastRun({ status: 'SUCCEEDED' }).get(); - * ``` - * * @param options - Options to filter the last run * @param options.status - Filter by run status (e.g., `'SUCCEEDED'`, `'FAILED'`, `'RUNNING'`, `'ABORTED'`, `'TIMED-OUT'`). * @param options.origin - Filter by run origin (e.g., `'DEVELOPMENT'`, `'WEB'`, `'API'`, `'SCHEDULER'`). * @returns A client for the last run * @see https://docs.apify.com/api/v2/act-runs-last-get + * + * @example + * ```javascript + * // Get the last successful run + * const lastRun = await client.actor('my-actor').lastRun({ status: 'SUCCEEDED' }).get(); + * ``` */ lastRun(options: ActorLastRunOptions = {}): RunClient { ow( diff --git a/src/resource_clients/actor_collection.ts b/src/resource_clients/actor_collection.ts index 2782747e..ec437e3b 100644 --- a/src/resource_clients/actor_collection.ts +++ b/src/resource_clients/actor_collection.ts @@ -49,6 +49,10 @@ export class ActorCollectionClient extends ResourceCollectionClient { * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @param options - Pagination options. + * @returns A paginated iterator of Actors. + * @see https://docs.apify.com/api/v2/acts-get + * * @example * ```javascript * const paginatedList = await client.list(options); @@ -58,10 +62,6 @@ export class ActorCollectionClient extends ResourceCollectionClient { * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` - * - * @param options - Pagination options. - * @returns A paginated iterator of Actors. - * @see https://docs.apify.com/api/v2/acts-get */ list(options: ActorCollectionListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/actor_env_var_collection.ts b/src/resource_clients/actor_env_var_collection.ts index cd64b86e..3ecf26e6 100644 --- a/src/resource_clients/actor_env_var_collection.ts +++ b/src/resource_clients/actor_env_var_collection.ts @@ -51,6 +51,10 @@ export class ActorEnvVarCollectionClient extends ResourceCollectionClient { * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @param options - Pagination options. + * @returns A paginated iterator of environment variables. + * @see https://docs.apify.com/api/v2/act-version-env-vars-get + * * @example * ```javascript * const paginatedList = await client.list(options); @@ -60,10 +64,6 @@ export class ActorEnvVarCollectionClient extends ResourceCollectionClient { * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` - * - * @param options - Pagination options. - * @returns A paginated iterator of environment variables. - * @see https://docs.apify.com/api/v2/act-version-env-vars-get */ list( options: ActorEnvVarCollectionListOptions = {}, diff --git a/src/resource_clients/actor_version_collection.ts b/src/resource_clients/actor_version_collection.ts index aa7d1f54..bfaec516 100644 --- a/src/resource_clients/actor_version_collection.ts +++ b/src/resource_clients/actor_version_collection.ts @@ -49,6 +49,10 @@ export class ActorVersionCollectionClient extends ResourceCollectionClient { * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @param options - Pagination options. + * @returns A paginated iterator of Actor versions. + * @see https://docs.apify.com/api/v2/act-versions-get + * * @example * ```javascript * const paginatedList = await client.list(options); @@ -58,10 +62,6 @@ export class ActorVersionCollectionClient extends ResourceCollectionClient { * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` - * - * @param options - Pagination options. - * @returns A paginated iterator of Actor versions. - * @see https://docs.apify.com/api/v2/act-versions-get */ list( options: ActorVersionCollectionListOptions = {}, diff --git a/src/resource_clients/build_collection.ts b/src/resource_clients/build_collection.ts index 8114ea54..cc6f5267 100644 --- a/src/resource_clients/build_collection.ts +++ b/src/resource_clients/build_collection.ts @@ -46,6 +46,10 @@ export class BuildCollectionClient extends ResourceCollectionClient { * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @param options - Pagination and sorting options. + * @returns A paginated iterator of Actor builds. + * @see https://docs.apify.com/api/v2/actor-builds-get + * * @example * ```javascript * const paginatedList = await client.list(options); @@ -55,10 +59,6 @@ export class BuildCollectionClient extends ResourceCollectionClient { * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` - * - * @param options - Pagination and sorting options. - * @returns A paginated iterator of Actor builds. - * @see https://docs.apify.com/api/v2/actor-builds-get */ list(options: BuildCollectionClientListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/dataset_collection.ts b/src/resource_clients/dataset_collection.ts index 42e40a10..8af06d4a 100644 --- a/src/resource_clients/dataset_collection.ts +++ b/src/resource_clients/dataset_collection.ts @@ -45,6 +45,10 @@ export class DatasetCollectionClient extends ResourceCollectionClient { * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @param options - Pagination options. + * @returns A paginated iterator of Datasets. + * @see https://docs.apify.com/api/v2/datasets-get + * * @example * ```javascript * const paginatedList = await client.list(options); @@ -54,10 +58,6 @@ export class DatasetCollectionClient extends ResourceCollectionClient { * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` - * - * @param options - Pagination options. - * @returns A paginated iterator of Datasets. - * @see https://docs.apify.com/api/v2/datasets-get */ list(options: DatasetCollectionClientListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/key_value_store.ts b/src/resource_clients/key_value_store.ts index 9821fee6..9ddf0858 100644 --- a/src/resource_clients/key_value_store.ts +++ b/src/resource_clients/key_value_store.ts @@ -107,6 +107,14 @@ export class KeyValueStoreClient extends ResourceClient { * Returns a paginated list of all record keys in the store. Use pagination parameters * to retrieve large lists efficiently. * + * @param options - Listing options + * @param options.limit - Maximum number of keys to return. Default is 1000. + * @param options.exclusiveStartKey - Key to start listing from (for pagination). The listing starts with the next key after this one. + * @param options.collection - Filter keys by collection name. + * @param options.prefix - Filter keys that start with this prefix. + * @returns Object containing `items` array of key metadata, pagination info (`count`, `limit`, `isTruncated`, `nextExclusiveStartKey`) + * @see https://docs.apify.com/api/v2/key-value-store-keys-get + * * @example * ```javascript * // List all keys @@ -127,14 +135,6 @@ export class KeyValueStoreClient extends ResourceClient { * exclusiveStartKey = result.nextExclusiveStartKey; * } while (result.isTruncated); * ``` - * - * @param options - Listing options - * @param options.limit - Maximum number of keys to return. Default is 1000. - * @param options.exclusiveStartKey - Key to start listing from (for pagination). The listing starts with the next key after this one. - * @param options.collection - Filter keys by collection name. - * @param options.prefix - Filter keys that start with this prefix. - * @returns Object containing `items` array of key metadata, pagination info (`count`, `limit`, `isTruncated`, `nextExclusiveStartKey`) - * @see https://docs.apify.com/api/v2/key-value-store-keys-get */ async listKeys(options: KeyValueClientListKeysOptions = {}): Promise { ow( @@ -165,15 +165,15 @@ export class KeyValueStoreClient extends ResourceClient { * the URL will include a cryptographic signature for authenticated access without * requiring an API token. * + * @param key - The record key + * @returns A public URL string for accessing the record + * * @example * ```javascript * const url = await client.keyValueStore('my-store').getRecordPublicUrl('OUTPUT'); * console.log(`Public URL: ${url}`); * // You can now share this URL or use it in a browser * ``` - * - * @param key - The record key - * @returns A public URL string for accessing the record */ async getRecordPublicUrl(key: string): Promise { ow(key, ow.string.nonEmpty); @@ -196,6 +196,12 @@ export class KeyValueStoreClient extends ResourceClient { * If the client has permission to access the key-value store's URL signing key, * the URL will include a cryptographic signature which allows access without authentication. * + * @param options - URL generation options (extends all options from {@link listKeys}) + * @param options.expiresInSecs - Number of seconds until the signed URL expires. If omitted, the URL never expires. + * @param options.limit - Maximum number of keys to return. + * @param options.prefix - Filter keys by prefix. + * @returns A public URL string for accessing the keys list + * * @example * ```javascript * // Create a URL that expires in 1 hour @@ -205,12 +211,6 @@ export class KeyValueStoreClient extends ResourceClient { * }); * console.log(`Share this URL: ${url}`); * ``` - * - * @param options - URL generation options (extends all options from {@link listKeys}) - * @param options.expiresInSecs - Number of seconds until the signed URL expires. If omitted, the URL never expires. - * @param options.limit - Maximum number of keys to return. - * @param options.prefix - Filter keys by prefix. - * @returns A public URL string for accessing the keys list */ async createKeysPublicUrl(options: KeyValueClientCreateKeysUrlOptions = {}) { ow( @@ -249,6 +249,10 @@ export class KeyValueStoreClient extends ResourceClient { * * This is more efficient than {@link getRecord} when you only need to check for existence. * + * @param key - The record key to check + * @returns `true` if the record exists, `false` if it does not + * @see https://docs.apify.com/api/v2/key-value-store-record-get + * * @example * ```javascript * const exists = await client.keyValueStore('my-store').recordExists('OUTPUT'); @@ -256,10 +260,6 @@ export class KeyValueStoreClient extends ResourceClient { * console.log('OUTPUT record exists'); * } * ``` - * - * @param key - The record key to check - * @returns `true` if the record exists, `false` if it does not - * @see https://docs.apify.com/api/v2/key-value-store-record-get */ async recordExists(key: string): Promise { const requestOpts: Record = { @@ -359,6 +359,18 @@ export class KeyValueStoreClient extends ResourceClient { * the upload cannot be retried on failure or follow redirects. For reliable uploads, * buffer the entire stream into memory first. * + * @param record - The record to store + * @param record.key - Record key (unique identifier) + * @param record.value - Record value (object, string, Buffer, or Stream) + * @param record.contentType - Optional MIME type. Auto-detected if not provided: + * - Objects: `'application/json; charset=utf-8'` + * - Strings: `'text/plain; charset=utf-8'` + * - Buffers/Streams: `'application/octet-stream'` + * @param options - Storage options + * @param options.timeoutSecs - Timeout for the upload in seconds. Default varies by value size. + * @param options.doNotRetryTimeouts - If `true`, don't retry on timeout errors. Default is `false`. + * @see https://docs.apify.com/api/v2/key-value-store-record-put + * * @example * ```javascript * // Store JSON object @@ -382,18 +394,6 @@ export class KeyValueStoreClient extends ResourceClient { * contentType: 'image/png' * }); * ``` - * - * @param record - The record to store - * @param record.key - Record key (unique identifier) - * @param record.value - Record value (object, string, Buffer, or Stream) - * @param record.contentType - Optional MIME type. Auto-detected if not provided: - * - Objects: `'application/json; charset=utf-8'` - * - Strings: `'text/plain; charset=utf-8'` - * - Buffers/Streams: `'application/octet-stream'` - * @param options - Storage options - * @param options.timeoutSecs - Timeout for the upload in seconds. Default varies by value size. - * @param options.doNotRetryTimeouts - If `true`, don't retry on timeout errors. Default is `false`. - * @see https://docs.apify.com/api/v2/key-value-store-record-put */ async setRecord(record: KeyValueStoreRecord, options: KeyValueStoreRecordOptions = {}): Promise { ow( @@ -451,13 +451,13 @@ export class KeyValueStoreClient extends ResourceClient { /** * Deletes a record from the key-value store. * + * @param key - The record key to delete + * @see https://docs.apify.com/api/v2/key-value-store-record-delete + * * @example * ```javascript * await client.keyValueStore('my-store').deleteRecord('temp-data'); * ``` - * - * @param key - The record key to delete - * @see https://docs.apify.com/api/v2/key-value-store-record-delete */ async deleteRecord(key: string): Promise { ow(key, ow.string); diff --git a/src/resource_clients/key_value_store_collection.ts b/src/resource_clients/key_value_store_collection.ts index 8950a14d..5123b5df 100644 --- a/src/resource_clients/key_value_store_collection.ts +++ b/src/resource_clients/key_value_store_collection.ts @@ -45,6 +45,10 @@ export class KeyValueStoreCollectionClient extends ResourceCollectionClient { * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @param options - Pagination options. + * @returns A paginated iterator of Key-value stores. + * @see https://docs.apify.com/api/v2/key-value-stores-get + * * @example * ```javascript * const paginatedList = await client.list(options); @@ -54,10 +58,6 @@ export class KeyValueStoreCollectionClient extends ResourceCollectionClient { * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` - * - * @param options - Pagination options. - * @returns A paginated iterator of Key-value stores. - * @see https://docs.apify.com/api/v2/key-value-stores-get */ list( options: KeyValueStoreCollectionClientListOptions = {}, diff --git a/src/resource_clients/request_queue_collection.ts b/src/resource_clients/request_queue_collection.ts index 3ad2ebfe..a6eb5a3c 100644 --- a/src/resource_clients/request_queue_collection.ts +++ b/src/resource_clients/request_queue_collection.ts @@ -45,6 +45,10 @@ export class RequestQueueCollectionClient extends ResourceCollectionClient { * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @param options - Pagination options. + * @returns A paginated iterator of Request queues. + * @see https://docs.apify.com/api/v2/request-queues-get + * * @example * ```javascript * const paginatedList = await client.list(options); @@ -54,10 +58,6 @@ export class RequestQueueCollectionClient extends ResourceCollectionClient { * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` - * - * @param options - Pagination options. - * @returns A paginated iterator of Request queues. - * @see https://docs.apify.com/api/v2/request-queues-get */ list( options: RequestQueueCollectionListOptions = {}, diff --git a/src/resource_clients/run.ts b/src/resource_clients/run.ts index 17900958..cf9066db 100644 --- a/src/resource_clients/run.ts +++ b/src/resource_clients/run.ts @@ -53,6 +53,11 @@ export class RunClient extends ResourceClient { /** * Gets the Actor run object from the Apify API. * + * @param options - Get options + * @param options.waitForFinish - Maximum time to wait (in seconds, max 60s) for the run to finish on the API side before returning. Default is 0 (returns immediately). + * @returns The ActorRun object, or `undefined` if it does not exist + * @see https://docs.apify.com/api/v2/actor-run-get + * * @example * ```javascript * // Get run status immediately @@ -62,11 +67,6 @@ export class RunClient extends ResourceClient { * // Wait up to 60 seconds for run to finish * const run = await client.run('run-id').get({ waitForFinish: 60 }); * ``` - * - * @param options - Get options - * @param options.waitForFinish - Maximum time to wait (in seconds, max 60s) for the run to finish on the API side before returning. Default is 0 (returns immediately). - * @returns The ActorRun object, or `undefined` if it does not exist - * @see https://docs.apify.com/api/v2/actor-run-get */ async get(options: RunGetOptions = {}): Promise { ow( @@ -82,6 +82,11 @@ export class RunClient extends ResourceClient { /** * Aborts the Actor run. * + * @param options - Abort options + * @param options.gracefully - If `true`, the Actor run will abort gracefully - it can send status messages and perform cleanup. Default is `false` (immediate abort). + * @returns The updated ActorRun object with `ABORTING` or `ABORTED` status + * @see https://docs.apify.com/api/v2/actor-run-abort-post + * * @example * ```javascript * // Abort immediately @@ -90,11 +95,6 @@ export class RunClient extends ResourceClient { * // Abort gracefully (allows cleanup) * await client.run('run-id').abort({ gracefully: true }); * ``` - * - * @param options - Abort options - * @param options.gracefully - If `true`, the Actor run will abort gracefully - it can send status messages and perform cleanup. Default is `false` (immediate abort). - * @returns The updated ActorRun object with `ABORTING` or `ABORTED` status - * @see https://docs.apify.com/api/v2/actor-run-abort-post */ async abort(options: RunAbortOptions = {}): Promise { ow( @@ -129,6 +129,14 @@ export class RunClient extends ResourceClient { * and resource allocation. The run effectively becomes a run of the target Actor with new input. * This is useful for chaining Actor executions or implementing complex workflows. * + * @param targetActorId - ID or username/name of the target Actor + * @param input - Input for the target Actor. Can be any JSON-serializable value. + * @param options - Metamorph options + * @param options.build - Tag or number of the target Actor's build to run. Default is the target Actor's default build. + * @param options.contentType - Content type of the input. If specified, input must be a string or Buffer. + * @returns The metamorphed ActorRun object (same ID, but now running the target Actor) + * @see https://docs.apify.com/api/v2/actor-run-metamorph-post + * * @example * ```javascript * // Transform current run into another Actor @@ -138,14 +146,6 @@ export class RunClient extends ResourceClient { * ); * console.log(`Run ${metamorphedRun.id} is now running ${metamorphedRun.actId}`); * ``` - * - * @param targetActorId - ID or username/name of the target Actor - * @param input - Input for the target Actor. Can be any JSON-serializable value. - * @param options - Metamorph options - * @param options.build - Tag or number of the target Actor's build to run. Default is the target Actor's default build. - * @param options.contentType - Content type of the input. If specified, input must be a string or Buffer. - * @returns The metamorphed ActorRun object (same ID, but now running the target Actor) - * @see https://docs.apify.com/api/v2/actor-run-metamorph-post */ async metamorph(targetActorId: string, input: unknown, options: RunMetamorphOptions = {}): Promise { ow(targetActorId, ow.string); @@ -194,13 +194,13 @@ export class RunClient extends ResourceClient { * This can be useful to recover from certain errors or to force the Actor to restart * with a fresh environment. * + * @returns The updated ActorRun object + * @see https://docs.apify.com/api/v2/actor-run-reboot-post + * * @example * ```javascript * const run = await client.run('run-id').reboot(); * ``` - * - * @returns The updated ActorRun object - * @see https://docs.apify.com/api/v2/actor-run-reboot-post */ async reboot(): Promise { const request: AxiosRequestConfig = { @@ -215,6 +215,12 @@ export class RunClient extends ResourceClient { /** * Updates the Actor run with specified fields. * + * @param newFields - Fields to update + * @param newFields.statusMessage - Custom status message to display (e.g., "Processing page 10/100") + * @param newFields.isStatusMessageTerminal - If `true`, the status message is final and won't be overwritten. Default is `false`. + * @param newFields.generalAccess - General resource access level ('FOLLOW_USER_SETTING', 'ANYONE_WITH_ID_CAN_READ' or 'RESTRICTED') + * @returns The updated ActorRun object + * * @example * ```javascript * // Set a status message @@ -222,12 +228,6 @@ export class RunClient extends ResourceClient { * statusMessage: 'Processing items: 50/100' * }); * ``` - * - * @param newFields - Fields to update - * @param newFields.statusMessage - Custom status message to display (e.g., "Processing page 10/100") - * @param newFields.isStatusMessageTerminal - If `true`, the status message is final and won't be overwritten. Default is `false`. - * @param newFields.generalAccess - General resource access level ('FOLLOW_USER_SETTING', 'ANYONE_WITH_ID_CAN_READ' or 'RESTRICTED') - * @returns The updated ActorRun object */ async update(newFields: RunUpdateOptions): Promise { ow(newFields, ow.object); @@ -241,13 +241,6 @@ export class RunClient extends ResourceClient { * This creates a new run with the same configuration as the original run. The original * run's storages (dataset, key-value store, request queue) are preserved and reused. * - * @example - * ```javascript - * // Resurrect a failed run with more memory - * const newRun = await client.run('failed-run-id').resurrect({ memory: 2048 }); - * console.log(`New run started: ${newRun.id}`); - * ``` - * * @param options - Resurrection options (override original run settings) * @param options.build - Tag or number of the build to use. If not provided, uses the original run's build. * @param options.memory - Memory in megabytes. If not provided, uses the original run's memory. @@ -257,6 +250,13 @@ export class RunClient extends ResourceClient { * @param options.restartOnError - Whether to restart on error. * @returns The new (resurrected) ActorRun object * @see https://docs.apify.com/api/v2/post-resurrect-run + * + * @example + * ```javascript + * // Resurrect a failed run with more memory + * const newRun = await client.run('failed-run-id').resurrect({ memory: 2048 }); + * console.log(`New run started: ${newRun.id}`); + * ``` */ async resurrect(options: RunResurrectOptions = {}): Promise { ow( @@ -363,14 +363,14 @@ export class RunClient extends ResourceClient { /** * Returns a client for the default dataset of this Actor run. * + * @returns A client for accessing the run's default dataset + * @see https://docs.apify.com/api/v2/actor-run-get + * * @example * ```javascript * // Access run's dataset * const { items } = await client.run('run-id').dataset().listItems(); * ``` - * - * @returns A client for accessing the run's default dataset - * @see https://docs.apify.com/api/v2/actor-run-get */ dataset(): DatasetClient { return new DatasetClient( @@ -383,14 +383,14 @@ export class RunClient extends ResourceClient { /** * Returns a client for the default key-value store of this Actor run. * + * @returns A client for accessing the run's default key-value store + * @see https://docs.apify.com/api/v2/actor-run-get + * * @example * ```javascript * // Access run's key-value store * const output = await client.run('run-id').keyValueStore().getRecord('OUTPUT'); * ``` - * - * @returns A client for accessing the run's default key-value store - * @see https://docs.apify.com/api/v2/actor-run-get */ keyValueStore(): KeyValueStoreClient { return new KeyValueStoreClient( @@ -403,14 +403,14 @@ export class RunClient extends ResourceClient { /** * Returns a client for the default Request queue of this Actor run. * + * @returns A client for accessing the run's default Request queue + * @see https://docs.apify.com/api/v2/actor-run-get + * * @example * ```javascript * // Access run's Request queue * const { items } = await client.run('run-id').requestQueue().listHead(); * ``` - * - * @returns A client for accessing the run's default Request queue - * @see https://docs.apify.com/api/v2/actor-run-get */ requestQueue(): RequestQueueClient { return new RequestQueueClient( @@ -423,15 +423,15 @@ export class RunClient extends ResourceClient { /** * Returns a client for accessing the log of this Actor run. * + * @returns A client for accessing the run's log + * @see https://docs.apify.com/api/v2/actor-run-get + * * @example * ```javascript * // Get run log * const log = await client.run('run-id').log().get(); * console.log(log); * ``` - * - * @returns A client for accessing the run's log - * @see https://docs.apify.com/api/v2/actor-run-get */ log(): LogClient { return new LogClient( diff --git a/src/resource_clients/run_collection.ts b/src/resource_clients/run_collection.ts index 4e4d3cf0..da7a41a0 100644 --- a/src/resource_clients/run_collection.ts +++ b/src/resource_clients/run_collection.ts @@ -48,6 +48,10 @@ export class RunCollectionClient extends ResourceCollectionClient { * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @param options - Pagination and filtering options. + * @returns A paginated iterator of Actor runs. + * @see https://docs.apify.com/api/v2/actor-runs-get + * * @example * ```javascript * const paginatedList = await client.list(options); @@ -57,10 +61,6 @@ export class RunCollectionClient extends ResourceCollectionClient { * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` - * - * @param options - Pagination and filtering options. - * @returns A paginated iterator of Actor runs. - * @see https://docs.apify.com/api/v2/actor-runs-get */ list(options: RunCollectionListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/schedule_collection.ts b/src/resource_clients/schedule_collection.ts index e840bc96..b160c42d 100644 --- a/src/resource_clients/schedule_collection.ts +++ b/src/resource_clients/schedule_collection.ts @@ -49,6 +49,10 @@ export class ScheduleCollectionClient extends ResourceCollectionClient { * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @param options - Pagination and sorting options. + * @returns A paginated iterator of schedules. + * @see https://docs.apify.com/api/v2/schedules-get + * * @example * ```javascript * const paginatedList = await client.list(options); @@ -58,10 +62,6 @@ export class ScheduleCollectionClient extends ResourceCollectionClient { * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` - * - * @param options - Pagination and sorting options. - * @returns A paginated iterator of schedules. - * @see https://docs.apify.com/api/v2/schedules-get */ list(options: ScheduleCollectionListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/store_collection.ts b/src/resource_clients/store_collection.ts index 96540bd7..01108a9f 100644 --- a/src/resource_clients/store_collection.ts +++ b/src/resource_clients/store_collection.ts @@ -45,6 +45,10 @@ export class StoreCollectionClient extends ResourceCollectionClient { * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @param options - Search and pagination options. + * @returns A paginated iterator of store Actors. + * @see https://docs.apify.com/api/v2/store-actors-get + * * @example * ```javascript * const paginatedList = await client.list(options); @@ -54,10 +58,6 @@ export class StoreCollectionClient extends ResourceCollectionClient { * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` - * - * @param options - Search and pagination options. - * @returns A paginated iterator of store Actors. - * @see https://docs.apify.com/api/v2/store-actors-get */ list(options: StoreCollectionListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/task_collection.ts b/src/resource_clients/task_collection.ts index 6502e314..fc9255ac 100644 --- a/src/resource_clients/task_collection.ts +++ b/src/resource_clients/task_collection.ts @@ -49,6 +49,10 @@ export class TaskCollectionClient extends ResourceCollectionClient { * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @param options - Pagination and sorting options. + * @returns A paginated iterator of tasks. + * @see https://docs.apify.com/api/v2/actor-tasks-get + * * @example * ```javascript * const paginatedList = await client.list(options); @@ -58,10 +62,6 @@ export class TaskCollectionClient extends ResourceCollectionClient { * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` - * - * @param options - Pagination and sorting options. - * @returns A paginated iterator of tasks. - * @see https://docs.apify.com/api/v2/actor-tasks-get */ list(options: TaskCollectionListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/webhook_collection.ts b/src/resource_clients/webhook_collection.ts index d1ef3d53..01223ba1 100644 --- a/src/resource_clients/webhook_collection.ts +++ b/src/resource_clients/webhook_collection.ts @@ -48,6 +48,10 @@ export class WebhookCollectionClient extends ResourceCollectionClient { * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @param options - Pagination and sorting options. + * @returns A paginated iterator of webhooks. + * @see https://docs.apify.com/api/v2/webhooks-get + * * @example * ```javascript * const paginatedList = await client.list(options); @@ -57,10 +61,6 @@ export class WebhookCollectionClient extends ResourceCollectionClient { * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` - * - * @param options - Pagination and sorting options. - * @returns A paginated iterator of webhooks. - * @see https://docs.apify.com/api/v2/webhooks-get */ list( diff --git a/src/resource_clients/webhook_dispatch_collection.ts b/src/resource_clients/webhook_dispatch_collection.ts index 71e7bdd7..5ab7d6aa 100644 --- a/src/resource_clients/webhook_dispatch_collection.ts +++ b/src/resource_clients/webhook_dispatch_collection.ts @@ -43,6 +43,10 @@ export class WebhookDispatchCollectionClient extends ResourceCollectionClient { * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are * retrieved. * + * @param options - Pagination and sorting options. + * @returns A paginated iterator of webhook dispatches. + * @see https://docs.apify.com/api/v2/webhook-dispatches-get + * * @example * ```javascript * const paginatedList = await client.list(options); @@ -52,10 +56,6 @@ export class WebhookDispatchCollectionClient extends ResourceCollectionClient { * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` - * - * @param options - Pagination and sorting options. - * @returns A paginated iterator of webhook dispatches. - * @see https://docs.apify.com/api/v2/webhook-dispatches-get */ list(options: WebhookDispatchCollectionListOptions = {}): PaginatedIterator { ow( From 0eb8836f5eeee36b090971917866531b5c92af1a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 1 Dec 2025 19:57:19 +0000 Subject: [PATCH 4/4] Revert @example tags to inline code blocks in collection list() methods Co-authored-by: B4nan <615580+B4nan@users.noreply.github.com> --- src/resource_clients/actor_collection.ts | 17 +++++++---------- .../actor_env_var_collection.ts | 17 +++++++---------- .../actor_version_collection.ts | 17 +++++++---------- src/resource_clients/build_collection.ts | 17 +++++++---------- src/resource_clients/dataset_collection.ts | 17 +++++++---------- .../key_value_store_collection.ts | 17 +++++++---------- .../request_queue_collection.ts | 17 +++++++---------- src/resource_clients/run_collection.ts | 17 +++++++---------- src/resource_clients/schedule_collection.ts | 17 +++++++---------- src/resource_clients/store_collection.ts | 17 +++++++---------- src/resource_clients/task_collection.ts | 17 +++++++---------- src/resource_clients/webhook_collection.ts | 17 +++++++---------- .../webhook_dispatch_collection.ts | 17 +++++++---------- 13 files changed, 91 insertions(+), 130 deletions(-) diff --git a/src/resource_clients/actor_collection.ts b/src/resource_clients/actor_collection.ts index ec437e3b..0add7fa3 100644 --- a/src/resource_clients/actor_collection.ts +++ b/src/resource_clients/actor_collection.ts @@ -45,23 +45,20 @@ export class ActorCollectionClient extends ResourceCollectionClient { * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * - * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are - * retrieved. - * - * @param options - Pagination options. - * @returns A paginated iterator of Actors. - * @see https://docs.apify.com/api/v2/acts-get - * - * @example * ```javascript * const paginatedList = await client.list(options); * ``` * - * @example + * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are + * retrieved. + * * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination options. + * @returns A paginated iterator of Actors. + * @see https://docs.apify.com/api/v2/acts-get */ list(options: ActorCollectionListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/actor_env_var_collection.ts b/src/resource_clients/actor_env_var_collection.ts index 3ecf26e6..a215922c 100644 --- a/src/resource_clients/actor_env_var_collection.ts +++ b/src/resource_clients/actor_env_var_collection.ts @@ -47,23 +47,20 @@ export class ActorEnvVarCollectionClient extends ResourceCollectionClient { * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * - * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are - * retrieved. - * - * @param options - Pagination options. - * @returns A paginated iterator of environment variables. - * @see https://docs.apify.com/api/v2/act-version-env-vars-get - * - * @example * ```javascript * const paginatedList = await client.list(options); * ``` * - * @example + * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are + * retrieved. + * * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination options. + * @returns A paginated iterator of environment variables. + * @see https://docs.apify.com/api/v2/act-version-env-vars-get */ list( options: ActorEnvVarCollectionListOptions = {}, diff --git a/src/resource_clients/actor_version_collection.ts b/src/resource_clients/actor_version_collection.ts index bfaec516..f4b9d67f 100644 --- a/src/resource_clients/actor_version_collection.ts +++ b/src/resource_clients/actor_version_collection.ts @@ -45,23 +45,20 @@ export class ActorVersionCollectionClient extends ResourceCollectionClient { * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * - * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are - * retrieved. - * - * @param options - Pagination options. - * @returns A paginated iterator of Actor versions. - * @see https://docs.apify.com/api/v2/act-versions-get - * - * @example * ```javascript * const paginatedList = await client.list(options); * ``` * - * @example + * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are + * retrieved. + * * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination options. + * @returns A paginated iterator of Actor versions. + * @see https://docs.apify.com/api/v2/act-versions-get */ list( options: ActorVersionCollectionListOptions = {}, diff --git a/src/resource_clients/build_collection.ts b/src/resource_clients/build_collection.ts index cc6f5267..bb7b0d58 100644 --- a/src/resource_clients/build_collection.ts +++ b/src/resource_clients/build_collection.ts @@ -42,23 +42,20 @@ export class BuildCollectionClient extends ResourceCollectionClient { * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * - * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are - * retrieved. - * - * @param options - Pagination and sorting options. - * @returns A paginated iterator of Actor builds. - * @see https://docs.apify.com/api/v2/actor-builds-get - * - * @example * ```javascript * const paginatedList = await client.list(options); * ``` * - * @example + * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are + * retrieved. + * * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination and sorting options. + * @returns A paginated iterator of Actor builds. + * @see https://docs.apify.com/api/v2/actor-builds-get */ list(options: BuildCollectionClientListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/dataset_collection.ts b/src/resource_clients/dataset_collection.ts index 8af06d4a..2d7fdf17 100644 --- a/src/resource_clients/dataset_collection.ts +++ b/src/resource_clients/dataset_collection.ts @@ -41,23 +41,20 @@ export class DatasetCollectionClient extends ResourceCollectionClient { * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * - * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are - * retrieved. - * - * @param options - Pagination options. - * @returns A paginated iterator of Datasets. - * @see https://docs.apify.com/api/v2/datasets-get - * - * @example * ```javascript * const paginatedList = await client.list(options); * ``` * - * @example + * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are + * retrieved. + * * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination options. + * @returns A paginated iterator of Datasets. + * @see https://docs.apify.com/api/v2/datasets-get */ list(options: DatasetCollectionClientListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/key_value_store_collection.ts b/src/resource_clients/key_value_store_collection.ts index 5123b5df..c2fe0670 100644 --- a/src/resource_clients/key_value_store_collection.ts +++ b/src/resource_clients/key_value_store_collection.ts @@ -41,23 +41,20 @@ export class KeyValueStoreCollectionClient extends ResourceCollectionClient { * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * - * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are - * retrieved. - * - * @param options - Pagination options. - * @returns A paginated iterator of Key-value stores. - * @see https://docs.apify.com/api/v2/key-value-stores-get - * - * @example * ```javascript * const paginatedList = await client.list(options); * ``` * - * @example + * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are + * retrieved. + * * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination options. + * @returns A paginated iterator of Key-value stores. + * @see https://docs.apify.com/api/v2/key-value-stores-get */ list( options: KeyValueStoreCollectionClientListOptions = {}, diff --git a/src/resource_clients/request_queue_collection.ts b/src/resource_clients/request_queue_collection.ts index a6eb5a3c..9bd422bc 100644 --- a/src/resource_clients/request_queue_collection.ts +++ b/src/resource_clients/request_queue_collection.ts @@ -41,23 +41,20 @@ export class RequestQueueCollectionClient extends ResourceCollectionClient { * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * - * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are - * retrieved. - * - * @param options - Pagination options. - * @returns A paginated iterator of Request queues. - * @see https://docs.apify.com/api/v2/request-queues-get - * - * @example * ```javascript * const paginatedList = await client.list(options); * ``` * - * @example + * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are + * retrieved. + * * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination options. + * @returns A paginated iterator of Request queues. + * @see https://docs.apify.com/api/v2/request-queues-get */ list( options: RequestQueueCollectionListOptions = {}, diff --git a/src/resource_clients/run_collection.ts b/src/resource_clients/run_collection.ts index da7a41a0..1622dd04 100644 --- a/src/resource_clients/run_collection.ts +++ b/src/resource_clients/run_collection.ts @@ -44,23 +44,20 @@ export class RunCollectionClient extends ResourceCollectionClient { * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * - * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are - * retrieved. - * - * @param options - Pagination and filtering options. - * @returns A paginated iterator of Actor runs. - * @see https://docs.apify.com/api/v2/actor-runs-get - * - * @example * ```javascript * const paginatedList = await client.list(options); * ``` * - * @example + * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are + * retrieved. + * * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination and filtering options. + * @returns A paginated iterator of Actor runs. + * @see https://docs.apify.com/api/v2/actor-runs-get */ list(options: RunCollectionListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/schedule_collection.ts b/src/resource_clients/schedule_collection.ts index b160c42d..7b35397e 100644 --- a/src/resource_clients/schedule_collection.ts +++ b/src/resource_clients/schedule_collection.ts @@ -45,23 +45,20 @@ export class ScheduleCollectionClient extends ResourceCollectionClient { * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * - * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are - * retrieved. - * - * @param options - Pagination and sorting options. - * @returns A paginated iterator of schedules. - * @see https://docs.apify.com/api/v2/schedules-get - * - * @example * ```javascript * const paginatedList = await client.list(options); * ``` * - * @example + * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are + * retrieved. + * * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination and sorting options. + * @returns A paginated iterator of schedules. + * @see https://docs.apify.com/api/v2/schedules-get */ list(options: ScheduleCollectionListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/store_collection.ts b/src/resource_clients/store_collection.ts index 01108a9f..14365e68 100644 --- a/src/resource_clients/store_collection.ts +++ b/src/resource_clients/store_collection.ts @@ -41,23 +41,20 @@ export class StoreCollectionClient extends ResourceCollectionClient { * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * - * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are - * retrieved. - * - * @param options - Search and pagination options. - * @returns A paginated iterator of store Actors. - * @see https://docs.apify.com/api/v2/store-actors-get - * - * @example * ```javascript * const paginatedList = await client.list(options); * ``` * - * @example + * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are + * retrieved. + * * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Search and pagination options. + * @returns A paginated iterator of store Actors. + * @see https://docs.apify.com/api/v2/store-actors-get */ list(options: StoreCollectionListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/task_collection.ts b/src/resource_clients/task_collection.ts index fc9255ac..2c5a9833 100644 --- a/src/resource_clients/task_collection.ts +++ b/src/resource_clients/task_collection.ts @@ -45,23 +45,20 @@ export class TaskCollectionClient extends ResourceCollectionClient { * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * - * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are - * retrieved. - * - * @param options - Pagination and sorting options. - * @returns A paginated iterator of tasks. - * @see https://docs.apify.com/api/v2/actor-tasks-get - * - * @example * ```javascript * const paginatedList = await client.list(options); * ``` * - * @example + * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are + * retrieved. + * * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination and sorting options. + * @returns A paginated iterator of tasks. + * @see https://docs.apify.com/api/v2/actor-tasks-get */ list(options: TaskCollectionListOptions = {}): PaginatedIterator { ow( diff --git a/src/resource_clients/webhook_collection.ts b/src/resource_clients/webhook_collection.ts index 01223ba1..1eaa6781 100644 --- a/src/resource_clients/webhook_collection.ts +++ b/src/resource_clients/webhook_collection.ts @@ -44,23 +44,20 @@ export class WebhookCollectionClient extends ResourceCollectionClient { * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * - * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are - * retrieved. - * - * @param options - Pagination and sorting options. - * @returns A paginated iterator of webhooks. - * @see https://docs.apify.com/api/v2/webhooks-get - * - * @example * ```javascript * const paginatedList = await client.list(options); * ``` * - * @example + * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are + * retrieved. + * * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination and sorting options. + * @returns A paginated iterator of webhooks. + * @see https://docs.apify.com/api/v2/webhooks-get */ list( diff --git a/src/resource_clients/webhook_dispatch_collection.ts b/src/resource_clients/webhook_dispatch_collection.ts index 5ab7d6aa..73823ad7 100644 --- a/src/resource_clients/webhook_dispatch_collection.ts +++ b/src/resource_clients/webhook_dispatch_collection.ts @@ -39,23 +39,20 @@ export class WebhookDispatchCollectionClient extends ResourceCollectionClient { * * Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched * items in a single API call is limited. - * - * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are - * retrieved. - * - * @param options - Pagination and sorting options. - * @returns A paginated iterator of webhook dispatches. - * @see https://docs.apify.com/api/v2/webhook-dispatches-get - * - * @example * ```javascript * const paginatedList = await client.list(options); * ``` * - * @example + * Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are + * retrieved. + * * ```javascript * for await (const singleItem of client.list(options)) {...} * ``` + * + * @param options - Pagination and sorting options. + * @returns A paginated iterator of webhook dispatches. + * @see https://docs.apify.com/api/v2/webhook-dispatches-get */ list(options: WebhookDispatchCollectionListOptions = {}): PaginatedIterator { ow(