Documentation
¶
Overview ¶
Package shortlinks provides a thin helper for the hosted shortlink API
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrMissingAuthenticationParams indicates a missing client ID or secret ErrMissingAuthenticationParams = errors.New("shortlinks: missing client ID or secret") // ErrMissingURL indicates a missing URL ErrMissingURL = errors.New("shortlinks: missing URL") // ErrEmptyResponse indicates the API returned a nil response ErrEmptyResponse = errors.New("shortlinks: empty response") // ErrEmptyResponseBody indicates the API returned an empty body ErrEmptyResponseBody = errors.New("shortlinks: empty response body") // ErrMissingShortURL indicates the response did not contain a short URL ErrMissingShortURL = errors.New("shortlinks: missing short URL in response") // ErrClientNotConfigured indicates the shortlinks client is not configured ErrClientNotConfigured = errors.New("shortlinks: client not configured") )
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v1.7.1
type Client struct {
// contains filtered or unexported fields
}
Client wraps the shortlink service credentials and provides methods for creating short URLs
func NewClient ¶ added in v1.7.1
NewClient creates a new shortlinks client with the provided credentials
func NewClientFromConfig ¶ added in v1.7.1
NewClientFromConfig creates a new shortlinks client from the provided config
type Config ¶ added in v1.7.1
type Config struct {
// Enabled indicates whether shortlinks functionality is enabled
Enabled bool `json:"enabled" koanf:"enabled" default:"false"`
// ClientID is the Cloudflare Access client ID for shortlink API requests
ClientID string `json:"clientid" koanf:"clientid" default:"d5d5babbdd4ba64d59ae543ac3b6a74d.access"`
// ClientSecret is the Cloudflare Access client secret for shortlink API requests
ClientSecret string `json:"clientsecret" koanf:"clientsecret" default:"" sensitive:"true"`
// EndpointURL is the shortlink service API endpoint
EndpointURL string `json:"endpointurl" koanf:"endpointurl" default:"https://admin.s.theopenlane.io/api/links"`
}
Config holds the configuration for the shortlinks client
Click to show internal directories.
Click to hide internal directories.