Skip to content
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
1 change: 1 addition & 0 deletions apify-api/openapi/code_samples/curl/act_builds_get.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify builds ls
1 change: 1 addition & 0 deletions apify-api/openapi/code_samples/curl/act_builds_post.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify actors build <ACTOR ID>
1 change: 1 addition & 0 deletions apify-api/openapi/code_samples/curl/act_delete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify actors rm <ACTOR ID>
1 change: 1 addition & 0 deletions apify-api/openapi/code_samples/curl/act_get.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify actors info <ACTOR ID>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify runs resurrect <RUN ID>
1 change: 1 addition & 0 deletions apify-api/openapi/code_samples/curl/act_runs_get.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify runs ls <ACTOR ID>
1 change: 1 addition & 0 deletions apify-api/openapi/code_samples/curl/act_runs_post.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify actors start <ACTOR ID>
1 change: 1 addition & 0 deletions apify-api/openapi/code_samples/curl/actorBuild_delete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify builds rm <BUILD ID>
1 change: 1 addition & 0 deletions apify-api/openapi/code_samples/curl/actorBuild_get.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify builds info <BUILD ID>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify builds log <BUILD ID>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify runs abort <RUN ID>
1 change: 1 addition & 0 deletions apify-api/openapi/code_samples/curl/actorRun_delete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify runs rm <RUN ID>
1 change: 1 addition & 0 deletions apify-api/openapi/code_samples/curl/actorRun_get.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify runs info <RUN ID>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify runs resurrect <RUN ID>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify task run <TASK ID>
1 change: 1 addition & 0 deletions apify-api/openapi/code_samples/curl/acts_get.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify actors ls
1 change: 1 addition & 0 deletions apify-api/openapi/code_samples/curl/acts_post.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify create <ACTOR NAME>
1 change: 1 addition & 0 deletions apify-api/openapi/code_samples/curl/dataset_delete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify datasets rm <DATASET ID>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify datasets push-items <DATASET ID> '{ "foo": "bar" }'
1 change: 1 addition & 0 deletions apify-api/openapi/code_samples/curl/dataset_put.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify datasets rename <DATASET ID> <DATASET NAME>
1 change: 1 addition & 0 deletions apify-api/openapi/code_samples/curl/datasets_get.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify datasets ls
1 change: 1 addition & 0 deletions apify-api/openapi/code_samples/curl/datasets_post.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify datasets create <DATASET NAME>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify key-value-stores rm <STORE ID>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify key-value-stores keys <STORE ID>
1 change: 1 addition & 0 deletions apify-api/openapi/code_samples/curl/keyValueStore_put.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify key-value-stores rename <STORE ID> <STORE NAME>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify key-value-stores delete-value <STORE ID> INPUT
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify key-value-stores get-value <STORE ID> INPUT
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify key-value-stores set-value <STORE ID> INPUT '{"new": "value"}'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify key-value-stores ls
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify key-value-stores create <STORE NAME>
1 change: 1 addition & 0 deletions apify-api/openapi/code_samples/curl/users_me_get.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
apify info
12 changes: 8 additions & 4 deletions apify-api/plugins/decorators/code-samples-decorator.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const path = require('path');
const X_CODE_SAMPLES_PROPERTY = 'x-codeSamples';

const LANGUAGES = [
{ lang: 'JavaScript', label: 'JS client' },
{ lang: 'JavaScript', label: 'JS client', langSuffix: 'js' },
{ lang: 'cURL', label: 'Apify CLI', langSuffix: 'sh' },
];

/**
Expand All @@ -28,12 +29,15 @@ function CodeSamplesDecorator(target) {
// so we change it here to keep the file names consistent
const operationId = target.operationId === 'PostResurrectRun' ? 'actorRun_resurrect_post' : target.operationId;

for (const { lang, label } of LANGUAGES) {
const codeSamplePath = path.join(__dirname, `../../openapi/code_samples/${lang.toLowerCase()}/${operationId}.js`);
for (const { lang, label, langSuffix } of LANGUAGES) {
const codeSamplePath = path.join(
__dirname,
`../../openapi/code_samples/${lang.toLowerCase()}/${operationId}.${langSuffix}`,
);

if (!existsSync(codeSamplePath)) {
// Just use this console log in development to see which operations are missing a code sample.
// console.log(`Missing code sample for operation ${target.operationId}`);
// console.log(`Missing code sample for operation ${target.operationId}.${langSuffix}`);
return;
}

Expand Down
12 changes: 6 additions & 6 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,12 @@ module.exports = {
],
},
languageTabs: [
{
highlight: 'bash',
label: 'CLI',
language: 'curl',
logoClass: 'curl',
},
{
highlight: 'javascript',
label: 'JavaScript',
Expand All @@ -334,12 +340,6 @@ module.exports = {
language: 'python',
logoClass: 'python',
},
{
highlight: 'bash',
label: 'cURL',
language: 'curl',
logoClass: 'curl',
},
{
highlight: 'php',
label: 'PHP',
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading