Versions in this module Expand all Collapse all v2 v2.0.0 Aug 21, 2026 Changes in this version + const MinFlagWriteVersion + var ErrFlagWritesUnsupported = fmt.Errorf("changing flags needs Flagsmith %s or newer", MinFlagWriteVersion) + var ErrNoSuchOverride = errors.New("no override exists for that segment") + var ErrPlanGated = errors.New("not available on your organisation's current plan") + var ErrQuotaExceeded = errors.New("resource limit reached on your organisation's current plan") + var ErrWorkflowGated = fmt.Errorf("this environment uses change-request workflows; direct updates are disabled") + func ServerVersion(ctx context.Context, httpClient *http.Client, apiURL string) (string, error) + type APIKey string + func (k APIKey) Apply(req *http.Request) + type Auth interface + Apply func(req *http.Request) + type Bearer string + func (b Bearer) Apply(req *http.Request) + type Client struct + func NewClient(baseURL string, auth Auth, opts ...Option) *Client + func (c *Client) CloneEnvironment(ctx context.Context, apiKey string, body map[string]any) (*Environment, error) + func (c *Client) CoreIdentityOverrides(ctx context.Context, envKey string, featureID int) ([]IdentityOverrideRow, error) + func (c *Client) CreateEnvironment(ctx context.Context, body map[string]any) (*Environment, error) + func (c *Client) CreateEnvironmentAPIKey(ctx context.Context, envKey string, body map[string]any) (*EnvironmentAPIKey, error) + func (c *Client) CreateFeature(ctx context.Context, projectID int, in FeatureWrite) (*Feature, error) + func (c *Client) CreateIdentity(ctx context.Context, envKey, identifier string) (int, error) + func (c *Client) CreateMVOption(ctx context.Context, projectID, featureID int, in MultivariateOption) (*MultivariateOption, error) + func (c *Client) CreateOrganisation(ctx context.Context, body map[string]any) (*Organisation, error) + func (c *Client) CreateProject(ctx context.Context, body map[string]any) (*Project, error) + func (c *Client) CreateSegment(ctx context.Context, projectID int, in Segment) (*Segment, error) + func (c *Client) DeleteEdgeIdentityOverride(ctx context.Context, envKey, identifier string, featureID int) error + func (c *Client) DeleteEnvironment(ctx context.Context, apiKey string) error + func (c *Client) DeleteEnvironmentAPIKey(ctx context.Context, envKey string, keyID int) error + func (c *Client) DeleteFeature(ctx context.Context, projectID, featureID int) error + func (c *Client) DeleteIdentityOverride(ctx context.Context, envKey string, identityID, fsID int) error + func (c *Client) DeleteMVOption(ctx context.Context, projectID, featureID, optionID int) error + func (c *Client) DeleteOrganisation(ctx context.Context, orgID int) error + func (c *Client) DeleteProject(ctx context.Context, projectID int) error + func (c *Client) DeleteSegment(ctx context.Context, projectID, segmentID int) error + func (c *Client) DeleteSegmentOverride(ctx context.Context, environmentKey string, featureID, segmentID int) (*UpdateFlagResponse, error) + func (c *Client) EdgeIdentityOverride(ctx context.Context, envKey, identityUUID string, featureID int) (*IdentityFeatureState, error) + func (c *Client) EdgeIdentityOverrides(ctx context.Context, envKey string, featureID int) ([]IdentityOverrideRow, error) + func (c *Client) EdgeIdentityUUID(ctx context.Context, envKey, identifier string) (uuid string, found bool, err error) + func (c *Client) EnvironmentAPIKeys(ctx context.Context, envKey string) ([]EnvironmentAPIKey, error) + func (c *Client) EnvironmentDocument(ctx context.Context, apiKey string) (json.RawMessage, error) + func (c *Client) Environments(ctx context.Context, projectID int) ([]Environment, error) + func (c *Client) FeatureSegments(ctx context.Context, environmentID, featureID int) ([]FeatureSegment, error) + func (c *Client) FeatureStates(ctx context.Context, environmentID, featureID int) ([]EnvironmentFeatureState, error) + func (c *Client) Features(ctx context.Context, projectID, environmentID, segmentID int, search string) ([]Feature, error) + func (c *Client) GetEnvironment(ctx context.Context, apiKey string) (*Environment, error) + func (c *Client) GetFeature(ctx context.Context, projectID, featureID int) (*Feature, error) + func (c *Client) GetOrganisation(ctx context.Context, orgID int) (*Organisation, error) + func (c *Client) GetProject(ctx context.Context, projectID int) (*Project, error) + func (c *Client) GetSegment(ctx context.Context, projectID, segmentID int) (*Segment, error) + func (c *Client) GetSubscriptionMetadata(ctx context.Context, orgID int) (*SubscriptionMetadata, error) + func (c *Client) IdentityByIdentifier(ctx context.Context, envKey, identifier string) (id int, found bool, err error) + func (c *Client) IdentityOverride(ctx context.Context, envKey string, identityID, featureID int) (*IdentityFeatureState, error) + func (c *Client) Organisations(ctx context.Context) ([]Organisation, error) + func (c *Client) ProjectFeatures(ctx context.Context, projectID int, includeArchived bool) ([]Feature, error) + func (c *Client) Projects(ctx context.Context, organisationID int) ([]Project, error) + func (c *Client) Segments(ctx context.Context, projectID int, include bool) ([]Segment, error) + func (c *Client) SetEdgeIdentityOverride(ctx context.Context, envKey, identifier string, featureID int, enabled bool, ...) error + func (c *Client) SetIdentityOverride(ctx context.Context, envKey string, identityID, featureID, fsID int, ...) error + func (c *Client) UpdateEnvironment(ctx context.Context, apiKey string, body map[string]any) (*Environment, error) + func (c *Client) UpdateFeature(ctx context.Context, projectID, featureID int, in FeatureWrite) (*Feature, error) + func (c *Client) UpdateFlag(ctx context.Context, environmentKey string, featureID int, ...) (*UpdateFlagResponse, error) + func (c *Client) UpdateMVOption(ctx context.Context, projectID, featureID, optionID int, in MultivariateOption) (*MultivariateOption, error) + func (c *Client) UpdateOrganisation(ctx context.Context, orgID int, body map[string]any) (*Organisation, error) + func (c *Client) UpdateProject(ctx context.Context, projectID int, body map[string]any) (*Project, error) + func (c *Client) UpdateSegment(ctx context.Context, projectID, segmentID int, in Segment) (*Segment, error) + func (c *Client) UsersMe(ctx context.Context) (*User, error) + type CodeReferenceCount struct + Count int + type Environment struct + APIKey string + Description string + ID int + Name string + Project int + UseV2FeatureVersioning bool + func (e *Environment) UnmarshalJSON(b []byte) error + func (e Environment) MarshalJSON() ([]byte, error) + type EnvironmentAPIKey struct + Active bool + CreatedAt string + ExpiresAt *string + ID int + Key string + Name string + type EnvironmentFeatureState struct + Enabled bool + FeatureSegment *int + ID int + Identity *int + Multivariate []MultivariateStateValue + Value TypedValue + type Feature struct + CodeReferencesCounts []CodeReferenceCount + DefaultEnabled bool + Description string + EnvironmentState *FeatureState + ID int + InitialValue *string + IsArchived bool + LifecycleStage string + MultivariateOptions []MultivariateOption + Name string + NumIdentityOverrides *int + NumSegmentOverrides int + SegmentState *FeatureState + Type string + func (f Feature) CodeReferences() int + type FeatureSegment struct + ID int + Priority int + Segment int + SegmentName string + type FeatureState struct + Enabled bool + Value any + type FeatureValue struct + Type string + Value string + type FeatureWrite struct + DefaultEnabled *bool + Description *string + InitialValue *string + IsArchived *bool + MultivariateOptions []MultivariateOption + Name string + type FlagState struct + Enabled bool + Value *FeatureValue + Variants []Variant + type FlagStateUpdate struct + Enabled *bool + Value *FeatureValue + Variants []Variant + type IdentityFeatureState struct + Enabled bool + Feature int + ID int + Value any + type IdentityOverrideRow struct + Enabled bool + Identifier string + Value any + type MultivariateOption struct + BooleanValue *bool + DefaultPercentageAllocation *float64 + Feature int + ID int + IntegerValue *int + Key string + StringValue *string + Type string + type MultivariateStateValue struct + Allocation float64 + OptionID int + type Option func(*Client) + func WithHTTPClient(h *http.Client) Option + func WithUserAgent(ua string) Option + type Organisation struct + ID int + Name string + func (o *Organisation) UnmarshalJSON(b []byte) error + func (o Organisation) MarshalJSON() ([]byte, error) + type Project struct + ID int + Name string + Organisation int + UseEdgeIdentities bool + func (p *Project) UnmarshalJSON(b []byte) error + func (p Project) MarshalJSON() ([]byte, error) + type Segment struct + Description string + Feature *int + ID int + Name string + Project int + Rules []SegmentRule + type SegmentCondition struct + Operator string + Property string + Value any + type SegmentOverrideState struct + Enabled bool + Priority int + Segment SegmentTarget + Value *FeatureValue + Variants []Variant + type SegmentOverrideUpdate struct + Enabled *bool + Priority *int + Segment SegmentTarget + Value *FeatureValue + Variants []Variant + type SegmentRule struct + Conditions []SegmentCondition + Rules []SegmentRule + Type string + type SegmentTarget struct + ID int + type SubscriptionMetadata struct + MaxAPICalls *int + MaxProjects *int + MaxSeats *int + type TypedValue struct + BooleanValue *bool + IntegerValue *int + StringValue *string + Type string + func (v TypedValue) Scalar() any + type UpdateFlagRequest struct + EnvironmentDefault *FlagStateUpdate + SegmentOverrides []SegmentOverrideUpdate + type UpdateFlagResponse struct + EnvironmentDefault FlagState + SegmentOverrides []SegmentOverrideState + func (r *UpdateFlagResponse) Override(segmentID int) *SegmentOverrideState + type User struct + Email string + FirstName string + LastName string + UUID string + type Variant struct + ID int + Weight float64 v2.0.0-beta.3 Aug 11, 2026 v2.0.0-beta.2 Aug 4, 2026 v2.0.0-beta.1 Jul 30, 2026