Skip to content

Commit 8b11936

Browse files
committed
fix: better IDs and narrower code
1 parent 73fd227 commit 8b11936

13 files changed

+75
-32
lines changed
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 abortedBuild = await apifyClient.build('my-build-ID').abort();
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const abortedBuild = await apifyClient
7+
.build('<BUILD ID>')
8+
.abort();
59

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

3-
const apifyClient = new ApifyClient({ token: 'my-token' });
4-
await apifyClient.build('my-build-ID').delete();
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
await apifyClient.build('<BUILD ID>').delete();
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 build = await apifyClient.build('my-build-ID').get();
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const build = await apifyClient
7+
.build('<BUILD ID>')
8+
.get();
59

610
console.log(build);

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

Lines changed: 5 additions & 2 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-
const buildLog = await apifyClient.build('my-build-ID')
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const buildLog = await apifyClient
7+
.build('<BUILD ID>')
58
.log()
69
.get();
710

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

610
console.log(items);
Lines changed: 7 additions & 3 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 run = await apifyClient.run('my-run-ID').abort();
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const abortedRun = await apifyClient
7+
.run('<RUN ID>')
8+
.abort();
59

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

3-
const apifyClient = new ApifyClient({ token: 'my-token' });
4-
const run = await apifyClient.run('my-run-ID').delete();
5-
6-
console.log(run);
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
await apifyClient.run('<RUN ID>').delete();
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 run = await apifyClient.run('my-run-ID').get();
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const run = await apifyClient
7+
.run('<RUN ID>')
8+
.get();
59

610
console.log(run);
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-
const metamorphedRun = await apifyClient.run('my-run-ID')
5-
.metamorph('target-actor-ID');
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const metamorphedRun = await apifyClient
7+
.run('<RUN ID>')
8+
.metamorph('<ACTOR ID>');
69

710
console.log(metamorphedRun);
Lines changed: 6 additions & 3 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-
const updatedRun = await apifyClient.run('my-run-ID')
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const updatedRun = await apifyClient
7+
.run('<RUN ID>')
58
.update({
6-
statusMessage: 'My status message',
9+
statusMessage: 'Actor has finished',
710
});
811

912
console.log(updatedRun);

0 commit comments

Comments
 (0)