awsysco-go-sdk
Official Go SDK for the AWSYS.CO URL Shortener API.
Installation
go get github.com/AlphaWaveSystems/awsysco-go-sdk
Quick Start
package main
import (
"context"
"fmt"
"log"
awsysco "github.com/AlphaWaveSystems/awsysco-go-sdk"
)
func main() {
client := awsysco.NewClient("awsys_your_api_key_here")
link, err := client.Links.Create(context.Background(), awsysco.CreateLinkInput{
URL: "https://example.com/very/long/url",
})
if err != nil {
log.Fatal(err)
}
fmt.Println("Short URL:", link.ShortURL)
}
Configuration
client := awsysco.NewClient("awsys_your_key",
awsysco.WithBaseURL("https://staging.awsys.co"), // override base URL
awsysco.WithTimeout(15 * time.Second), // custom timeout
awsysco.WithHTTPClient(&http.Client{}), // bring your own http.Client
)
API Reference
Links
// Create a link
link, err := client.Links.Create(ctx, awsysco.CreateLinkInput{
URL: "https://example.com",
CustomSlug: "my-slug", // optional
MaxClicks: &maxClicks, // optional *int
ExpiresAt: &expiresAt, // optional *time.Time
})
// List links
resp, err := client.Links.List(ctx, awsysco.ListLinksInput{
Limit: 20,
Offset: 0,
})
// resp.Links []Link, resp.Total int, resp.HasMore bool
// Get a link by ID
link, err := client.Links.Get(ctx, "link_id")
// Update a link
maxClicks := 500
link, err := client.Links.Update(ctx, "link_id", awsysco.UpdateLinkInput{
MaxClicks: &maxClicks,
})
// Delete a link
err := client.Links.Delete(ctx, "link_id")
Analytics
stats, err := client.Analytics.GetStats(ctx, "link_id")
// stats.ShortCode string
// stats.TotalClicks int
// stats.Clicks []ClickEvent — per-click breakdown (country, device, browser, OS, referrer)