Go client for the DataPacket API.
go get github.com/sliplane/datapacket-goclient := datapacket.New("your-api-key")
ctx := context.Background()
// Get account info
account, err := client.Account(ctx)
// List all servers
for server, err := range client.ServerIterator(ctx, nil) {
fmt.Printf("%s (%s)\n", server.Name, server.Location.Name)
}
// Error handling
server, err := client.Server(ctx, datapacket.ServerInput{Name: ptr("DP-99999")})
if apiErr, ok := err.(datapacket.APIError); ok && apiErr.IsNotFound() {
// handle not found
}MIT