Official SDK
Go SDKMethods accept context.Context for cancellation. API failures are returned as *as213905.APIError with Status, Code, RequiredScope and RetryAfter fields.
Installation
Example
go get git.datacoria.com/Phylex/as213905-sdk/go@v1.1.0
Complete example
Example
package main

import (
  "context"
  "fmt"
  "log"
  "os"

  as213905 "git.datacoria.com/Phylex/as213905-sdk/go/as213905"
)

func main() {
  client := as213905.New(os.Getenv("AS213905_API_KEY"))
  traffic, err := client.Traffic(context.Background(), &as213905.TrafficQuery{Days: 7})
  if err != nil { log.Fatal(err) }
  fmt.Printf("p95: %d kbps\n", traffic.P95Kbps)
}
Production usage
Credential handling
Read the API key from a secret or environment variable. Reuse one client instance, set request cancellation in your application, and handle 429 responses according to Retry-After.