Shared runtime helpers used by the Sendmux Go surface packages.
go get sendmux.ai/go@latestimport "sendmux.ai/go/core"- API-key prefix validation with
ValidateAPIKeyandKeySurface. - Shared
APIError,ErrorIssue,SuccessEnvelope, andPaginationtypes. - Retry-aware HTTP clients through
NewHTTPClient,NewRetryingTransport, andRetryOptions. - Cursor iteration through
IterateCursorfor code that adapts a response type to thecore.Pageinterface.
package main
import (
"net/http"
"os"
"time"
"sendmux.ai/go/core"
)
func newHTTPClient() *http.Client {
if err := core.ValidateAPIKey(os.Getenv("SENDMUX_API_KEY"), core.KeySurfaceRoot); err != nil {
panic(err)
}
return core.NewHTTPClient(nil, core.RetryOptions{
MaxAttempts: 4,
BaseDelay: 250 * time.Millisecond,
MaxDelay: 5 * time.Second,
})
}Use KeySurfaceSending for send-capable smx_mbx_ keys or owner-approved Sending-resource smx_agent_ tokens, KeySurfaceMailbox for smx_mbx_ keys or scoped smx_agent_ tokens, and KeySurfaceRoot for smx_root_ keys.
Most applications should import sendmux.ai/go/sending, sendmux.ai/go/mailbox, or sendmux.ai/go/management directly. Those packages apply the core helpers for you.
- Guides: https://sendmux.ai/docs
- Go reference: https://pkg.go.dev/sendmux.ai/go/core