Skip to content

Commit 5a36160

Browse files
authored
feat: add code samples for Actor object (#1336)
1 parent b948acd commit 5a36160

File tree

5 files changed

+42
-4
lines changed

5 files changed

+42
-4
lines changed
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.actor('<ACTOR 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 actor = await apifyClient
7+
.actor('<ACTOR ID>')
8+
.get();
9+
10+
console.log(actor);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { ApifyClient } from 'apify-client';
2+
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const updatedActor = await apifyClient
7+
.actor('<ACTOR ID>')
8+
.update({
9+
title: 'New title',
10+
});
11+
12+
console.log(updatedActor);
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.actors().list();
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const { items } = await apifyClient
7+
.actors()
8+
.list();
59

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

3-
const apifyClient = new ApifyClient({ token: 'my-token' });
4-
const myActor = await apifyClient.actors().create({ name: 'my-actor' });
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
const myActor = await apifyClient
7+
.actors()
8+
.create({
9+
name: '<ACTOR NAME>',
10+
});
511

612
console.log(myActor);

0 commit comments

Comments
 (0)