diff --git a/apify-api/openapi/code_samples/javascript/act_builds_get.js b/apify-api/openapi/code_samples/javascript/act_builds_get.js new file mode 100644 index 000000000..e70e1bf29 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/act_builds_get.js @@ -0,0 +1,11 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .actor('') + .builds() + .list(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/act_builds_post.js b/apify-api/openapi/code_samples/javascript/act_builds_post.js new file mode 100644 index 000000000..d57d8f6cb --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/act_builds_post.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const build = await apifyClient + .actor('') + .build('0.0'); + +console.log(build); diff --git a/apify-api/openapi/code_samples/javascript/act_delete.js b/apify-api/openapi/code_samples/javascript/act_delete.js new file mode 100644 index 000000000..67d162818 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/act_delete.js @@ -0,0 +1,6 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +await apifyClient.actor('').delete(); diff --git a/apify-api/openapi/code_samples/javascript/act_get.js b/apify-api/openapi/code_samples/javascript/act_get.js new file mode 100644 index 000000000..c2fa2db3c --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/act_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const actor = await apifyClient + .actor('') + .get(); + +console.log(actor); diff --git a/apify-api/openapi/code_samples/javascript/act_put.js b/apify-api/openapi/code_samples/javascript/act_put.js new file mode 100644 index 000000000..e5f45bba5 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/act_put.js @@ -0,0 +1,12 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const updatedActor = await apifyClient + .actor('') + .update({ + title: 'New title', + }); + +console.log(updatedActor); diff --git a/apify-api/openapi/code_samples/javascript/act_runs_get.js b/apify-api/openapi/code_samples/javascript/act_runs_get.js new file mode 100644 index 000000000..62303fe5d --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/act_runs_get.js @@ -0,0 +1,11 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .actor('') + .runs() + .list(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/act_runs_last_get.js b/apify-api/openapi/code_samples/javascript/act_runs_last_get.js new file mode 100644 index 000000000..3963ab289 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/act_runs_last_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const lastRun = await apifyClient + .actor('') + .lastRun(); + +console.log(lastRun); diff --git a/apify-api/openapi/code_samples/javascript/act_runs_post.js b/apify-api/openapi/code_samples/javascript/act_runs_post.js new file mode 100644 index 000000000..316deb6ba --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/act_runs_post.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const run = await apifyClient + .actor('') + .start({ foo: 'bar' }); + +console.log(run); diff --git a/apify-api/openapi/code_samples/javascript/act_version_delete.js b/apify-api/openapi/code_samples/javascript/act_version_delete.js new file mode 100644 index 000000000..576d6daea --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/act_version_delete.js @@ -0,0 +1,9 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +await apifyClient + .actor('') + .version('0.1') + .delete(); diff --git a/apify-api/openapi/code_samples/javascript/act_version_envVar_delete.js b/apify-api/openapi/code_samples/javascript/act_version_envVar_delete.js new file mode 100644 index 000000000..92d57d9e4 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/act_version_envVar_delete.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +await apifyClient + .actor('') + .version('0.1') + .envVar('MY_ENV_VAR') + .delete(); diff --git a/apify-api/openapi/code_samples/javascript/act_version_envVar_get.js b/apify-api/openapi/code_samples/javascript/act_version_envVar_get.js new file mode 100644 index 000000000..7a200fb7e --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/act_version_envVar_get.js @@ -0,0 +1,12 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const envVar = await apifyClient + .actor('') + .version('0.1') + .envVar('MY_ENV_VAR') + .get(); + +console.log(envVar); diff --git a/apify-api/openapi/code_samples/javascript/act_version_envVar_put.js b/apify-api/openapi/code_samples/javascript/act_version_envVar_put.js new file mode 100644 index 000000000..18318129e --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/act_version_envVar_put.js @@ -0,0 +1,15 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const updatedEnvVar = await apifyClient + .actor('') + .version('0.1') + .envVar('MY_ENV_VAR') + .update({ + name: 'MY_ENV_VAR', + value: 'my-new-value', + }); + +console.log(updatedEnvVar); diff --git a/apify-api/openapi/code_samples/javascript/act_version_envVars_get.js b/apify-api/openapi/code_samples/javascript/act_version_envVars_get.js new file mode 100644 index 000000000..896c14b05 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/act_version_envVars_get.js @@ -0,0 +1,12 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .actor('') + .version('0.1') + .envVars() + .list(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/act_version_envVars_post.js b/apify-api/openapi/code_samples/javascript/act_version_envVars_post.js new file mode 100644 index 000000000..6eace8ced --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/act_version_envVars_post.js @@ -0,0 +1,16 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const envVar = await apifyClient + .actor('') + .version('0.1') + .envVars() + .create({ + name: 'MY_ENV_VAR', + value: 'my-new-value', + isSecret: true, + }); + +console.log(envVar); diff --git a/apify-api/openapi/code_samples/javascript/act_version_get.js b/apify-api/openapi/code_samples/javascript/act_version_get.js new file mode 100644 index 000000000..d3dc8770b --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/act_version_get.js @@ -0,0 +1,11 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const version = await apifyClient + .actor('') + .version('0.1') + .get(); + +console.log(version); diff --git a/apify-api/openapi/code_samples/javascript/act_version_put.js b/apify-api/openapi/code_samples/javascript/act_version_put.js new file mode 100644 index 000000000..51c213aad --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/act_version_put.js @@ -0,0 +1,13 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const updatedVersion = await apifyClient + .actor('') + .version('0.1') + .update({ + buildTag: 'latest', + }); + +console.log(updatedVersion); diff --git a/apify-api/openapi/code_samples/javascript/act_versions_get.js b/apify-api/openapi/code_samples/javascript/act_versions_get.js new file mode 100644 index 000000000..d2399a533 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/act_versions_get.js @@ -0,0 +1,11 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .actor('') + .versions() + .list(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/act_versions_post.js b/apify-api/openapi/code_samples/javascript/act_versions_post.js new file mode 100644 index 000000000..e525a391b --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/act_versions_post.js @@ -0,0 +1,15 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const version = await apifyClient + .actor('') + .versions() + .create({ + versionNumber: '0.1', + sourceType: 'GIT_REPO', + gitRepoUrl: 'https://github.com/my/repo', + }); + +console.log(version); diff --git a/apify-api/openapi/code_samples/javascript/act_webhooks_get.js b/apify-api/openapi/code_samples/javascript/act_webhooks_get.js new file mode 100644 index 000000000..c78d5f63f --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/act_webhooks_get.js @@ -0,0 +1,11 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .actor('') + .webhooks() + .list(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/actorBuild_abort_post.js b/apify-api/openapi/code_samples/javascript/actorBuild_abort_post.js new file mode 100644 index 000000000..9bc2a962d --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorBuild_abort_post.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const abortedBuild = await apifyClient + .build('') + .abort(); + +console.log(abortedBuild); diff --git a/apify-api/openapi/code_samples/javascript/actorBuild_delete.js b/apify-api/openapi/code_samples/javascript/actorBuild_delete.js new file mode 100644 index 000000000..d5dba0bbf --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorBuild_delete.js @@ -0,0 +1,6 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +await apifyClient.build('').delete(); diff --git a/apify-api/openapi/code_samples/javascript/actorBuild_get.js b/apify-api/openapi/code_samples/javascript/actorBuild_get.js new file mode 100644 index 000000000..e5d92e363 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorBuild_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const build = await apifyClient + .build('') + .get(); + +console.log(build); diff --git a/apify-api/openapi/code_samples/javascript/actorBuild_log_get.js b/apify-api/openapi/code_samples/javascript/actorBuild_log_get.js new file mode 100644 index 000000000..8e71959ab --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorBuild_log_get.js @@ -0,0 +1,11 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const buildLog = await apifyClient + .build('') + .log() + .get(); + +console.log(buildLog); diff --git a/apify-api/openapi/code_samples/javascript/actorBuilds_get.js b/apify-api/openapi/code_samples/javascript/actorBuilds_get.js new file mode 100644 index 000000000..52ed3e4e2 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorBuilds_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .builds() + .list(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/actorRun_abort_post.js b/apify-api/openapi/code_samples/javascript/actorRun_abort_post.js new file mode 100644 index 000000000..1af7ebcea --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorRun_abort_post.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const abortedRun = await apifyClient + .run('') + .abort(); + +console.log(abortedRun); diff --git a/apify-api/openapi/code_samples/javascript/actorRun_delete.js b/apify-api/openapi/code_samples/javascript/actorRun_delete.js new file mode 100644 index 000000000..96f1c596b --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorRun_delete.js @@ -0,0 +1,6 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +await apifyClient.run('').delete(); diff --git a/apify-api/openapi/code_samples/javascript/actorRun_get.js b/apify-api/openapi/code_samples/javascript/actorRun_get.js new file mode 100644 index 000000000..a521d49ca --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorRun_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const run = await apifyClient + .run('') + .get(); + +console.log(run); diff --git a/apify-api/openapi/code_samples/javascript/actorRun_metamorph_post.js b/apify-api/openapi/code_samples/javascript/actorRun_metamorph_post.js new file mode 100644 index 000000000..7cc0bc3b2 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorRun_metamorph_post.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const metamorphedRun = await apifyClient + .run('') + .metamorph(''); + +console.log(metamorphedRun); diff --git a/apify-api/openapi/code_samples/javascript/actorRun_put.js b/apify-api/openapi/code_samples/javascript/actorRun_put.js new file mode 100644 index 000000000..9aef10b16 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorRun_put.js @@ -0,0 +1,12 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const updatedRun = await apifyClient + .run('') + .update({ + statusMessage: 'Actor has finished', + }); + +console.log(updatedRun); diff --git a/apify-api/openapi/code_samples/javascript/actorRun_reboot_post.js b/apify-api/openapi/code_samples/javascript/actorRun_reboot_post.js new file mode 100644 index 000000000..5e837a87b --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorRun_reboot_post.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const rebootedRun = await apifyClient + .run('') + .reboot(); + +console.log(rebootedRun); diff --git a/apify-api/openapi/code_samples/javascript/actorRun_resurrect_post.js b/apify-api/openapi/code_samples/javascript/actorRun_resurrect_post.js new file mode 100644 index 000000000..975a94b6c --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorRun_resurrect_post.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const resurrectedRun = await apifyClient + .run('') + .resurrect(); + +console.log(resurrectedRun); diff --git a/apify-api/openapi/code_samples/javascript/actorRuns_get.js b/apify-api/openapi/code_samples/javascript/actorRuns_get.js new file mode 100644 index 000000000..9d58c9387 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorRuns_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .runs() + .list(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/actorTask_delete.js b/apify-api/openapi/code_samples/javascript/actorTask_delete.js new file mode 100644 index 000000000..18009bf77 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorTask_delete.js @@ -0,0 +1,6 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +await apifyClient.task('').delete(); diff --git a/apify-api/openapi/code_samples/javascript/actorTask_get.js b/apify-api/openapi/code_samples/javascript/actorTask_get.js new file mode 100644 index 000000000..5baa06b21 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorTask_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const task = await apifyClient + .task('') + .get(); + +console.log(task); diff --git a/apify-api/openapi/code_samples/javascript/actorTask_input_get.js b/apify-api/openapi/code_samples/javascript/actorTask_input_get.js new file mode 100644 index 000000000..967a7e0e8 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorTask_input_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const input = await apifyClient + .task('') + .getInput(); + +console.log(input); diff --git a/apify-api/openapi/code_samples/javascript/actorTask_input_put.js b/apify-api/openapi/code_samples/javascript/actorTask_input_put.js new file mode 100644 index 000000000..df3995459 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorTask_input_put.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const updatedInput = await apifyClient + .task('') + .updateInput({ foo: 'baz' }); + +console.log(updatedInput); diff --git a/apify-api/openapi/code_samples/javascript/actorTask_put.js b/apify-api/openapi/code_samples/javascript/actorTask_put.js new file mode 100644 index 000000000..202c2ad29 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorTask_put.js @@ -0,0 +1,12 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const updatedTask = await apifyClient + .task('') + .update({ + title: 'New title', + }); + +console.log(updatedTask); diff --git a/apify-api/openapi/code_samples/javascript/actorTask_runs_get.js b/apify-api/openapi/code_samples/javascript/actorTask_runs_get.js new file mode 100644 index 000000000..fc510b110 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorTask_runs_get.js @@ -0,0 +1,11 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .task('') + .runs() + .list(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/actorTask_runs_post.js b/apify-api/openapi/code_samples/javascript/actorTask_runs_post.js new file mode 100644 index 000000000..9a5a86ce5 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorTask_runs_post.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const run = await apifyClient + .task('') + .start(); + +console.log(run); diff --git a/apify-api/openapi/code_samples/javascript/actorTask_webhooks_get.js b/apify-api/openapi/code_samples/javascript/actorTask_webhooks_get.js new file mode 100644 index 000000000..5947c7241 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorTask_webhooks_get.js @@ -0,0 +1,11 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .task('') + .webhooks() + .list(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/actorTasks_get.js b/apify-api/openapi/code_samples/javascript/actorTasks_get.js new file mode 100644 index 000000000..4ea9bb278 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorTasks_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .tasks() + .list(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/actorTasks_post.js b/apify-api/openapi/code_samples/javascript/actorTasks_post.js new file mode 100644 index 000000000..2beae4e41 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/actorTasks_post.js @@ -0,0 +1,13 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .tasks() + .create({ + actId: '', + name: '', + }); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/acts_get.js b/apify-api/openapi/code_samples/javascript/acts_get.js index ef13872c1..a8616422b 100644 --- a/apify-api/openapi/code_samples/javascript/acts_get.js +++ b/apify-api/openapi/code_samples/javascript/acts_get.js @@ -1,6 +1,10 @@ import { ApifyClient } from 'apify-client'; -const apifyClient = new ApifyClient({ token: 'my-token' }); -const { items } = await apifyClient.actors().list(); +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .actors() + .list(); console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/acts_post.js b/apify-api/openapi/code_samples/javascript/acts_post.js index a2fd96905..878650fc5 100644 --- a/apify-api/openapi/code_samples/javascript/acts_post.js +++ b/apify-api/openapi/code_samples/javascript/acts_post.js @@ -1,6 +1,12 @@ import { ApifyClient } from 'apify-client'; -const apifyClient = new ApifyClient({ token: 'my-token' }); -const myActor = await apifyClient.actors().create({ name: 'my-actor' }); +const apifyClient = new ApifyClient({ + token: '', +}); +const myActor = await apifyClient + .actors() + .create({ + name: '', + }); console.log(myActor); diff --git a/apify-api/openapi/code_samples/javascript/dataset_delete.js b/apify-api/openapi/code_samples/javascript/dataset_delete.js new file mode 100644 index 000000000..359ddacf7 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/dataset_delete.js @@ -0,0 +1,8 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +await apifyClient + .dataset('') + .delete(); diff --git a/apify-api/openapi/code_samples/javascript/dataset_get.js b/apify-api/openapi/code_samples/javascript/dataset_get.js new file mode 100644 index 000000000..b64a28d8d --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/dataset_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const dataset = await apifyClient + .dataset('') + .get(); + +console.log(dataset); diff --git a/apify-api/openapi/code_samples/javascript/dataset_items_get.js b/apify-api/openapi/code_samples/javascript/dataset_items_get.js new file mode 100644 index 000000000..795926fe1 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/dataset_items_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .dataset('') + .listItems(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/dataset_items_post.js b/apify-api/openapi/code_samples/javascript/dataset_items_post.js new file mode 100644 index 000000000..8c2a09d55 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/dataset_items_post.js @@ -0,0 +1,11 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +await apifyClient + .dataset('') + .pushItems([ + { foo: 'bar' }, + { fizz: 'buzz' }, + ]); diff --git a/apify-api/openapi/code_samples/javascript/dataset_put.js b/apify-api/openapi/code_samples/javascript/dataset_put.js new file mode 100644 index 000000000..35c3a9ab7 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/dataset_put.js @@ -0,0 +1,12 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const updatedDataset = await apifyClient + .dataset('') + .update({ + title: 'New title', + }); + +console.log(updatedDataset); diff --git a/apify-api/openapi/code_samples/javascript/datasets_get.js b/apify-api/openapi/code_samples/javascript/datasets_get.js new file mode 100644 index 000000000..000841d40 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/datasets_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .datasets() + .list(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/datasets_post.js b/apify-api/openapi/code_samples/javascript/datasets_post.js new file mode 100644 index 000000000..c1610a0d4 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/datasets_post.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const dataset = await apifyClient + .datasets() + .getOrCreate(''); + +console.log(dataset); diff --git a/apify-api/openapi/code_samples/javascript/keyValueStore_delete.js b/apify-api/openapi/code_samples/javascript/keyValueStore_delete.js new file mode 100644 index 000000000..65e7da57a --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/keyValueStore_delete.js @@ -0,0 +1,8 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +await apifyClient + .keyValueStore('') + .delete(); diff --git a/apify-api/openapi/code_samples/javascript/keyValueStore_get.js b/apify-api/openapi/code_samples/javascript/keyValueStore_get.js new file mode 100644 index 000000000..6ac4443f1 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/keyValueStore_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const store = await apifyClient + .keyValueStore('') + .get(); + +console.log(store); diff --git a/apify-api/openapi/code_samples/javascript/keyValueStore_keys_get.js b/apify-api/openapi/code_samples/javascript/keyValueStore_keys_get.js new file mode 100644 index 000000000..4cec302be --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/keyValueStore_keys_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .keyValueStore('') + .listKeys(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/keyValueStore_put.js b/apify-api/openapi/code_samples/javascript/keyValueStore_put.js new file mode 100644 index 000000000..a092e8b6a --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/keyValueStore_put.js @@ -0,0 +1,12 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const updatedStore = await apifyClient + .keyValueStore('') + .update({ + title: 'New title', + }); + +console.log(updatedStore); diff --git a/apify-api/openapi/code_samples/javascript/keyValueStore_record_delete.js b/apify-api/openapi/code_samples/javascript/keyValueStore_record_delete.js new file mode 100644 index 000000000..05ca706d8 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/keyValueStore_record_delete.js @@ -0,0 +1,8 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +await apifyClient + .keyValueStore('') + .deleteRecord(''); diff --git a/apify-api/openapi/code_samples/javascript/keyValueStore_record_get.js b/apify-api/openapi/code_samples/javascript/keyValueStore_record_get.js new file mode 100644 index 000000000..d5a4aefb6 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/keyValueStore_record_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const record = await apifyClient + .keyValueStore('') + .getRecord(''); + +console.log(record); diff --git a/apify-api/openapi/code_samples/javascript/keyValueStore_record_put.js b/apify-api/openapi/code_samples/javascript/keyValueStore_record_put.js new file mode 100644 index 000000000..dd6230cfd --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/keyValueStore_record_put.js @@ -0,0 +1,11 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +await apifyClient + .keyValueStore('') + .setRecord({ + key: '', + value: 'my value', + }); diff --git a/apify-api/openapi/code_samples/javascript/keyValueStores_get.js b/apify-api/openapi/code_samples/javascript/keyValueStores_get.js new file mode 100644 index 000000000..31d0f95d5 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/keyValueStores_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .keyValueStores() + .list(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/keyValueStores_post.js b/apify-api/openapi/code_samples/javascript/keyValueStores_post.js new file mode 100644 index 000000000..56da93638 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/keyValueStores_post.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const store = await apifyClient + .keyValueStores() + .getOrCreate(''); + +console.log(store); diff --git a/apify-api/openapi/code_samples/javascript/log_get.js b/apify-api/openapi/code_samples/javascript/log_get.js new file mode 100644 index 000000000..7d1ae4719 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/log_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const log = await apifyClient + .log('') + .get(); + +console.log(log); diff --git a/apify-api/openapi/code_samples/javascript/requestQueue_delete.js b/apify-api/openapi/code_samples/javascript/requestQueue_delete.js new file mode 100644 index 000000000..1c12403f4 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/requestQueue_delete.js @@ -0,0 +1,8 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +await apifyClient + .requestQueue('') + .delete(); diff --git a/apify-api/openapi/code_samples/javascript/requestQueue_get.js b/apify-api/openapi/code_samples/javascript/requestQueue_get.js new file mode 100644 index 000000000..2f7a4c5c3 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/requestQueue_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const queue = await apifyClient + .requestQueue('') + .get(); + +console.log(queue); diff --git a/apify-api/openapi/code_samples/javascript/requestQueue_head_get.js b/apify-api/openapi/code_samples/javascript/requestQueue_head_get.js new file mode 100644 index 000000000..61afd5af6 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/requestQueue_head_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const head = await apifyClient + .requestQueue('') + .listHead(); + +console.log(head); diff --git a/apify-api/openapi/code_samples/javascript/requestQueue_head_lock_post.js b/apify-api/openapi/code_samples/javascript/requestQueue_head_lock_post.js new file mode 100644 index 000000000..47fc8da25 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/requestQueue_head_lock_post.js @@ -0,0 +1,12 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const result = await apifyClient + .requestQueue('') + .listAndLockHead({ + lockSecs: 300, + }); + +console.log(result); diff --git a/apify-api/openapi/code_samples/javascript/requestQueue_put.js b/apify-api/openapi/code_samples/javascript/requestQueue_put.js new file mode 100644 index 000000000..f7f6dc475 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/requestQueue_put.js @@ -0,0 +1,12 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const updatedQueue = await apifyClient + .requestQueue('') + .update({ + title: 'New title', + }); + +console.log(updatedQueue); diff --git a/apify-api/openapi/code_samples/javascript/requestQueue_request_delete.js b/apify-api/openapi/code_samples/javascript/requestQueue_request_delete.js new file mode 100644 index 000000000..5c79dfee3 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/requestQueue_request_delete.js @@ -0,0 +1,8 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +await apifyClient + .requestQueue('') + .deleteRequest(''); diff --git a/apify-api/openapi/code_samples/javascript/requestQueue_request_get.js b/apify-api/openapi/code_samples/javascript/requestQueue_request_get.js new file mode 100644 index 000000000..f197e8801 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/requestQueue_request_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const request = await apifyClient + .requestQueue('') + .getRequest(''); + +console.log(request); diff --git a/apify-api/openapi/code_samples/javascript/requestQueue_request_lock_delete.js b/apify-api/openapi/code_samples/javascript/requestQueue_request_lock_delete.js new file mode 100644 index 000000000..45aec1a44 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/requestQueue_request_lock_delete.js @@ -0,0 +1,8 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +await apifyClient + .requestQueue('') + .deleteRequestLock(''); diff --git a/apify-api/openapi/code_samples/javascript/requestQueue_request_lock_put.js b/apify-api/openapi/code_samples/javascript/requestQueue_request_lock_put.js new file mode 100644 index 000000000..1aba3f131 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/requestQueue_request_lock_put.js @@ -0,0 +1,15 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const result = await apifyClient + .requestQueue('') + .prolongRequestLock( + '', + { + lockSecs: 3600, + }, + ); + +console.log(result); diff --git a/apify-api/openapi/code_samples/javascript/requestQueue_request_put.js b/apify-api/openapi/code_samples/javascript/requestQueue_request_put.js new file mode 100644 index 000000000..62b3e86fa --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/requestQueue_request_put.js @@ -0,0 +1,14 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const result = await apifyClient + .requestQueue('') + .updateRequest({ + id: '', + uniqueKey: 'http://example.com', + url: 'http://example.com', + }); + +console.log(result); diff --git a/apify-api/openapi/code_samples/javascript/requestQueue_requests_batch_delete.js b/apify-api/openapi/code_samples/javascript/requestQueue_requests_batch_delete.js new file mode 100644 index 000000000..08ebdecb1 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/requestQueue_requests_batch_delete.js @@ -0,0 +1,13 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const result = await apifyClient + .requestQueue('') + .batchDeleteRequests([ + { uniqueKey: 'http://example.com' }, + { uniqueKey: 'http://example.com/2' }, + ]); + +console.log(result); diff --git a/apify-api/openapi/code_samples/javascript/requestQueue_requests_batch_post.js b/apify-api/openapi/code_samples/javascript/requestQueue_requests_batch_post.js new file mode 100644 index 000000000..297e23480 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/requestQueue_requests_batch_post.js @@ -0,0 +1,21 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const result = await apifyClient + .requestQueue('') + .batchAddRequests([ + { + uniqueKey: 'http://example.com', + url: 'http://example.com', + method: 'GET', + }, + { + uniqueKey: 'http://example.com/2', + url: 'http://example.com/2', + method: 'GET', + }, + ]); + +console.log(result); diff --git a/apify-api/openapi/code_samples/javascript/requestQueue_requests_get.js b/apify-api/openapi/code_samples/javascript/requestQueue_requests_get.js new file mode 100644 index 000000000..806336ef7 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/requestQueue_requests_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .requestQueue('') + .listRequests(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/requestQueue_requests_post.js b/apify-api/openapi/code_samples/javascript/requestQueue_requests_post.js new file mode 100644 index 000000000..02cc07368 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/requestQueue_requests_post.js @@ -0,0 +1,14 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const result = await apifyClient + .requestQueue('') + .addRequest({ + 'uniqueKey': 'http://example.com', + 'url': 'http://example.com', + 'method': 'GET', + }); + +console.log(result); diff --git a/apify-api/openapi/code_samples/javascript/requestQueues_get.js b/apify-api/openapi/code_samples/javascript/requestQueues_get.js new file mode 100644 index 000000000..f2f6ddfcb --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/requestQueues_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .requestQueues() + .list(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/requestQueues_post.js b/apify-api/openapi/code_samples/javascript/requestQueues_post.js new file mode 100644 index 000000000..74dd73658 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/requestQueues_post.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const queue = await apifyClient + .requestQueues() + .getOrCreate(''); + +console.log(queue); diff --git a/apify-api/openapi/code_samples/javascript/schedule_delete.js b/apify-api/openapi/code_samples/javascript/schedule_delete.js new file mode 100644 index 000000000..54e3f5fd7 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/schedule_delete.js @@ -0,0 +1,8 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +await apifyClient + .schedule('') + .delete(); diff --git a/apify-api/openapi/code_samples/javascript/schedule_get.js b/apify-api/openapi/code_samples/javascript/schedule_get.js new file mode 100644 index 000000000..6c2e63432 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/schedule_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const schedule = await apifyClient + .schedule('') + .get(); + +console.log(schedule); diff --git a/apify-api/openapi/code_samples/javascript/schedule_log_get.js b/apify-api/openapi/code_samples/javascript/schedule_log_get.js new file mode 100644 index 000000000..1110ec950 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/schedule_log_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const log = await apifyClient + .schedule('') + .getLog(); + +console.log(log); diff --git a/apify-api/openapi/code_samples/javascript/schedule_put.js b/apify-api/openapi/code_samples/javascript/schedule_put.js new file mode 100644 index 000000000..963fbfa6d --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/schedule_put.js @@ -0,0 +1,12 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const updatedSchedule = await apifyClient + .schedule('') + .update({ + title: 'New title', + }); + +console.log(updatedSchedule); diff --git a/apify-api/openapi/code_samples/javascript/schedules_get.js b/apify-api/openapi/code_samples/javascript/schedules_get.js new file mode 100644 index 000000000..c2d81b733 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/schedules_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .schedules() + .list(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/schedules_post.js b/apify-api/openapi/code_samples/javascript/schedules_post.js new file mode 100644 index 000000000..342d0ef14 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/schedules_post.js @@ -0,0 +1,12 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const schedule = await apifyClient + .schedules() + .create({ + name: '', + }); + +console.log(schedule); diff --git a/apify-api/openapi/code_samples/javascript/store_get.js b/apify-api/openapi/code_samples/javascript/store_get.js new file mode 100644 index 000000000..77be88157 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/store_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .store() + .list(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/user_get.js b/apify-api/openapi/code_samples/javascript/user_get.js new file mode 100644 index 000000000..d05d638f3 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/user_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const user = await apifyClient + .user('') + .get(); + +console.log(user); diff --git a/apify-api/openapi/code_samples/javascript/users_me_get.js b/apify-api/openapi/code_samples/javascript/users_me_get.js new file mode 100644 index 000000000..889f33ce9 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/users_me_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const user = await apifyClient + .user('me') + .get(); + +console.log(user); diff --git a/apify-api/openapi/code_samples/javascript/users_me_limits_get.js b/apify-api/openapi/code_samples/javascript/users_me_limits_get.js new file mode 100644 index 000000000..a26de71d4 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/users_me_limits_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const limits = await apifyClient + .user('me') + .limits(); + +console.log(limits); diff --git a/apify-api/openapi/code_samples/javascript/users_me_limits_put.js b/apify-api/openapi/code_samples/javascript/users_me_limits_put.js new file mode 100644 index 000000000..ca04d325e --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/users_me_limits_put.js @@ -0,0 +1,12 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const updatedLimits = await apifyClient + .user('me') + .updateLimits({ + dataRetentionDays: 5, + }); + +console.log(updatedLimits); diff --git a/apify-api/openapi/code_samples/javascript/users_me_usage_monthly_get.js b/apify-api/openapi/code_samples/javascript/users_me_usage_monthly_get.js new file mode 100644 index 000000000..56bcf1f93 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/users_me_usage_monthly_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const usage = await apifyClient + .user('me') + .monthlyUsage(); + +console.log(usage); diff --git a/apify-api/openapi/code_samples/javascript/webhookDispatch_get.js b/apify-api/openapi/code_samples/javascript/webhookDispatch_get.js new file mode 100644 index 000000000..e09873dd9 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/webhookDispatch_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const dispatch = await apifyClient + .webhookDispatch('') + .get(); + +console.log(dispatch); diff --git a/apify-api/openapi/code_samples/javascript/webhookDispatches_get.js b/apify-api/openapi/code_samples/javascript/webhookDispatches_get.js new file mode 100644 index 000000000..b7b03ace0 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/webhookDispatches_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .webhookDispatches() + .list(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/webhook_delete.js b/apify-api/openapi/code_samples/javascript/webhook_delete.js new file mode 100644 index 000000000..d37ec999a --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/webhook_delete.js @@ -0,0 +1,8 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +await apifyClient + .webhook('') + .delete(); diff --git a/apify-api/openapi/code_samples/javascript/webhook_dispatches_get.js b/apify-api/openapi/code_samples/javascript/webhook_dispatches_get.js new file mode 100644 index 000000000..a8f925a18 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/webhook_dispatches_get.js @@ -0,0 +1,11 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .webhook('') + .dispatches() + .list(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/webhook_get.js b/apify-api/openapi/code_samples/javascript/webhook_get.js new file mode 100644 index 000000000..e143b8567 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/webhook_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const webhook = await apifyClient + .webhook('') + .get(); + +console.log(webhook); diff --git a/apify-api/openapi/code_samples/javascript/webhook_put.js b/apify-api/openapi/code_samples/javascript/webhook_put.js new file mode 100644 index 000000000..ebe131497 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/webhook_put.js @@ -0,0 +1,12 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const updatedWebhook = await apifyClient + .webhook('') + .update({ + eventTypes: ['ACTOR.RUN.FAILED'], + }); + +console.log(updatedWebhook); diff --git a/apify-api/openapi/code_samples/javascript/webhook_test_post.js b/apify-api/openapi/code_samples/javascript/webhook_test_post.js new file mode 100644 index 000000000..524ac5a93 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/webhook_test_post.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const result = await apifyClient + .webhook('') + .test(); + +console.log(result); diff --git a/apify-api/openapi/code_samples/javascript/webhooks_get.js b/apify-api/openapi/code_samples/javascript/webhooks_get.js new file mode 100644 index 000000000..2ea019de4 --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/webhooks_get.js @@ -0,0 +1,10 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const { items } = await apifyClient + .webhooks() + .list(); + +console.log(items); diff --git a/apify-api/openapi/code_samples/javascript/webhooks_post.js b/apify-api/openapi/code_samples/javascript/webhooks_post.js new file mode 100644 index 000000000..b9e486fad --- /dev/null +++ b/apify-api/openapi/code_samples/javascript/webhooks_post.js @@ -0,0 +1,16 @@ +import { ApifyClient } from 'apify-client'; + +const apifyClient = new ApifyClient({ + token: '', +}); +const webhook = await apifyClient + .webhooks() + .create({ + eventTypes: ['ACTOR.RUN.SUCCEEDED'], + condition: { + actorId: '', + }, + requestUrl: 'http://example.com/', + }); + +console.log(webhook); diff --git a/apify-api/openapi/components/schemas/actor-runs/ChargeRunRequest.yaml b/apify-api/openapi/components/schemas/actor-runs/ChargeRunRequest.yaml new file mode 100644 index 000000000..a1462f647 --- /dev/null +++ b/apify-api/openapi/components/schemas/actor-runs/ChargeRunRequest.yaml @@ -0,0 +1,12 @@ +title: ChargeRunRequest +required: + - eventName + - eventCount +type: object +properties: + eventName: + type: string + example: ANALYZE_PAGE + eventCount: + type: number + example: 1 diff --git a/apify-api/openapi/components/schemas/request-queues/GetHeadAndLockResponse.yaml b/apify-api/openapi/components/schemas/request-queues/GetHeadAndLockResponse.yaml index e9d49616e..8c458e33d 100644 --- a/apify-api/openapi/components/schemas/request-queues/GetHeadAndLockResponse.yaml +++ b/apify-api/openapi/components/schemas/request-queues/GetHeadAndLockResponse.yaml @@ -11,7 +11,15 @@ properties: example: 1000 queueModifiedAt: type: string + description: The modifiedAt is updated whenever the queue is modified. Modifications include adding, updating, or removing requests, as well as locking or unlocking requests in the queue. example: '2018-03-14T23:00:00.000Z' + queueHasLockedRequests: + type: boolean + description: Whether the queue contains requests locked by any client (either the one calling the endpoint or a different one). + example: true + clientKey: + type: string + example: client-one hadMultipleClients: type: boolean example: true diff --git a/apify-api/openapi/components/schemas/request-queues/RequestQueue.yaml b/apify-api/openapi/components/schemas/request-queues/RequestQueue.yaml index ce6249b05..9e293eb2e 100644 --- a/apify-api/openapi/components/schemas/request-queues/RequestQueue.yaml +++ b/apify-api/openapi/components/schemas/request-queues/RequestQueue.yaml @@ -25,7 +25,8 @@ properties: example: '2019-12-12T07:34:14.202Z' modifiedAt: type: string - example: '2019-12-13T08:36:13.202Z' + description: The modifiedAt is updated whenever the queue is modified. Modifications include adding, updating, or removing requests, as well as locking or unlocking requests in the queue. + example: '2030-12-13T08:36:13.202Z' accessedAt: type: string example: '2019-12-14T08:36:13.202Z' diff --git a/apify-api/openapi/components/tags.yaml b/apify-api/openapi/components/tags.yaml index 90c85c876..72376c981 100644 --- a/apify-api/openapi/components/tags.yaml +++ b/apify-api/openapi/components/tags.yaml @@ -620,6 +620,10 @@ x-displayName: Resurrect run x-parent-tag-name: Actor runs x-trait: 'true' +- name: Actor runs/Charge events in run + x-displayName: Charge events in run + x-parent-tag-name: Actor runs + x-trait: 'true' - name: Actor runs/Update status message x-displayName: Update status message x-parent-tag-name: Actor runs diff --git a/apify-api/openapi/components/x-tag-groups.yaml b/apify-api/openapi/components/x-tag-groups.yaml index c52de15a6..1a4a46965 100644 --- a/apify-api/openapi/components/x-tag-groups.yaml +++ b/apify-api/openapi/components/x-tag-groups.yaml @@ -40,6 +40,7 @@ - Actor runs/Metamorph run - Actor runs/Reboot run - Actor runs/Resurrect run + - Actor runs/Charge events in run - Actor runs/Update status message - name: Actor builds tags: diff --git a/apify-api/openapi/openapi.yaml b/apify-api/openapi/openapi.yaml index 4d0c6d021..0819020ce 100644 --- a/apify-api/openapi/openapi.yaml +++ b/apify-api/openapi/openapi.yaml @@ -544,6 +544,8 @@ paths: $ref: paths/actor-runs/actor-runs@{runId}@reboot.yaml '/v2/actor-runs/{runId}/resurrect': $ref: paths/actor-runs/actor-runs@{runId}@resurrect.yaml + '/v2/actor-runs/{runId}/charge': + $ref: paths/actor-runs/actor-runs@{runId}@charge.yaml /v2/actor-builds: $ref: paths/actor-builds/actor-builds.yaml '/v2/actor-builds/{buildId}': diff --git a/apify-api/openapi/paths/actor-runs/actor-runs@{runId}@charge.yaml b/apify-api/openapi/paths/actor-runs/actor-runs@{runId}@charge.yaml new file mode 100644 index 000000000..bc76638c7 --- /dev/null +++ b/apify-api/openapi/paths/actor-runs/actor-runs@{runId}@charge.yaml @@ -0,0 +1,46 @@ +post: + tags: + - Actor runs/Charge events in run + summary: Charge events in run + description: | + Charge for events in the run of your [pay per event Actor](https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event). + The event you are charging for must be one of the configured events in your Actor. If the Actor is not set up as pay per event, or if the event is not configured, + the endpoint will return an error. The endpoint must be called from the Actor run itself, with the same API token that the run was started with. + + Note that pay per events Actors are still in alpha. Please, reach out to us with any questions or feedback. + operationId: PostChargeRun + parameters: + - name: runId + in: path + required: true + schema: + type: string + example: 3KH8gEpp4d8uQSe8T + description: Run ID. + - name: idempotency-key + in: header + required: false + schema: + type: string + example: 2024-12-09T01:23:45.000Z-random-uuid + description: Always pass a unique idempotency key (any unique string) for each charge to avoid double charging in case of retries or network errors. + requestBody: + description: 'Define which event, and how many times, you want to charge for.' + content: + application/json: + schema: + $ref: "../../components/schemas/actor-runs/ChargeRunRequest.yaml" + example: + eventName: 'ANALYZE_PAGE' + eventCount: 1 + required: true + responses: + '201': + description: 'The charge was successful. Note that you still have to make sure in your Actor that the total charge for the run respects the maximum value set by the user, as the API does not check this. Above the limit, the charges reported as successful in API will not be added to your payouts, but you will still bear the associated costs. Use the Apify charge manager or SDK to avoid having to deal with this manually.' + deprecated: false + x-js-parent: RunClient + x-js-name: charge + x-js-doc-url: https://docs.apify.com/api/client/js/reference/class/RunClient#charge + x-py-parent: RunClientAsync + x-py-name: charge + x-py-doc-url: https://docs.apify.com/api/client/python/reference/class/RunClientAsync#charge diff --git a/apify-api/openapi/paths/request-queues/request-queues@{queueId}@head@lock.yaml b/apify-api/openapi/paths/request-queues/request-queues@{queueId}@head@lock.yaml index 8ec2ae40c..e5ea3ccb8 100644 --- a/apify-api/openapi/paths/request-queues/request-queues@{queueId}@head@lock.yaml +++ b/apify-api/openapi/paths/request-queues/request-queues@{queueId}@head@lock.yaml @@ -6,10 +6,9 @@ post: Returns the given number of first requests from the queue and locks them for the given time. - If this endpoint locks the request, no other client will be able to get and + If this endpoint locks the request, no other client or run will be able to get and lock these requests. - The response contains the `hadMultipleClients` boolean field which indicates that the queue was accessed by more than one client (with unique or empty `clientKey`). diff --git a/apify-api/openapi/paths/request-queues/request-queues@{queueId}@requests@{requestId}@lock.yaml b/apify-api/openapi/paths/request-queues/request-queues@{queueId}@requests@{requestId}@lock.yaml index 50480fde3..3a533468b 100644 --- a/apify-api/openapi/paths/request-queues/request-queues@{queueId}@requests@{requestId}@lock.yaml +++ b/apify-api/openapi/paths/request-queues/request-queues@{queueId}@requests@{requestId}@lock.yaml @@ -37,11 +37,10 @@ put: - name: clientKey in: query description: | - A unique identifier of the client accessing the request queue. It must - be a string between 1 and 32 characters long. This identifier is used to - ensure one client is not to able delete or prolong - - a request from another client. + A unique identifier of the client accessing the request queue. It must + be a string between 1 and 32 characters long. This identifier is used to for locking + and unlocking requests. You can delete or prolong lock only for requests that were locked by by same + client key or from the same Actor run. style: form explode: true schema: @@ -121,11 +120,10 @@ delete: - name: clientKey in: query description: | - A unique identifier of the client accessing the request queue. It must - be a string between 1 and 32 characters long. This identifier is used to - ensure one client is not to able delete or prolong - - a request from another client. + A unique identifier of the client accessing the request queue. It must + be a string between 1 and 32 characters long. This identifier is used to for locking + and unlocking requests. You can delete or prolong lock only for requests that were locked by by same + client key or from the same Actor run. style: form explode: true schema: diff --git a/apify-api/plugins/decorators/code-samples-decorator.js b/apify-api/plugins/decorators/code-samples-decorator.js index a95146098..6b839d078 100644 --- a/apify-api/plugins/decorators/code-samples-decorator.js +++ b/apify-api/plugins/decorators/code-samples-decorator.js @@ -24,8 +24,12 @@ function CodeSamplesDecorator(target) { const codeSamples = []; + // For some reason, the operationId for resurrect run is PostResurrectRun, + // so we change it here to keep the file names consistent + const operationId = target.operationId === 'PostResurrectRun' ? 'actorRun_resurrect_post' : target.operationId; + for (const { lang, label } of LANGUAGES) { - const codeSamplePath = path.join(__dirname, `../../openapi/code_samples/${lang.toLowerCase()}/${target.operationId}.js`); + const codeSamplePath = path.join(__dirname, `../../openapi/code_samples/${lang.toLowerCase()}/${operationId}.js`); if (!existsSync(codeSamplePath)) { // Just use this console log in development to see which operations are missing a code sample. diff --git a/nginx.conf b/nginx.conf index c6d7746fe..287606acd 100644 --- a/nginx.conf +++ b/nginx.conf @@ -324,4 +324,7 @@ server { } # Redirect rule for "upgrading-to-v03" to "upgrading-to-v0x" rewrite ^/python/docs/upgrading/upgrading-to-v03$ /python/docs/upgrading/upgrading-to-v0x permanent; + + # Redirect rule so that /python/docs actually leads somewhere + rewrite ^/python/docs/?$ /python/docs/quick-start; } diff --git a/sources/platform/actors/development/actor_definition/dataset_schema/validation.md b/sources/platform/actors/development/actor_definition/dataset_schema/validation.md index 882b614e9..e96c9def6 100644 --- a/sources/platform/actors/development/actor_definition/dataset_schema/validation.md +++ b/sources/platform/actors/development/actor_definition/dataset_schema/validation.md @@ -4,6 +4,9 @@ description: Specify the dataset schema within the Actors so you can add monito slug: /actors/development/actor-definition/dataset-schema/validation --- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + **Specify the dataset schema within the Actors so you can add monitoring and validation at the field level.** --- @@ -105,6 +108,8 @@ The type of the AJV validation error object is [here](https://github.com/ajv-val If you use the Apify JS client or Apify SDK and call `pushData` function you can access the validation errors in a `try catch` block like this: + + ```javascript try { const response = await Actor.pushData(items); @@ -115,6 +120,17 @@ try { }); } ``` + + +```python +try: + await Actor.push_data(items) +except ApifyApiError as error: + if "invalidItems" in error.data: + validation_errors = e.data["invalidItems"] +``` + + ## Examples of common types of validation diff --git a/sources/platform/actors/development/actor_definition/input_schema/specification.md b/sources/platform/actors/development/actor_definition/input_schema/specification.md index 18fe9e77e..d9e14cb70 100644 --- a/sources/platform/actors/development/actor_definition/input_schema/specification.md +++ b/sources/platform/actors/development/actor_definition/input_schema/specification.md @@ -20,13 +20,16 @@ The Actor input schema serves three main purposes: To define an input schema for an Actor, set `input` field in the `.actor/actor.json` file to an input schema object (described below), or path to a JSON file containing the input schema object. For backwards compatibility, if the `input` field is omitted, the system looks for an `INPUT_SCHEMA.json` file either in the `.actor` directory or the Actor's top-level directory—but note that this functionality is deprececated and might be removed in the future. The maximum allowed size for the input schema file is 500 kB. -When you provide an input schema, the system will validate the input data passed to the Actor on start (via the API or Apify Console) against the specified schema to ensure compliance before starting the Actor. +When you provide an input schema, the Apify platform will validate the input data passed to the Actor on start (via the API or Apify Console) to ensure compliance before starting the Actor. If the input object doesn't conform the schema, the caller receives an error and the Actor is not started. :::note Validation aid -You can also use our [visual input schema editor](https://apify.github.io/input-schema-editor-react/) to guide you through the creation of the `INPUT_SCHEMA.json` file. -If you need to validate your input schemas, you can use the [`apify validate-schema`](/cli/docs/reference#apify-validate-schema-path) command in the Apify CLI. +You can use our [visual input schema editor](https://apify.github.io/input-schema-editor-react/) to guide you through the creation of the `INPUT_SCHEMA.json` file. + +To ensure the input schema is valid, here's a corresponding [JSON schema file](https://github.com/apify/apify-shared-js/blob/master/packages/input_schema/src/schema.json). + +You can also use the [`apify validate-schema`](/cli/docs/reference#apify-validate-schema-path) command in the Apify CLI. ::: diff --git a/sources/platform/integrations/images/api-token-organization.png b/sources/platform/integrations/images/api-token-organization.png index d3185fca0..160cd2035 100644 Binary files a/sources/platform/integrations/images/api-token-organization.png and b/sources/platform/integrations/images/api-token-organization.png differ diff --git a/sources/platform/integrations/images/api-token-scoped-default-storage-access.png b/sources/platform/integrations/images/api-token-scoped-default-storage-access.png new file mode 100644 index 000000000..22ad2351e Binary files /dev/null and b/sources/platform/integrations/images/api-token-scoped-default-storage-access.png differ diff --git a/sources/platform/integrations/images/api-token-scoped-restricted-access-active.png b/sources/platform/integrations/images/api-token-scoped-restricted-access-active.png new file mode 100644 index 000000000..daf547258 Binary files /dev/null and b/sources/platform/integrations/images/api-token-scoped-restricted-access-active.png differ diff --git a/sources/platform/integrations/images/api-token-scoped-run-modes.png b/sources/platform/integrations/images/api-token-scoped-run-modes.png index 2ae49c473..e630097b4 100644 Binary files a/sources/platform/integrations/images/api-token-scoped-run-modes.png and b/sources/platform/integrations/images/api-token-scoped-run-modes.png differ diff --git a/sources/platform/integrations/images/api-token-scoped-run-tasks.png b/sources/platform/integrations/images/api-token-scoped-run-tasks.png new file mode 100644 index 000000000..4a57342de Binary files /dev/null and b/sources/platform/integrations/images/api-token-scoped-run-tasks.png differ diff --git a/sources/platform/integrations/images/api-token.png b/sources/platform/integrations/images/api-token.png index 98b03683c..d7832755e 100644 Binary files a/sources/platform/integrations/images/api-token.png and b/sources/platform/integrations/images/api-token.png differ diff --git a/sources/platform/integrations/programming/api.md b/sources/platform/integrations/programming/api.md index e8cec5406..3a686fec0 100644 --- a/sources/platform/integrations/programming/api.md +++ b/sources/platform/integrations/programming/api.md @@ -80,7 +80,7 @@ A single token can combine both types. You can create a token that can _read_ an ### Allowing tokens to create resources -If you need to create new resources with the token (for example, create a new Task, or storage), you need to explicitly allow that as well. +If you need to create new resources with the token (for example, create a new task, or storage), you need to explicitly allow that as well. Once you create a new resource with the token, _the token will gain full access to that resource_, regardless of other permissions. It is not possible to create a token that can create a dataset, but not write to it. @@ -94,19 +94,21 @@ Some permissions require other permissions to be granted alongside them. These a #### Automatic dependencies -The form enforces certain dependencies automatically. For example, when you grant the _Write_ permission for a dataset, the _Read_ permission is automatically selected. This ensures that you can write to a dataset if you can also read from it. +The form enforces certain dependencies automatically. For example, when you grant the **Write** permission for a dataset, the **Read** permission is automatically selected. This ensures that you can write to a dataset if you can also read from it. ![The Write permission depends on Read for a dataset](../images/api-token-scoped-dependencies.png) #### Manual dependencies -Other dependencies are more complicated, and **it is your responsibility that the token is set up correctly**. Specifically: +Other dependencies are more complicated, so it is up to you to ensure that the token is configured correctly. -- To create or update a Schedule, the token needs access not only to the Schedule itself, but also to the Actor or task that is being scheduled. -- Similarly, to create or update a task, the token needs the additional permission to access the task's Actor itself. +Specifically: + +- To create or update a Schedule, the token needs access not only to the Schedule itself, but also to the Actor (the **Run** permission) or task (the **Read** permission) that is being scheduled. +- Similarly, to create, update or run a task, the token needs the **Run** permission on the task's Actor itself. :::tip -Let's say that you have an Actor and you want to programmatically create schedules for that Actor. Then you can create a token that has the account level _Create_ permission on schedules, but only the resource-specific _Run_ permission on the Actor. Such a token has exactly the permissions it needs, and nothing more. +Let's say that you have an Actor and you want to programmatically create schedules for that Actor. Then you can create a token that has the account level **Create** permission on schedules, but only the resource-specific **Run** permission on the Actor. Such a token has exactly the permissions it needs, and nothing more. ::: ### Actor execution @@ -146,8 +148,20 @@ This restriction is _transitive_, which means that if the Actor runs another Act When Apify [runs an Actor](/platform/actors/running/runs-and-builds#runs), it automatically creates a set of default storages (a dataset, a key-value store and request queue) that the Actor can use in runtime. -- Regardless of mode, the injected token always gets write access to its default storages, and to the run itself (for example, so that the Actor can abort itself). You don't need to configure this on your scoped token. -- If a scoped token can run an Actor, it gets **write access to default storages of the runs it triggered**. Moreover, it gets **read access to default storages of _all_ runs of that Actor**. If this is not desirable, change your Actor to output data into an existing named storage, or have it create a new storage. +You can configure whether the scoped token you are going use to run the Actor should get **Write** +access to these default storages. + +![Configure whether the trigger token gets write access to the run default storages.](../images/api-token-scoped-default-storage-access.png) + +:::tip +Let's say your Actor produces a lot of data that you want to delete just after the Actor finishes. If you enable this toggle, your scoped token will be allowed to do that. +::: + +:::caution +Even if you disable this option, **the default storages can still be accessed anonymously using just their ID** (which can be obtained via the [run object](https://docs.apify.com/api/v2#tag/Actor-runsRun-object-and-its-storages)). + +Moreover, if a scoped token can run an Actor, it can also list all its runs, including their storage IDs, ultimately exposing their content as well. If this is not desirable, change your Actor to output data into an existing named storage, or have it create a new storage. +::: ### Schedules @@ -164,7 +178,32 @@ If you set up a webhook pointing to the Apify API, the Apify platform will autom Therefore, you need to make sure the token has sufficient permissions not only to set up the webhook, but also to perform the actual operation. :::tip - Let's say you want to create a webhook that pushes an item to a dataset every time an Actor successfully finishes. Then such a scoped token needs to be allowed to both run the Actor (to create the webhook), and write to that dataset. - ::: + +### Troubleshooting + +#### How do I allow a token to run a task? + +Tasks don't have a dedicated **Run** permission. Instead, you should configure the token with the following permissions: + +- **Run** on the Actor that the task is executing +- **Read** on the task + +See the following example: + +![Scoped token configured to run a task](../images/api-token-scoped-run-tasks.png) + +Refer to [this section](#permission-dependencies) to understand how permission dependencies work. + +#### My run failed and I can see `insufficient permissions` in the logs + +When a run fails with insufficient permissions in the logs, it typically means the Actor is using a scoped token with **Restricted access** configured. + +![Scoped token with Restricted access](../images/api-token-scoped-restricted-access-active.png) + +What is happening is that the Actor is trying to access a resource (such as a dataset, or a key-value store) or perform an operation that it does not have sufficient permissions for. + +If you know what it is, you can add the permission to the scope of your token. If you don't, you can switch the permission mode on the token to **Full access**. This means that the Actor will be able to access all your account data. + +Refer to [Actor execution](#actor-execution) section to understand how executing Actors with scoped tokens works.