Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

188 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smapp Golang SDK

smapp-sdk-go is a Go SDK for Smapp services.

Supported Services

Installation

Configure your device to access private packages from github.com/snapp-incubator, then add to go.mod:

require (
    github.com/snapp-incubator/smapp-sdk-go v0.9.2
)

Download with:

go mod download

Note: Versions before v0.9.1 are deprecated.

Configuration

All services (except SmappShot) require a config object.

Import: github.com/snapp-incubator/smapp-sdk-go/config

From environment variables

config, err := config.ReadFromEnvironment()
Variable Default Description
SMAPP_API_KEY Required. API key
SMAPP_API_KEY_SOURCE header header or query
SMAPP_API_KEY_NAME X-Smapp-Key Header or query param name
SMAPP_API_REGION teh-1 teh-1 or teh-2
SMAPP_API_BASE_URL http://smapp-api.apps.inter-dc.okd4.teh-1.snappcloud.io API Gateway base URL

From code

cfg, err := config.NewDefaultConfig("api-key")

Config options

Both constructors accept options to override defaults:

Option Description
WithRegion(string) Set region
WithAPIKey(string) Set API key
WithAPIBaseURL(string) Set custom base URL
WithAPIKeySource(APIKeySource) Set key source
WithAPIKeyName(string) Set key name
WithPublicURL() Use public routes (set region first)
WithInternalURL() Use internal routes (set region first)
cfg, err := config.ReadFromEnvironment(
    config.WithRegion("teh-2"),
    config.WithAPIKey("example-api-key"),
    config.WithPublicURL(),
)

Additional Topics

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages