Documentation
¶
Index ¶
- type API
- func NewAPI(ap APIProvider, props ...string) (api API, err error)
- func NewAPIClientContext(ctx context.Context, ap APIProvider, props ...string) (api API, err error)
- func NewAPIClientFromConn(c connection.Connection) (api API, err error)
- func NewAPIClientFromConnContext(ctx context.Context, c connection.Connection) (api API, err error)
- type APIEndpoint
- type APIProvider
- type BaseAPI
- func (api *BaseAPI) Base() *BaseAPI
- func (api *BaseAPI) Call(name string, params map[string]interface{}, body []byte) (respBytes []byte, err error)
- func (api *BaseAPI) GetBaseURL() string
- func (api *BaseAPI) GetProp(key string) string
- func (api *BaseAPI) Init() (err error)
- func (api *BaseAPI) LoadEndpoints() (err error)
- func (api *BaseAPI) Props() map[string]string
- func (api *BaseAPI) SetProp(key string, val string)
- func (api *BaseAPI) Stream(name string, params map[string]interface{}, body []byte) (ds *iop.Datastream, err error)
- type DigitalOceanAPI
- type GitAPI
- type GithubAPI
- type HubspotAPI
- type SurveyMonkeyAPI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface {
Self() API
Base() *BaseAPI
Init() error
Close() error
GetProp(key string) string
SetProp(key string, val string)
GetBaseURL() string
Call(name string, params map[string]interface{}, body []byte) (respBytes []byte, err error)
Stream(name string, params map[string]interface{}, body []byte) (ds *iop.Datastream, err error)
LoadEndpoints() (err error)
}
API is the Base interface for apis
func NewAPI ¶
func NewAPI(ap APIProvider, props ...string) (api API, err error)
NewAPI creates an API
func NewAPIClientContext ¶
NewAPI creates an API Client with provided context
func NewAPIClientFromConn ¶
func NewAPIClientFromConn(c connection.Connection) (api API, err error)
NewAPIClientFromConn provides an API client with the given Dataconn URL
func NewAPIClientFromConnContext ¶
func NewAPIClientFromConnContext(ctx context.Context, c connection.Connection) (api API, err error)
NewAPIClientFromConnContext provides an API client with the given Dataconn URL
type APIEndpoint ¶
type APIEndpoint struct {
API API `yaml:"-"`
Name string `yaml:"-"`
ColumnMap map[string]*iop.Column `yaml:"-"`
URL string `yaml:"-"`
Endpoint string `yaml:"endpoint,omitempty"`
Method string `yaml:"method,omitempty"`
RecordsJP string `yaml:"records_jp,omitempty"`
NextJP string `yaml:"next_jp,omitempty"`
RespType string `yaml:"resp_type,omitempty"`
Headers map[string]string `yaml:"headers"`
Ds *iop.Datastream `yaml:"-"`
// contains filtered or unexported fields
}
APIEndpoint represents an api endpoint
func (*APIEndpoint) NextURL ¶
func (aos *APIEndpoint) NextURL(data interface{}, resp *http.Response) string
NextURL determines and sets the next URL in a stream call
func (*APIEndpoint) Request ¶
func (aos *APIEndpoint) Request(url string, body []byte) (resp *http.Response, respBytes []byte, err error)
Request performs a request
func (*APIEndpoint) Unmarshal ¶
func (aos *APIEndpoint) Unmarshal(body []byte, data *interface{}) (err error)
Unmarshal parses the response based on the response type
type APIProvider ¶
type APIProvider string
const ( // DigitalOcean is APIProvider DigitalOcean APIProvider = "digitalocean" Git APIProvider = "git" Github APIProvider = "github" SurveyMonkey APIProvider = "surveymonkey" Hubspot APIProvider = "hubspot" )
type BaseAPI ¶
type BaseAPI struct {
API
Provider APIProvider
Endpoints map[string]*APIEndpoint
BaseURL string
User string
Key string
Context g.Context
FlattenNested bool
DefHeaders map[string]string
DefParams map[string]string
// contains filtered or unexported fields
}
BaseAPI is the base api struct
func (*BaseAPI) Call ¶
func (api *BaseAPI) Call(name string, params map[string]interface{}, body []byte) (respBytes []byte, err error)
Call calls an endpoint by name with the provided params and body
func (*BaseAPI) LoadEndpoints ¶
LoadEndpoints loads the endpoints from a yaml file
type DigitalOceanAPI ¶
type DigitalOceanAPI struct {
BaseAPI
// contains filtered or unexported fields
}
DigitalOceanAPI is DO's api https://developers.digitalocean.com/documentation/v2
type GitAPI ¶
type GitAPI struct {
BaseAPI
}
GitAPI is for interacting with a Git Repo for cloning, fetching
type GithubAPI ¶
type GithubAPI struct {
BaseAPI
}
GithubAPI is github's api https://developer.github.com/v3/
type HubspotAPI ¶
type HubspotAPI struct {
BaseAPI
}
HubspotAPI is for hubspot https://developers.hubspot.com/docs/api/overview
type SurveyMonkeyAPI ¶
type SurveyMonkeyAPI struct {
BaseAPI
}
SurveyMonkeyAPI is for surveymonkey https://developer.surveymonkey.com/api/v3