Skip to content

Commit 98ce77a

Browse files
authored
feat: add code samples for Runs and Builds (#1340)
1 parent 54fe91e commit 98ce77a

16 files changed

+132
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ const apifyClient = new ApifyClient({
55
});
66
const run = await apifyClient
77
.actor('<ACTOR ID>')
8-
.start({ 'foo': 'bar' });
8+
.start({ foo: 'bar' });
99

1010
console.log(run);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { ApifyClient } from 'apify-client';
2+
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const abortedBuild = await apifyClient
7+
.build('<BUILD ID>')
8+
.abort();
9+
10+
console.log(abortedBuild);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { ApifyClient } from 'apify-client';
2+
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
await apifyClient.build('<BUILD ID>').delete();
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { ApifyClient } from 'apify-client';
2+
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const build = await apifyClient
7+
.build('<BUILD ID>')
8+
.get();
9+
10+
console.log(build);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { ApifyClient } from 'apify-client';
2+
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const buildLog = await apifyClient
7+
.build('<BUILD ID>')
8+
.log()
9+
.get();
10+
11+
console.log(buildLog);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { ApifyClient } from 'apify-client';
2+
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const { items } = await apifyClient
7+
.builds()
8+
.list();
9+
10+
console.log(items);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { ApifyClient } from 'apify-client';
2+
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const abortedRun = await apifyClient
7+
.run('<RUN ID>')
8+
.abort();
9+
10+
console.log(abortedRun);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { ApifyClient } from 'apify-client';
2+
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
await apifyClient.run('<RUN ID>').delete();
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { ApifyClient } from 'apify-client';
2+
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const run = await apifyClient
7+
.run('<RUN ID>')
8+
.get();
9+
10+
console.log(run);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { ApifyClient } from 'apify-client';
2+
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const metamorphedRun = await apifyClient
7+
.run('<RUN ID>')
8+
.metamorph('<ACTOR ID>');
9+
10+
console.log(metamorphedRun);

0 commit comments

Comments
 (0)