-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add code samples for Actor object (#1336)
- Loading branch information
1 parent
b948acd
commit 5a36160
Showing
5 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||