Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/josef-friedrich/pretty-typed-icinga2-api-client_js
pretiac: PREtty Typed Icinga2 Api Client (in Typescript)
https://github.com/josef-friedrich/pretty-typed-icinga2-api-client_js
api icinga2 rest-api
Last synced: 23 days ago
JSON representation
pretiac: PREtty Typed Icinga2 Api Client (in Typescript)
- Host: GitHub
- URL: https://github.com/josef-friedrich/pretty-typed-icinga2-api-client_js
- Owner: Josef-Friedrich
- License: mit
- Created: 2023-12-29T08:20:43.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-08-21T15:58:50.000Z (4 months ago)
- Last Synced: 2024-09-18T20:56:01.006Z (3 months ago)
- Topics: api, icinga2, rest-api
- Language: TypeScript
- Homepage: https://josef-friedrich.github.io/PREtty-Typed-Icinga2-Api-Client_js/
- Size: 402 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![npm](https://img.shields.io/npm/v/pretiac.svg)](https://npmjs.com/package/pretiac)
# pretiac: PREtty Typed Icinga2 Api Client
## Similar projects
* [icinga-api](https://github.com/jovemnf/icinga-api): javascript / not updated since 6 years
* [icinga2-api](https://www.npmjs.com/package/icinga2-api): javascript / not updated since 5 years
* [icinga2_api_request](https://github.com/jtejedera/icinga2_api_request) corresponding frontend
* [kube-icinga](https://github.com/gyselroth/kube-icinga): uses icinga2-apihttps://github.com/adedomin/perfdata-parser
## TypeDoc
https://typedoc.org/tags/group/
Configuration attributes
```ts
/**
* @group config
*/
```Runtime attributes
```ts
/**
* @group runtime
*/
```Attributes that represent object relationships. The objects are linked via joins.
```ts
/**
* @group navigation
*/
```## Typescript
TypeScript function return type based on input parameter
https://stackoverflow.com/a/54166010
```ts
interface Circle {
type: 'circle'
radius: number
}interface Square {
type: 'square'
length: number
}type TypeName = 'circle' | 'square'
type ObjectTyp = T extends 'circle'
? Circle
: T extends 'square'
? Square
: neverconst shapes: (Circle | Square)[] = [
{ type: 'circle', radius: 1 },
{ type: 'circle', radius: 2 },
{ type: 'square', length: 10 }
]function getItems(type: T): ObjectTyp[] {
return shapes.filter((s) => s.type == type) as ObjectTyp[]
}const circles = getItems('circle')
for (const circle of circles) {
console.log(circle.length)
}
```