Skip to content

Commit

Permalink
fix: better IDs and make code narrower
Browse files Browse the repository at this point in the history
  • Loading branch information
m-murasovs committed Dec 11, 2024
1 parent 836ea08 commit 766838e
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { ApifyClient } from 'apify-client';

const apifyClient = new ApifyClient({ token: 'my-token' });
// Replace apify/my-sample-actor with your Actor's ID or technical name
await apifyClient.actor('apify/my-sample-actor')
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
await apifyClient
.actor('<ACTOR ID>')
.version('0.1')
.delete();
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { ApifyClient } from 'apify-client';

const apifyClient = new ApifyClient({ token: 'my-token' });
// Replace apify/my-sample-actor with your Actor's ID or technical name
await apifyClient.actor('apify/my-sample-actor')
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
await apifyClient
.actor('<ACTOR ID>')
.version('0.1')
.envVar('MY_ENV_VAR')
.delete();
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { ApifyClient } from 'apify-client';

const apifyClient = new ApifyClient({ token: 'my-token' });
// Replace apify/my-sample-actor with your Actor's ID or technical name
const envVar = await apifyClient.actor('apify/my-sample-actor')
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const envVar = await apifyClient
.actor('<ACTOR ID>')
.version('0.1')
.envVar('MY_ENV_VAR')
.get();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { ApifyClient } from 'apify-client';

const apifyClient = new ApifyClient({ token: 'my-token' });
// Replace apify/my-sample-actor with your Actor's ID or technical name
const updatedEnvVar = await apifyClient.actor('apify/my-sample-actor')
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const updatedEnvVar = await apifyClient
.actor('<ACTOR ID>')
.version('0.1')
.envVar('MY_ENV_VAR')
.update({
name: 'MY_ENV_VAR',
value: '54321',
value: 'my-new-value',
});

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

const apifyClient = new ApifyClient({ token: 'my-token' });
// Replace apify/my-sample-actor with your Actor's ID or technical name
const { items } = await apifyClient.actor('apify/my-sample-actor')
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const { items } = await apifyClient
.actor('<ACTOR ID>')
.version('0.1')
.envVars()
.list();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { ApifyClient } from 'apify-client';

const apifyClient = new ApifyClient({ token: 'my-token' });
// Replace apify/my-sample-actor with your Actor's ID or technical name
const envVar = await apifyClient.actor('apify/my-sample-actor')
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const envVar = await apifyClient
.actor('<ACTOR ID>')
.version('0.1')
.envVars()
.create({
name: 'MY_ENV_VAR',
value: '12345',
value: 'my-new-value',
isSecret: true,
});

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

const apifyClient = new ApifyClient({ token: 'my-token' });
// Replace apify/my-sample-actor with your Actor's ID or technical name
const version = await apifyClient.actor('apify/my-sample-actor')
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const version = await apifyClient
.actor('<ACTOR ID>')
.version('0.1')
.get();

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

const apifyClient = new ApifyClient({ token: 'my-token' });
// Replace apify/my-sample-actor with your Actor's ID or technical name
const updatedVersion = await apifyClient.actor('apify/my-sample-actor')
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const updatedVersion = await apifyClient
.actor('<ACTOR ID>')
.version('0.1')
.update({
gitRepoUrl: 'https://github.com/my-github-account/new-actor-repo',
buildTag: 'latest',
});

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

const apifyClient = new ApifyClient({ token: 'my-token' });
// Replace apify/my-sample-actor with your Actor's ID or technical name
const { items } = await apifyClient.actor('apify/my-sample-actor')
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const { items } = await apifyClient
.actor('<ACTOR ID>')
.versions()
.list();

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

const apifyClient = new ApifyClient({ token: 'my-token' });
// Replace apify/my-sample-actor with your Actor's ID or technical name
const version = await apifyClient.actor('apify/my-sample-actor')
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const version = await apifyClient
.actor('<ACTOR ID>')
.versions()
.create({
versionNumber: '0.1',
sourceType: 'GIT_REPO',
gitRepoUrl: 'https://github.com/my-github-account/actor-repo',
gitRepoUrl: 'https://github.com/my/repo',
});

console.log(version);

0 comments on commit 766838e

Please sign in to comment.