Documentation
¶
Index ¶
Constants ¶
const (
// DefaultTimeout is http client timeout and 60 seconds
DefaultTimeout = 60
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthToken ¶
type AuthToken struct {
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
ExpiresIn int `json:"expires_in"`
Scope string `json:"scope"`
}
AuthToken holds data from Auth request
type Client ¶
type Client interface {
GetTokenInfo() TokenInfo
RefreshToken() (AuthToken, error)
Get(string) (*Response, error)
Post(string, []byte) (*Response, error)
Delete(string, []byte) (*Response, error)
// contains filtered or unexported methods
}
Client Marketo http client
func NewClient ¶
func NewClient(config ClientConfig) (Client, error)
NewClient returns a new Marketo Client
type ClientConfig ¶
type ClientConfig struct {
// ID: Marketo client ID
ID string
// Secret: Marketo client secret
Secret string
// Endpoint: https://xxx-xxx-xxx.mktorest.com
Endpoint string
// Timeout, optional: default http timeout is 60 seconds
Timeout uint
// Debug, optional: a flag to show logging output
Debug bool
}
ClientConfig stores client configuration
type LeadResult ¶
type LeadResult struct {
ID int `json:"id"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Email string `json:"email"`
Created string `json:"createdAt"`
Updated string `json:"updatedAt"`
}
LeadResult default result struct
type RecordResult ¶
type RecordResult struct {
ID int `json:"id"`
Status string `json:"status"`
Reasons []struct {
Code string `json:"code"`
Message string `json:"message"`
} `json:"reasons,omitempty"`
}
RecordResult holds Marketo record-level result
type Response ¶
type Response struct {
RequestID string `json:"requestId"`
Success bool `json:"success"`
NextPageToken string `json:"nextPageToken,omitempty"`
MoreResult bool `json:"moreResult,omitempty"`
Errors []struct {
Code string `json:"code"`
Message string `json:"message"`
} `json:"errors,omitempty"`
Result json.RawMessage `json:"result,omitempty"`
Warnings []struct {
Code string `json:"code"`
Message string `json:"message"`
} `json:"warning,omitempty"`
}
Response is the common Marketo response which covers most of the Marketo response format