goflagr

package module
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

README

Go API client for goflagr

Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is "/api/v1".

Overview

This API client was generated by the swagger-codegen project. By using the swagger-spec from a remote server, you can easily generate an API client.

  • API version: 1.2.2
  • Package version: 1.2.2
  • Build package: io.swagger.codegen.languages.GoClientCodegen

Installation

Put the package under your project folder and add the following in import:

import "./goflagr"

Documentation for API Endpoints

All URIs are relative to http://localhost/api/v1

Class Method HTTP request Description
ConstraintApi CreateConstraint Post /flags/{flagID}/segments/{segmentID}/constraints
ConstraintApi DeleteConstraint Delete /flags/{flagID}/segments/{segmentID}/constraints/{constraintID}
ConstraintApi FindConstraints Get /flags/{flagID}/segments/{segmentID}/constraints
ConstraintApi PutConstraint Put /flags/{flagID}/segments/{segmentID}/constraints/{constraintID}
DatarApi GetDatarFlagSummary Get /datar/flags/{flagID}/summary
DatarApi GetDatarSummary Get /datar/summary
DistributionApi FindDistributions Get /flags/{flagID}/segments/{segmentID}/distributions
DistributionApi PutDistributions Put /flags/{flagID}/segments/{segmentID}/distributions
EvaluationApi GetEvaluation Get /evaluation
EvaluationApi GetEvaluationBatch Get /evaluation/batch
EvaluationApi PostEvaluation Post /evaluation
EvaluationApi PostEvaluationBatch Post /evaluation/batch
ExportApi GetExportEvalCacheJSON Get /export/eval_cache/json
ExportApi GetExportSqlite Get /export/sqlite
ExposureApi PostExposures Post /exposures Log exposures (batch)
FlagApi CreateFlag Post /flags
FlagApi DeleteFlag Delete /flags/{flagID}
FlagApi DuplicateFlag Post /flags/{flagID}/duplicate
FlagApi FindFlags Get /flags
FlagApi GetFlag Get /flags/{flagID}
FlagApi GetFlagEntityTypes Get /flags/entity_types
FlagApi GetFlagSnapshotMaxID Get /flags/snapshots/max_id Get the max flag snapshot ID (config change version)
FlagApi GetFlagSnapshots Get /flags/{flagID}/snapshots
FlagApi PutFlag Put /flags/{flagID}
FlagApi RestoreFlag Put /flags/{flagID}/restore
FlagApi SetFlagEnabled Put /flags/{flagID}/enabled
HealthApi GetHealth Get /health
SegmentApi CreateSegment Post /flags/{flagID}/segments
SegmentApi DeleteSegment Delete /flags/{flagID}/segments/{segmentID}
SegmentApi FindSegments Get /flags/{flagID}/segments
SegmentApi PutSegment Put /flags/{flagID}/segments/{segmentID}
SegmentApi PutSegmentsReorder Put /flags/{flagID}/segments/reorder
TagApi CreateTag Post /flags/{flagID}/tags
TagApi DeleteTag Delete /flags/{flagID}/tags/{tagID}
TagApi FindAllTags Get /tags
TagApi FindTags Get /flags/{flagID}/tags
VariantApi CreateVariant Post /flags/{flagID}/variants
VariantApi DeleteVariant Delete /flags/{flagID}/variants/{variantID}
VariantApi FindVariants Get /flags/{flagID}/variants
VariantApi PutVariant Put /flags/{flagID}/variants/{variantID}

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Author

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = contextKey("apikey")
)

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {
	ConstraintApi *ConstraintApiService

	DatarApi *DatarApiService

	DistributionApi *DistributionApiService

	EvaluationApi *EvaluationApiService

	ExportApi *ExportApiService

	ExposureApi *ExposureApiService

	FlagApi *FlagApiService

	HealthApi *HealthApiService

	SegmentApi *SegmentApiService

	TagApi *TagApiService

	VariantApi *VariantApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the Flagr API v1.2.2 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

Change base path to allow switching to mocks

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the swagger operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	HTTPClient    *http.Client
}

func NewConfiguration

func NewConfiguration() *Configuration

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

type Constraint

type Constraint struct {
	Id int64 `json:"id,omitempty"`
	// The property name from the entity context to evaluate. Supports nested field access: use dots (e.g., `user.name`) for nested objects and brackets (e.g., `users[0]`) for array indices.
	Property string `json:"property"`
	Operator string `json:"operator"`
	Value    string `json:"value"`
}

type ConstraintApiService

type ConstraintApiService service

func (*ConstraintApiService) CreateConstraint

func (a *ConstraintApiService) CreateConstraint(ctx context.Context, flagID int64, segmentID int64, body CreateConstraintRequest) (Constraint, *http.Response, error)

ConstraintApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag
  • @param segmentID numeric ID of the segment
  • @param body create a constraint

@return Constraint

func (*ConstraintApiService) DeleteConstraint

func (a *ConstraintApiService) DeleteConstraint(ctx context.Context, flagID int64, segmentID int64, constraintID int64) (*http.Response, error)

ConstraintApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag
  • @param segmentID numeric ID of the segment
  • @param constraintID numeric ID of the constraint

func (*ConstraintApiService) FindConstraints

func (a *ConstraintApiService) FindConstraints(ctx context.Context, flagID int64, segmentID int64) ([]Constraint, *http.Response, error)

ConstraintApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag
  • @param segmentID numeric ID of the segment

@return []Constraint

func (*ConstraintApiService) PutConstraint

func (a *ConstraintApiService) PutConstraint(ctx context.Context, flagID int64, segmentID int64, constraintID int64, body CreateConstraintRequest) (Constraint, *http.Response, error)

ConstraintApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag
  • @param segmentID numeric ID of the segment
  • @param constraintID numeric ID of the constraint
  • @param body create a constraint

@return Constraint

type CreateConstraintRequest

type CreateConstraintRequest struct {
	// The property name from the entity context to evaluate. Supports nested field access: use dots (e.g., `user.name`) for nested objects and brackets (e.g., `users[0]`) for array indices.
	Property string `json:"property"`
	Operator string `json:"operator"`
	Value    string `json:"value"`
}

type CreateFlagRequest

type CreateFlagRequest struct {
	Description string `json:"description"`
	// unique key representation of the flag
	Key string `json:"key,omitempty"`
	// template for flag creation
	Template string `json:"template,omitempty"`
}

type CreateSegmentRequest

type CreateSegmentRequest struct {
	Description    string `json:"description"`
	RolloutPercent int64  `json:"rolloutPercent"`
}

type CreateTagRequest

type CreateTagRequest struct {
	Value string `json:"value"`
}

type CreateVariantRequest

type CreateVariantRequest struct {
	Key        string       `json:"key"`
	Attachment *interface{} `json:"attachment,omitempty"`
}

type DatarApiService

type DatarApiService service

func (*DatarApiService) GetDatarFlagSummary

func (a *DatarApiService) GetDatarFlagSummary(ctx context.Context, flagID int64, localVarOptionals *GetDatarFlagSummaryOpts) (DatarFlagSummaryResponse, *http.Response, error)

func (*DatarApiService) GetDatarSummary

func (a *DatarApiService) GetDatarSummary(ctx context.Context, localVarOptionals *GetDatarSummaryOpts) (DatarSummaryResponse, *http.Response, error)

type DatarDayEntry

type DatarDayEntry struct {
	Date  string `json:"date,omitempty"`
	Count int64  `json:"count,omitempty"`
}

type DatarFlagSummaryResponse

type DatarFlagSummaryResponse struct {
	FlagID           int64               `json:"flagID,omitempty"`
	TrafficByVariant []DatarVariantEntry `json:"trafficByVariant,omitempty"`
	TrafficBySegment []DatarSegmentEntry `json:"trafficBySegment,omitempty"`
	TrafficByDay     []DatarDayEntry     `json:"trafficByDay,omitempty"`
}

type DatarSegmentEntry

type DatarSegmentEntry struct {
	SegmentID int64 `json:"segmentID,omitempty"`
	Count     int64 `json:"count,omitempty"`
}

type DatarSummaryFlag

type DatarSummaryFlag struct {
	FlagID          int64     `json:"flagID,omitempty"`
	FlagKey         string    `json:"flagKey,omitempty"`
	Enabled         bool      `json:"enabled,omitempty"`
	Description     string    `json:"description,omitempty"`
	TotalEvalCount  int64     `json:"totalEvalCount,omitempty"`
	LastEvaluatedAt time.Time `json:"lastEvaluatedAt,omitempty"`
}

type DatarSummaryResponse

type DatarSummaryResponse struct {
	Flags []DatarSummaryFlag `json:"flags,omitempty"`
}

type DatarVariantEntry

type DatarVariantEntry struct {
	VariantID int64 `json:"variantID,omitempty"`
	Count     int64 `json:"count,omitempty"`
}

type Distribution

type Distribution struct {
	Id         int64  `json:"id,omitempty"`
	Percent    int64  `json:"percent"`
	VariantKey string `json:"variantKey"`
	VariantID  int64  `json:"variantID"`
}

type DistributionApiService

type DistributionApiService service

func (*DistributionApiService) FindDistributions

func (a *DistributionApiService) FindDistributions(ctx context.Context, flagID int64, segmentID int64) ([]Distribution, *http.Response, error)

DistributionApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag
  • @param segmentID numeric ID of the segment

@return []Distribution

func (*DistributionApiService) PutDistributions

func (a *DistributionApiService) PutDistributions(ctx context.Context, flagID int64, segmentID int64, body PutDistributionsRequest) ([]Distribution, *http.Response, error)

DistributionApiService replace the distribution with the new setting

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag
  • @param segmentID numeric ID of the segment
  • @param body array of distributions

@return []Distribution

type DuplicateFlagOpts

type DuplicateFlagOpts struct {
	Body optional.Interface
}

type DuplicateFlagRequest

type DuplicateFlagRequest struct {
	// unique key for the new flag; auto-generated if omitted or empty
	Key string `json:"key,omitempty"`
	// description for the new flag; defaults to source description with \" (cloned)\" suffix if omitted or empty
	Description string `json:"description,omitempty"`
}

type EvalContext

type EvalContext struct {
	// entityID is used to deterministically at random to evaluate the flag result. If it's empty, flagr will randomly generate one.
	EntityID      string       `json:"entityID,omitempty"`
	EntityType    string       `json:"entityType,omitempty"`
	EntityContext *interface{} `json:"entityContext,omitempty"`
	EnableDebug   bool         `json:"enableDebug,omitempty"`
	// flagID
	FlagID int64 `json:"flagID,omitempty"`
	// flagKey. flagID or flagKey will resolve to the same flag. Either works.
	FlagKey string `json:"flagKey,omitempty"`
	// flagTags. flagTags looks up flags by tag. Either works.
	FlagTags []string `json:"flagTags,omitempty"`
	// determine how flagTags is used to filter flags to be evaluated. OR extends the evaluation to those which contains at least one of the provided flagTags or AND limit the evaluation to those which contains all the flagTags.
	FlagTagsOperator string `json:"flagTagsOperator,omitempty"`
}

type EvalDebugLog

type EvalDebugLog struct {
	SegmentDebugLogs []SegmentDebugLog `json:"segmentDebugLogs,omitempty"`
	Msg              string            `json:"msg,omitempty"`
}

type EvalResult

type EvalResult struct {
	FlagID         int64  `json:"flagID,omitempty"`
	FlagKey        string `json:"flagKey,omitempty"`
	FlagSnapshotID int64  `json:"flagSnapshotID,omitempty"`
	// flagTags. flagTags looks up flags by tag. Either works.
	FlagTags   []string `json:"flagTags,omitempty"`
	SegmentID  int64    `json:"segmentID,omitempty"`
	VariantID  int64    `json:"variantID,omitempty"`
	VariantKey string   `json:"variantKey,omitempty"`
	// evaluation for eval API results; exposure for client-reported impressions via POST /exposures (same data recorders as eval)
	RecordSource      string        `json:"recordSource,omitempty"`
	VariantAttachment *interface{}  `json:"variantAttachment,omitempty"`
	EvalContext       *EvalContext  `json:"evalContext,omitempty"`
	Timestamp         string        `json:"timestamp,omitempty"`
	EvalDebugLog      *EvalDebugLog `json:"evalDebugLog,omitempty"`
	// Whether data records (impression logging) are enabled for this flag.
	DataRecordsEnabled bool `json:"dataRecordsEnabled,omitempty"`
}

type EvaluationApiService

type EvaluationApiService service

func (*EvaluationApiService) GetEvaluation

func (a *EvaluationApiService) GetEvaluation(ctx context.Context, json string) (EvalResult, *http.Response, error)

EvaluationApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param json Percent-encoded (URI-encoded) JSON matching POST /evaluation body (evalContext). Example: ?json=%7B%22entityID%22%3A%22u1%22%2C%22flagID%22%3A1%7D decodes to {\"entityID\":\"u1\",\"flagID\":1}.

@return EvalResult

func (*EvaluationApiService) GetEvaluationBatch

func (a *EvaluationApiService) GetEvaluationBatch(ctx context.Context, json string) (EvaluationBatchResponse, *http.Response, error)

EvaluationApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param json Percent-encoded (URI-encoded) JSON matching POST /evaluation/batch body (evaluationBatchRequest). Example: ?json=%7B%22entities%22%3A%5B%7B%22entityID%22%3A%22u1%22%7D%5D%2C%22flagIDs%22%3A%5B1%5D%7D decodes to {\"entities\":[{\"entityID\":\"u1\"}],\"flagIDs\":[1]}.

@return EvaluationBatchResponse

func (*EvaluationApiService) PostEvaluation

func (a *EvaluationApiService) PostEvaluation(ctx context.Context, body EvalContext) (EvalResult, *http.Response, error)

EvaluationApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body evaluation context

@return EvalResult

func (*EvaluationApiService) PostEvaluationBatch

EvaluationApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body evaluation batch request

@return EvaluationBatchResponse

type EvaluationBatchRequest

type EvaluationBatchRequest struct {
	Entities    []EvaluationEntity `json:"entities"`
	EnableDebug bool               `json:"enableDebug,omitempty"`
	// flagIDs
	FlagIDs []int64 `json:"flagIDs,omitempty"`
	// flagKeys. Either flagIDs, flagKeys or flagTags works. If pass in multiples, Flagr may return duplicate results.
	FlagKeys []string `json:"flagKeys,omitempty"`
	// flagTags. Either flagIDs, flagKeys or flagTags works. If pass in multiples, Flagr may return duplicate results.
	FlagTags []string `json:"flagTags,omitempty"`
	// determine how flagTags is used to filter flags to be evaluated. OR extends the evaluation to those which contains at least one of the provided flagTags or AND limit the evaluation to those which contains all the flagTags.
	FlagTagsOperator string `json:"flagTagsOperator,omitempty"`
}

type EvaluationBatchResponse

type EvaluationBatchResponse struct {
	EvaluationResults []EvalResult `json:"evaluationResults"`
}

type EvaluationEntity

type EvaluationEntity struct {
	EntityID      string       `json:"entityID,omitempty"`
	EntityType    string       `json:"entityType,omitempty"`
	EntityContext *interface{} `json:"entityContext,omitempty"`
}

type ExportApiService

type ExportApiService service

func (*ExportApiService) GetExportEvalCacheJSON

func (a *ExportApiService) GetExportEvalCacheJSON(ctx context.Context, localVarOptionals *GetExportEvalCacheJSONOpts) (interface{}, *http.Response, error)

func (*ExportApiService) GetExportSqlite

func (a *ExportApiService) GetExportSqlite(ctx context.Context, localVarOptionals *GetExportSqliteOpts) (*os.File, *http.Response, error)

type Exposure

type Exposure struct {
	FlagID     int64  `json:"flagID,omitempty"`
	FlagKey    string `json:"flagKey,omitempty"`
	VariantID  int64  `json:"variantID,omitempty"`
	VariantKey string `json:"variantKey,omitempty"`
	EntityID   string `json:"entityID"`
	EntityType string `json:"entityType,omitempty"`
	// Optional attributes recorded on evalContext.entityContext (same field as POST /evaluation). Include impression-specific keys here (e.g. page path); exposure does not re-run segment constraints.
	EntityContext  *interface{} `json:"entityContext,omitempty"`
	FlagSnapshotID int64        `json:"flagSnapshotID,omitempty"`
	Timestamp      time.Time    `json:"timestamp,omitempty"`
}

type ExposureApiService

type ExposureApiService service

func (*ExposureApiService) PostExposures

ExposureApiService Log exposures (batch) Log when a user actually saw a flag or variant (impression), typically after POST /evaluation. Integrates with the data recorder when FLAGR_RECORDER_ENABLED and per-flag dataRecordsEnabled are set.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body

@return ExposuresResponse

type ExposureRowError

type ExposureRowError struct {
	Index   int64  `json:"index,omitempty"`
	Message string `json:"message,omitempty"`
}

type ExposuresRequest

type ExposuresRequest struct {
	Exposures []Exposure `json:"exposures"`
}

type ExposuresResponse

type ExposuresResponse struct {
	LoggedCount int64              `json:"loggedCount,omitempty"`
	Message     string             `json:"message,omitempty"`
	Errors      []ExposureRowError `json:"errors,omitempty"`
}

type FindAllTagsOpts

type FindAllTagsOpts struct {
	Limit     optional.Int64
	Offset    optional.Int64
	ValueLike optional.String
}

type FindFlagsOpts

type FindFlagsOpts struct {
	Limit           optional.Int64
	Enabled         optional.Bool
	Description     optional.String
	Tags            optional.String
	DescriptionLike optional.String
	Key             optional.String
	Offset          optional.Int64
	Preload         optional.Bool
	Deleted         optional.Bool
}

type Flag

type Flag struct {
	Id int64 `json:"id,omitempty"`
	// unique key representation of the flag
	Key         string    `json:"key,omitempty"`
	Description string    `json:"description"`
	Enabled     bool      `json:"enabled"`
	Tags        []Tag     `json:"tags,omitempty"`
	Segments    []Segment `json:"segments,omitempty"`
	Variants    []Variant `json:"variants,omitempty"`
	// when true and FLAGR_RECORDER_ENABLED is set, evaluation and exposure rows are written to configured data recorders (e.g. kafka).
	DataRecordsEnabled bool `json:"dataRecordsEnabled"`
	// it will override the entityType in the evaluation logs if it's not empty
	EntityType string `json:"entityType,omitempty"`
	// flag usage details in markdown format
	Notes     string    `json:"notes,omitempty"`
	CreatedBy string    `json:"createdBy,omitempty"`
	UpdatedBy string    `json:"updatedBy,omitempty"`
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
}

type FlagApiService

type FlagApiService service

func (*FlagApiService) CreateFlag

func (a *FlagApiService) CreateFlag(ctx context.Context, body CreateFlagRequest) (Flag, *http.Response, error)

FlagApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body create a flag

@return Flag

func (*FlagApiService) DeleteFlag

func (a *FlagApiService) DeleteFlag(ctx context.Context, flagID int64) (*http.Response, error)

FlagApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag

func (*FlagApiService) DuplicateFlag

func (a *FlagApiService) DuplicateFlag(ctx context.Context, flagID int64, localVarOptionals *DuplicateFlagOpts) (Flag, *http.Response, error)

func (*FlagApiService) FindFlags

func (a *FlagApiService) FindFlags(ctx context.Context, localVarOptionals *FindFlagsOpts) ([]Flag, *http.Response, error)

func (*FlagApiService) GetFlag

func (a *FlagApiService) GetFlag(ctx context.Context, flagID int64) (Flag, *http.Response, error)

FlagApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag to get

@return Flag

func (*FlagApiService) GetFlagEntityTypes

func (a *FlagApiService) GetFlagEntityTypes(ctx context.Context) ([]string, *http.Response, error)

FlagApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return []string

func (*FlagApiService) GetFlagSnapshotMaxID

func (a *FlagApiService) GetFlagSnapshotMaxID(ctx context.Context) (FlagSnapshotMaxId, *http.Response, error)

FlagApiService Get the max flag snapshot ID (config change version) Returns the highest (most recent) flag_snapshot id. flag_snapshot is an append-only changelog — every flag configuration mutation (create, update, delete, restore of flags, segments, variants, constraints, distributions, or tags) inserts a new row with a monotonically increasing id. This makes the max id a lightweight single source of truth for detecting any configuration change. Consumers can store this value and poll it periodically: if the value changes, at least one flag's configuration has been modified and caches should be invalidated. This is vastly more efficient than polling the flags list or individual flags.

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return FlagSnapshotMaxId

func (*FlagApiService) GetFlagSnapshots

func (a *FlagApiService) GetFlagSnapshots(ctx context.Context, flagID int64, localVarOptionals *GetFlagSnapshotsOpts) ([]FlagSnapshot, *http.Response, error)

func (*FlagApiService) PutFlag

func (a *FlagApiService) PutFlag(ctx context.Context, flagID int64, body PutFlagRequest) (Flag, *http.Response, error)

FlagApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag to get
  • @param body update a flag

@return Flag

func (*FlagApiService) RestoreFlag

func (a *FlagApiService) RestoreFlag(ctx context.Context, flagID int64) (Flag, *http.Response, error)

FlagApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag to get

@return Flag

func (*FlagApiService) SetFlagEnabled

func (a *FlagApiService) SetFlagEnabled(ctx context.Context, flagID int64, body SetFlagEnabledRequest) (Flag, *http.Response, error)

FlagApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag to get
  • @param body set flag enabled state

@return Flag

type FlagSnapshot

type FlagSnapshot struct {
	Id        int64  `json:"id,omitempty"`
	UpdatedBy string `json:"updatedBy,omitempty"`
	Flag      *Flag  `json:"flag"`
	UpdatedAt string `json:"updatedAt"`
}

type FlagSnapshotMaxId

type FlagSnapshotMaxId struct {
	MaxID int64 `json:"maxID,omitempty"`
}

type GenericSwaggerError

type GenericSwaggerError struct {
	// contains filtered or unexported fields
}

GenericSwaggerError Provides access to the body, error and model on returned errors.

func (GenericSwaggerError) Body

func (e GenericSwaggerError) Body() []byte

Body returns the raw bytes of the response

func (GenericSwaggerError) Error

func (e GenericSwaggerError) Error() string

Error returns non-empty string if there was an error.

func (GenericSwaggerError) Model

func (e GenericSwaggerError) Model() interface{}

Model returns the unpacked model of the error

type GetDatarFlagSummaryOpts

type GetDatarFlagSummaryOpts struct {
	From optional.Time
	To   optional.Time
}

type GetDatarSummaryOpts

type GetDatarSummaryOpts struct {
	From   optional.Time
	To     optional.Time
	Limit  optional.Int32
	Offset optional.Int32
}

type GetExportEvalCacheJSONOpts

type GetExportEvalCacheJSONOpts struct {
	Ids          optional.Interface
	Keys         optional.Interface
	Enabled      optional.Bool
	Tags         optional.Interface
	TagsOperator optional.String
}

type GetExportSqliteOpts

type GetExportSqliteOpts struct {
	ExcludeSnapshots optional.Bool
}

type GetFlagSnapshotsOpts

type GetFlagSnapshotsOpts struct {
	Limit  optional.Int64
	Offset optional.Int64
	Sort   optional.String
}

type Health

type Health struct {
	Status string `json:"status,omitempty"`
}

type HealthApiService

type HealthApiService service

func (*HealthApiService) GetHealth

func (a *HealthApiService) GetHealth(ctx context.Context) (Health, *http.Response, error)

HealthApiService Check if Flagr is healthy

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return Health

type ModelError

type ModelError struct {
	Message string `json:"message"`
}

type PutDistributionsRequest

type PutDistributionsRequest struct {
	Distributions []Distribution `json:"distributions"`
}

type PutFlagRequest

type PutFlagRequest struct {
	Description string `json:"description,omitempty"`
	// when true and FLAGR_RECORDER_ENABLED is set, evaluation and exposure rows are written to configured data recorders (e.g. kafka).
	DataRecordsEnabled bool `json:"dataRecordsEnabled,omitempty"`
	// it will overwrite entityType into evaluation logs if it's not empty
	EntityType string `json:"entityType,omitempty"`
	Enabled    bool   `json:"enabled,omitempty"`
	Key        string `json:"key,omitempty"`
	Notes      string `json:"notes,omitempty"`
}

type PutSegmentReorderRequest

type PutSegmentReorderRequest struct {
	SegmentIDs []int64 `json:"segmentIDs"`
}

type PutSegmentRequest

type PutSegmentRequest struct {
	Description    string `json:"description"`
	RolloutPercent int64  `json:"rolloutPercent"`
}

type PutVariantRequest

type PutVariantRequest struct {
	Key        string       `json:"key"`
	Attachment *interface{} `json:"attachment,omitempty"`
}

type Segment

type Segment struct {
	Id             int64          `json:"id,omitempty"`
	Description    string         `json:"description"`
	Constraints    []Constraint   `json:"constraints,omitempty"`
	Distributions  []Distribution `json:"distributions,omitempty"`
	Rank           int64          `json:"rank"`
	RolloutPercent int64          `json:"rolloutPercent"`
}

type SegmentApiService

type SegmentApiService service

func (*SegmentApiService) CreateSegment

func (a *SegmentApiService) CreateSegment(ctx context.Context, flagID int64, body CreateSegmentRequest) (Segment, *http.Response, error)

SegmentApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag to get
  • @param body create a segment under a flag

@return Segment

func (*SegmentApiService) DeleteSegment

func (a *SegmentApiService) DeleteSegment(ctx context.Context, flagID int64, segmentID int64) (*http.Response, error)

SegmentApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag
  • @param segmentID numeric ID of the segment

func (*SegmentApiService) FindSegments

func (a *SegmentApiService) FindSegments(ctx context.Context, flagID int64) ([]Segment, *http.Response, error)

SegmentApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag to get

@return []Segment

func (*SegmentApiService) PutSegment

func (a *SegmentApiService) PutSegment(ctx context.Context, flagID int64, segmentID int64, body PutSegmentRequest) (Segment, *http.Response, error)

SegmentApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag
  • @param segmentID numeric ID of the segment
  • @param body update a segment

@return Segment

func (*SegmentApiService) PutSegmentsReorder

func (a *SegmentApiService) PutSegmentsReorder(ctx context.Context, flagID int64, body PutSegmentReorderRequest) (*http.Response, error)

SegmentApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag
  • @param body reorder segments

type SegmentDebugLog

type SegmentDebugLog struct {
	SegmentID int64  `json:"segmentID,omitempty"`
	Msg       string `json:"msg,omitempty"`
}

type SetFlagEnabledRequest

type SetFlagEnabledRequest struct {
	Enabled bool `json:"enabled"`
}

type Tag

type Tag struct {
	Id    int64  `json:"id,omitempty"`
	Value string `json:"value"`
}

type TagApiService

type TagApiService service

func (*TagApiService) CreateTag

func (a *TagApiService) CreateTag(ctx context.Context, flagID int64, body CreateTagRequest) (Tag, *http.Response, error)

TagApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag
  • @param body create a tag

@return Tag

func (*TagApiService) DeleteTag

func (a *TagApiService) DeleteTag(ctx context.Context, flagID int64, tagID int64) (*http.Response, error)

TagApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag
  • @param tagID numeric ID of the tag

func (*TagApiService) FindAllTags

func (a *TagApiService) FindAllTags(ctx context.Context, localVarOptionals *FindAllTagsOpts) ([]Tag, *http.Response, error)

func (*TagApiService) FindTags

func (a *TagApiService) FindTags(ctx context.Context, flagID int64) ([]Tag, *http.Response, error)

TagApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag

@return []Tag

type Variant

type Variant struct {
	Id         int64        `json:"id,omitempty"`
	Key        string       `json:"key"`
	Attachment *interface{} `json:"attachment,omitempty"`
}

type VariantApiService

type VariantApiService service

func (*VariantApiService) CreateVariant

func (a *VariantApiService) CreateVariant(ctx context.Context, flagID int64, body CreateVariantRequest) (Variant, *http.Response, error)

VariantApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag
  • @param body create a variant

@return Variant

func (*VariantApiService) DeleteVariant

func (a *VariantApiService) DeleteVariant(ctx context.Context, flagID int64, variantID int64) (*http.Response, error)

VariantApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag
  • @param variantID numeric ID of the variant

func (*VariantApiService) FindVariants

func (a *VariantApiService) FindVariants(ctx context.Context, flagID int64) ([]Variant, *http.Response, error)

VariantApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag

@return []Variant

func (*VariantApiService) PutVariant

func (a *VariantApiService) PutVariant(ctx context.Context, flagID int64, variantID int64, body PutVariantRequest) (Variant, *http.Response, error)

VariantApiService

  • @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param flagID numeric ID of the flag
  • @param variantID numeric ID of the variant
  • @param body update a variant

@return Variant

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL