Documentation
¶
Overview ¶
Package hyphen provides a Go SDK for the Hyphen platform services including Toggle (feature flags), NetInfo (geo information), and Link (URL shortening).
Index ¶
- Constants
- Variables
- func NewLink(options ...Option) (*link.Link, error)
- func NewNetInfo(options ...Option) (*netinfo.NetInfo, error)
- func NewToggle(options ...Option) (*toggle.Toggle, error)
- type Client
- type CreateQRCodeOptions
- type CreateShortCodeOptions
- type EnvOptions
- type GetCodeStatsResponse
- type GetQRCodesResponse
- type GetShortCodesResponse
- type IPInfo
- type Link
- type NetInfo
- type Option
- func WithAPIKey(key string) Option
- func WithApplicationID(id string) Option
- func WithDefaultContext(ctx *toggle.Context) Option
- func WithDefaultTargetingKey(key string) Option
- func WithEnvironment(env string) Option
- func WithHorizonURLs(urls []string) Option
- func WithLinkURIs(uris []string) Option
- func WithNetInfoBaseURI(uri string) Option
- func WithOrganizationID(id string) Option
- func WithPublicAPIKey(key string) Option
- type Options
- type QRCodeResponse
- type ShortCodeResponse
- type Toggle
- type ToggleContext
- type ToggleCustomAttrs
- type ToggleUser
- type UpdateShortCodeOptions
Constants ¶
const ( QRSizeSmall = link.QRSizeSmall QRSizeMedium = link.QRSizeMedium QRSizeLarge = link.QRSizeLarge )
Re-export constants
Variables ¶
var LoadEnv = env.LoadEnv
LoadEnv loads environment variables from .env files
Functions ¶
func NewNetInfo ¶
NewNetInfo creates a new NetInfo client
Types ¶
type Client ¶
type Client struct {
Toggle *toggle.Toggle
NetInfo *netinfo.NetInfo
Link *link.Link
// contains filtered or unexported fields
}
Client is the main Hyphen SDK client that provides access to all services
type CreateQRCodeOptions ¶
type CreateQRCodeOptions = link.CreateQRCodeOptions
Re-export main types for convenience
type CreateShortCodeOptions ¶
type CreateShortCodeOptions = link.CreateShortCodeOptions
Re-export main types for convenience
type GetCodeStatsResponse ¶
type GetCodeStatsResponse = link.GetCodeStatsResponse
Re-export main types for convenience
type GetQRCodesResponse ¶
type GetQRCodesResponse = link.GetQRCodesResponse
Re-export main types for convenience
type GetShortCodesResponse ¶
type GetShortCodesResponse = link.GetShortCodesResponse
Re-export main types for convenience
type Option ¶
type Option func(*Options)
Option is a functional option for configuring Hyphen services
func WithAPIKey ¶
WithAPIKey sets the API key (used by Link and NetInfo services)
func WithApplicationID ¶
WithApplicationID sets the application ID (used by Toggle service)
func WithDefaultContext ¶
WithDefaultContext sets the default context for Toggle evaluations
func WithDefaultTargetingKey ¶
WithDefaultTargetingKey sets the default targeting key for Toggle
func WithEnvironment ¶
WithEnvironment sets the environment (used by Toggle service)
func WithHorizonURLs ¶
WithHorizonURLs sets custom Horizon URLs for the Toggle service
func WithLinkURIs ¶
WithLinkURIs sets custom URIs for the Link service
func WithNetInfoBaseURI ¶
WithNetInfoBaseURI sets the base URI for the NetInfo service
func WithOrganizationID ¶
WithOrganizationID sets the organization ID (used by Link service)
func WithPublicAPIKey ¶
WithPublicAPIKey sets the public API key (used by Toggle service)
type Options ¶
type Options struct {
// Common authentication
APIKey string // API key for Link and NetInfo services
PublicAPIKey string // Public API key for Toggle service
// Toggle options
ApplicationID string // Application ID for Toggle
Environment string // Environment for Toggle (defaults to "development")
DefaultContext *toggle.Context // Default context for Toggle evaluations
HorizonURLs []string // Custom Horizon URLs for Toggle
DefaultTargetingKey string // Default targeting key for Toggle
// NetInfo options
NetInfoBaseURI string // Base URI for NetInfo service
// Link options
OrganizationID string // Organization ID for Link service
LinkURIs []string // Custom URIs for Link service
}
Options contains all configuration options for Hyphen services
type QRCodeResponse ¶
type QRCodeResponse = link.QRCodeResponse
Re-export main types for convenience
type ShortCodeResponse ¶
type ShortCodeResponse = link.ShortCodeResponse
Re-export main types for convenience
type ToggleCustomAttrs ¶
type ToggleCustomAttrs = toggle.CustomAttributes
Re-export main types for convenience
type UpdateShortCodeOptions ¶
type UpdateShortCodeOptions = link.UpdateShortCodeOptions
Re-export main types for convenience