0.0.4 • Published 2 years ago

@adactiveasia/apify-client v0.0.4

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

fork from apify client for javascript fixing error on build

Apify API client for JavaScript

apify-client is the official library to access Apify API from your JavaScript applications. It runs both in Node.js and browser and provides useful features like automatic retries and convenience functions that improve the experience of using the Apify API.

Quick Start

const ApifyClient = require('apify-client');

const client = new ApifyClient({
    token: 'MY-APIFY-TOKEN',
});

// Starts an actor and waits for it to finish.
const { defaultDatasetId } = await client.actor('john-doe/my-cool-actor').call();
// Fetches results from the actor's dataset.
const { items } = await client.dataset(defaultDatasetId).listItems();

Features

Besides greatly simplifying the process of querying the Apify API, the client provides other useful features.

Automatic parsing and error handling

Based on the endpoint, the client automatically extracts the relevant data and returns it in the expected format. Date strings are automatically converted to Date objects. For exceptions, we throw an ApifyApiError, which wraps the plain JSON errors returned by API and enriches them with other context for easier debugging.

Retries with exponential backoff

Network communication sometimes fails, that's a given. The client will automatically retry requests that failed due to a network error, an internal error of the Apify API (HTTP 500+) or rate limit error (HTTP 429). By default, it will retry up to 8 times. First retry will be attempted after ~500ms, second after ~1000ms and so on. You can configure those parameters using the maxRetries and minDelayBetweenRetriesMillis options of the ApifyClient constructor.

Convenience functions and options

Some actions can't be performed by the API itself, such as indefinite waiting for an actor run to finish (because of network timeouts). The client provides convenient call() and waitForFinish() functions that do that. Key-value store records can be retrieved as objects, buffers or streams via the respective options, dataset items can be fetched as individual objects or serialized data and we plan to add better stream support and async iterators.

Usage concepts

The ApifyClient interface follows a generic pattern that is applicable to all of its components. By calling individual methods of ApifyClient, specific clients which target individual API resources are created. There are two types of those clients. A client for management of a single resource and a client for a collection of resources.

const ApifyClient = require('apify-client');
const apifyClient = new ApifyClient({ token: 'my-token' });

// Collection clients do not require a parameter.
const actorCollectionClient = apifyClient.actors();
// Creates an actor with the name: my-actor.
const myActor = await actorCollectionClient.create({ name: 'my-actor' });
// Lists all of your actors.
const { items } = await actorCollectionClient.list();
// Collection clients do not require a parameter.
const datasetCollectionClient = apifyClient.datasets();
// Gets (or creates, if it doesn't exist) a dataset with the name of my-dataset.
const myDataset = await datasetCollectionClient.getOrCreate('my-dataset');
// Resource clients accept an ID of the resource.
const actorClient = apifyClient.actor('john-doe/my-actor');
// Fetches the john-doe/my-actor object from the API.
const myActor = await actorClient.get();
// Starts the run of john-doe/my-actor and returns the Run object.
const myActorRun = await actorClient.start();
// Resource clients accept an ID of the resource.
const datasetClient = apifyClient.dataset('john-doe/my-dataset');
// Appends items to the end of john-doe/my-dataset.
await datasetClient.pushItems([{ foo: 1 }, { bar: 2 }]);

The ID of the resource can be either the id of the said resource, or a combination of your username/resource-name.

This is really all you need to remember, because all resource clients follow the pattern you see above.

Nested clients

Sometimes clients return other clients. That's to simplify working with nested collections, such as runs of a given actor.

const actorClient = apifyClient.actor('john-doe/hello-world');
const runsClient = actorClient.runs();
// Lists the last 10 runs of the john-doe/hello-world actor.
const { items } = await runsClient.list({ limit: 10, desc: true })

// Selects the last run of the john-doe/hello-world actor that finished
// with a SUCCEEDED status.
const lastSucceededRunClient = actorClient.lastRun({ status: 'SUCCEEDED' });
// Fetches items from the run's dataset.
const { items } = await lastSucceededRunClient.dataset().listItems();

The quick access to dataset and other storages directly from the run client can now only be used with the lastRun() method, but the feature will be available to all runs in the future.

Pagination

Most methods named list or listSomething return a Promise.<PaginationList>. There are some exceptions though, like listKeys or listHead which paginate differently. The results you're looking for are always stored under items and you can use the limit property to get only a subset of results. Other props are also available, depending on the method.

API Reference

All public classes, methods and their parameters can be inspected in this API reference.

ApifyClient

ApifyClient is the official library to access Apify API from your JavaScript applications. It runs both in Node.js and browser.


new ApifyClient([options])

ParamTypeDefault
optionsobject
options.baseUrlstring"https://api.apify.com"
options.maxRetriesnumber8
options.minDelayBetweenRetriesMillisnumber500
options.requestInterceptorsArray.<function()>
options.timeoutSecsnumber
options.tokenstring

apifyClient.actors()ActorCollectionClient

https://docs.apify.com/api/v2#/reference/actors/actor-collection


apifyClient.actor(id)ActorClient

https://docs.apify.com/api/v2#/reference/actors/actor-object

ParamType
idstring

apifyClient.build(id)BuildClient

https://docs.apify.com/api/v2#/reference/actor-builds/build-object

ParamType
idstring

apifyClient.datasets()DatasetCollectionClient

https://docs.apify.com/api/v2#/reference/datasets/dataset-collection


apifyClient.dataset(id)DatasetClient

https://docs.apify.com/api/v2#/reference/datasets/dataset

ParamType
idstring

apifyClient.keyValueStores()KeyValueStoreCollectionClient

https://docs.apify.com/api/v2#/reference/key-value-stores/store-collection


apifyClient.keyValueStore(id)KeyValueStoreClient

https://docs.apify.com/api/v2#/reference/key-value-stores/store-object

ParamType
idstring

apifyClient.log(buildOrRunId)LogClient

https://docs.apify.com/api/v2#/reference/logs

ParamType
buildOrRunIdstring

apifyClient.requestQueues()RequestQueueCollection

https://docs.apify.com/api/v2#/reference/request-queues/queue-collection


apifyClient.requestQueue(id, [options])RequestQueueClient

https://docs.apify.com/api/v2#/reference/request-queues/queue

ParamType
idstring
optionsobject
options.clientKeyobject

apifyClient.run(id)RunClient

https://docs.apify.com/api/v2#/reference/actor-runs/run-object-and-its-storages

ParamType
idstring

apifyClient.tasks()TaskCollectionClient

https://docs.apify.com/api/v2#/reference/actor-tasks/task-collection


apifyClient.task(id)TaskClient

https://docs.apify.com/api/v2#/reference/actor-tasks/task-object

ParamType
idstring

apifyClient.schedules()ScheduleCollectionClient

https://docs.apify.com/api/v2#/reference/schedules/schedules-collection


apifyClient.schedule(id)ScheduleClient

https://docs.apify.com/api/v2#/reference/schedules/schedule-object

ParamType
idstring

apifyClient.user(id)UserClient

https://docs.apify.com/api/v2#/reference/users

ParamType
idstring

apifyClient.webhooks()WebhookCollectionClient

https://docs.apify.com/api/v2#/reference/webhooks/webhook-collection


apifyClient.webhook(id)WebhookClient

https://docs.apify.com/api/v2#/reference/webhooks/webhook-object

ParamType
idstring

apifyClient.webhookDispatches()WebhookDispatchCollectionClient

https://docs.apify.com/api/v2#/reference/webhook-dispatches


apifyClient.webhookDispatch(id)WebhookDispatchClient

https://docs.apify.com/api/v2#/reference/webhook-dispatches/webhook-dispatch-object

ParamType
idstring

ApifyApiError

An ApifyApiError is thrown for successful HTTP requests that reach the API, but the API responds with an error response. Typically, those are rate limit errors and internal errors, which are automatically retried, or validation errors, which are thrown immediately, because a correction by the user is needed.

Properties

NameTypeDescription
messagestringError message returned by the API.
clientMethodstringThe invoked resource client and the method. Known issue: Sometimes it displays as undefined because it can't be parsed from a stack trace.
statusCodenumberHTTP status code of the error.
typestringThe type of the error, as returned by the API.
attemptnumberNumber of the API call attempt.
httpMethodstringHTTP method of the API call.
pathstringFull path of the API endpoint (URL excluding origin).
originalStackstringOriginal stack trace of the exception. It is replaced by a more informative stack with API call information.

ActorClient


actorClient.build(versionNumber, [options])Promise.<Build>

https://docs.apify.com/api/v2#/reference/actors/build-collection/build-actor

ParamType
versionNumberstring
optionsobject
options.betaPackagesboolean
options.tagstring
options.useCacheboolean
options.waitForFinishnumber

actorClient.builds()BuildCollectionClient

https://docs.apify.com/api/v2#/reference/actors/build-collection


actorClient.call([input], [options])Promise.<Run>

Starts an actor and waits for it to finish before returning the Run object. It waits indefinitely, unless the waitSecs option is provided. https://docs.apify.com/api/v2#/reference/actors/run-collection/run-actor

ParamType
input*
optionsobject
options.buildstring
options.contentTypestring
options.memorynumber
options.timeoutnumber
options.waitSecsnumber
options.webhooksArray.<object>

actorClient.delete()Promise.<void>

https://docs.apify.com/api/v2#/reference/actors/actor-object/delete-actor


actorClient.get()Promise.<?Actor>

https://docs.apify.com/api/v2#/reference/actors/actor-object/get-actor


actorClient.lastRun([options])RunClient

https://docs.apify.com/api/v2#/reference/actors/last-run-object-and-its-storages

ParamType
optionsobject
options.statusstring

actorClient.runs()RunCollectionClient

https://docs.apify.com/api/v2#/reference/actors/run-collection


actorClient.start([input], [options])Promise.<Run>

Starts an actor and immediately returns the Run object. https://docs.apify.com/api/v2#/reference/actors/run-collection/run-actor

ParamType
input*
optionsobject
options.buildstring
options.contentTypestring
options.memorynumber
options.timeoutnumber
options.waitForFinishnumber
options.webhooksArray.<object>

actorClient.update(newFields)Promise.<Actor>

https://docs.apify.com/api/v2#/reference/actors/actor-object/update-actor

ParamType
newFieldsobject

actorClient.version(versionNumber)ActorVersionClient

https://docs.apify.com/api/v2#/reference/actors/version-object

ParamType
versionNumberstring

actorClient.versions()ActorVersionCollectionClient

https://docs.apify.com/api/v2#/reference/actors/version-collection


actorClient.webhooks()WebhookCollectionClient

https://docs.apify.com/api/v2#/reference/actors/webhook-collection


ActorCollectionClient


actorCollectionClient.create([actor])Promise.<Actor>

https://docs.apify.com/api/v2#/reference/actors/actor-collection/create-actor

ParamType
actorobject

actorCollectionClient.list([options])Promise.<PaginationList>

https://docs.apify.com/api/v2#/reference/actors/actor-collection/get-list-of-actors

ParamType
optionsobject
options.myboolean
options.limitnumber
options.offsetnumber
options.descboolean

ActorVersionClient


actorVersionClient.delete()Promise.<void>

https://docs.apify.com/api/v2#/reference/actors/version-object/delete-version


actorVersionClient.get()Promise.<ActorVersion>

https://docs.apify.com/api/v2#/reference/actors/version-object/get-version


actorVersionClient.update(newFields)Promise.<ActorVersion>

https://docs.apify.com/api/v2#/reference/actors/version-object/update-version

ParamType
newFieldsobject

ActorVersionCollectionClient


actorVersionCollectionClient.create([actorVersion])Promise.<object>

https://docs.apify.com/api/v2#/reference/actors/version-collection/create-version

ParamType
actorVersionobject

actorVersionCollectionClient.list([options])Promise.<PaginationList>

https://docs.apify.com/api/v2#/reference/actors/version-collection/get-list-of-versions

ParamType
optionsobject
options.limitnumber
options.offsetnumber
options.descboolean

BuildClient


buildClient.abort()Promise.<Build>

https://docs.apify.com/api/v2#/reference/actor-builds/abort-build/abort-build


buildClient.get([options])Promise.<Build>

https://docs.apify.com/api/v2#/reference/actor-builds/build-object/get-build

ParamType
optionsobject
options.waitForFinishnumber

buildClient.waitForFinish([options])Promise.<Build>

Returns a promise that resolves with the finished Build object when the provided actor build finishes or with the unfinished Build object when the waitSecs timeout lapses. The promise is NOT rejected based on run status. You can inspect the status property of the Build object to find out its status.

The difference between this function and the waitForFinish parameter of the get method is the fact that this function can wait indefinitely. Its use is preferable to the waitForFinish parameter alone, which it uses internally.

This is useful when you need to immediately start a run after a build finishes.

ParamTypeDescription
optionsobject
options.waitSecsnumberMaximum time to wait for the build to finish, in seconds. If the limit is reached, the returned promise is resolved to a build object that will have status READY or RUNNING. If waitSecs omitted, the function waits indefinitely.

BuildCollectionClient


buildCollectionClient.list([options])Promise.<PaginationList>

https://docs.apify.com/api/v2#/reference/actors/build-collection/get-list-of-builds

ParamType
optionsobject
options.limitnumber
options.offsetnumber
options.descboolean

DatasetClient


datasetClient.delete()Promise.<void>

https://docs.apify.com/api/v2#/reference/datasets/dataset/delete-dataset


datasetClient.downloadItems(format, [options])Promise.<Buffer>

Unlike listItems which returns a PaginationList with an array of individual dataset items, downloadItems returns the items serialized to the provided format. https://docs.apify.com/api/v2#/reference/datasets/item-collection/get-items

ParamTypeDescription
formatstringOne of json, jsonl, xml, html, csv, xlsx, rss
optionsobject
options.attachmentboolean
options.bomboolean
options.cleanboolean
options.delimiterstring
options.descboolean
options.fieldsArray.<string>
options.omitArray.<string>
options.limitnumber
options.offsetnumber
options.skipEmptyboolean
options.skipHeaderRowboolean
options.skipHiddenboolean
options.unwindstring
options.xmlRootstring
options.xmlRowstring

datasetClient.get()Promise.<Dataset>

https://docs.apify.com/api/v2#/reference/datasets/dataset/get-dataset


datasetClient.listItems([options])Promise.<PaginationList>

https://docs.apify.com/api/v2#/reference/datasets/item-collection/get-items

ParamType
optionsobject
options.cleanboolean
options.descboolean
options.fieldsArray.<string>
options.omitArray.<string>
options.limitnumber
options.offsetnumber
options.skipEmptyboolean
options.skipHiddenboolean
options.unwindstring

datasetClient.pushItems(items)Promise.<void>

https://docs.apify.com/api/v2#/reference/datasets/item-collection/put-items

ParamType
itemsobject | string | Array.<(object|string)>

datasetClient.update(newFields)Promise.<Dataset>

https://docs.apify.com/api/v2#/reference/datasets/dataset/update-dataset

ParamType
newFieldsobject

DatasetCollectionClient


datasetCollectionClient.getOrCreate([name])Promise.<object>

https://docs.apify.com/api/v2#/reference/datasets/dataset-collection/create-dataset

ParamType
namestring

datasetCollectionClient.list([options])Promise.<PaginationList>

https://docs.apify.com/api/v2#/reference/datasets/dataset-collection/get-list-of-datasets

ParamType
optionsobject
options.unnamedboolean
options.limitnumber
options.offsetnumber
options.descboolean

KeyValueStoreClient


keyValueStoreClient.delete()Promise.<void>

https://docs.apify.com/api/v2#/reference/key-value-stores/store-object/delete-store


keyValueStoreClient.deleteRecord(key)Promise.<void>

https://docs.apify.com/api/v2#/reference/key-value-stores/record/delete-record

ParamType
keystring

keyValueStoreClient.get()Promise.<KeyValueStore>

https://docs.apify.com/api/v2#/reference/key-value-stores/store-object/get-store


keyValueStoreClient.getRecord(key, [options])Promise.<(KeyValueStoreRecord|undefined)>

You can use the buffer option to get the value in a Buffer (Node.js) or ArrayBuffer (browser) format. In Node.js (not in browser) you can also use the stream option to get a Readable stream.

When the record does not exist, the function resolves to undefined. It does NOT resolve to a KeyValueStore record with an undefined value. https://docs.apify.com/api/v2#/reference/key-value-stores/record/get-record

ParamType
keystring
optionsobject
options.bufferboolean
options.streamboolean

keyValueStoreClient.listKeys([options])Promise.<object>

https://docs.apify.com/api/v2#/reference/key-value-stores/key-collection/get-list-of-keys

ParamType
optionsobject
options.limitobject
options.exclusiveStartKeystring

keyValueStoreClient.setRecord(record)Promise.<void>

https://docs.apify.com/api/v2#/reference/key-value-stores/record/put-record

ParamType
recordKeyValueStoreRecord

keyValueStoreClient.update(newFields)Promise.<KeyValueStore>

https://docs.apify.com/api/v2#/reference/key-value-stores/store-object/update-store

ParamType
newFieldsobject

KeyValueStoreCollectionClient


keyValueStoreCollectionClient.getOrCreate([name])Promise.<object>

https://docs.apify.com/api/v2#/reference/key-value-stores/store-collection/create-key-value-store

ParamType
namestring

keyValueStoreCollectionClient.list([options])Promise.<PaginationList>

https://docs.apify.com/api/v2#/reference/key-value-stores/store-collection/get-list-of-key-value-stores

ParamType
optionsobject
options.unnamedboolean
options.limitnumber
options.offsetnumber
options.descboolean

KeyValueStoreRecord : object

Properties

NameType
keystring
valuenull | string | number | object
contentTypestring

LogClient


logClient.get()Promise.<?string>

https://docs.apify.com/api/v2#/reference/logs/log/get-log


logClient.stream()Promise.<?Readable>

Gets the log in a Readable stream format. Only works in Node.js. https://docs.apify.com/api/v2#/reference/logs/log/get-log


PaginationList : object

Properties

NameTypeDescription
itemsArray.<object>List of returned objects
totalnumberTotal number of objects
offsetnumberNumber of objects that were skipped
countnumberNumber of returned objects
limitnumberRequested limit

RequestQueueClient


requestQueueClient.addRequest(request, [options])Promise.<object>

https://docs.apify.com/api/v2#/reference/request-queues/request-collection/add-request

ParamType
requestobject
optionsobject
options.forefrontboolean

requestQueueClient.delete()Promise.<void>

https://docs.apify.com/api/v2#/reference/request-queues/queue/delete-request-queue


requestQueueClient.deleteRequest(id)Promise.<void>

ParamType
idstring

requestQueueClient.get()Promise.<RequestQueue>

https://docs.apify.com/api/v2#/reference/request-queues/queue/get-request-queue


requestQueueClient.getRequest(id)Promise.<?object>

https://docs.apify.com/api/v2#/reference/request-queues/request/get-request

ParamType
idstring

requestQueueClient.listHead([options])Promise.<object>

https://docs.apify.com/api/v2#/reference/request-queues/queue-head/get-head

ParamType
optionsobject
options.limitnumber

requestQueueClient.update(newFields)Promise.<RequestQueue>

https://docs.apify.com/api/v2#/reference/request-queues/queue/update-request-queue

ParamType
newFieldsobject

requestQueueClient.updateRequest(request, [options])Promise.<*>

https://docs.apify.com/api/v2#/reference/request-queues/request/update-request

ParamType
requestobject
optionsobject
options.forefrontboolean

RequestQueueCollection


requestQueueCollection.getOrCreate([name])Promise.<RequestQueue>

https://docs.apify.com/api/v2#/reference/request-queues/queue-collection/create-request-queue

ParamType
namestring

requestQueueCollection.list([options])Promise.<PaginationList>

https://docs.apify.com/api/v2#/reference/request-queues/queue-collection/get-list-of-request-queues

ParamType
optionsobject
options.unnamedboolean
options.limitnumber
options.offsetnumber
options.descboolean

RunClient


runClient.abort()Promise.<Run>

https://docs.apify.com/api/v2#/reference/actor-runs/abort-run/abort-run


runClient.dataset()DatasetClient

https://docs.apify.com/api/v2#/reference/actor-runs/run-object-and-its-storages

This also works through actorClient.lastRun().dataset(). https://docs.apify.com/api/v2#/reference/actors/last-run-object-and-its-storages


runClient.get([options])Promise.<Run>

https://docs.apify.com/api/v2#/reference/actor-runs/run-object/get-run

ParamType
optionsobject
options.waitForFinishnumber

runClient.keyValueStore()KeyValueStoreClient

https://docs.apify.com/api/v2#/reference/actor-runs/run-object-and-its-storages

This also works through actorClient.lastRun().keyValueStore(). https://docs.apify.com/api/v2#/reference/actors/last-run-object-and-its-storages


runClient.log()LogClient

https://docs.apify.com/api/v2#/reference/actor-runs/run-object-and-its-storages

This also works through actorClient.lastRun().log(). https://docs.apify.com/api/v2#/reference/actors/last-run-object-and-its-storages


runClient.metamorph(targetActorId, [input], [options])Promise.<Run>

https://docs.apify.com/api/v2#/reference/actor-runs/metamorph-run/metamorph-run

ParamType
targetActorIdstring
input*
optionsobject
options.contentTypeobject
options.buildobject

runClient.requestQueue()RequestQueueClient

https://docs.apify.com/api/v2#/reference/actor-runs/run-object-and-its-storages

This also works through actorClient.lastRun().requestQueue(). https://docs.apify.com/api/v2#/reference/actors/last-run-object-and-its-storages


runClient.resurrect([options])Promise.<Run>

https://docs.apify.com/api/v2#/reference/actor-runs/resurrect-run/resurrect-run

ParamType
optionsobject
options.buildstring
options.memorynumber
options.timeoutnumber

runClient.waitForFinish([options])Promise.<Run>

Returns a promise that resolves with the finished Run object when the provided actor run finishes or with the unfinished Run object when the waitSecs timeout lapses. The promise is NOT rejected based on run status. You can inspect the status property of the Run object to find out its status.

The difference between this function and the waitForFinish parameter of the get method is the fact that this function can wait indefinitely. Its use is preferable to the waitForFinish parameter alone, which it uses internally.

This is useful when you need to chain actor executions. Similar effect can be achieved by using webhooks, so be sure to review which technique fits your use-case better.

ParamTypeDescription
optionsobject
options.waitSecsnumberMaximum time to wait for the run to finish, in seconds. If the limit is reached, the returned promise is resolved to a run object that will have status READY or RUNNING. If waitSecs omitted, the function waits indefinitely.

RunCollectionClient


runCollectionClient.list([options])Promise.<PaginationList>

https://docs.apify.com/api/v2#/reference/actors/run-collection/get-list-of-runs

ParamType
optionsobject
options.limitnumber
options.offsetnumber
options.descboolean
options.statusboolean

ScheduleClient


scheduleClient.delete()Promise.<void>

https://docs.apify.com/api/v2#/reference/schedules/schedule-object/delete-schedule


scheduleClient.get()Promise.<?Schedule>

https://docs.apify.com/api/v2#/reference/schedules/schedule-object/get-schedule


scheduleClient.getLog()Promise.<?string>

https://docs.apify.com/api/v2#/reference/schedules/schedule-log/get-schedule-log


scheduleClient.update(newFields)Promise.<Schedule>

https://docs.apify.com/api/v2#/reference/schedules/schedule-object/update-schedule

ParamType
newFieldsobject

ScheduleCollectionClient


scheduleCollectionClient.create([schedule])Promise.<Schedule>

https://docs.apify.com/api/v2#/reference/schedules/schedules-collection/create-schedule

ParamType
scheduleobject

scheduleCollectionClient.list([options])Promise.<PaginationList>

https://docs.apify.com/api/v2#/reference/schedules/schedules-collection/get-list-of-schedules

ParamType
optionsobject
options.limitnumber
options.offsetnumber
options.descboolean

TaskClient


taskClient.call([input], [options])Promise.<Run>

Starts a task and waits for it to finish before returning the Run object. It waits indefinitely, unless the waitSecs option is provided. https://docs.apify.com/api/v2#/reference/actor-tasks/run-collection/run-task

ParamType
inputobject
optionsobject
options.buildstring
options.memorynumber
options.timeoutnumber
options.waitSecsnumber
options.webhooksArray.<object>

taskClient.delete()Promise.<void>

https://docs.apify.com/api/v2#/reference/actor-tasks/task-object/delete-task


taskClient.get()Promise.<?Task>

https://docs.apify.com/api/v2#/reference/actor-tasks/task-object/get-task


taskClient.getInput()Promise.<?object>

https://docs.apify.com/api/v2#/reference/actor-tasks/task-input-object/get-task-input


taskClient.lastRun(options)RunClient

https://docs.apify.com/api/v2#/reference/actor-tasks/last-run-object-and-its-storages

ParamType
optionsobject
options.statusstring

taskClient.runs()RunCollectionClient

https://docs.apify.com/api/v2#/reference/actor-tasks/run-collection


taskClient.start([input], [options])Promise.<Run>

Starts a task and immediately returns the Run object. https://docs.apify.com/api/v2#/reference/actor-tasks/run-collection/run-task

ParamType
inputobject
optionsobject
options.buildstring
options.memorynumber
options.timeoutnumber
options.waitForFinishnumber
options.webhooksArray.<object>

taskClient.update(newFields)Promise.<Task>

https://docs.apify.com/api/v2#/reference/actor-tasks/task-object/update-task

ParamType
newFieldsobject

taskClient.updateInput()Promise.<object>

https://docs.apify.com/api/v2#/reference/actor-tasks/task-input-object/update-task-input


taskClient.webhooks()WebhookCollectionClient

https://docs.apify.com/api/v2#/reference/actor-tasks/webhook-collection


TaskCollectionClient


taskCollectionClient.create([task])Promise.<Task>

https://docs.apify.com/api/v2#/reference/actor-tasks/task-collection/create-task

ParamType
taskobject

taskCollectionClient.list([options])Promise.<PaginationList>

https://docs.apify.com/api/v2#/reference/actor-tasks/task-collection/get-list-of-tasks

ParamType
optionsobject
options.limitnumber
options.offsetnumber
options.descboolean

UserClient


userClient.get()Promise.<?User>

Depending on whether ApifyClient was created with a token, the method will either return public or private user data. https://docs.apify.com/api/v2#/reference/users


WebhookClient


webhookClient.delete()Promise.<void>

https://docs.apify.com/api/v2#/reference/webhooks/webhook-object/delete-webhook


webhookClient.dispatches()WebhookDispatchCollectionClient

https://docs.apify.com/api/v2#/reference/webhooks/dispatches-collection


webhookClient.get()Promise.<?Webhook>

https://docs.apify.com/api/v2#/reference/webhooks/webhook-object/get-webhook


webhookClient.update(newFields)Promise.<Webhook>

https://docs.apify.com/api/v2#/reference/webhooks/webhook-object/update-webhook

ParamType
newFieldsobject

WebhookCollectionClient


webhookCollectionClient.create([webhook])Promise.<Webhook>

https://docs.apify.com/api/v2#/reference/webhooks/webhook-collection/create-webhook

ParamType
webhookobject

webhookCollectionClient.list([options])Promise.<PaginationList>

https://docs.apify.com/api/v2#/reference/webhooks/webhook-collection/get-list-of-webhooks

ParamType
optionsobject
options.limitnumber
options.offsetnumber
options.descboolean

WebhookDispatchClient


webhookDispatchClient.get()Promise.<?WebhookDispatch>

https://docs.apify.com/api/v2#/reference/webhook-dispatches/webhook-dispatch-object/get-webhook-dispatch


WebhookDispatchCollectionClient


webhookDispatchCollectionClient.list([options])Promise.<PaginationList>

https://docs.apify.com/api/v2#/reference/webhook-dispatches/webhook-dispatches-collection/get-list-of-webhook-dispatches

ParamType
optionsobject
options.limitnumber
options.offsetnumber
options.descboolean