api

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Copyright 2020

Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. Code generated by gen-accessors; DO NOT EDIT.

Index

Constants

View Source
const (
	// DefaultAPIBaseURL is the base API url.
	DefaultAPIBaseURL = "https://api.split.io/internal/api/v2"

	// DefaultUserAgent is the user agent used when making API calls.
	DefaultUserAgent = "split-go"

	// DefaultContentTypeHeader is the default and Content-Type header.
	DefaultContentTypeHeader = "application/json"

	// DefaultAcceptHeader is the default and Content-Type header.
	DefaultAcceptHeader = "application/json"

	//DefaultClientTimeout is the default timeout before the client stops making api calls, will be overriden by split/config.go when instantiate
	DefaultClientTimeout = 300 // 5 min

	UserStatusPending     = "PENDING"
	UserStatusActive      = "ACTIVE"
	UserStatusDeactivated = "DEACTIVATED"
)

Variables

View Source
var (
	ValidApiKeyTypes = []string{"client_side", "server_side", "admin"}
	ValidApiKeyRoles = []string{"API_ALL_GRANTED", "API_APIKEY", "API_ADMIN", "API_WORKSPACE_ADMIN", "API_FEATURE_FLAG_VIEWER",
		"API_FEATURE_FLAG_EDITOR", "API_SEGMENT_VIEWER", "API_SEGMENT_EDITOR"}
)

Functions

This section is empty.

Types

type ApiToken added in v0.15.0

type ApiToken struct {
	ID         *string `json:"id"`
	Name       *string `json:"name"`
	Type       *string `json:"type"`
	ApiKeyType *string `json:"apiKeyType"`
}

ApiToken represents an automatically-created API token for an environment.

func (*ApiToken) GetApiKeyType added in v0.15.0

func (a *ApiToken) GetApiKeyType() string

GetApiKeyType returns the ApiKeyType field if it's non-nil, zero value otherwise.

func (*ApiToken) GetID added in v0.15.0

func (a *ApiToken) GetID() string

GetID returns the ID field if it's non-nil, zero value otherwise.

func (*ApiToken) GetName added in v0.15.0

func (a *ApiToken) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*ApiToken) GetType added in v0.15.0

func (a *ApiToken) GetType() string

GetType returns the Type field if it's non-nil, zero value otherwise.

type Attribute added in v0.3.0

type Attribute struct {
	ID              *string  `json:"id"` // this is different from the usually computed ID.
	OrganizationId  *string  `json:"organizationId"`
	TrafficTypeID   *string  `json:"trafficTypeId"`
	DisplayName     *string  `json:"displayName"`
	Description     *string  `json:"description"`
	DataType        *string  `json:"dataType"` // (Optional) The data type of the attribute used for display formatting, defaults to displaying the raw string. Must be one of: null, "string", "datetime", "number", "set"
	IsSearchable    *bool    `json:"isSearchable"`
	SuggestedValues []string `json:"suggestedValues"`
}

Attribute represents an attribute in Split.

func (*Attribute) GetDataType added in v0.3.0

func (a *Attribute) GetDataType() string

GetDataType returns the DataType field if it's non-nil, zero value otherwise.

func (*Attribute) GetDescription added in v0.3.0

func (a *Attribute) GetDescription() string

GetDescription returns the Description field if it's non-nil, zero value otherwise.

func (*Attribute) GetDisplayName added in v0.3.0

func (a *Attribute) GetDisplayName() string

GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise.

func (*Attribute) GetID added in v0.8.0

func (a *Attribute) GetID() string

GetID returns the ID field if it's non-nil, zero value otherwise.

func (*Attribute) GetIsSearchable added in v0.3.0

func (a *Attribute) GetIsSearchable() bool

GetIsSearchable returns the IsSearchable field if it's non-nil, zero value otherwise.

func (*Attribute) GetOrganizationId added in v0.3.0

func (a *Attribute) GetOrganizationId() string

GetOrganizationId returns the OrganizationId field if it's non-nil, zero value otherwise.

func (*Attribute) GetTrafficTypeID added in v0.3.0

func (a *Attribute) GetTrafficTypeID() string

GetTrafficTypeID returns the TrafficTypeID field if it's non-nil, zero value otherwise.

func (*Attribute) HasSuggestedValues added in v0.8.0

func (a *Attribute) HasSuggestedValues() bool

HasSuggestedValues checks if Attribute has any SuggestedValues.

type AttributeListQueryParams added in v0.8.0

type AttributeListQueryParams struct {
	// Whether to paginate the response.
	Paginate bool `url:"Paginate,omitempty"`

	// Search prefix under which to look for attributes (ex. att returns attribute1, but not myAttribute).
	// Search is case insensitive, and only available with pagination.
	SearchPrefix string `url:"searchPrefix,omitempty"`

	// Get results 'After' the marker passed into this parameter. Only available with pagination. Markers are obfuscated
	// strings by design.
	AfterMarker string `url:"afterMarker,omitempty"`

	// Get results 'Before' the marker passed into this parameter. Only available with pagination. Markers are obfuscated
	// strings by design.
	BeforeMarker string `url:"beforeMarker,omitempty"`

	// Limit the number of return objects. If nothing or something invalid is given, then this will be the default markerLimit
	// for the query. If something greater than the maximum limit is passed in, this will be the maximum allowed markerLimit for this query.
	MarkerLimit int `url:"markerLimit,omitempty"`
}

AttributeListQueryParams represents all query parameters available when listing attributes

type AttributeRequest added in v0.3.0

type AttributeRequest struct {
	Identifier      *string  `json:"id,omitempty"`
	DisplayName     *string  `json:"displayName,omitempty"`
	Description     *string  `json:"description,omitempty"`
	TrafficTypeID   *string  `json:"trafficTypeId,omitempty"`
	DataType        *string  `json:"dataType,omitempty"`
	IsSearchable    *bool    `json:"isSearchable,omitempty"`
	SuggestedValues []string `json:"suggestedValues,omitempty"`
}

AttributeRequest represents a request to create an attribute.

func (*AttributeRequest) GetDataType added in v0.8.0

func (a *AttributeRequest) GetDataType() string

GetDataType returns the DataType field if it's non-nil, zero value otherwise.

func (*AttributeRequest) GetDescription added in v0.8.0

func (a *AttributeRequest) GetDescription() string

GetDescription returns the Description field if it's non-nil, zero value otherwise.

func (*AttributeRequest) GetDisplayName added in v0.8.0

func (a *AttributeRequest) GetDisplayName() string

GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise.

func (*AttributeRequest) GetIdentifier added in v0.8.0

func (a *AttributeRequest) GetIdentifier() string

GetIdentifier returns the Identifier field if it's non-nil, zero value otherwise.

func (*AttributeRequest) GetIsSearchable added in v0.3.0

func (a *AttributeRequest) GetIsSearchable() bool

GetIsSearchable returns the IsSearchable field if it's non-nil, zero value otherwise.

func (*AttributeRequest) GetTrafficTypeID added in v0.8.0

func (a *AttributeRequest) GetTrafficTypeID() string

GetTrafficTypeID returns the TrafficTypeID field if it's non-nil, zero value otherwise.

func (*AttributeRequest) HasSuggestedValues added in v0.8.0

func (a *AttributeRequest) HasSuggestedValues() bool

HasSuggestedValues checks if AttributeRequest has any SuggestedValues.

type AttributesService added in v0.3.0

type AttributesService service

AttributesService handles communication with the attributes related methods of the Split.io APIv2.

Reference: https://docs.split.io/reference/attributes-overview

func (*AttributesService) Create added in v0.3.0

func (a *AttributesService) Create(workspaceID, trafficTypeID string, opts *AttributeRequest) (*Attribute, *simpleresty.Response, error)

Create an attribute.

Reference: https://docs.split.io/reference/save-attribute

func (*AttributesService) Delete added in v0.3.0

func (a *AttributesService) Delete(workspaceID, trafficTypeID, attributeID string) (*simpleresty.Response, error)

Delete an attribute.

Reference: https://docs.split.io/reference/delete-attribute

func (*AttributesService) FindByID added in v0.3.0

func (a *AttributesService) FindByID(workspaceID, trafficTypeID, attributeID string, opts *AttributeListQueryParams) (*Attribute, *simpleresty.Response, error)

FindByID retrieves an attribute by its ID.

This is a helper method as it is not possible to retrieve a single attribute.

func (*AttributesService) List added in v0.3.0

func (a *AttributesService) List(workspaceID, trafficTypeID string, opts *AttributeListQueryParams) ([]*Attribute, *simpleresty.Response, error)

List all attributes for a traffic type.

Reference: https://docs.split.io/reference/get-attributes

func (*AttributesService) Update added in v0.8.0

func (a *AttributesService) Update(workspaceID, trafficTypeID, attributeID string, opts *AttributeRequest) (*Attribute, *simpleresty.Response, error)

Update an attribute.

Reference: https://docs.split.io/reference/update-attribute

type Bucket added in v0.5.0

type Bucket struct {
	Treatment *string `json:"treatment"`
	Size      *int    `json:"size"`
}

Bucket represents a sticky distribution of customers into treatments of a Split.

func (*Bucket) GetSize added in v0.5.0

func (b *Bucket) GetSize() int

GetSize returns the Size field if it's non-nil, zero value otherwise.

func (*Bucket) GetTreatment added in v0.5.0

func (b *Bucket) GetTreatment() string

GetTreatment returns the Treatment field if it's non-nil, zero value otherwise.

type Client

type Client struct {

	// Services used for talking to different parts of the Sendgrid APIv3.
	ApiKeys      *KeysService
	Attributes   *AttributesService
	Environments *EnvironmentsService
	FlagSets     *FlagSetsService
	Groups       *GroupsService
	TrafficTypes *TrafficTypesService
	Segments     *SegmentsService
	Splits       *SplitsService
	Users        *UsersService
	Workspaces   *WorkspacesService
	// contains filtered or unexported fields
}

Client manages communication with Sendgrid APIs.

func New

func New(opts ...Option) (*Client, error)

New constructs a new Client.

type Condition added in v0.5.0

type Condition struct {
	Combiner *string    `json:"combiner,omitempty"`
	Matchers []*Matcher `json:"matchers,omitempty"`
}

Condition consists of different Matchers. A customer satisfies a Condition only of it satisfies all the Matchers.

Note that when configuring or updating a `Split Definition, there is no need to specify the combiner, since for now, Split only allows AND combiner.

func (*Condition) GetCombiner added in v0.5.0

func (c *Condition) GetCombiner() string

GetCombiner returns the Combiner field if it's non-nil, zero value otherwise.

func (*Condition) HasMatchers added in v0.5.0

func (c *Condition) HasMatchers() bool

HasMatchers checks if Condition has any Matchers.

type Config

type Config struct {
	// APIBaseURL is the base URL for Sendgrid's API v3.
	APIBaseURL string

	// UserAgent used when communicating with the Sendgrid API.
	UserAgent string

	// CustomHTTPHeaders are any additional user defined headers.
	CustomHTTPHeaders map[string]string

	// ContentTypeHeader
	ContentTypeHeader string

	// AcceptHeader
	AcceptHeader string

	// APIKey
	APIKey string

	// HarnessToken is used for x-api-key header authentication
	HarnessToken string

	// ClientTimeout
	ClientTimeout int
}

Config represents all configuration options available to user to customize the API v2.

func (*Config) ParseOptions

func (c *Config) ParseOptions(opts ...Option) error

ParseOptions parses the supplied options functions.

type Environment

type Environment struct {
	ID         *string    `json:"id"`
	Name       *string    `json:"name"`
	Production *bool      `json:"production"`
	ApiTokens  []ApiToken `json:"apiTokens,omitempty"`
}

Environment reflects a stage in the development process, such as your production application or your internal staging environment. During the feature release process, Splits can be promoted through the various environments; allowing for a targeted roll out throughout the development process.

func (*Environment) GetID

func (e *Environment) GetID() string

GetID returns the ID field if it's non-nil, zero value otherwise.

func (*Environment) GetName

func (e *Environment) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*Environment) GetProduction

func (e *Environment) GetProduction() bool

GetProduction returns the Production field if it's non-nil, zero value otherwise.

func (*Environment) HasApiTokens added in v0.15.0

func (e *Environment) HasApiTokens() bool

HasApiTokens checks if Environment has any ApiTokens.

type EnvironmentRequest

type EnvironmentRequest struct {
	Name       *string `json:"name,omitempty"`
	Production *bool   `json:"production,omitempty"`
}

EnvironmentRequest represents a request modify an environment.

func (*EnvironmentRequest) GetName

func (e *EnvironmentRequest) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*EnvironmentRequest) GetProduction

func (e *EnvironmentRequest) GetProduction() bool

GetProduction returns the Production field if it's non-nil, zero value otherwise.

type EnvironmentSegment added in v0.10.0

type EnvironmentSegment struct {
	ID             *string      `json:"id"`
	OrgID          *string      `json:"orgId"`
	Environment    *string      `json:"environment"`
	Name           *string      `json:"name"`
	TrafficTypeID  *string      `json:"trafficTypeId"`
	Description    *string      `json:"description"`
	Status         *string      `json:"status"`
	CreationTime   *int64       `json:"creationTime"`
	LastUpdateTime *int64       `json:"lastUpdateTime"`
	TrafficTypeURN *TrafficType `json:"trafficTypeURN"`
	Creator        *User        `json:"creator"`
}

EnvironmentSegment represents a segment in an environment.

func (*EnvironmentSegment) GetCreationTime added in v0.10.0

func (e *EnvironmentSegment) GetCreationTime() int64

GetCreationTime returns the CreationTime field if it's non-nil, zero value otherwise.

func (*EnvironmentSegment) GetCreator added in v0.10.0

func (e *EnvironmentSegment) GetCreator() *User

GetCreator returns the Creator field.

func (*EnvironmentSegment) GetDescription added in v0.10.0

func (e *EnvironmentSegment) GetDescription() string

GetDescription returns the Description field if it's non-nil, zero value otherwise.

func (*EnvironmentSegment) GetEnvironment added in v0.10.0

func (e *EnvironmentSegment) GetEnvironment() string

GetEnvironment returns the Environment field if it's non-nil, zero value otherwise.

func (*EnvironmentSegment) GetID added in v0.10.0

func (e *EnvironmentSegment) GetID() string

GetID returns the ID field if it's non-nil, zero value otherwise.

func (*EnvironmentSegment) GetLastUpdateTime added in v0.10.0

func (e *EnvironmentSegment) GetLastUpdateTime() int64

GetLastUpdateTime returns the LastUpdateTime field if it's non-nil, zero value otherwise.

func (*EnvironmentSegment) GetName added in v0.10.0

func (e *EnvironmentSegment) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*EnvironmentSegment) GetOrgID added in v0.10.0

func (e *EnvironmentSegment) GetOrgID() string

GetOrgID returns the OrgID field if it's non-nil, zero value otherwise.

func (*EnvironmentSegment) GetStatus added in v0.10.0

func (e *EnvironmentSegment) GetStatus() string

GetStatus returns the Status field if it's non-nil, zero value otherwise.

func (*EnvironmentSegment) GetTrafficTypeID added in v0.10.0

func (e *EnvironmentSegment) GetTrafficTypeID() string

GetTrafficTypeID returns the TrafficTypeID field if it's non-nil, zero value otherwise.

func (*EnvironmentSegment) GetTrafficTypeURN added in v0.10.0

func (e *EnvironmentSegment) GetTrafficTypeURN() *TrafficType

GetTrafficTypeURN returns the TrafficTypeURN field.

type EnvironmentSegmentKeysRequest added in v0.10.0

type EnvironmentSegmentKeysRequest struct {
	Keys    []string `json:"keys"`
	Comment string   `json:"comment,omitempty"`
	Title   string   `json:"title,omitempty"`
}

EnvironmentSegmentKeysRequest represents a request to add/remove segment keys in an environment.

func (*EnvironmentSegmentKeysRequest) HasKeys added in v0.10.0

func (e *EnvironmentSegmentKeysRequest) HasKeys() bool

HasKeys checks if EnvironmentSegmentKeysRequest has any Keys.

type EnvironmentsService

type EnvironmentsService service

EnvironmentsService handles communication with the environments related methods of the Split.io APIv2.

Reference: https://docs.split.io/reference#environments-overview

func (*EnvironmentsService) AddSegmentKeys added in v0.10.0

func (e *EnvironmentsService) AddSegmentKeys(environmentID, segmentName string, shouldReplace bool, opts *EnvironmentSegmentKeysRequest) (*EnvironmentSegment, *simpleresty.Response, error)

AddSegmentKeys for a given an environment.

Reference: https://docs.split.io/reference/update-segment-keys-in-environment-via-json

func (*EnvironmentsService) Create

Create an environment.

Reference: https://docs.split.io/reference#create-environment

func (*EnvironmentsService) Delete

func (e *EnvironmentsService) Delete(workspaceID, envID string) (*simpleresty.Response, error)

Delete an environment.

Note: you CANNOT delete an environment unless you first revoke all api keys associated with it.

If deletion request is successful, the response body returns a "true" string.

Reference: https://docs.split.io/reference#delete-environment

func (*EnvironmentsService) FindByID

func (e *EnvironmentsService) FindByID(workspaceID, envID string) (*Environment, *simpleresty.Response, error)

FindByID retrieves an environment by its ID.

Note: this method uses the List() method to first return all environments and then look for the target environment by an ID. The Split APIv2 does not provide a GET#show endpoint for environments unfortunately.

func (*EnvironmentsService) FindByName added in v0.6.0

func (e *EnvironmentsService) FindByName(workspaceID, envName string) (*Environment, *simpleresty.Response, error)

FindByName retrieves an environment by its name.

Note: this method uses the List() method to first return all environments and then look for the target environment by an name. The Split APIv2 does not provide a GET#show endpoint for environments unfortunately.

func (*EnvironmentsService) GetSegmentKeys added in v0.10.0

func (e *EnvironmentsService) GetSegmentKeys(environmentID, segmentName string) (*SegmentKeysList, *simpleresty.Response, error)

GetSegmentKeys retrieves segment keys given an environment.

Reference: https://docs.split.io/reference/get-segment-keys-in-environment

func (*EnvironmentsService) List

func (e *EnvironmentsService) List(workspaceID string) ([]*Environment, *simpleresty.Response, error)

List all environments.

Reference: https://docs.split.io/reference#get-environments

func (*EnvironmentsService) ListSegments added in v0.2.0

func (e *EnvironmentsService) ListSegments(workspaceID, environmentID string) (*SegmentListResult, *simpleresty.Response, error)

ListSegments retrieves segments given an environment.

Reference: https://docs.split.io/reference/list-segments-in-environment

func (*EnvironmentsService) RemoveSegmentKeys added in v0.10.0

func (e *EnvironmentsService) RemoveSegmentKeys(environmentID, segmentName string, opts *EnvironmentSegmentKeysRequest) (*simpleresty.Response, error)

RemoveSegmentKeys removes segment keys given an environment.

Reference: https://docs.split.io/reference/remove-segment-keys-from-environment

func (*EnvironmentsService) Update

func (e *EnvironmentsService) Update(workspaceID, envID string, opts *EnvironmentRequest) (*Environment, *simpleresty.Response, error)

Update an environment.

Reference: https://docs.split.io/reference#update-environment

type FlagSet added in v0.14.0

type FlagSet struct {
	ID          *string         `json:"id"`
	Name        *string         `json:"name"`
	Description *string         `json:"description"`
	Workspace   *WorkspaceIDRef `json:"workspace"`
}

FlagSet represents a flag set which allows grouping feature flags together for easier management.

func (*FlagSet) GetDescription added in v0.14.0

func (f *FlagSet) GetDescription() string

GetDescription returns the Description field if it's non-nil, zero value otherwise.

func (*FlagSet) GetID added in v0.14.0

func (f *FlagSet) GetID() string

GetID returns the ID field if it's non-nil, zero value otherwise.

func (*FlagSet) GetName added in v0.14.0

func (f *FlagSet) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*FlagSet) GetWorkspace added in v0.14.0

func (f *FlagSet) GetWorkspace() *WorkspaceIDRef

GetWorkspace returns the Workspace field.

type FlagSetListResult added in v0.14.0

type FlagSetListResult struct {
	Objects        []*FlagSet `json:"objects"`
	NextMarker     *string    `json:"nextMarker"`
	PreviousMarker *string    `json:"previousMarker"`
}

FlagSetListResult represents the response when listing flag sets.

func (*FlagSetListResult) GetNextMarker added in v0.14.0

func (f *FlagSetListResult) GetNextMarker() string

GetNextMarker returns the NextMarker field if it's non-nil, zero value otherwise.

func (*FlagSetListResult) GetPreviousMarker added in v0.14.0

func (f *FlagSetListResult) GetPreviousMarker() string

GetPreviousMarker returns the PreviousMarker field if it's non-nil, zero value otherwise.

func (*FlagSetListResult) HasObjects added in v0.14.0

func (f *FlagSetListResult) HasObjects() bool

HasObjects checks if FlagSetListResult has any Objects.

type FlagSetRequest added in v0.14.0

type FlagSetRequest struct {
	Name        *string         `json:"name,omitempty"`
	Description *string         `json:"description,omitempty"`
	Workspace   *WorkspaceIDRef `json:"workspace,omitempty"`
}

FlagSetRequest represents a request to create a flag set.

func (*FlagSetRequest) GetDescription added in v0.14.0

func (f *FlagSetRequest) GetDescription() string

GetDescription returns the Description field if it's non-nil, zero value otherwise.

func (*FlagSetRequest) GetName added in v0.14.0

func (f *FlagSetRequest) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*FlagSetRequest) GetWorkspace added in v0.14.0

func (f *FlagSetRequest) GetWorkspace() *WorkspaceIDRef

GetWorkspace returns the Workspace field.

type FlagSetsService added in v0.14.0

type FlagSetsService service

FlagSetsService handles communication with the flag sets related methods of the Split.io APIv3.

Reference: https://docs.split.io/reference/create-flag-set

func (*FlagSetsService) Create added in v0.14.0

Create a flag set.

Reference: https://docs.split.io/reference/create-flag-set

func (*FlagSetsService) Delete added in v0.14.0

func (f *FlagSetsService) Delete(id string) (*simpleresty.Response, error)

Delete a flag set.

Reference: https://docs.split.io/reference/delete-flag-set-by-id

func (*FlagSetsService) FindByID added in v0.14.0

func (f *FlagSetsService) FindByID(id string) (*FlagSet, *simpleresty.Response, error)

FindByID retrieves a flag set by its ID.

Reference: https://docs.split.io/reference/get-flag-set-by-id

func (*FlagSetsService) FindByName added in v0.14.0

func (f *FlagSetsService) FindByName(workspaceID, name string) (*FlagSet, *simpleresty.Response, error)

FindByName retrieves a flag set by its name.

Note: this method uses the List() method to first return all flag sets and then look for the target flag set by name. The Split APIv3 does not provide a direct GET endpoint to find flag sets by name.

func (*FlagSetsService) List added in v0.14.0

func (f *FlagSetsService) List(workspaceID string) ([]*FlagSet, *simpleresty.Response, error)

List all flag sets for a given workspace.

Reference: https://docs.split.io/reference/list-flag-sets

type GenericListQueryParams added in v0.4.0

type GenericListQueryParams struct {
	// The offset to retrieve. Useful for pagination
	Offset int `url:"offset,omitempty"`

	// The maximum limit to return per call. Max=20-50.
	Limit int `url:"limit,omitempty"`
}

GenericListQueryParams are parameters for any resource.

type GenericListResult added in v0.2.0

type GenericListResult struct {
	Offset     *int `json:"offset"`
	Limit      *int `json:"limit"`
	TotalCount *int `json:"totalCount"`
}

GenericListResult is the generic list result.

func (*GenericListResult) GetLimit added in v0.2.0

func (g *GenericListResult) GetLimit() int

GetLimit returns the Limit field if it's non-nil, zero value otherwise.

func (*GenericListResult) GetOffset added in v0.2.0

func (g *GenericListResult) GetOffset() int

GetOffset returns the Offset field if it's non-nil, zero value otherwise.

func (*GenericListResult) GetTotalCount added in v0.2.0

func (g *GenericListResult) GetTotalCount() int

GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise.

type Group added in v0.2.0

type Group struct {
	ID          *string `json:"id"`
	Name        *string `json:"name"`
	Description *string `json:"description"`
	Type        *string `json:"type"`
}

Group represents a group in Split.

func (*Group) GetDescription added in v0.2.0

func (g *Group) GetDescription() string

GetDescription returns the Description field if it's non-nil, zero value otherwise.

func (*Group) GetID added in v0.2.0

func (g *Group) GetID() string

GetID returns the ID field if it's non-nil, zero value otherwise.

func (*Group) GetName added in v0.2.0

func (g *Group) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*Group) GetType added in v0.2.0

func (g *Group) GetType() string

GetType returns the Type field if it's non-nil, zero value otherwise.

type GroupListOpts added in v0.2.0

type GroupListOpts struct {
	// 1-200 are the potential values. Default=50
	Limit int `url:"limit,omitempty"`
}

GroupListOpts

type GroupListResult added in v0.2.0

type GroupListResult struct {
	Data           []*Group `json:"objects"`
	NextMarker     *string  `json:"nextMarker,omitempty"`
	PreviousMarker *string  `json:"previousMarker,omitempty"`
	Limit          *int     `json:"limit"`
	Count          *int     `json:"count"`
}

GroupListResult

func (*GroupListResult) GetCount added in v0.2.0

func (g *GroupListResult) GetCount() int

GetCount returns the Count field if it's non-nil, zero value otherwise.

func (*GroupListResult) GetLimit added in v0.2.0

func (g *GroupListResult) GetLimit() int

GetLimit returns the Limit field if it's non-nil, zero value otherwise.

func (*GroupListResult) GetNextMarker added in v0.2.0

func (g *GroupListResult) GetNextMarker() string

GetNextMarker returns the NextMarker field if it's non-nil, zero value otherwise.

func (*GroupListResult) GetPreviousMarker added in v0.2.0

func (g *GroupListResult) GetPreviousMarker() string

GetPreviousMarker returns the PreviousMarker field if it's non-nil, zero value otherwise.

func (*GroupListResult) HasData added in v0.2.0

func (g *GroupListResult) HasData() bool

HasData checks if GroupListResult has any Data.

type GroupRequest added in v0.2.0

type GroupRequest struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

GroupRequest

type GroupsService added in v0.2.0

type GroupsService service

GroupsService handles communication with the group related methods of the Split.io APIv2.

Reference: https://docs.split.io/reference#groups-overview

func (*GroupsService) Create added in v0.2.0

func (g *GroupsService) Create(opts *GroupRequest) (*Group, *simpleresty.Response, error)

Create a new group in your organization.

Reference: https://docs.split.io/reference#create-group

func (*GroupsService) Delete added in v0.2.0

func (g *GroupsService) Delete(id string) (*simpleresty.Response, error)

Delete a group in your organization.

Reference: https://docs.split.io/reference#delete-group

func (*GroupsService) Get added in v0.2.0

Get a group by their group Id.

Reference: https://docs.split.io/reference#get-group

func (*GroupsService) List added in v0.2.0

List all active Groups in the organization

Reference: https://docs.split.io/reference#list-groups

func (*GroupsService) Update added in v0.2.0

func (g *GroupsService) Update(id string, opts *GroupRequest) (*Group, *simpleresty.Response, error)

Update a group in your organization.

Reference: https://docs.split.io/reference#update-group

type KeyEnvironmentRequest added in v0.13.0

type KeyEnvironmentRequest struct {
	Type string `json:"type"`
	Id   string `json:"id"`
}

type KeyRequest added in v0.13.0

type KeyRequest struct {
	Name         string                  `json:"name"`
	KeyType      string                  `json:"apiKeyType"`
	Roles        []string                `json:"roles"`
	Environments []KeyEnvironmentRequest `json:"environments"`
	Workspace    *KeyWorkspaceRequest    `json:"workspace"`
}

KeyRequest represents a request to create an API key.

func (*KeyRequest) GetWorkspace added in v0.13.0

func (k *KeyRequest) GetWorkspace() *KeyWorkspaceRequest

GetWorkspace returns the Workspace field.

func (*KeyRequest) HasEnvironments added in v0.13.0

func (k *KeyRequest) HasEnvironments() bool

HasEnvironments checks if KeyRequest has any Environments.

func (*KeyRequest) HasRoles added in v0.13.0

func (k *KeyRequest) HasRoles() bool

HasRoles checks if KeyRequest has any Roles.

type KeyResponse added in v0.13.0

type KeyResponse struct {
	Id         *string  `json:"id"`
	Name       *string  `json:"name"`
	Roles      []string `json:"roles"`
	Type       *string  `json:"type"`
	ApiKeyType *string  `json:"apiKeyType"`

	// Key is the actual API key
	Key *string `json:"key"`
}

KeyResponse represents the created key.

Not all fields are added here.

func (*KeyResponse) GetApiKeyType added in v0.13.0

func (k *KeyResponse) GetApiKeyType() string

GetApiKeyType returns the ApiKeyType field if it's non-nil, zero value otherwise.

func (*KeyResponse) GetId added in v0.13.0

func (k *KeyResponse) GetId() string

GetId returns the Id field if it's non-nil, zero value otherwise.

func (*KeyResponse) GetKey added in v0.13.0

func (k *KeyResponse) GetKey() string

GetKey returns the Key field if it's non-nil, zero value otherwise.

func (*KeyResponse) GetName added in v0.13.0

func (k *KeyResponse) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*KeyResponse) GetType added in v0.13.0

func (k *KeyResponse) GetType() string

GetType returns the Type field if it's non-nil, zero value otherwise.

func (*KeyResponse) HasRoles added in v0.13.0

func (k *KeyResponse) HasRoles() bool

HasRoles checks if KeyResponse has any Roles.

type KeyWorkspaceRequest added in v0.13.0

type KeyWorkspaceRequest struct {
	Type string `json:"type"`
	Id   string `json:"id"`
}

type KeysService added in v0.13.0

type KeysService service

KeysService handles communication with the api keys related methods of the Split.io APIv2.

Reference: https://docs.split.io/reference/api-keys-overview

func (*KeysService) Create added in v0.13.0

Create an API key.

Reference: https://docs.split.io/reference/create-an-api-key

func (*KeysService) Delete added in v0.13.0

func (k *KeysService) Delete(key string) (*simpleresty.Response, error)

Delete an API key.

Reference: https://docs.split.io/reference/delete-an-api-key

type Matcher added in v0.5.0

type Matcher struct {
	Negate    *bool       `json:"negate,omitempty"`
	Type      *string     `json:"type,omitempty"`
	Attribute *string     `json:"attribute,omitempty"`
	String    *string     `json:"string,omitempty"`
	Bool      *bool       `json:"bool,omitempty"`
	Strings   []string    `json:"strings,omitempty"`
	Number    *int        `json:"number,omitempty"`
	Date      *int        `json:"date,omitempty"`
	Between   interface{} `json:"between,omitempty"`
	Depends   interface{} `json:"depends,omitempty"`
}

Matcher represents the logic for selecting a specific subset of your customer population.

func (*Matcher) GetAttribute added in v0.5.0

func (m *Matcher) GetAttribute() string

GetAttribute returns the Attribute field if it's non-nil, zero value otherwise.

func (*Matcher) GetBool added in v0.5.0

func (m *Matcher) GetBool() bool

GetBool returns the Bool field if it's non-nil, zero value otherwise.

func (*Matcher) GetDate added in v0.5.0

func (m *Matcher) GetDate() int

GetDate returns the Date field if it's non-nil, zero value otherwise.

func (*Matcher) GetNegate added in v0.5.0

func (m *Matcher) GetNegate() bool

GetNegate returns the Negate field if it's non-nil, zero value otherwise.

func (*Matcher) GetNumber added in v0.5.0

func (m *Matcher) GetNumber() int

GetNumber returns the Number field if it's non-nil, zero value otherwise.

func (*Matcher) GetString added in v0.5.0

func (m *Matcher) GetString() string

GetString returns the String field if it's non-nil, zero value otherwise.

func (*Matcher) GetType added in v0.5.0

func (m *Matcher) GetType() string

GetType returns the Type field if it's non-nil, zero value otherwise.

func (*Matcher) HasStrings added in v0.5.0

func (m *Matcher) HasStrings() bool

HasStrings checks if Matcher has any Strings.

type Option

type Option func(*Config) error

Option is a functional option for configuring the API client.

func APIBaseURL

func APIBaseURL(url string) Option

APIBaseURL allows for a custom API v3 base URL.

func APIKey

func APIKey(token string) Option

APIKey sets the API key for authentication.

func AcceptHeader

func AcceptHeader(s string) Option

AcceptHeader allows for a custom Aceept header.

func ClientTimeout added in v0.7.0

func ClientTimeout(duration int) Option

ClientTimeout sets the client max timeout.

func ContentTypeHeader

func ContentTypeHeader(s string) Option

ContentTypeHeader allows for a custom Content-Type header.

func CustomHTTPHeaders

func CustomHTTPHeaders(headers map[string]string) Option

CustomHTTPHeaders allows for additional HTTPHeaders.

func HarnessToken added in v0.15.0

func HarnessToken(token string) Option

HarnessToken sets the Harness token for x-api-key header authentication.

func UserAgent

func UserAgent(userAgent string) Option

UserAgent allows for a custom User Agent.

type Rule added in v0.5.0

type Rule struct {
	Condition *Condition `json:"condition"`
	Buckets   []*Bucket  `json:"buckets"`
}

Rule consists of a Condition and a list of Buckets.

When the Split Definition is evaluated, if the Condition of this Rule is met, then the customer will be evaluated and fall in the sticky distribution specified in the Buckets

func (*Rule) GetCondition added in v0.5.0

func (r *Rule) GetCondition() *Condition

GetCondition returns the Condition field.

func (*Rule) HasBuckets added in v0.5.0

func (r *Rule) HasBuckets() bool

HasBuckets checks if Rule has any Buckets.

type Segment added in v0.2.0

type Segment struct {
	Name         *string      `json:"name"`
	Description  *string      `json:"description,omitempty"`
	Environment  *Environment `json:"environment"`
	TrafficType  *TrafficType `json:"trafficType"`
	CreationTime *int64       `json:"creationTime"`
	Tags         []*Tag       `json:"tags,omitempty"`
}

Segment represents a Split segment.

func (*Segment) GetCreationTime added in v0.2.0

func (s *Segment) GetCreationTime() int64

GetCreationTime returns the CreationTime field if it's non-nil, zero value otherwise.

func (*Segment) GetDescription added in v0.2.0

func (s *Segment) GetDescription() string

GetDescription returns the Description field if it's non-nil, zero value otherwise.

func (*Segment) GetEnvironment added in v0.2.0

func (s *Segment) GetEnvironment() *Environment

GetEnvironment returns the Environment field.

func (*Segment) GetName added in v0.2.0

func (s *Segment) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*Segment) GetTrafficType added in v0.2.0

func (s *Segment) GetTrafficType() *TrafficType

GetTrafficType returns the TrafficType field.

func (*Segment) HasTags added in v0.2.0

func (s *Segment) HasTags() bool

HasTags checks if Segment has any Tags.

type SegmentKey added in v0.10.0

type SegmentKey struct {
	Key *string `json:"key"`
}

SegmentKey

func (*SegmentKey) GetKey added in v0.10.0

func (s *SegmentKey) GetKey() string

GetKey returns the Key field if it's non-nil, zero value otherwise.

type SegmentKeysList added in v0.10.0

type SegmentKeysList struct {
	Keys []*SegmentKey `json:"keys"`
	GenericListResult
}

SegmentKeysList

func (*SegmentKeysList) HasKeys added in v0.10.0

func (s *SegmentKeysList) HasKeys() bool

HasKeys checks if SegmentKeysList has any Keys.

type SegmentListResult added in v0.2.0

type SegmentListResult struct {
	Objects []*Segment `json:"objects"`
	GenericListResult
}

SegmentListResult represents the response returned when listing all segments.

func (*SegmentListResult) HasObjects added in v0.2.0

func (s *SegmentListResult) HasObjects() bool

HasObjects checks if SegmentListResult has any Objects.

type SegmentRequest added in v0.2.0

type SegmentRequest struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

SegmentRequest represents a request to create a segment.

type SegmentsService added in v0.2.0

type SegmentsService service

SegmentsService handles communication with the segment related methods of the Split.io APIv2.

Reference: https://docs.split.io/reference#segments-overview

func (*SegmentsService) Activate added in v0.2.0

func (s *SegmentsService) Activate(environmentID, segmentName string) (*Segment, *simpleresty.Response, error)

Activate a Segment in an environment to be able to set its definitions.

Reference: https://docs.split.io/reference#enable-segment-in-environment

func (*SegmentsService) Create added in v0.2.0

func (s *SegmentsService) Create(workspaceID, trafficTypeID string, opts *SegmentRequest) (*Segment, *simpleresty.Response, error)

Create a segment. This API does not configure the Segment in any environment.

Reference: https://docs.split.io/reference#create-segment

func (*SegmentsService) Deactivate added in v0.2.0

func (s *SegmentsService) Deactivate(environmentID, segmentName string) (*simpleresty.Response, error)

Deactivate a Segment in an environment.

Reference: https://docs.split.io/reference#deactivate-segment-in-environment

func (*SegmentsService) Delete added in v0.2.0

func (s *SegmentsService) Delete(workspaceID, segmentName string) (*simpleresty.Response, error)

Delete a segment. This will automatically unconfigure the Segment Definition from all environments.

Reference: https://docs.split.io/reference#delete-segment

func (*SegmentsService) Get added in v0.2.0

func (s *SegmentsService) Get(workspaceID, name string) (*Segment, *simpleresty.Response, error)

Get a segment.

Reference: n/a

func (*SegmentsService) List added in v0.2.0

List all segments.

Reference: https://docs.split.io/reference#list-segments

type Split added in v0.4.0

type Split struct {
	ID                     *string             `json:"id"`
	Name                   *string             `json:"name"`
	Description            *string             `json:"description"`
	Tags                   []SplitTag          `json:"tags,omitempty"`
	CreationTime           *int64              `json:"creationTime"`
	RolloutStatusTimestamp *int64              `json:"rolloutStatusTimestamp"`
	TrafficType            *TrafficType        `json:"trafficType"`
	RolloutStatus          *SplitRolloutStatus `json:"rolloutStatus"`
}

Split is a feature flag, toggle, or experiment.

func (*Split) GetCreationTime added in v0.4.0

func (s *Split) GetCreationTime() int64

GetCreationTime returns the CreationTime field if it's non-nil, zero value otherwise.

func (*Split) GetDescription added in v0.4.0

func (s *Split) GetDescription() string

GetDescription returns the Description field if it's non-nil, zero value otherwise.

func (*Split) GetID added in v0.4.0

func (s *Split) GetID() string

GetID returns the ID field if it's non-nil, zero value otherwise.

func (*Split) GetName added in v0.4.0

func (s *Split) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*Split) GetRolloutStatus added in v0.4.0

func (s *Split) GetRolloutStatus() *SplitRolloutStatus

GetRolloutStatus returns the RolloutStatus field.

func (*Split) GetRolloutStatusTimestamp added in v0.4.0

func (s *Split) GetRolloutStatusTimestamp() int64

GetRolloutStatusTimestamp returns the RolloutStatusTimestamp field if it's non-nil, zero value otherwise.

func (*Split) GetTrafficType added in v0.4.0

func (s *Split) GetTrafficType() *TrafficType

GetTrafficType returns the TrafficType field.

func (*Split) HasTags added in v0.4.0

func (s *Split) HasTags() bool

HasTags checks if Split has any Tags.

type SplitCreateRequest added in v0.4.0

type SplitCreateRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

SplitCreateRequest represents a request to create a split.

type SplitDefinition added in v0.5.0

type SplitDefinition struct {
	ID                *string      `json:"id"`
	Name              *string      `json:"name"`
	DefaultTreatment  *string      `json:"defaultTreatment"`
	Environment       *Environment `json:"environment"`
	TrafficType       *TrafficType `json:"trafficType"`
	Killed            *bool        `json:"killed"`
	Treatments        []*Treatment `json:"treatments"`
	Rules             []*Rule      `json:"rules"`
	DefaultRule       []*Bucket    `json:"defaultRule"`
	TrafficAllocation *int         `json:"trafficAllocation"`
	CreationTIme      *int         `json:"creationTIme"`
	LastUpdateTime    *int         `json:"lastUpdateTime"`
}

SplitDefinition is the configuration of a Split in a specific environment such as production or staging.

func (*SplitDefinition) GetCreationTIme added in v0.5.0

func (s *SplitDefinition) GetCreationTIme() int

GetCreationTIme returns the CreationTIme field if it's non-nil, zero value otherwise.

func (*SplitDefinition) GetDefaultTreatment added in v0.5.0

func (s *SplitDefinition) GetDefaultTreatment() string

GetDefaultTreatment returns the DefaultTreatment field if it's non-nil, zero value otherwise.

func (*SplitDefinition) GetEnvironment added in v0.5.0

func (s *SplitDefinition) GetEnvironment() *Environment

GetEnvironment returns the Environment field.

func (*SplitDefinition) GetID added in v0.5.0

func (s *SplitDefinition) GetID() string

GetID returns the ID field if it's non-nil, zero value otherwise.

func (*SplitDefinition) GetKilled added in v0.5.0

func (s *SplitDefinition) GetKilled() bool

GetKilled returns the Killed field if it's non-nil, zero value otherwise.

func (*SplitDefinition) GetLastUpdateTime added in v0.5.0

func (s *SplitDefinition) GetLastUpdateTime() int

GetLastUpdateTime returns the LastUpdateTime field if it's non-nil, zero value otherwise.

func (*SplitDefinition) GetName added in v0.5.0

func (s *SplitDefinition) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*SplitDefinition) GetTrafficAllocation added in v0.5.0

func (s *SplitDefinition) GetTrafficAllocation() int

GetTrafficAllocation returns the TrafficAllocation field if it's non-nil, zero value otherwise.

func (*SplitDefinition) GetTrafficType added in v0.5.0

func (s *SplitDefinition) GetTrafficType() *TrafficType

GetTrafficType returns the TrafficType field.

func (*SplitDefinition) HasDefaultRule added in v0.5.0

func (s *SplitDefinition) HasDefaultRule() bool

HasDefaultRule checks if SplitDefinition has any DefaultRule.

func (*SplitDefinition) HasRules added in v0.5.0

func (s *SplitDefinition) HasRules() bool

HasRules checks if SplitDefinition has any Rules.

func (*SplitDefinition) HasTreatments added in v0.5.0

func (s *SplitDefinition) HasTreatments() bool

HasTreatments checks if SplitDefinition has any Treatments.

type SplitDefinitionRequest added in v0.5.0

type SplitDefinitionRequest struct {
	Treatments        []Treatment `json:"treatments"`
	Rules             []Rule      `json:"rules"`
	DefaultRule       []Bucket    `json:"defaultRule"`
	DefaultTreatment  string      `json:"defaultTreatment"`
	Comment           string      `json:"comment,omitempty"`
	Title             string      `json:"title,omitempty"`
	TrafficAllocation int         `json:"trafficAllocation"`
}

SplitDefinitionRequest creates or updates a split definition.

func (*SplitDefinitionRequest) HasDefaultRule added in v0.5.0

func (s *SplitDefinitionRequest) HasDefaultRule() bool

HasDefaultRule checks if SplitDefinitionRequest has any DefaultRule.

func (*SplitDefinitionRequest) HasRules added in v0.5.0

func (s *SplitDefinitionRequest) HasRules() bool

HasRules checks if SplitDefinitionRequest has any Rules.

func (*SplitDefinitionRequest) HasTreatments added in v0.5.0

func (s *SplitDefinitionRequest) HasTreatments() bool

HasTreatments checks if SplitDefinitionRequest has any Treatments.

type SplitDefinitions added in v0.5.0

type SplitDefinitions struct {
	GenericListResult
	Objects []*SplitDefinition `json:"objects"`
}

SplitDefinitions represents all definitions in an environment.

func (*SplitDefinitions) HasObjects added in v0.5.0

func (s *SplitDefinitions) HasObjects() bool

HasObjects checks if SplitDefinitions has any Objects.

type SplitRolloutStatus added in v0.4.0

type SplitRolloutStatus struct {
	ID   *string `json:"id"`
	Name *string `json:"name"`
}

SplitRolloutStatus represents the rollout status.

func (*SplitRolloutStatus) GetID added in v0.4.0

func (s *SplitRolloutStatus) GetID() string

GetID returns the ID field if it's non-nil, zero value otherwise.

func (*SplitRolloutStatus) GetName added in v0.4.0

func (s *SplitRolloutStatus) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

type SplitTag added in v0.7.1

type SplitTag struct {
	Name string `json:"name"`
}

SplitTag represents a tag in the split

type SplitUpdateRequest added in v0.4.0

type SplitUpdateRequest struct {
	Description string `json:"description"`
}

SplitUpdateRequest represents a request to update a split.

type Splits added in v0.4.0

type Splits struct {
	Objects []*Split `json:"objects"`
	GenericListResult
}

Splits represents all splits.

func (*Splits) HasObjects added in v0.4.0

func (s *Splits) HasObjects() bool

HasObjects checks if Splits has any Objects.

type SplitsService added in v0.4.0

type SplitsService service

SplitsService handles communication with the segment related methods of the Split.io APIv2.

Reference: https://docs.split.io/reference/splits-overview

func (*SplitsService) Create added in v0.4.0

func (s *SplitsService) Create(workspaceId, trafficTypeId string, opts *SplitCreateRequest) (*Split, *simpleresty.Response, error)

Create a single split.

Reference: https://docs.split.io/reference/create-split

func (*SplitsService) CreateDefinition added in v0.5.0

func (s *SplitsService) CreateDefinition(workspaceId, splitName, environmentId string, opts *SplitDefinitionRequest) (*SplitDefinition, *simpleresty.Response, error)

CreateDefinition configures a Split Definition for a specific environment.

Reference: https://docs.split.io/reference/create-split-definition-in-environment

func (*SplitsService) Delete added in v0.4.0

func (s *SplitsService) Delete(workspaceId, splitName string) (*simpleresty.Response, error)

Delete a single split.

This will automatically unconfigure the Split Definition from all environments. Returns `true` in the response body.

Split name is required, not the split UUID.

Reference: https://docs.split.io/reference/delete-split

func (*SplitsService) Get added in v0.4.0

func (s *SplitsService) Get(workspaceId, splitId string) (*Split, *simpleresty.Response, error)

Get a single split.

splitId can be either the name or the UUID.

Reference: https://docs.split.io/reference/get-split

func (*SplitsService) GetDefinition added in v0.5.0

func (s *SplitsService) GetDefinition(workspaceId, splitName, environmentId string) (*SplitDefinition, *simpleresty.Response, error)

GetDefinition retrieves a Split Definition given the name and the environment.

Reference: https://docs.split.io/reference/get-split-definition-in-environment

func (*SplitsService) List added in v0.4.0

func (s *SplitsService) List(workspaceId string, opts ...interface{}) (*Splits, *simpleresty.Response, error)

List all splits.

Reference: https://docs.split.io/reference/list-splits

func (*SplitsService) ListDefinitions added in v0.5.0

func (s *SplitsService) ListDefinitions(workspaceId, environmentId string, opts ...interface{}) (*SplitDefinitions, *simpleresty.Response, error)

ListDefinitions retrieves the Split Definitions given an environment.

Reference: https://docs.split.io/reference/lists-split-definitions-in-environment

func (*SplitsService) RemoveDefinition added in v0.5.0

func (s *SplitsService) RemoveDefinition(workspaceId, splitName, environmentId string) (*simpleresty.Response, error)

RemoveDefinition removes a Split Definition for a specific environment.

Reference: https://docs.split.io/reference/remove-split-definition-from-environment

func (*SplitsService) UpdateDefinitionFull added in v0.5.0

func (s *SplitsService) UpdateDefinitionFull(workspaceId, splitName, environmentId string, opts *SplitDefinitionRequest) (*SplitDefinition, *simpleresty.Response, error)

UpdateDefinitionFull performs a full update of a Split Definition for a specific environment.

Reference: https://docs.split.io/reference/full-update-split-definition-in-environment

func (*SplitsService) UpdateDescription added in v0.4.0

func (s *SplitsService) UpdateDescription(workspaceId, splitName, description string) (*Split, *simpleresty.Response, error)

UpdateDescription of an existing split.

Reference: https://docs.split.io/reference/update-split-description

type Tag added in v0.2.0

type Tag struct {
	Name *string `json:"name"`
}

func (*Tag) GetName added in v0.2.0

func (t *Tag) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

type TrafficType

type TrafficType struct {
	Name               *string    `json:"name,omitempty"`
	Type               *string    `json:"type,omitempty"`
	ID                 *string    `json:"id,omitempty"`
	DisplayAttributeID *string    `json:"displayAttributeId,omitempty"`
	Workspace          *Workspace `json:"workspace,omitempty"`
}

func (*TrafficType) GetDisplayAttributeID

func (t *TrafficType) GetDisplayAttributeID() string

GetDisplayAttributeID returns the DisplayAttributeID field if it's non-nil, zero value otherwise.

func (*TrafficType) GetID

func (t *TrafficType) GetID() string

GetID returns the ID field if it's non-nil, zero value otherwise.

func (*TrafficType) GetName

func (t *TrafficType) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*TrafficType) GetType

func (t *TrafficType) GetType() string

GetType returns the Type field if it's non-nil, zero value otherwise.

func (*TrafficType) GetWorkspace

func (t *TrafficType) GetWorkspace() *Workspace

GetWorkspace returns the Workspace field.

type TrafficTypeRequest added in v0.3.0

type TrafficTypeRequest struct {
	// Name must begin with a letter (a-z or A-Z) and can only contain letters, numbers, hyphens and underscores
	// (a-z, A-Z, 0-9, -, _).
	Name string `json:"name"`
}

type TrafficTypesService

type TrafficTypesService service

TrafficTypesService handles communication with the traffic types related methods of the Split.io APIv2.

Reference: https://docs.split.io/reference#traffic-types-overview

func (*TrafficTypesService) Create added in v0.3.0

Create a traffic type.

Reference: https://docs.split.io/reference/create-traffic-types

func (*TrafficTypesService) Delete added in v0.3.0

func (t *TrafficTypesService) Delete(trafficTypeID string) (*simpleresty.Response, error)

Delete a traffic type.

Reference: https://docs.split.io/reference/delete-trafic-type

func (*TrafficTypesService) FindByID

func (t *TrafficTypesService) FindByID(workspaceID, trafficTypeID string) (*TrafficType, *simpleresty.Response, error)

FindByID retrieves a traffic type by its ID.

func (*TrafficTypesService) FindByName

func (t *TrafficTypesService) FindByName(workspaceID, trafficTypeName string) (*TrafficType, *simpleresty.Response, error)

FindByName retrieves a traffic type by its name.

func (*TrafficTypesService) List

func (t *TrafficTypesService) List(workspaceID string) ([]*TrafficType, *simpleresty.Response, error)

List all traffic types.

Reference: https://docs.split.io/reference#get-traffic-types

type Treatment added in v0.5.0

type Treatment struct {
	Name           *string  `json:"name"`
	Configurations *string  `json:"configurations"`
	Description    *string  `json:"description"`
	Keys           []string `json:"keys,omitempty"`
	Segments       []string `json:"segments,omitempty"`
}

Treatment is a state of a Split. A simple feature flag has two treatments: on and off. An experiment can have any number of treatments.

func (*Treatment) GetConfigurations added in v0.5.0

func (t *Treatment) GetConfigurations() string

GetConfigurations returns the Configurations field if it's non-nil, zero value otherwise.

func (*Treatment) GetDescription added in v0.5.0

func (t *Treatment) GetDescription() string

GetDescription returns the Description field if it's non-nil, zero value otherwise.

func (*Treatment) GetName added in v0.5.0

func (t *Treatment) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*Treatment) HasKeys added in v0.9.0

func (t *Treatment) HasKeys() bool

HasKeys checks if Treatment has any Keys.

func (*Treatment) HasSegments added in v0.9.0

func (t *Treatment) HasSegments() bool

HasSegments checks if Treatment has any Segments.

type User added in v0.2.0

type User struct {
	ID     *string  `json:"id"`
	Type   *string  `json:"type"`
	Name   *string  `json:"name"`
	Email  *string  `json:"email"`
	Status *string  `json:"status"`
	TFA    *bool    `json:"2fa"`
	Groups []*Group `json:"groups,omitempty"`
}

User represents a user.

func (*User) GetEmail added in v0.2.0

func (u *User) GetEmail() string

GetEmail returns the Email field if it's non-nil, zero value otherwise.

func (*User) GetID added in v0.2.0

func (u *User) GetID() string

GetID returns the ID field if it's non-nil, zero value otherwise.

func (*User) GetName added in v0.2.0

func (u *User) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*User) GetStatus added in v0.2.0

func (u *User) GetStatus() string

GetStatus returns the Status field if it's non-nil, zero value otherwise.

func (*User) GetTFA added in v0.2.0

func (u *User) GetTFA() bool

GetTFA returns the TFA field if it's non-nil, zero value otherwise.

func (*User) GetType added in v0.2.0

func (u *User) GetType() string

GetType returns the Type field if it's non-nil, zero value otherwise.

func (*User) HasGroups added in v0.2.0

func (u *User) HasGroups() bool

HasGroups checks if User has any Groups.

type UserCreateRequest added in v0.2.0

type UserCreateRequest struct {
	Email  string `json:"email,omitempty"`
	Groups []struct {
		ID   string `json:"id,omitempty"`
		Type string `json:"type,omitempty"`
	} `json:"groups,omitempty"`
}

UserCreateRequest is to create a new user.

func (*UserCreateRequest) HasGroups added in v0.2.0

func (u *UserCreateRequest) HasGroups() bool

HasGroups checks if UserCreateRequest has any Groups.

type UserListOpts added in v0.2.0

type UserListOpts struct {
	// ACTIVE | DEACTIVATED | PENDING are the allowed status values to filter by
	Status string `url:"status,omitempty"`

	// 1-200 are the potential values. Default=50
	Limit int `url:"limit,omitempty"`

	// value of "previousMarker" in response
	Before int `url:"limit,omitempty"`

	// value of "nextMarker" in response
	After string `url:"limit,omitempty"`

	// eturns Active members of a group
	GroupID string `url:"limit,omitempty"`
}

UserListOpts represents all query parameters when fetching all Users.

type UserListResult added in v0.2.0

type UserListResult struct {
	Data           []*User `json:"data"`
	NextMarker     *string `json:"nextMarker,omitempty"`
	PreviousMarker *string `json:"previousMarker,omitempty"`
	Limit          *int    `json:"limit"`
	Count          *int    `json:"count"`
}

UserListResult

func (*UserListResult) GetCount added in v0.2.0

func (u *UserListResult) GetCount() int

GetCount returns the Count field if it's non-nil, zero value otherwise.

func (*UserListResult) GetLimit added in v0.2.0

func (u *UserListResult) GetLimit() int

GetLimit returns the Limit field if it's non-nil, zero value otherwise.

func (*UserListResult) GetNextMarker added in v0.2.0

func (u *UserListResult) GetNextMarker() string

GetNextMarker returns the NextMarker field if it's non-nil, zero value otherwise.

func (*UserListResult) GetPreviousMarker added in v0.2.0

func (u *UserListResult) GetPreviousMarker() string

GetPreviousMarker returns the PreviousMarker field if it's non-nil, zero value otherwise.

func (*UserListResult) HasData added in v0.2.0

func (u *UserListResult) HasData() bool

HasData checks if UserListResult has any Data.

type UserUpdateRequest added in v0.2.0

type UserUpdateRequest struct {
	Name   string `json:"name,omitempty"`
	Email  string `json:"email,omitempty"`
	TFA    *bool  `json:"2fa,omitempty"`
	Status string `json:"status,omitempty"`
}

UserUpdateRequest updates an existing user.

func (*UserUpdateRequest) GetTFA added in v0.2.0

func (u *UserUpdateRequest) GetTFA() bool

GetTFA returns the TFA field if it's non-nil, zero value otherwise.

type UsersService added in v0.2.0

type UsersService service

UsersService handles communication with the user related methods of the Split.io APIv2.

Reference: https://docs.split.io/reference#users-overview

func (*UsersService) DeletePendingUser added in v0.2.0

func (u *UsersService) DeletePendingUser(id string) (*simpleresty.Response, error)

DeletePendingUser that have not accepted their invites yet. Once a user is active, you can only deactivate the user via a PUT request

Reference: https://docs.split.io/reference#delete-a-pending-user

func (*UsersService) Get added in v0.2.0

func (u *UsersService) Get(id string) (*User, *simpleresty.Response, error)

Get a user by their user Id.

Reference: https://docs.split.io/reference#get-user

func (*UsersService) Invite added in v0.2.0

Invite a new user to your organization. They will be created with a Pending status

Reference: https://docs.split.io/reference#invite-a-new-user

func (*UsersService) List added in v0.2.0

List all active, deactivated, and pending users in the organization.

By default, pending users are not returned via this endpoint.

Reference: https://docs.split.io/reference#list-users

func (*UsersService) Update added in v0.2.0

func (u *UsersService) Update(id string, opts *UserUpdateRequest) (*User, *simpleresty.Response, error)

Update display name, email, disable 2FA, and Activate/Deactivate of a User.

Reference: https://docs.split.io/reference#full-update-user

type Workspace

type Workspace struct {
	Name                     *string `json:"name"`
	Type                     *string `json:"type"`
	ID                       *string `json:"id"`
	RequiresTitleAndComments *bool   `json:"requiresTitleAndComments"`
}

Workspace represents a workspace.

func (*Workspace) GetID

func (w *Workspace) GetID() string

GetID returns the ID field if it's non-nil, zero value otherwise.

func (*Workspace) GetName

func (w *Workspace) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*Workspace) GetRequiresTitleAndComments

func (w *Workspace) GetRequiresTitleAndComments() bool

GetRequiresTitleAndComments returns the RequiresTitleAndComments field if it's non-nil, zero value otherwise.

func (*Workspace) GetType

func (w *Workspace) GetType() string

GetType returns the Type field if it's non-nil, zero value otherwise.

type WorkspaceIDRef added in v0.14.0

type WorkspaceIDRef struct {
	Type *string `json:"type"`
	ID   *string `json:"id"`
}

WorkspaceIDRef represents a minimal representation of a workspace for flag set operations.

func (*WorkspaceIDRef) GetID added in v0.14.0

func (w *WorkspaceIDRef) GetID() string

GetID returns the ID field if it's non-nil, zero value otherwise.

func (*WorkspaceIDRef) GetType added in v0.14.0

func (w *WorkspaceIDRef) GetType() string

GetType returns the Type field if it's non-nil, zero value otherwise.

type WorkspaceListQueryParams added in v0.3.0

type WorkspaceListQueryParams struct {
	GenericListQueryParams

	// Filter workspaces by name.
	Name string `url:"name,omitempty"`

	// Match operator for the name query parameter. `IS` is the default value but STARTS_WITH and CONTAINS is also supported.
	NameOp string `url:"nameOp,omitempty"`
}

WorkspaceListQueryParams represents query parameters when retrieving all workspaces.

type WorkspaceRequest added in v0.3.0

type WorkspaceRequest struct {
	Name                     *string `json:"name,omitempty"`
	RequiresTitleAndComments *bool   `json:"requiresTitleAndComments,omitempty"` // Require title and comments for splits, segment, and metric changes.
}

WorkspaceRequest represents a request to create/update a workspace.

func (*WorkspaceRequest) GetName added in v0.3.0

func (w *WorkspaceRequest) GetName() string

GetName returns the Name field if it's non-nil, zero value otherwise.

func (*WorkspaceRequest) GetRequiresTitleAndComments added in v0.3.0

func (w *WorkspaceRequest) GetRequiresTitleAndComments() bool

GetRequiresTitleAndComments returns the RequiresTitleAndComments field if it's non-nil, zero value otherwise.

type Workspaces

type Workspaces struct {
	Objects []*Workspace `json:"objects"`
	GenericListResult
}

Workspaces represents all workspaces.

func (*Workspaces) HasObjects

func (w *Workspaces) HasObjects() bool

HasObjects checks if Workspaces has any Objects.

type WorkspacesService

type WorkspacesService service

WorkspacesService handles communication with the workspace related methods of the Split.io APIv2.

Reference: https://docs.split.io/reference/workspaces-overview

func (*WorkspacesService) Create added in v0.3.0

Create a workspaces.

Note: When you create a workspace from this API, this won't create the default environment. You must use the create environment API to create an environment.

Reference: https://docs.split.io/reference/create-workspace

func (*WorkspacesService) Delete added in v0.3.0

Delete a workspace.

Reference: https://docs.split.io/reference/delete-workspace

func (*WorkspacesService) FindById

FindById retrieves a workspace by its ID.

Note: this method uses the List() method to first return all workspaces and then look for the target workspace by an ID. The Split APIv2 does not provide a GET#show endpoint for workspaces, unfortunately.

func (*WorkspacesService) FindByName

func (w *WorkspacesService) FindByName(name string) (*Workspace, *simpleresty.Response, error)

FindByName retrieves a workspace by its name.

This method uses List query parameters to find an exact match.

func (*WorkspacesService) List

func (w *WorkspacesService) List(opts ...interface{}) (*Workspaces, *simpleresty.Response, error)

List all workspaces.

Reference: https://docs.split.io/reference#get-workspaces

func (*WorkspacesService) Update added in v0.3.0

Update a workspaces.

Reference: https://docs.split.io/reference/update-workspace

Jump to

Keyboard shortcuts

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