Initial AS213905 SDK release
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
# 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/as213905-sdk/go` |
|
||||
| Rust | `as213905-sdk` | Git dependency shown in `rust/README.md` |
|
||||
| Python | `as213905` | `pip install "as213905 @ git+https://git.datacoria.com/Phylex/as213905-sdk.git#subdirectory=python"` |
|
||||
| JavaScript | `@as213905/sdk` | `npm install git+https://git.datacoria.com/Phylex/as213905-sdk.git#javascript` |
|
||||
|
||||
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).
|
||||
Reference in New Issue
Block a user