Skip to content

Commit

Permalink
fix: better IDs and narrower code
Browse files Browse the repository at this point in the history
  • Loading branch information
m-murasovs committed Dec 11, 2024
1 parent 73fd227 commit 8b11936
Show file tree
Hide file tree
Showing 13 changed files with 75 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { ApifyClient } from 'apify-client';

const apifyClient = new ApifyClient({ token: 'my-token' });
const abortedBuild = await apifyClient.build('my-build-ID').abort();
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const abortedBuild = await apifyClient
.build('<BUILD ID>')
.abort();

console.log(abortedBuild);
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { ApifyClient } from 'apify-client';

const apifyClient = new ApifyClient({ token: 'my-token' });
await apifyClient.build('my-build-ID').delete();
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
await apifyClient.build('<BUILD ID>').delete();
8 changes: 6 additions & 2 deletions apify-api/openapi/code_samples/javascript/actorBuild_get.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { ApifyClient } from 'apify-client';

const apifyClient = new ApifyClient({ token: 'my-token' });
const build = await apifyClient.build('my-build-ID').get();
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const build = await apifyClient
.build('<BUILD ID>')
.get();

console.log(build);
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { ApifyClient } from 'apify-client';

const apifyClient = new ApifyClient({ token: 'my-token' });
const buildLog = await apifyClient.build('my-build-ID')
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const buildLog = await apifyClient
.build('<BUILD ID>')
.log()
.get();

Expand Down
8 changes: 6 additions & 2 deletions apify-api/openapi/code_samples/javascript/actorBuilds_get.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { ApifyClient } from 'apify-client';

const apifyClient = new ApifyClient({ token: 'my-token' });
const { items } = await apifyClient.builds().list();
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const { items } = await apifyClient
.builds()
.list();

console.log(items);
10 changes: 7 additions & 3 deletions apify-api/openapi/code_samples/javascript/actorRun_abort_post.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { ApifyClient } from 'apify-client';

const apifyClient = new ApifyClient({ token: 'my-token' });
const run = await apifyClient.run('my-run-ID').abort();
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const abortedRun = await apifyClient
.run('<RUN ID>')
.abort();

console.log(run);
console.log(abortedRun);
8 changes: 4 additions & 4 deletions apify-api/openapi/code_samples/javascript/actorRun_delete.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApifyClient } from 'apify-client';

const apifyClient = new ApifyClient({ token: 'my-token' });
const run = await apifyClient.run('my-run-ID').delete();

console.log(run);
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
await apifyClient.run('<RUN ID>').delete();
8 changes: 6 additions & 2 deletions apify-api/openapi/code_samples/javascript/actorRun_get.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { ApifyClient } from 'apify-client';

const apifyClient = new ApifyClient({ token: 'my-token' });
const run = await apifyClient.run('my-run-ID').get();
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const run = await apifyClient
.run('<RUN ID>')
.get();

console.log(run);
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { ApifyClient } from 'apify-client';

const apifyClient = new ApifyClient({ token: 'my-token' });
const metamorphedRun = await apifyClient.run('my-run-ID')
.metamorph('target-actor-ID');
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const metamorphedRun = await apifyClient
.run('<RUN ID>')
.metamorph('<ACTOR ID>');

console.log(metamorphedRun);
9 changes: 6 additions & 3 deletions apify-api/openapi/code_samples/javascript/actorRun_put.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { ApifyClient } from 'apify-client';

const apifyClient = new ApifyClient({ token: 'my-token' });
const updatedRun = await apifyClient.run('my-run-ID')
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const updatedRun = await apifyClient
.run('<RUN ID>')
.update({
statusMessage: 'My status message',
statusMessage: 'Actor has finished',
});

console.log(updatedRun);
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { ApifyClient } from 'apify-client';

const apifyClient = new ApifyClient({ token: 'my-token' });
const rebootedRun = await apifyClient.run('my-run-ID').reboot();
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const rebootedRun = await apifyClient
.run('<RUN ID>')
.reboot();

console.log(rebootedRun);
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { ApifyClient } from 'apify-client';

const apifyClient = new ApifyClient({ token: 'my-token' });
const run = await apifyClient.run('my-run-ID').resurrect();
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const resurrectedRun = await apifyClient
.run('<RUN ID>')
.resurrect();

console.log(run);
console.log(resurrectedRun);
8 changes: 6 additions & 2 deletions apify-api/openapi/code_samples/javascript/actorRuns_get.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { ApifyClient } from 'apify-client';

const apifyClient = new ApifyClient({ token: 'my-token' });
const { items } = await apifyClient.runs().list();
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const { items } = await apifyClient
.runs()
.list();

console.log(items);

0 comments on commit 8b11936

Please sign in to comment.