getresponse

package
Version: v0.0.0-...-3cf7a8a Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorAPI = "ERROR_API"

	// described @ https://apidocs.getresponse.com/v3/errors
	ErrorInternalError           = 1
	ErrorValidationError         = 1000
	ErrorRelatedResourceNotFound = 1001
	ErrorForbidden               = 1002
	ErrorInvalidParameterFormat  = 1003
	ErrorInvalidHash             = 1004
	ErrorMissingParameter        = 1005
	ErrorInvalidParameterType    = 1006
	ErrorInvalidParameterLength  = 1007
	ErrorResourceAlreadyExists   = 1008
	ErrorResourceInUse           = 1009
	ErrorExternalError           = 1010
	ErrorMessageAlreadySending   = 1011
	ErrorMessageParsing          = 1012
	ErrorResourceNotFound        = 1013
	ErrorAuthenticationFailure   = 1014
	ErrorRequestQuotaReached     = 1015
	ErrorTemporarilyBlocked      = 1016
	ErrorPermanentlyBlocked      = 1017
	ErrorIPBlocked               = 1018
	ErrorInvalidRequestHeaders   = 1021
)

Error codes

Variables

This section is empty.

Functions

This section is empty.

Types

type Campaign

type Campaign struct {
	CampaignID string  `json:"campaignId"` // required
	Name       string  `json:"name,omitempty"`
	Href       *string `json:"href,omitempty"`
}

Campaign holds the representation of a campaign

type Client

type Client interface {
	// CreateContact - https://apidocs.getresponse.com/v3/resources/contacts#contacts.create
	CreateContact(ctx context.Context, email string, name *string, dayOfCycle *int32, campaignID string, customFields []CustomField, ipAddress *string) glitch.DataError

	// GetContacts - https://apidocs.getresponse.com/v3/resources/contacts#contacts.get.all
	GetContacts(ctx context.Context, queryHash map[string]string, fields []string, sortHash map[string]string, page int32, perPage int32, additionalFlags *string) ([]Contact, glitch.DataError)

	// Get Contact - https://apidocs.getresponse.com/v3/resources/contacts#contacts.get
	GetContact(ctx context.Context, ID string, fields []string) (Contact, glitch.DataError)

	// UpdateContact - https://apidocs.getresponse.com/v3/resources/contacts#contacts.update
	UpdateContact(ctx context.Context, ID string, newData Contact) (Contact, glitch.DataError)

	// UpdateContactCustomFields - https://apidocs.getresponse.com/v3/resources/contacts#contacts.upsert.custom-fields
	UpdateContactCustomFields(ctx context.Context, ID string, customFields []CustomField) (Contact, glitch.DataError)

	// DeleteContact - https://apidocs.getresponse.com/v3/resources/contacts#contacts.delete
	DeleteContact(ctx context.Context, ID string, messageID string, ipAddress string) glitch.DataError
}

Client can make requests to the GR api

func NewClient

func NewClient(apiKey string, timeout time.Duration) Client

NewClient returns a new pushy client

type Contact

type Contact struct {
	ContactID         *string       `json:"contactId,omitempty"`
	Href              *string       `json:"href,omitempty"`
	Name              *string       `json:"name,omitempty"`
	Email             *string       `json:"email,omitempty"`
	Note              *string       `json:"note,omitempty"`
	DayOfCycle        *int32        `json:"dayOfCycle,omitempty"`
	Origin            *string       `json:"origin,omitempty"`
	CreatedOn         *string       `json:"createdOn,omitempty"` // there doesn't seem to be any docs on what timezone these times are in so I'm leaving them as strings (timeZone below is the user's timezone)
	ChangedOn         *string       `json:"changedOn,omitempty"`
	Campaign          *Campaign     `json:"campaign,omitempty"`
	Geolocation       *Geolocation  `json:"geolocation,omitempty"`
	Tags              []Tag         `json:"tags,omitempty"`
	CustomFieldValues []CustomField `json:"customFieldValues,omitempty"`
	TimeZone          *string       `json:"timeZone,omitempty"`
	IPAddress         *string       `json:"ipAddress,omitempty"`
	Activities        *string       `json:"activities,omitempty"`
	Scoring           *int64        `json:"scoring,omitempty"`
}

Contact represents a GR contact

type CustomField

type CustomField struct {
	CustomFieldID string   `json:"customFieldId"`
	Value         []string `json:"value"`
	Href          *string  `json:"href,omitempty"`
}

CustomField holds key value sets

type ErrorResponse

type ErrorResponse struct {
	HTTPStatus      int      `json:"httpStatus"`
	ErrorCode       int      `json:"code"`
	CodeDescription string   `json:"codeDescription"`
	Message         string   `json:"message"`
	MoreInfo        string   `json:"moreInfo"`
	Context         []string `json:"context"`
	UUID            string   `json:"uuid"`
}
ErrorResponse holds an API error

example error: {

"httpStatus": 400,
"code": 1000,
"codeDescription": "General error of validation process, more details should be in context section",
"message": "Custom field invalid",
"moreInfo": "https://apidocs.getresponse.com/en/v3/errors/1000",
"context": [
  "Empty value. ID: y8jnp"
],
"uuid": "5a42dd48-7f57-4919-9b32-391e594ce375"

}

type Geolocation

type Geolocation struct {
	Latitude      *string `json:"latitude,omitempty"`
	Longitude     *string `json:"longitude,omitempty"`
	ContinentCode *string `json:"continentCode,omitempty"`
	CountryCode   *string `json:"countryCode,omitempty"`
	Region        *string `json:"region,omitempty"`
	PostalCode    *string `json:"postalCode,omitempty"`
	DmaCode       *string `json:"dmaCode,omitempty"`
	City          *string `json:"city,omitempty"`
}

Geolocation holds geo data on contacts

type Tag

type Tag struct {
	TagID string `json:"tagId"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL