Skip to content

Commit

Permalink
feat: add code samples for Actor object (#1336)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-murasovs authored Dec 13, 2024
1 parent b948acd commit 5a36160
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 4 deletions.
6 changes: 6 additions & 0 deletions apify-api/openapi/code_samples/javascript/act_delete.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { ApifyClient } from 'apify-client';

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

const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const actor = await apifyClient
.actor('<ACTOR ID>')
.get();

console.log(actor);

Check warning on line 10 in apify-api/openapi/code_samples/javascript/act_get.js

View workflow job for this annotation

GitHub Actions / Lint app code

Unexpected console statement
12 changes: 12 additions & 0 deletions apify-api/openapi/code_samples/javascript/act_put.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { ApifyClient } from 'apify-client';

const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const updatedActor = await apifyClient
.actor('<ACTOR ID>')
.update({
title: 'New title',
});

console.log(updatedActor);

Check warning on line 12 in apify-api/openapi/code_samples/javascript/act_put.js

View workflow job for this annotation

GitHub Actions / Lint app code

Unexpected console statement
8 changes: 6 additions & 2 deletions apify-api/openapi/code_samples/javascript/acts_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.actors().list();
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const { items } = await apifyClient
.actors()
.list();

console.log(items);

Check warning on line 10 in apify-api/openapi/code_samples/javascript/acts_get.js

View workflow job for this annotation

GitHub Actions / Lint app code

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

const apifyClient = new ApifyClient({ token: 'my-token' });
const myActor = await apifyClient.actors().create({ name: 'my-actor' });
const apifyClient = new ApifyClient({
token: '<TOKEN>',
});
const myActor = await apifyClient
.actors()
.create({
name: '<ACTOR NAME>',
});

console.log(myActor);

Check warning on line 12 in apify-api/openapi/code_samples/javascript/acts_post.js

View workflow job for this annotation

GitHub Actions / Lint app code

Unexpected console statement

0 comments on commit 5a36160

Please sign in to comment.