Skip to content

Commit d57d035

Browse files
committed
fix: better IDs and narrower examples
1 parent 6a75eb4 commit d57d035

File tree

10 files changed

+60
-39
lines changed

10 files changed

+60
-39
lines changed
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ApifyClient } from 'apify-client';
22

3-
const apifyClient = new ApifyClient({ token: 'my-token' });
4-
// Replace apify~my-sample-task with your task's ID or technical name
5-
await apifyClient.task('apify~my-sample-task').delete();
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
await apifyClient.task('<TASK ID>').delete();
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { ApifyClient } from 'apify-client';
22

3-
const apifyClient = new ApifyClient({ token: 'my-token' });
4-
// Replace apify~my-sample-task with your task's ID or technical name
5-
const task = await apifyClient.task('apify~my-sample-task').get();
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const task = await apifyClient
7+
.task('<TASK ID>')
8+
.get();
69

710
console.log(task);
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { ApifyClient } from 'apify-client';
22

3-
const apifyClient = new ApifyClient({ token: 'my-token' });
4-
// Replace apify~my-sample-task with your task's ID or technical name
5-
const input = await apifyClient.task('apify~my-sample-task').getInput();
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const input = await apifyClient
7+
.task('<TASK ID>')
8+
.getInput();
69

710
console.log(input);
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { ApifyClient } from 'apify-client';
22

3-
const apifyClient = new ApifyClient({ token: 'my-token' });
4-
// Replace apify~my-sample-task with your task's ID or technical name
5-
const updatedInput = await apifyClient.task('apify~my-sample-task')
6-
.updateInput({
7-
// Your input here
8-
});
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const updatedInput = await apifyClient
7+
.task('<TASK ID>')
8+
.updateInput({ /** NEW INPUT */ });
99

1010
console.log(updatedInput);
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import { ApifyClient } from 'apify-client';
22

3-
const apifyClient = new ApifyClient({ token: 'my-token' });
4-
// Replace apify~my-sample-task with your task's ID or technical name
5-
const task = await apifyClient.task('apify~my-sample-task').update({
6-
title: 'New title',
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
75
});
6+
const updatedTask = await apifyClient
7+
.task('<TASK ID>')
8+
.update({
9+
title: 'New title',
10+
});
811

9-
console.log(task);
12+
console.log(updatedTask);

apify-api/openapi/code_samples/javascript/actorTask_runs_get.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { ApifyClient } from 'apify-client';
22

3-
const apifyClient = new ApifyClient({ token: 'my-token' });
4-
// Replace apify~my-sample-task with your task's ID or technical name
5-
const { items } = await apifyClient.task('apify~my-sample-task')
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const { items } = await apifyClient
7+
.task('<TASK ID>')
68
.runs()
79
.list();
810

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { ApifyClient } from 'apify-client';
22

3-
const apifyClient = new ApifyClient({ token: 'my-token' });
4-
// Replace apify~my-sample-task with your task's ID or technical name
5-
const run = await apifyClient.task('apify~my-sample-task').start();
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const run = await apifyClient
7+
.task('<TASK ID>')
8+
.start();
69

710
console.log(run);

apify-api/openapi/code_samples/javascript/actorTask_webhooks_get.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { ApifyClient } from 'apify-client';
22

3-
const apifyClient = new ApifyClient({ token: 'my-token' });
4-
// Replace apify~my-sample-task with your task's ID or technical name
5-
const { items } = await apifyClient.task('apify~my-sample-task')
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const { items } = await apifyClient
7+
.task('<TASK ID>')
68
.webhooks()
79
.list();
810

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { ApifyClient } from 'apify-client';
22

3-
const apifyClient = new ApifyClient({ token: 'my-token' });
4-
const { items } = await apifyClient.tasks().list();
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const { items } = await apifyClient
7+
.tasks()
8+
.list();
59

610
console.log(items);
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { ApifyClient } from 'apify-client';
22

3-
const apifyClient = new ApifyClient({ token: 'my-token' });
4-
const { items } = await apifyClient.tasks().create({
5-
/**
6-
* Replace apify~my-sample-actor with the ID or technical name
7-
* of the Actor this task will be based on
8-
*/
9-
actId: 'apify~my-sample-actor',
10-
name: 'my-sample-task',
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
115
});
6+
const { items } = await apifyClient
7+
.tasks()
8+
.create({
9+
actId: '<ACTOR ID>',
10+
name: '<TASK NAME>',
11+
});
1212

1313
console.log(items);

0 commit comments

Comments
 (0)