clients

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	// Create creates a new client in your account with basic contact information and no access to the application.
	//
	// Client billing options are set once the client is created.
	Create(details BasicDetails) (string, error)
	// Get returns the complete details for a client including their API key, access level, contact details and billing settings.
	Get(clientID string) (*ClientDetails, error)
	// SentCampaign returns a list of all sent campaigns for a client.
	SentCampaigns(clientID string) ([]*SentCampaign, error)
	// ScheduledCampaigns returns all currently scheduled campaigns for a client.
	ScheduledCampaigns(clientID string) ([]*ScheduledCampaign, error)
	// DraftCampaigns returns all draft campaigns belonging to a client.
	DraftCampaigns(clientID string) ([]*DraftCampaign, error)
	// Lists returns all the subscriber lists that belong to a client.
	Lists(clientID string) ([]*List, error)
	// ListsByEmailAddress returns all the subscriber lists across the client, to which an email address is subscribed.
	ListsByEmailAddress(clientID, emailAddress string) ([]*SubscriberList, error)
	// Segments returns a list of all list segments belonging to a particular client.
	Segments(clientID string) ([]*Segment, error)
	// SuppressionList returns a paged result representing the client’s suppression list.
	SuppressionList(clientID string, pageSize, page int, orderBy order.SuppressionListField, direction order.Direction) (*SuppressionList, error)
	// Suppress adds the email addresses provided to the client’s suppression list.
	Suppress(clientID string, emails ...string) error
	// UnSuppress removes the email address from a client’s suppression list.
	UnSuppress(clientID string, email string) error
	//Templates returns a list of the templates belonging to the client.
	Templates(clientID string) ([]*Template, error)
	// Update updates the basic account details for an existing client.
	//
	// If the client is paying itself, changing the country may have unexpected tax implications.
	// If you need to change a client’s country, do so through the UI by updating their payment details.
	Update(clientID string, details BasicDetails) error
	// SetPAYGBilling sets the client's PAYG billing rates.
	SetPAYGBilling(clientID string, rates PAYGRates) error
	// SetMonthlyBilling sets the client's monthly billing rates.
	SetMonthlyBilling(clientID string, rates MonthlyRates) error
	// TransferCredits Transfers credits from your account to a client, or transfer credits from a client to your account.
	TransferCredits(clientID string, request CreditTransferRequest) (*CreditTransferResult, error)
	// Delete deletes an existing client from your account.
	Delete(clientID string) error
	// AddPerson adds a new person to the client.
	AddPerson(clientID string, person Person) (string, error)
	// UpdatePerson updates an existing person.
	//
	// The emailAddress argument is the person's old email address.
	UpdatePerson(clientID string, emailAddress string, person Person) (string, error)
	// People returns a list of all people associated with the client excluding account administrators.
	People(clientID string) ([]*PersonDetails, error)
	// Person returns the details of a single person associated with the client.
	Person(clientID string, emailAddress string) (*PersonDetails, error)
	// DeletePerson changes the status of an active person to a deleted person.
	DeletePerson(clientID string, emailAddress string) error
	// SetPrimaryContact sets the primary contact for the client to be the person with the specified email address.
	SetPrimaryContact(clientID string, emailAddress string) (string, error)
	// PrimaryContact returns the email address of the person who is selected as the primary contact for this client.
	PrimaryContact(clientID string) (string, error)
}

API is an interface that wraps client related operations.

The API contains all the functionality you need to manage the clients in your account. From adding new clients, updating their billing settings, giving them access to their account, accessing their lists, templates and campaigns, etc.

type BasicDetails

type BasicDetails struct {
	// Company company name.
	Company string `json:"CompanyName"`
	// Country country.
	Country string
	// Timezone client timezone (eg. "(GMT+10:00) Canberra, Melbourne, Sydney").
	Timezone string `json:"TimeZone"`
}

BasicDetails represents a client's basic details.

type BillingDetails

type BillingDetails struct {
	// Mode billing mode.
	Mode BillingMode
	// Monthly is monthly billing details if the Client is on a monthly plan, nil otherwise.
	Monthly *MonthlyBillingDetails
	// PAYG is PAYG billing details of the Client is not on a monthly plan, nil otherwise.
	PAYG *PayAsYouGoBillingDetails
	// ClientPays is true if the client pays for itself.
	ClientPays bool
	// Currency the current billing currency.
	Currency string
}

BillingDetails represents Clients' billing details.

type BillingMode

type BillingMode int8

BillingMode billing mode.

const (
	// MonthlyBilling monthly billing.
	MonthlyBilling BillingMode = iota + 1
	// PAYGBilling Pay as you go billing.
	PAYGBilling
)

type Campaign

type Campaign struct {
	// ID campaign id.
	ID string
	// Name campaign name.
	Name string
	// From the sender.
	From mail.Address
	// ReplyTo reply to value.
	ReplyTo string
	// WebVersionURL web version URL.
	WebVersionURL string
	// WebVersionTextURL the plain text format of the web version URL.
	WebVersionTextURL string
	// Subject Campaign's subject.
	Subject string
}

Campaign represents a Campaign.

type ClientDetails

type ClientDetails struct {
	// APIKey Client API key
	APIKey string
	// ID client id
	ID string
	// Company company name
	Company string
	// Country country
	Country string
	// Timezone timezone
	Timezone string
	// Contact the contact details and access level of the Person within the client.
	//
	// If there are multiple Persons in this Client, or no Persons at all, this will be nil.
	Contact *ContactDetails
	// Billing is the Client's billing details.
	//
	// If the authenticated user is NOT authorised to see the billing details, the value will be nil.
	Billing *BillingDetails
}

ClientDetails represents Client details.

type ContactDetails

type ContactDetails struct {
	// Name contact's name.
	Name string
	// EmailAddress contact's email address.
	EmailAddress string
	// AccessLevel access level
	AccessLevel int
	// Username username.
	Username string
}

ContactDetails represents the contact details of a Person within a Client.

type CreditTransferRequest

type CreditTransferRequest struct {
	// Credits number of credits to transfer.
	Credits int
	// CanUseMyCreditsWhenTheyRunOut if true the client will be able to continue sending emails using your credits or payment details once they run out of credits.
	//
	// Otherwise the client will not be able to continue sending until you allocate more credits to them.
	CanUseMyCreditsWhenTheyRunOut bool
}

CreditTransferRequest credit transfer request.

type CreditTransferResult

type CreditTransferResult struct {
	// AccountCredits the source/target account's credits.
	AccountCredits int
	// ClientCredits the source/target client's credits.
	ClientCredits int
}

CreditTransferResult credit transfer result.

type DraftCampaign

type DraftCampaign struct {
	// Campaign Campaign's basic details.
	Campaign
	// DateCreated the time when the Campaign was created.
	DateCreated time.Time
}

DraftCampaign represents a draft Campaign.

type List

type List struct {
	// ID list id.
	ID string `json:"ListID"`
	// Name list name.
	Name string
}

List represents a list.

type MonthlyBillingDetails

type MonthlyBillingDetails struct {
	// Tier monthly billing tier.
	Tier string
	// Scheme the current scheme (eg. Unlimited, Basic, etc).
	Scheme string
	// Rate the current rate.
	Rate float64
	// MarkupPercentage the current markup percentage value.
	MarkupPercentage int64
	// Pending returns the plan pending for approval (if any).
	Pending *BillingDetails
}

MonthlyBillingDetails represents monthly billing details if the Client is on a monthly plan.

type MonthlyRates

type MonthlyRates struct {
	// Currency the billing currency.
	Currency string
	// ClientPays is true if the client pays for itself.
	ClientPays bool
	// MarkupPercentage markup percentage value.
	MarkupPercentage int64
	// Scheme the billing scheme (eg. Unlimited, Basic, etc).
	Scheme string `json:"MonthlyScheme"`
}

MonthlyRates represents monthly billing rates.

type PAYGRates

type PAYGRates struct {
	// Currency the billing currency.
	Currency string
	// CanPurchaseCredits is true if the Client is allowed to purchase credit.
	CanPurchaseCredits bool
	// ClientPays is true if the client pays for itself.
	ClientPays bool
	// MarkupPercentage markup percentage value.
	MarkupPercentage int64
	// MarkupOnDelivery markup on delivery.
	MarkupOnDelivery float64
	// MarkupPerRecipient markup per recipient.
	MarkupPerRecipient float64
	// MarkupOnDesignSpamTest markup value on design and spam testing.
	MarkupOnDesignSpamTest float64
}

PAYGRates represents PAYG billing rates.

type PayAsYouGoBillingDetails

type PayAsYouGoBillingDetails struct {
	// CanPurchaseCredits is true if the Client is allowed to purchase credit.
	CanPurchaseCredits bool
	// Credits the number of Campaign Monitor credits.
	Credits int64
	// MarkupOnDesignSpamTest the current markup value on design and spam testing.
	MarkupOnDesignSpamTest float64
	// BaseRatePerRecipient the current rate per recipient.
	BaseRatePerRecipient float64
	// MarkupPerRecipient the current value of markup per recipient.
	MarkupPerRecipient float64
	// MarkupOnDelivery the current value of markup on delivery.
	MarkupOnDelivery float64
	// BaseDeliveryRate the current value of base delivery rate.
	BaseDeliveryRate float64
	// BaseDesignSpamTestRate the base rate for design & spam tests.
	BaseDesignSpamTestRate float64
}

PayAsYouGoBillingDetails represents PAYG billing details if the client is on pay-as-you-go.

type Person

type Person struct {
	PersonBasicDetails
	// Password the person's password.
	Password string
}

Person represents a person.

type PersonBasicDetails

type PersonBasicDetails struct {
	// EmailAddress the email address.
	EmailAddress string
	// Name the name.
	Name string
	// AccessLevel access level.
	AccessLevel int
}

PersonBasicDetails represents a person's basic details

type PersonDetails

type PersonDetails struct {
	PersonBasicDetails
	// Status the person's status (eg. Active)
	Status string
}

PersonDetails represents a person's details.

type ScheduledCampaign

type ScheduledCampaign struct {
	// Campaign Campaign's basic details.
	Campaign
	// DateCreated the time when the Campaign was created.
	DateCreated time.Time
	// DateScheduled the time when the Campaign will be sent.
	DateScheduled time.Time
	// Timezone schedule timezone.
	Timezone string
}

ScheduledCampaign represents a scheduled Campaign.

type Segment

type Segment struct {
	// ID segment id.
	ID string `json:"SegmentID"`
	// Title segment title.
	Title string
	// ListID the ID of the list the segment belongs to.
	ListID string
}

Segment represents a list segment.

type SentCampaign

type SentCampaign struct {
	// Campaign Campaign's basic details.
	Campaign
	// SentDate the time when the Campaign was sent.
	SentDate time.Time
	// Recipients number of recipients the Campaign was sent to.
	Recipients int64
}

SentCampaign represents a sent Campaign.

type Subscriber

type Subscriber struct {
	// State the subscription state.
	State string
	// DateAdded the date the subscriber has subscribed in the client’s timezone.
	DateAdded time.Time
}

Subscriber represents a subscriber.

type SubscriberList

type SubscriberList struct {
	// List the list the subscriber belongs to.
	List
	// Subscriber the subscriber details.
	Subscriber Subscriber
}

SubscriberList represents a subscriber list

type SuppressionDetails

type SuppressionDetails struct {
	// Reason reason for suppression.
	Reason string
	// EmailAddress the suppressed email address.
	EmailAddress string
	// Date the date when the email address has been added to the suppression list.
	Date time.Time
	// State the state of the suppressed email address.
	State string
}

SuppressionDetails represents a suppression list item.

type SuppressionList

type SuppressionList struct {
	// Entries the list of suppressed email addresses.
	Entries []*SuppressionDetails
	// OrderedBy the field by which the result set was ordered (email/date).
	OrderedBy order.SuppressionListField
	// OrderDirection the order in which the results were sorted.
	OrderDirection order.Direction
	// PageNumber the current page number.
	PageNumber int
	// PageSize the page size.
	PageSize int
	// RecordsOnThisPage the number of records on this page.
	RecordsOnThisPage int
	// TotalNumberOfRecords the total number of records.
	TotalNumberOfRecords int
	// NumberOfPages the total number of pages.
	NumberOfPages int
}

SuppressionList represents client suppression list.

type Template

type Template struct {
	// ID template id.
	ID string `json:"TemplateID"`
	// Name template name.
	Name string
	// PreviewURL the HTML preview URL of the template.
	PreviewURL string
	// ScreenshotURL the template's screenshot URL.
	ScreenshotURL string
}

Template represents a template.

Jump to

Keyboard shortcuts

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