connection

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const OriginalBaseUrl = "https://api.ctl.io/"

Variables

View Source
var (

	//this made a variable instead of a constant for testing purpoises
	BaseUrl = OriginalBaseUrl
)
View Source
var NewConnection = func(username, password, accountAlias string, logger *log.Logger) (base.Connection, error) {
	cn := &connection{
		logger: logger,
	}
	cn.logger.Printf("Creating new connection. Username: %s", username)
	loginReq := &authentication.LoginReq{Username: username, Password: password}
	loginRes := &authentication.LoginRes{}
	err := cn.ExecuteRequest("POST", BaseUrl+"v2/authentication/login", loginReq, loginRes)
	if err != nil {
		return nil, err
	}
	cn.bearerToken = loginRes.BearerToken
	if accountAlias == "" {
		accountAlias = loginRes.AccountAlias
	}
	cn.accountAlias = accountAlias
	cn.logger.Printf("Updating connection. Bearer: %s, Alias: %s", cn.bearerToken, accountAlias)
	return cn, nil
}

Functions

func ExtractURIParams

func ExtractURIParams(uri string, model interface{}) string

func FilterQuery

func FilterQuery(raw string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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