Run pre-commit hooks over existing codebase

Co-Authored-By: Ben Phelps <ben@phelps.io>
This commit is contained in:
shamoon 2023-10-17 23:26:55 -07:00
parent fa50bbad9c
commit 19c25713c4
387 changed files with 4785 additions and 4109 deletions

View file

@ -9,28 +9,28 @@ Fields need to be defined in the `mappings` section YAML object to correlate wit
```yaml
widget:
type: customapi
url: http://custom.api.host.or.ip:port/path/to/exact/api/endpoint
refreshInterval: 10000 # optional - in milliseconds, defaults to 10s
username: username # auth - optional
password: password # auth - optional
method: GET # optional, e.g. POST
headers: # optional, must be object, see below
mappings:
- field: key # needs to be YAML string or object
label: Field 1
format: text # optional - defaults to text
- field: # needs to be YAML string or object
path:
to: key2
format: number # optional - defaults to text
label: Field 2
- field: # needs to be YAML string or object
path:
to:
another: key3
label: Field 3
format: percent # optional - defaults to text
type: customapi
url: http://custom.api.host.or.ip:port/path/to/exact/api/endpoint
refreshInterval: 10000 # optional - in milliseconds, defaults to 10s
username: username # auth - optional
password: password # auth - optional
method: GET # optional, e.g. POST
headers: # optional, must be object, see below
mappings:
- field: key # needs to be YAML string or object
label: Field 1
format: text # optional - defaults to text
- field: # needs to be YAML string or object
path:
to: key2
format: number # optional - defaults to text
label: Field 2
- field: # needs to be YAML string or object
path:
to:
another: key3
label: Field 3
format: percent # optional - defaults to text
```
Supported formats for the values are `text`, `number`, `float`, `percent`, `bytes` and `bitrate`.
@ -41,22 +41,22 @@ For the following JSON object from the API:
```json
{
"id": 1,
"name": "Rick Sanchez",
"status": "Alive",
"species": "Human",
"gender": "Male",
"origin": {
"name": "Earth (C-137)"
"id": 1,
"name": "Rick Sanchez",
"status": "Alive",
"species": "Human",
"gender": "Male",
"origin": {
"name": "Earth (C-137)"
},
"locations": [
{
"name": "Earth (C-137)"
},
"locations": [
{
"name": "Earth (C-137)"
},
{
"name": "Citadel of Ricks"
}
]
{
"name": "Citadel of Ricks"
}
]
}
```
@ -64,17 +64,17 @@ Define the `mappings` section as an aray, for example:
```yaml
mappings:
- field: name # Rick Sanchez
label: Name
- field: status # Alive
label: Status
- field:
origin: name # Earth (C-137)
label: Origin
- field:
locations:
1: name # Citadel of Ricks
label: Location
- field: name # Rick Sanchez
label: Name
- field: status # Alive
label: Status
- field:
origin: name # Earth (C-137)
label: Origin
- field:
locations:
1: name # Citadel of Ricks
label: Location
```
## Data Transformation
@ -86,12 +86,12 @@ You can manipulate data with the following tools `remap`, `scale` and `suffix`,
label: Field 4
format: text
remap:
- value: 0
to: None
- value: 1
to: Connected
- any: true # will map all other values
to: Unknown
- value: 0
to: None
- value: 1
to: Connected
- any: true # will map all other values
to: Unknown
- field: key5
label: Power
format: float
@ -105,5 +105,5 @@ Pass custom headers using the `headers` option, for example:
```yaml
headers:
X-API-Token: token
X-API-Token: token
```