Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add code samples for Schedules, Users, Store #1355

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions apify-api/openapi/code_samples/javascript/log_get.js
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);
8 changes: 8 additions & 0 deletions apify-api/openapi/code_samples/javascript/schedule_delete.js
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();
10 changes: 10 additions & 0 deletions apify-api/openapi/code_samples/javascript/schedule_get.js
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 apify-api/openapi/code_samples/javascript/schedule_log_get.js
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);
12 changes: 12 additions & 0 deletions apify-api/openapi/code_samples/javascript/schedule_put.js
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 apify-api/openapi/code_samples/javascript/schedules_get.js
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 apify-api/openapi/code_samples/javascript/schedules_post.js
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);
10 changes: 10 additions & 0 deletions apify-api/openapi/code_samples/javascript/store_get.js
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);
10 changes: 10 additions & 0 deletions apify-api/openapi/code_samples/javascript/user_get.js
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);
10 changes: 10 additions & 0 deletions apify-api/openapi/code_samples/javascript/users_me_get.js
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 apify-api/openapi/code_samples/javascript/users_me_limits_get.js
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 apify-api/openapi/code_samples/javascript/users_me_limits_put.js
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);
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);
Loading