Skip to content
This repository was archived by the owner on Aug 8, 2025. It is now read-only.

taplytics/gosdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API client for openapi

The Taplytics Universal API is an API to quickly use Taplytics features and functionality at edge. This API allows the utilization of the Taplytics experimentation functionality anywhere in the stack, both client- and server-side.

Each call to the Universal API requires two main parameters: token and user_id.

  • token is unique to each Taplytics project and can be found under Settings -> Project Settings -> Taplytics SDK Key
  • user_id is your custom defined user ID.

To be able to utilize the Universal API, please ensure that your Taplytics project is setup for usage. You may contact your Account Manager or [email protected] for any questions.

Overview

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

  • API version: 1.1
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://taplytics.com

Installation

Install the SDK using:

go get github.com/taplytics/gosdk

Example

See the complete example here:

package main

import (
	"context"
	"fmt"
	"os"

	openapi "github.com/taplytics/gosdk"
)

func main() {

	token := "SDK TOKEN"                       // string | SDK token for the project
	userId := "USER ID"                        // string | ID for current user
	attributes := *openapi.NewUserAttributes() // UserAttributes | serialized attributes object
	customData := make(map[string]interface{}) // map[string]interface{} | serialized custom data object

	configuration := openapi.NewConfiguration()
	api_client := openapi.NewAPIClient(configuration)
	resp, err := api_client.FeatureFlagsApi.FeatureflagsGet(context.Background()).Token(token).UserId(userId).Attributes(attributes).CustomData(customData).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `FeatureFlagsApi.FeatureflagsGet``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", resp)
		return
	}

	fmt.Print(resp.Body)
}

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), sw.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), sw.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identifield by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), sw.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), sw.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://universal-api.taplytics.com/v1

Class Method HTTP request Description
BucketingApi BucketingGet Get /bucketing Get Experiments and Variations for the user.
BucketingApi BucketingPost Post /bucketing Get Experiments and Variations for the user.
ConfigApi ConfigGet Get /config Get Verbose Project Config Document for User
ConfigApi ConfigPost Post /config Get Verbose Project Config Document for User
FeatureFlagsApi FeatureflagsGet Get /featureflags Get enabled Feature Flags for the user
FeatureFlagsApi FeatureflagsPost Post /featureflags Get enabled Feature Flags for the user
FeatureFlagsApi IsfeatureflagenabledGet Get /isfeatureflagenabled Get if feature flag is enabled
FeatureFlagsApi IsfeatureflagenabledPost Post /isfeatureflagenabled Get if feature flag is enabled
VariablesApi VariablesGet Get /variables Get all active variables for user
VariablesApi VariablesPost Post /variables Get all active variables for user
VariablesApi VariablevalueGet Get /variablevalue Get value for a Taplytics Variable
VariablesApi VariablevaluePost Post /variablevalue Get value for a Taplytics Variable
VariationsApi VariationGet Get /variation Get Variation for a Taplytics Experiment
VariationsApi VariationPost Post /variation Get Variation for a Taplytics Experiment

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

[email protected]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •