kueski

package
v0.0.0-...-8a5cdbf Latest Latest
Warning

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

Go to latest
Published: May 3, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentMD5       string = "Content-MD5"
	Authorization    string = "Authorization"
	Date             string = "Date"
	ContentType      string = "Content-Type"
	ApplicationJSON  string = "application/json"
	AuthenticatePath string = "affiliates/authenticate"
	BodyString       string = ""
	Method           string = "POST"
	APIAuthPrefix    string = "APIAuth"
)

ContentMD5 - Content MD5 header key. Authorization - Authorization header key. Date - Date header key. ContentType - Content Type header key. ApplicationJSON - application/JSON string value. AuthenticatePath - Path to the authentication signature endpoint. BodyString - Authentication request body. Method - HTTP Method to use at Authentication (POST).

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client - Interface to connect with Kueski Affiliates API.

func NewClient

func NewClient(url, apiKey, secretKey string) *Client

NewClient - Constructor for Kueski API Client. url - API host URL. apiKey - API key. secretKey - Service secret key.

func (*Client) AuthorizationToken

func (client *Client) AuthorizationToken(canonical string) string

AuthorizationToken - Creates a signature for API authentication.

func (*Client) Evaluate

func (client *Client) Evaluate(curp, email string, fullData interface{}) (string, error)

Evaluate - Performs the lead evaluation. curp - Lead CURP. email - Lead email. fullData - Struct with the full lead data to be sent to Kueski API. Returns: A string with the Request ID if the operation was successful, otherwise error will not be nil. -- Steps to follow: * Request a JWT. * Call LeadEvaluation with CURP and email. * Identify if response is successful, otherwise return proper error code. * Request a JWT. * Call LeadData with fullData and Request ID. * Identify if response is successful, otherwise return proper error code. * Return Request ID if all successful.

func (*Client) RequestToken

func (client *Client) RequestToken() ([]byte, error)

RequestToken - Internal function to retrieve a valid JWT from Kueski API

type JWTProvider

type JWTProvider struct {
	sync.Mutex
	// contains filtered or unexported fields
}

JWTProvider - Structure that handles the JWT requests.

func NewJWTProvider

func NewJWTProvider() *JWTProvider

NewJWTProvider - JWT Provider constructor

func (*JWTProvider) Token

func (jwt *JWTProvider) Token(client TokenAccessor) (string, error)

Token - Provides a valid JSON web Token.

type TokenAccessor

type TokenAccessor interface {
	RequestToken() ([]byte, error)
}

TokenAccessor - Interface that defines the API auth methods.

type TokenProvider

type TokenProvider interface {
	Token(client TokenAccessor) (string, error)
}

TokenProvider - Interface that defines the Token retrieval signature.

type Validator

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

Validator - Affiliate data validator: CURP, email and full data.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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