lowdefy/packages/docs/actions/Request.yaml

71 lines
2.4 KiB
YAML

# Copyright 2020-2021 Lowdefy, Inc
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
_ref:
path: templates/actions.yaml.njk
vars:
pageId: Request
pageTitle: Request
filePath: actions/Request.yaml
types: |
```
(options: {all: boolean}): void
(requestId: string): void
(requestIds: string[]): void
```
description: |
The `Request` action calls a request, or if used during an `onInit` or `onEnter` events, calls those requests while a page loads.
`Request` can be used to call all requests on a `context`, a list of requests, or a single request. The `Request` action is synchronous, actions defined after
it will only run once all the called requests have returned.
To call requests that load data, the `onInitAsync` and `onEnterAsync` events can be used. These will execute the actions while the page begins to render. If the `onInit` or `onEnter` events are used, the page will only start rendering after the actions have completed.
`Request` can be called without any parameters to call all requests in the `context`. It can also be called with a list of requestIds or a single requestId to call.
params: |
###### object
- `all: boolean`: All requests in the context are called if `all` is set to true.
###### string
A requestId of the request to call.
###### string[]
An array of requestIds of the requests to call.
examples: |
###### Call a single request:
```yaml
- id: call_one_request
type: Request
params: my_request_id
```
###### Call a list of requests:
```yaml
- id: call_many_requests
type: Request
params:
- my_request_id_1
- my_request_id_2
- my_request_id_3
```
###### Call all requests:
```yaml
- id: call_all
type: Request
params:
all: true
```