68 lines
2.3 KiB
Markdown
68 lines
2.3 KiB
Markdown
# AS213905 SDK
|
|
|
|
Official API clients and the OpenAPI contract for the AS213905 customer API.
|
|
|
|
The clients cover organisations, invoices, services, VM metrics and power
|
|
actions, transit traffic, tunnels, and RFC 8805 geofeeds. API keys are created
|
|
in **Panel → Settings → API keys** and are always scoped to one organisation.
|
|
|
|
## Packages
|
|
|
|
| Language | Package | Install |
|
|
| --- | --- | --- |
|
|
| Go | `as213905` | `go get git.datacoria.com/Phylex/production-as213905/as213905-sdk/go` |
|
|
| Rust | `as213905-sdk` | Git dependency shown in `rust/README.md` |
|
|
| Python | `as213905` | Git dependency shown in `python/README.md` |
|
|
| JavaScript | `@as213905/sdk` | Git checkout instructions in `javascript/README.md` |
|
|
|
|
All clients use `https://as213905.com` by default and accept a different base
|
|
URL for tests. Never put an API key in a query string or commit it to source.
|
|
|
|
## Quick start
|
|
|
|
```go
|
|
client := as213905.New(os.Getenv("AS213905_API_KEY"))
|
|
traffic, err := client.Traffic(ctx, &as213905.TrafficQuery{Days: 7})
|
|
```
|
|
|
|
```rust
|
|
let client = as213905_sdk::Client::new(std::env::var("AS213905_API_KEY")?);
|
|
let traffic = client.traffic(Some(7), None, None).await?;
|
|
```
|
|
|
|
```python
|
|
client = AS213905(os.environ["AS213905_API_KEY"])
|
|
traffic = client.traffic(days=7)
|
|
```
|
|
|
|
```js
|
|
const client = new AS213905({apiKey: process.env.AS213905_API_KEY});
|
|
const traffic = await client.traffic({days: 7});
|
|
```
|
|
|
|
Geofeed methods additionally take the organisation UUID because the geofeed
|
|
service also supports administrator sessions. An API key can only use its own
|
|
organisation UUID and needs `geofeeds:read` or `geofeeds:write`.
|
|
|
|
## API contract
|
|
|
|
- [`openapi/openapi.yaml`](openapi/openapi.yaml) is the source of truth.
|
|
- Interactive reference: <https://as213905.com/docs/api/reference>
|
|
- Machine-readable production contract: <https://as213905.com/api/v1/openapi.json>
|
|
|
|
## Development
|
|
|
|
Each language directory is independently buildable and tested. See its README
|
|
for language-specific commands. Behaviour shared by every client:
|
|
|
|
- bearer authentication in the `Authorization` header;
|
|
- stable `APIError`/`Error` values containing HTTP status, API error code and
|
|
response message;
|
|
- request timeouts;
|
|
- no automatic retries for mutation requests;
|
|
- typed request and response models for the documented operations.
|
|
|
|
## License
|
|
|
|
MIT. See [LICENSE](LICENSE).
|