Skip to content

Commit 96e7fc6

Browse files
authored
Merge branch 'master' into update-academy/monetizing-your-actor
2 parents f4354de + 9f5e44b commit 96e7fc6

File tree

19 files changed

+184
-455
lines changed

19 files changed

+184
-455
lines changed

.redocly.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ plugins:
2727
decorators:
2828
apify/legacy-doc-url-decorator: on
2929
apify/client-references-links-decorator: on
30+
apify/code-samples-decorator: on
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { ApifyClient } from 'apify-client';
2+
3+
const apifyClient = new ApifyClient({ token: 'my-token' });
4+
const { items } = await apifyClient.actors().list();
5+
6+
console.log(items);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { ApifyClient } from 'apify-client';
2+
3+
const apifyClient = new ApifyClient({ token: 'my-token' });
4+
const myActor = await apifyClient.actors().create({ name: 'my-actor' });
5+
6+
console.log(myActor);

apify-api/plugins/apify.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const ClientReferencesLinksDecorator = require('./decorators/client-references-links-decorator');
2+
const CodeSamplesDecorator = require('./decorators/code-samples-decorator');
23
const LegacyDocUrlDecorator = require('./decorators/legacy-doc-url-decorator');
34

45
module.exports = {
@@ -7,6 +8,7 @@ module.exports = {
78
oas3: {
89
'legacy-doc-url-decorator': LegacyDocUrlDecorator,
910
'client-references-links-decorator': ClientReferencesLinksDecorator,
11+
'code-samples-decorator': CodeSamplesDecorator,
1012
},
1113
},
1214
};
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
const { existsSync } = require('fs');
2+
const path = require('path');
3+
4+
const X_CODE_SAMPLES_PROPERTY = 'x-codeSamples';
5+
6+
const LANGUAGES = [
7+
{ lang: 'JavaScript', label: 'JS client' },
8+
];
9+
10+
/**
11+
* This decorator adds the x-codeSamples property to the schema object if a file with the operationId exists in the
12+
* code samples directory.
13+
* This helps us add the samples in a consistent way and find out which operations are missing a sample.
14+
*
15+
* The added sample link will look like this:
16+
* x-codeSamples:
17+
* - lang: JavaScript
18+
* label: JS client
19+
* source:
20+
* $ref: ../../code_samples/js/acts_post.js
21+
*/
22+
function CodeSamplesDecorator(target) {
23+
if (!target.operationId) return;
24+
25+
const codeSamples = [];
26+
27+
for (const { lang, label } of LANGUAGES) {
28+
const codeSamplePath = path.join(__dirname, `../../openapi/code_samples/${lang.toLowerCase()}/${target.operationId}.js`);
29+
30+
if (!existsSync(codeSamplePath)) {
31+
// Just use this console log in development to see which operations are missing a code sample.
32+
// console.log(`Missing code sample for operation ${target.operationId}`);
33+
return;
34+
}
35+
36+
codeSamples.push({
37+
lang,
38+
label,
39+
source: {
40+
$ref: codeSamplePath,
41+
},
42+
});
43+
}
44+
45+
if (codeSamples.length) {
46+
target[X_CODE_SAMPLES_PROPERTY] = codeSamples;
47+
}
48+
}
49+
50+
module.exports = () => ({
51+
// Redocly is using a visitor pattern. What the following code does is that whenever the traverser leaves a node of
52+
// type Tag or Operation, it executes CodeSamplesDecorator on it.
53+
Tag: {
54+
leave: CodeSamplesDecorator,
55+
},
56+
Operation: {
57+
leave: CodeSamplesDecorator,
58+
},
59+
});

apify-docs-theme/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@apify/docs-theme",
3-
"version": "1.0.145",
3+
"version": "1.0.146",
44
"description": "",
55
"main": "./src/index.js",
66
"files": [

apify-docs-theme/src/theme/custom.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ html[data-theme='dark'] {
162162
--ifm-footer-link-color: #6b6e80;
163163
--max-layout-width: 1440px;
164164

165-
--ifm-code-background: #f6f8fa;
165+
--ifm-code-background: var(--ifm-pre-background);
166166

167167
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
168168

sources/academy/platform/get_most_of_actors/actor_readme.md

Lines changed: 0 additions & 97 deletions
This file was deleted.

sources/academy/platform/get_most_of_actors/guidelines_for_writing.md

Lines changed: 0 additions & 111 deletions
This file was deleted.

sources/academy/platform/get_most_of_actors/index.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,19 @@ category: apify platform
66
slug: /get-most-of-actors
77
---
88

9-
# Apify Store {#apify-store}
10-
119
**Learn how to optimize your public Actors on Apify Store and monetize them by renting your Actor to other platform users.**
1210

1311
---
1412

15-
[Apify Store](https://apify.com/store) is home to hundreds of public Actors available to the Apify community. Anyone is welcome to [publish Actors](/platform/actors/publishing) in the store, and you can even [monetize your Actors](https://apify.com/partners/actor-developers).
16-
17-
In this section, we will go over some of the practical steps you can take to ensure the high quality of your public Actors. You will learn:
13+
The [Apify Store](https://apify.com/store) is a marketplace featuring thousands of ready-made automation tools called Actors. As a developer, you can publish your own Actors and generate revenue through our [monetization program](https://apify.com/partners/actor-developers).
1814

19-
1. Actor naming and README best practices.
20-
2. How to monetize your Actor.
21-
3. Tips and tricks to attract more users to your Actor's page.
15+
To help you succeed, we've created a comprehensive Marketing Playbook. This resource shows you how to:
2216

23-
## Next up {#next}
17+
- Optimize your Actor's visibility in the store
18+
- Create compelling descriptions and documentation
19+
- Build your developer brand
20+
- Promote your work to potential customers
21+
- Analyze performance metrics
22+
- Engage with the Apify community
2423

25-
Without further ado, let's jump [right into the next lesson](./naming_your_actor.md)!
24+
Ready to grow your presence on the platform? Check out our [Marketing Playbook](https://apify.notion.site/3fdc9fd4c8164649a2024c9ca7a2d0da?v=6d262c0b026d49bfa45771cd71f8c9ab) and learn how to [publish your first Actor](/platform/actors/publishing).

0 commit comments

Comments
 (0)