docs: Fix grammar mistakes for build integrations

This commit is contained in:
Faruk AYDIN
2022-11-09 20:16:41 +01:00
parent a973887db2
commit 1cb951056a
5 changed files with 15 additions and 15 deletions

View File

@@ -55,7 +55,7 @@ If you add new actions, you need to add them to the actions/index.ts file and ex
## Add metadata ## Add metadata
Let's create the `actions/mark-cat-image-as-favorite.ts` file inside of the `thecatapi` folder. Let's create the `actions/mark-cat-image-as-favorite.ts` file inside the `thecatapi` folder.
```typescript ```typescript
import defineAction from '../../../../helpers/define-action'; import defineAction from '../../../../helpers/define-action';

View File

@@ -122,9 +122,9 @@ const verifyCredentials = async ($: IGlobalVariable) => {
export default verifyCredentials; export default verifyCredentials;
``` ```
We have generally use `users/me` endpoint or any other endpoint that we can validate the API key or any other credentials that user provides us. For our example, we don't have a specific API endpoint to check whether the credentials are correct or not. So we will randomly pick one of the API endpoints, which will be the `GET /v1/images/search` endpoint. We will send a request to this endpoint with the API key. If the API key is correct, we will get a response from the API. If the API key is incorrect, we will get an error response from the API. We generally use the `users/me` endpoint or any other endpoint that we can validate the API key or any other credentials that the user provides. For our example, we don't have a specific API endpoint to check whether the credentials are correct or not. So we will randomly pick one of the API endpoints, which will be the `GET /v1/images/search` endpoint. We will send a request to this endpoint with the API key. If the API key is correct, we will get a response from the API. If the API key is incorrect, we will get an error response from the API.
Let's implement the authentication logic that we mentioned in the `verify-credentials.ts` file. Let's implement the authentication logic that we mentioned above in the `verify-credentials.ts` file.
```typescript ```typescript
import { IGlobalVariable } from '@automatisch/types'; import { IGlobalVariable } from '@automatisch/types';
@@ -140,7 +140,7 @@ const verifyCredentials = async ($: IGlobalVariable) => {
export default verifyCredentials; export default verifyCredentials;
``` ```
Here we send a request to `/v1/images/search` endpoint with the API key. If we get a response from the API, we will set the screen name to the auth data. If we get an error response from the API, it will throw an error. Here we send a request to the `/v1/images/search` endpoint with the API key. If we get a response from the API, we will set the screen name to the auth data. If we get an error response from the API, it will throw an error.
## Is still verified? ## Is still verified?
@@ -177,15 +177,15 @@ export default isStillVerified;
``` ```
:::info :::info
`isStillVerified` method needs to return `truthy` value if the credentials are still valid. `isStillVerified` method needs to return the `truthy` value if the credentials are still valid.
::: :::
We will use the `verifyCredentials` method to check whether the credentials are still valid or not. If the credentials are still valid, we will return `true`. Otherwise it will thrown an error which will automatically handled by Automatisch. We will use the `verifyCredentials` method to check whether the credentials are still valid or not. If the credentials are still valid, we will return `true`. Otherwise, it will throw an error which will automatically be handled by Automatisch.
:::warning :::warning
You might be wondering why we need to have two separate functions even though we use only one of them behind the scenes in this scenario. That might be true in our example or any other APIs similar to the cat API but there are some other third-party APIs which we can't use the same functionality directly to check whether the credentials are still valid or not. So we need to have two separate functions for verifying the credentials and checking whether the credentials are still valid or not. You might be wondering why we need to have two separate functions even though we use only one of them behind the scenes in this scenario. That might be true in our example or any other APIs similar to the cat API but there are some other third-party APIs that we can't use the same functionality directly to check whether the credentials are still valid or not. So we need to have two separate functions for verifying the credentials and checking whether the credentials are still valid or not.
::: :::
Now we have completed the authentication of the cat API. Go to `My Apps` page in Automatisch, try to add a new connection, select `The Cat API` and use your API key you got with an email. Then you can also check the test connection and reconnect functionality there. Now we have completed the authentication of the cat API. Go to the `My Apps` page in Automatisch, try to add a new connection, select `The Cat API` and use the `API Key` you got with an email. Then you can also check the test connection and reconnect functionality there.
Let's move on to the next page to build a trigger. Let's move on to the next page to build a trigger.

View File

@@ -15,7 +15,7 @@ The build integrations section is best understood when read from beginning to en
::: :::
:::warning :::warning
If you did not set up the development environment yet, please go back to the [development setup](/contributing/development-setup) page and follow the instructions. If you still need to set up the development environment, please go back to the [development setup](/contributing/development-setup) page and follow the instructions.
::: :::
:::tip :::tip
@@ -57,7 +57,7 @@ As mentioned above, actions are the steps we place after a trigger. Actions are
## Common ## Common
Common folder is a place where you can put utilities or shared functionality used by other folders like triggers, actions, auth, etc. The common folder is where you can put utilities or shared functionality used by other folders like triggers, actions, auth, etc.
## Data ## Data

View File

@@ -21,7 +21,7 @@ The global variable is represented as `$` variable in the codebase, and it's a J
## $.auth.set ## $.auth.set
```typescript ```typescript
$.auth.set({ await $.auth.set({
key: 'value', key: 'value',
}); });
``` ```
@@ -54,10 +54,10 @@ It's used to retrieve the API base URL of the app that we defined previously. In
## $.http ## $.http
It's an HTTP client to be used for making HTTP requests. It's a wrapper around the [axios](https://axios-http.com) library. We use this property when we need to make HTTP requests to the third-party service. The `apiBaseUrl` field we set up in the app will be used as the base URL for the HTTP requests. For example to search the cat images, we can use the following code: It's an HTTP client to be used for making HTTP requests. It's a wrapper around the [axios](https://axios-http.com) library. We use this property when we need to make HTTP requests to the third-party service. The `apiBaseUrl` field we set up in the app will be used as the base URL for the HTTP requests. For example, to search the cat images, we can use the following code:
```typescript ```typescript
$.http.get('/v1/images/search?order=DESC', { await $.http.get('/v1/images/search?order=DESC', {
headers: { headers: {
'x-api-key': $.auth.data.apiKey, 'x-api-key': $.auth.data.apiKey,
}, },
@@ -75,7 +75,7 @@ $.pushTriggerItem({
}); });
``` ```
It's used to push trigger data to be processed by Automatisch. It must reflect the data that we get from the third-party service. Let's say for search tweets trigger it will be the JSON that represents the tweet object. It's used to push trigger data to be processed by Automatisch. It must reflect the data that we get from the third-party service. Let's say for search tweets trigger the `resourceData` will be the JSON that represents the single tweet object.
## $.setActionItem ## $.setActionItem

View File

@@ -146,4 +146,4 @@ We do not have to return anything from the `run` function. We are using the `$.p
### Test the trigger ### Test the trigger
Let's go to the flows page of Automatisch and create a new flow. Choose the `The cat API` app and the `Search cat images` trigger and click `Test & Continue` button. If you a see JSON response in the user interface, it means that the trigger is working properly. Let's go to the flows page of Automatisch and create a new flow. Choose `The cat API` app and the `Search cat images` trigger and click `Test & Continue` button. If you a see JSON response in the user interface, it means that the trigger is working properly.