marketoclient

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEnqueueLimit = errors.New("enqueue limit reached")
	ErrZeroRecords  = errors.New("no records found")
	ErrCannotCancel = errors.New("cannot cancel export, since it is already in completed state")
)

Functions

func GetDataMap

func GetDataMap(keys []string, values []string) map[string]interface{}

creates map from given keys and values.

func WithRetry

func WithRetry(ctx context.Context, r RetryFunc) error

retries supplied function using retry backoff strategy.

Types

type Client

type Client struct {
	minimarketo.Client
}

custom wrapper client for minimarketo client

func NewClient

func NewClient(config minimarketo.ClientConfig) (Client, error)

returns new marketo client with new token.

func (Client) CancelExportLeads

func (c Client) CancelExportLeads(exportID string) error

cancels export job.

func (Client) CreateExportLeads

func (c Client) CreateExportLeads(fields []string, startDate string, endDate string) (string, error)

creates New exportLeads job for given time range with requested fields. Maximum time range will be 31 days. return export id and error.

func (Client) EnqueueExportLeads

func (c Client) EnqueueExportLeads(exportID string) (string, error)

enqueues export job.

func (Client) FileExportLeads

func (c Client) FileExportLeads(ctx context.Context, endpoint string, exportID string) (*[]byte, error)

returns export job result in CSV format.

func (Client) FilterLeads

func (c Client) FilterLeads(fileterType string, filterValues []int, fields []string, nextPageToken string) (*minimarketo.Response, error)

returns filterd leads from marketo rest api

func (Client) GetAllFolders

func (c Client) GetAllFolders(maxDepth int) ([]FolderResult, error)

returns all folders from marketo.

func (Client) GetAuthToken

func (c Client) GetAuthToken() (string, error)

returns token for marketo rest api.

func (Client) GetDeletedLeads

func (c Client) GetDeletedLeads(nextPageToken string) (*json.RawMessage, error)

returns deleted leads from marketo rest api.

func (Client) GetLeadByID

func (c Client) GetLeadByID(id int, fields []string) (*json.RawMessage, error)

returns Lead record from marketo rest api.

func (Client) GetLeadChanges

func (c Client) GetLeadChanges(nextPageToken string, fields []string) (*minimarketo.Response, error)

returns updated leads from marketo rest api.

func (Client) GetNextPageToken

func (c Client) GetNextPageToken(sinceTime time.Time) (string, error)

returnss nextPageToken from marketo rest api.

func (Client) StatusOfExportLeads

func (c Client) StatusOfExportLeads(exportID string) (StatusOfExportResult, error)

returns current status of export job with error.

type CreateExportResult

type CreateExportResult struct {
	ExportID  string    `json:"exportId"`
	Format    string    `json:"format"`
	Status    string    `json:"status"`
	CreatedAt time.Time `json:"createdAt"`
}

type FolderResult

type FolderResult struct {
	Name        string      `json:"name"`
	Description string      `json:"description"`
	CreatedAt   string      `json:"createdAt"`
	UpdatedAt   string      `json:"updatedAt"`
	URL         interface{} `json:"url"`
	FolderID    struct {
		ID   int    `json:"id"`
		Type string `json:"type"`
	} `json:"folderId"`
}

type RetryFunc

type RetryFunc func() (bool, error)

retries the function until it returns false or an error

type StatusOfExportResult

type StatusOfExportResult struct {
	ExportID        string    `json:"exportId"`
	Format          string    `json:"format"`
	Status          string    `json:"status"`
	CreatedAt       time.Time `json:"createdAt"`
	QueuedAt        time.Time `json:"queuedAt"`
	StartedAt       time.Time `json:"startedAt"`
	FinishedAt      time.Time `json:"finishedAt"`
	NumberOfRecords int       `json:"numberOfRecords"`
	FileSize        int       `json:"fileSize"`
	FileChecksum    string    `json:"fileChecksum"`
}

Jump to

Keyboard shortcuts

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