-
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 Runs and Builds (#1340)
- Loading branch information
1 parent
54fe91e
commit 98ce77a
Showing
16 changed files
with
132 additions
and
3 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
10 changes: 10 additions & 0 deletions
10
apify-api/openapi/code_samples/javascript/actorBuild_abort_post.js
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 abortedBuild = await apifyClient | ||
.build('<BUILD ID>') | ||
.abort(); | ||
|
||
console.log(abortedBuild); |
6 changes: 6 additions & 0 deletions
6
apify-api/openapi/code_samples/javascript/actorBuild_delete.js
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.build('<BUILD ID>').delete(); |
10 changes: 10 additions & 0 deletions
10
apify-api/openapi/code_samples/javascript/actorBuild_get.js
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 build = await apifyClient | ||
.build('<BUILD ID>') | ||
.get(); | ||
|
||
console.log(build); |
11 changes: 11 additions & 0 deletions
11
apify-api/openapi/code_samples/javascript/actorBuild_log_get.js
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,11 @@ | ||
import { ApifyClient } from 'apify-client'; | ||
|
||
const apifyClient = new ApifyClient({ | ||
token: '<TOKEN>', | ||
}); | ||
const buildLog = await apifyClient | ||
.build('<BUILD ID>') | ||
.log() | ||
.get(); | ||
|
||
console.log(buildLog); |
10 changes: 10 additions & 0 deletions
10
apify-api/openapi/code_samples/javascript/actorBuilds_get.js
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 { items } = await apifyClient | ||
.builds() | ||
.list(); | ||
|
||
console.log(items); |
10 changes: 10 additions & 0 deletions
10
apify-api/openapi/code_samples/javascript/actorRun_abort_post.js
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 abortedRun = await apifyClient | ||
.run('<RUN ID>') | ||
.abort(); | ||
|
||
console.log(abortedRun); |
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.run('<RUN 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 run = await apifyClient | ||
.run('<RUN ID>') | ||
.get(); | ||
|
||
console.log(run); |
10 changes: 10 additions & 0 deletions
10
apify-api/openapi/code_samples/javascript/actorRun_metamorph_post.js
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 metamorphedRun = await apifyClient | ||
.run('<RUN ID>') | ||
.metamorph('<ACTOR ID>'); | ||
|
||
console.log(metamorphedRun); |
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 updatedRun = await apifyClient | ||
.run('<RUN ID>') | ||
.update({ | ||
statusMessage: 'Actor has finished', | ||
}); | ||
|
||
console.log(updatedRun); |
10 changes: 10 additions & 0 deletions
10
apify-api/openapi/code_samples/javascript/actorRun_reboot_post.js
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 rebootedRun = await apifyClient | ||
.run('<RUN ID>') | ||
.reboot(); | ||
|
||
console.log(rebootedRun); |
10 changes: 10 additions & 0 deletions
10
apify-api/openapi/code_samples/javascript/actorRun_resurrect_post.js
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 resurrectedRun = await apifyClient | ||
.run('<RUN ID>') | ||
.resurrect(); | ||
|
||
console.log(resurrectedRun); |
10 changes: 10 additions & 0 deletions
10
apify-api/openapi/code_samples/javascript/actorRuns_get.js
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 { items } = await apifyClient | ||
.runs() | ||
.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
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