Skip to content

Commit 080d7fa

Browse files
committed
feat: add code samples for Schedules, Users, Store
1 parent b948acd commit 080d7fa

File tree

14 files changed

+142
-2
lines changed

14 files changed

+142
-2
lines changed
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);
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 log = await apifyClient
7+
.log('<BUILD OR RUN ID>')
8+
.get();
9+
10+
console.log(log);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { ApifyClient } from 'apify-client';
2+
3+
const apifyClient = new ApifyClient({
4+
token: '<TOKEN>',
5+
});
6+
await apifyClient
7+
.schedule('<SCHEDULE ID>')
8+
.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 schedule = await apifyClient
7+
.schedule('<SCHEDULE ID>')
8+
.get();
9+
10+
console.log(schedule);
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 log = await apifyClient
7+
.schedule('<SCHEDULE ID>')
8+
.getLog();
9+
10+
console.log(log);
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 updatedSchedule = await apifyClient
7+
.schedule('<SCHEDULE ID>')
8+
.update({
9+
title: 'New title',
10+
});
11+
12+
console.log(updatedSchedule);
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 { items } = await apifyClient
7+
.schedules()
8+
.list();
9+
10+
console.log(items);
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 schedule = await apifyClient
7+
.schedules()
8+
.create({
9+
name: '<SCHEDULE NAME>',
10+
});
11+
12+
console.log(schedule);
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 { items } = await apifyClient
7+
.store()
8+
.list();
9+
10+
console.log(items);
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 user = await apifyClient
7+
.user('<USER ID>')
8+
.get();
9+
10+
console.log(user);

0 commit comments

Comments
 (0)