docs: Convert all file imports to ES modules
This commit is contained in:
@@ -19,10 +19,10 @@ The build integrations section is best understood when read from beginning to en
|
||||
Open the `thecatapi/index.js` file and add the highlighted lines for actions.
|
||||
|
||||
```javascript{4,17}
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import auth from './auth';
|
||||
import triggers from './triggers';
|
||||
import actions from './actions';
|
||||
import defineApp from '../../helpers/define-app.js';
|
||||
import auth from './auth/index.js';
|
||||
import triggers from './triggers/index.js';
|
||||
import actions from './actions/index.js';
|
||||
|
||||
export default defineApp({
|
||||
name: 'The cat API',
|
||||
@@ -44,7 +44,7 @@ export default defineApp({
|
||||
Create the `actions/index.js` file inside of the `thecatapi` folder.
|
||||
|
||||
```javascript
|
||||
import markCatImageAsFavorite from './mark-cat-image-as-favorite';
|
||||
import markCatImageAsFavorite from './mark-cat-image-as-favorite/index.js';
|
||||
|
||||
export default [markCatImageAsFavorite];
|
||||
```
|
||||
@@ -58,7 +58,7 @@ If you add new actions, you need to add them to the actions/index.js file and ex
|
||||
Create the `actions/mark-cat-image-as-favorite/index.js` file inside the `thecatapi` folder.
|
||||
|
||||
```javascript
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Mark the cat image as favorite',
|
||||
@@ -94,7 +94,7 @@ Let's briefly explain what we defined here.
|
||||
Open the `actions/mark-cat-image-as-favorite.js` file and add the highlighted lines.
|
||||
|
||||
```javascript{7-20}
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
|
||||
export default defineAction({
|
||||
// ...
|
||||
|
@@ -37,7 +37,7 @@ touch index.js
|
||||
Then let's define the app inside of the `index.js` file as follows:
|
||||
|
||||
```javascript
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import defineApp from '../../helpers/define-app.js';
|
||||
|
||||
export default defineApp({
|
||||
name: 'The cat API',
|
||||
|
@@ -27,8 +27,8 @@ You can find detailed documentation of the cat API [here](https://docs.thecatapi
|
||||
Open the `thecatapi/index.js` file and add the highlighted lines for authentication.
|
||||
|
||||
```javascript{2,13}
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import auth from './auth';
|
||||
import defineApp from '../../helpers/define-app.js';
|
||||
import auth from './auth/index.js';
|
||||
|
||||
export default defineApp({
|
||||
name: 'The cat API',
|
||||
@@ -104,7 +104,7 @@ So until now, we integrated auth folder with the app definition and defined the
|
||||
Start with adding the `verifyCredentials` method to the `auth/index.js` file.
|
||||
|
||||
```javascript{1,8}
|
||||
import verifyCredentials from './verify-credentials';
|
||||
import verifyCredentials from './verify-credentials.js';
|
||||
|
||||
export default {
|
||||
fields: [
|
||||
@@ -154,8 +154,8 @@ We have implemented the `verifyCredentials` method. Now we need to check whether
|
||||
Start with adding the `isStillVerified` method to the `auth/index.js` file.
|
||||
|
||||
```javascript{2,10}
|
||||
import verifyCredentials from './verify-credentials';
|
||||
import isStillVerified from './is-still-verified';
|
||||
import verifyCredentials from './verify-credentials.js';
|
||||
import isStillVerified from './is-still-verified.js';
|
||||
|
||||
export default {
|
||||
fields: [
|
||||
@@ -170,7 +170,7 @@ export default {
|
||||
Let's create the `is-still-verified.js` file inside the `auth` folder.
|
||||
|
||||
```javascript
|
||||
import verifyCredentials from './verify-credentials';
|
||||
import verifyCredentials from './verify-credentials.js';
|
||||
|
||||
const isStillVerified = async ($: IGlobalVariable) => {
|
||||
await verifyCredentials($);
|
||||
|
@@ -16,7 +16,7 @@ The build integrations section is best understood when read from beginning to en
|
||||
|
||||
Before handling authentication and building a trigger and an action, it's better to explain the `global variable` concept in Automatisch. Automatisch provides you the global variable that you need to use with authentication, triggers, actions, and basically all the stuff you will build for the integration.
|
||||
|
||||
The global variable is represented as `$` variable in the codebase, and it's a JSON object that contains the following properties:
|
||||
The global variable is represented as `$` variable in the codebase, and it's a JS object that contains the following properties:
|
||||
|
||||
## $.auth.set
|
||||
|
||||
|
@@ -23,9 +23,9 @@ We used a polling-based HTTP trigger in our example but if you need to use a web
|
||||
Open the `thecatapi/index.js` file and add the highlighted lines for triggers.
|
||||
|
||||
```javascript{3,15}
|
||||
import defineApp from '../../helpers/define-app';
|
||||
import auth from './auth';
|
||||
import triggers from './triggers';
|
||||
import defineApp from '../../helpers/define-app.js';
|
||||
import auth from './auth/index.js';
|
||||
import triggers from './triggers/index.js';
|
||||
|
||||
export default defineApp({
|
||||
name: 'The cat API',
|
||||
@@ -46,7 +46,7 @@ export default defineApp({
|
||||
Create the `triggers/index.js` file inside of the `thecatapi` folder.
|
||||
|
||||
```javascript
|
||||
import searchCatImages from './search-cat-images';
|
||||
import searchCatImages from './search-cat-images/index.js';
|
||||
|
||||
export default [searchCatImages];
|
||||
```
|
||||
@@ -60,7 +60,7 @@ If you add new triggers, you need to add them to the `triggers/index.js` file an
|
||||
Create the `triggers/search-cat-images/index.js` file inside of the `thecatapi` folder.
|
||||
|
||||
```javascript
|
||||
import defineTrigger from '../../../../helpers/define-trigger';
|
||||
import defineTrigger from '../../../../helpers/define-trigger.js';
|
||||
|
||||
export default defineTrigger({
|
||||
name: 'Search cat images',
|
||||
@@ -94,7 +94,7 @@ Let's briefly explain what we defined here.
|
||||
Implement the `run` function by adding highlighted lines.
|
||||
|
||||
```javascript{1,7-30}
|
||||
import defineTrigger from '../../../../helpers/define-trigger';
|
||||
import defineTrigger from '../../../../helpers/define-trigger.js';
|
||||
|
||||
export default defineTrigger({
|
||||
// ...
|
||||
|
Reference in New Issue
Block a user