api

package
v10.0.37 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: MIT Imports: 17 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// AgentService is the agent service endpoint
	AgentService = "agent.api"
	// AppService is the web app endpoint
	AppService = "app"
	// AuthService is the auth service endpoint
	AuthService = "auth.api"
	// EventService is the event service endpoint
	EventService = "event.api"
	// RegistryService is the integration registry service endpoint
	RegistryService = "registry.api"
	// GraphService is the graph service endpoint
	GraphService = "graph.api"
	// WebhookService is the webhook service endpoint
	WebhookService = "webhook.api"
)
View Source
const AuthorizationHeader = "Authorization"

AuthorizationHeader is the name of the authorization header to use

Variables

This section is empty.

Functions

func BackendURL

func BackendURL(subdomain string, channel string) string

BackendURL return the base url to the API server

func Get

func Get(ctx context.Context, channel string, service string, basepath string, apiKey string, opts ...WithOption) (*http.Response, error)

Get will invoke api for channel and basepath

func NewHTTPAPIClient

func NewHTTPAPIClient(config *httpclient.Config) (httpclient.Client, error)

NewHTTPAPIClient will return a new HTTP client for talking with the Pinpoint API it will only allow a trusted TLS connection with a valid TLS certificate signed by a trusted Certificate Authority and for a DNS name that is owned by Pinpoint

func NewHTTPAPIClientDefault

func NewHTTPAPIClientDefault() (httpclient.Client, error)

NewHTTPAPIClientDefault will return a new HTTP client for talking with the Pinpoint API it will only allow a trusted TLS connection with a valid TLS certificate signed by a trusted Certificate Authority and for a DNS name that is owned by Pinpoint the client will retry requests by default with a expotential backoff

func NewHTTPAPIClientDefaultWithTimeout

func NewHTTPAPIClientDefaultWithTimeout(duration time.Duration) (httpclient.Client, error)

NewHTTPAPIClientDefaultWithTimeout will return a new HTTP client for talking with the Pinpoint API it will only allow a trusted TLS connection with a valid TLS certificate signed by a trusted Certificate Authority and for a DNS name that is owned by Pinpoint the client will retry requests by default with a expotential backoff. The max duration to wait is supplied for how long to take at most to try and send data

func Post

func Post(ctx context.Context, channel string, service string, basepath string, apiKey string, obj interface{}, opts ...WithOption) (*http.Response, error)

Post will invoke api for channel and basepath as JSON post

func Put added in v10.0.3

func Put(ctx context.Context, channel string, service string, basepath string, apiKey string, reader io.Reader, opts ...WithOption) (*http.Response, error)

Put will invoke api for channel and basepath as JSON post

func SetAuthorization

func SetAuthorization(req *http.Request, apikey string)

SetAuthorization will set the authorization header

func SetUserAgent

func SetUserAgent(req *http.Request)

SetUserAgent will set the agent user agent

Types

type WithOption added in v10.0.3

type WithOption func(req *http.Request) error

WithOption allows the request to be modified

func WithContentType added in v10.0.3

func WithContentType(value string) WithOption

WithContentType sets the content-type on an outgoing request

func WithHeader added in v10.0.3

func WithHeader(key, value string) WithOption

WithHeader sets a HTTP header on the outgoing request

Jump to

Keyboard shortcuts

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