-
Notifications
You must be signed in to change notification settings - Fork 80
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 Schedules, Users, Store (#1355)
- Loading branch information
1 parent
53c7b02
commit 8c0df15
Showing
13 changed files
with
134 additions
and
0 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,10 @@ | ||
import { ApifyClient } from 'apify-client'; | ||
|
||
const apifyClient = new ApifyClient({ | ||
token: '<TOKEN>', | ||
}); | ||
const log = await apifyClient | ||
.log('<BUILD OR RUN ID>') | ||
.get(); | ||
|
||
console.log(log); |
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,8 @@ | ||
import { ApifyClient } from 'apify-client'; | ||
|
||
const apifyClient = new ApifyClient({ | ||
token: '<TOKEN>', | ||
}); | ||
await apifyClient | ||
.schedule('<SCHEDULE 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 schedule = await apifyClient | ||
.schedule('<SCHEDULE ID>') | ||
.get(); | ||
|
||
console.log(schedule); |
10 changes: 10 additions & 0 deletions
10
apify-api/openapi/code_samples/javascript/schedule_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,10 @@ | ||
import { ApifyClient } from 'apify-client'; | ||
|
||
const apifyClient = new ApifyClient({ | ||
token: '<TOKEN>', | ||
}); | ||
const log = await apifyClient | ||
.schedule('<SCHEDULE ID>') | ||
.getLog(); | ||
|
||
console.log(log); |
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 updatedSchedule = await apifyClient | ||
.schedule('<SCHEDULE ID>') | ||
.update({ | ||
title: 'New title', | ||
}); | ||
|
||
console.log(updatedSchedule); |
10 changes: 10 additions & 0 deletions
10
apify-api/openapi/code_samples/javascript/schedules_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 | ||
.schedules() | ||
.list(); | ||
|
||
console.log(items); |
12 changes: 12 additions & 0 deletions
12
apify-api/openapi/code_samples/javascript/schedules_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,12 @@ | ||
import { ApifyClient } from 'apify-client'; | ||
|
||
const apifyClient = new ApifyClient({ | ||
token: '<TOKEN>', | ||
}); | ||
const schedule = await apifyClient | ||
.schedules() | ||
.create({ | ||
name: '<SCHEDULE NAME>', | ||
}); | ||
|
||
console.log(schedule); |
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 | ||
.store() | ||
.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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ApifyClient } from 'apify-client'; | ||
|
||
const apifyClient = new ApifyClient({ | ||
token: '<TOKEN>', | ||
}); | ||
const user = await apifyClient | ||
.user('<USER ID>') | ||
.get(); | ||
|
||
console.log(user); |
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 user = await apifyClient | ||
.user('me') | ||
.get(); | ||
|
||
console.log(user); |
10 changes: 10 additions & 0 deletions
10
apify-api/openapi/code_samples/javascript/users_me_limits_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 limits = await apifyClient | ||
.user('me') | ||
.limits(); | ||
|
||
console.log(limits); |
12 changes: 12 additions & 0 deletions
12
apify-api/openapi/code_samples/javascript/users_me_limits_put.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,12 @@ | ||
import { ApifyClient } from 'apify-client'; | ||
|
||
const apifyClient = new ApifyClient({ | ||
token: '<TOKEN>', | ||
}); | ||
const updatedLimits = await apifyClient | ||
.user('me') | ||
.updateLimits({ | ||
dataRetentionDays: 5, | ||
}); | ||
|
||
console.log(updatedLimits); |
10 changes: 10 additions & 0 deletions
10
apify-api/openapi/code_samples/javascript/users_me_usage_monthly_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 usage = await apifyClient | ||
.user('me') | ||
.monthlyUsage(); | ||
|
||
console.log(usage); |