Feat: Write docs for prefab contributions (#49)

This commit is contained in:
kotte
2023-12-12 13:56:16 +01:00
committed by GitHub
parent 379ed363f4
commit 5e89922840
15 changed files with 296 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
---
title: My Prefab - Request
hide_title: true
---
# My Prefab - Request
This component is used to call My Prefab endpoints.
> Please note that [My Prefab - Setup](/library/prefabs/my-prefab/components/setup-my-prefab/) needs to be set up in your app before you can properly use this component.
## Extracting the data
The simplest way to extract the data from the response is by using an [Expression](/nodes/math/expression/) node, and accessing the body from the response:
<div className="ndl-image-with-background l">
![](/library/prefabs/my-prefab/request.png)
</div>
For more advanced extraction (and parsing) you can use a [Function](/nodes/javascript/function) node.
## Inputs
| Data | Description |
| ---------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| <span className="ndl-data">Endpoint</span> | The path of the endpoint to be called within the API Group, like `/auth/signup` or `/auth/login`. |
| <span className="ndl-data">Request Type</span> | The type of request you want send. Follows the HTTP standards `GET`, `POST`, `PUT`, `PATCH` and `DELETE`. |
| <span className="ndl-data">Data</span> | A JSON formatted payload that will be sent as Request Body. |
| Signals | Description |
| -------------------------------------- | -------------------------------------------------- |
| <span className="ndl-signal">Do</span> | Sends a Signal to this input to start the request. |
## Outputs
| Data | Description |
| ------------------------------------------ | --------------------------------------------- |
| <span className="ndl-data">Response</span> | The JSON formatted response from the request. |
| Signals | Description |
| ------------------------------------------- | -------------------------------------------------------------------------------- |
| <span className="ndl-signal">Success</span> | Sends a signal when the request succeeded. |
| <span className="ndl-signal">Failure</span> | Sends a signal when an error occurred, and logs an error message in the console. |

View File

@@ -0,0 +1,36 @@
---
title: My Prefab - Setup
hide_title: true
---
# My Prefab - Setup
This component is used to configure My Prefab, enabling your app to establish connections and query your endpoints.
This prefab will not work unless you place one instance of the **My Prefab - Setup** component in your projects Home Component and set the `API Key` and `Datasource` values:
<div className="ndl-image-with-background xl">
![](/library/prefabs/my-prefab/setup.png)
</div>
Below is how **Inputs** and **Outputs** should be documented. Please note the CSS classes attached to each key in the table, as well as the tables titles.
## Inputs
| Data | Description |
| -------------------------------------------- | --------------------------------------------------------------------------- |
| <span className="ndl-data">API Key</span> | The base Request URL used to call all the endpoints of the API Groups. |
| <span className="ndl-data">Datasource</span> | The data environment to be used in your Xano workspace. Defaults to `live`. |
## Outputs
| Data | Description |
| ---------------------------------------- | ---------------------------------------------------------------------------------- |
| <span className="ndl-data">Status</span> | The status of the prefab initialization. Can be `unloaded`, `loading` or `loaded`. |
| Signals | Description |
| ------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| <span className="ndl-signal">Success</span> | Sends a signal when the Xano Client initilized successfully. |
| <span className="ndl-signal">Failure</span> | Sends a signal when the Xano Client failed initializing. Outputs the error message in the console. |