postup

package module
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 10 Imported by: 2

README

Go-PostUp

Go Reference Go Report Card

A Go client for the Upland PostUp API.

How to use

The PostUp API uses basic authentication, this means that you only need to provide a PostUp username and password to the postup.NewPostUp method. It is safe to call the client from multiple Goroutines.

Example
package main

import (
    "context"
    "fmt"

    "github.com/SMGDevelopment/go-postup"
)

func main() {
    var (
        ctx = context.Background()

        username = "..."
        password = "..."

        client = postup.NewPostUp(username, password, nil)
    )

    lists, err := client.GetLists(ctx)
    if err != nil {
        panic(err)
    }

    fmt.Println(lists)
}

Implemented

Importing Data
  • Member imports through an import template
  • Return a single import status
  • Return import stats
Import Templates
  • Create an import template
  • Update an import template
  • Return import template configurations
Recipients
  • Create a recipient
  • Update existing recipient data
  • Return recipient data by email address
  • Return recipient data by external id
  • Return recipient data by recipient id
Recipient Privacy
  • Return recipient privacy data
  • Delete all recipient privacy data
  • Delete recipient from database
  • Delete recipient location data
  • Delete recipient contact data
  • Delete recipient demographics data
  • Delete recipient origin data
Lists
  • Create a new list
  • Update existing list
  • Return all lists
  • Return list by brand id
  • Return list counts
List Subscriptions
  • Subscribe recipient to a list
  • Unsubscribe recipient from a list
  • Return list subscriptions for a recipient
  • Return member subscriptions for a list
  • Check if recipient is subscribed to a list
Triggered Mailings
  • Create a send template
  • Update a send template
  • Send a triggered mailing
  • Return send template details
Scheduled Mailings
  • Create a campaign
  • Create scheduled mailing
  • Create A/B split mailing
  • Send test message from mailing draft
  • Schedule or update mailing draft
  • Check mailing status
  • Return brand information
Reports
  • Return all campaigns
  • Return campaign reports
  • Return report for a specific mailing
  • Return detailed click report for a mailing
  • Return mailings under a specific campaign
  • Recipient level reporting
  • Return recipients by engagement
Content
  • Create content folder in CMS
  • Create new content in CMS
  • Update existing content in CMS
  • Return content from a specific directory
Custom Fields
  • Create a custom field
  • Update a custom field
  • Return custom field data
Site Monitoring
  • Return site information
Data Fields
  • List property data fields
  • Recipient endpoint data fields
  • List subscription endpoint data fields
  • Import endpoint data fields
  • Import template endpoint data fields
  • Send template endpoint data fields
  • Template mailing endpoint data fields
  • Mailing endpoint data fields
  • Mailing report data fields
  • Link statistics data fields
  • Campaign statistics data fields
  • Content data fields
  • Content upload data fields
  • Custom field data fields

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRecipientNotFound = errors.New("recipient not found")
	ErrListNotFound      = errors.New("list not found")

	ErrRecipientMissingIdentifier = errors.New("recipient has no address, recipientId or externalId")
	ErrListMissingIdentifier      = errors.New("recipient has no listId or externalId")
)

Functions

This section is empty.

Types

type CreateRecipientRequest

type CreateRecipientRequest struct {
	ExternalID        string            `json:"externalId,omitempty"`
	Address           string            `json:"address,omitempty"`
	Channel           string            `json:"channel,omitempty"`
	Status            string            `json:"status,omitempty"`
	Comment           string            `json:"comment,omitempty"`
	Password          string            `json:"password,omitempty"`
	SourceDescription string            `json:"sourceDescription,omitempty"`
	Demographics      map[string]string `json:"-"`
}

func (*CreateRecipientRequest) MarshalJSON

func (crr *CreateRecipientRequest) MarshalJSON() ([]byte, error)

type DeleteRecipientResponse

type DeleteRecipientResponse struct {
	Message string `json:"message"`
	Status  string `json:"status"`
}

type List

type List struct {
	ID              int    `json:"listId"`
	Title           string `json:"title"`
	FriendlyTitle   string `json:"friendlyTitle"`
	Description     string `json:"description"`
	Populated       bool   `json:"populated"`
	PublicSignup    bool   `json:"publicSignup"`
	GlobalUnsub     bool   `json:"globalUnsub"`
	Query           string `json:"query"`
	CategoryID      int    `json:"categoryId"`
	BlockDomains    string `json:"blockDomains"`
	SeedListID      int    `json:"seedListId"`
	CreateTime      Time   `json:"createTime"`
	Creator         string `json:"creator"`
	ExternalID      string `json:"externalID"`
	Custom1         string `json:"custom1"`
	Channel         string `json:"channel"`
	CountRecips     bool   `json:"countRecips"`
	BrandIDs        []int  `json:"brandIds"`
	ListCount       int    `json:"listCount"`
	TestMessageList bool   `json:"testMessageList"`
}

type PostUp

type PostUp struct {
	// contains filtered or unexported fields
}

func NewPostUp

func NewPostUp(user, passwd string, c *http.Client) *PostUp

func (*PostUp) DeleteRecipientByAddress

func (pu *PostUp) DeleteRecipientByAddress(ctx context.Context, addr string) (*DeleteRecipientResponse, error)

func (*PostUp) GetListByExternalID

func (pu *PostUp) GetListByExternalID(ctx context.Context, id string) (*List, error)

func (*PostUp) GetListByListID

func (pu *PostUp) GetListByListID(ctx context.Context, id int) (*List, error)

func (*PostUp) GetListByTitle

func (pu *PostUp) GetListByTitle(ctx context.Context, title string) (*List, error)

func (*PostUp) GetLists

func (pu *PostUp) GetLists(ctx context.Context) ([]*List, error)

func (*PostUp) GetListsByBrandID

func (pu *PostUp) GetListsByBrandID(ctx context.Context, id int) ([]*List, error)

func (*PostUp) GetRecipientByAddress

func (pu *PostUp) GetRecipientByAddress(ctx context.Context, addr string) (*Recipient, error)

func (*PostUp) GetRecipientByExternalID

func (pu *PostUp) GetRecipientByExternalID(ctx context.Context, id string) (*Recipient, error)

func (*PostUp) GetRecipientByRecipientID

func (pu *PostUp) GetRecipientByRecipientID(ctx context.Context, id int) (*Recipient, error)

func (*PostUp) RecipientCreate

func (pu *PostUp) RecipientCreate(ctx context.Context, crr *CreateRecipientRequest) (*Recipient, error)

func (*PostUp) RecipientUpdate

func (pu *PostUp) RecipientUpdate(ctx context.Context, id int, urr *UpdateRecipientRequest) (*Recipient, error)

func (*PostUp) SubscribeRecipientToList

func (pu *PostUp) SubscribeRecipientToList(ctx context.Context, srr *SubscribeRecipientRequest) (*SubscribeRecipientResponse, error)

func (*PostUp) UnsubscribeRecipientFromList

func (pu *PostUp) UnsubscribeRecipientFromList(ctx context.Context, urr *UnsubscribeRecipientRequest) (*UnsubscribeRecipientResponse, error)

type Recipient

type Recipient struct {
	ID                int               `json:"recipientId"`
	ExternalID        string            `json:"externalId"`
	ImportID          int               `json:"importId"`
	Address           string            `json:"address"`
	Channel           string            `json:"channel"`
	Status            string            `json:"status"`
	Comment           string            `json:"comment"`
	Password          string            `json:"password"`
	SourceDescription string            `json:"sourceDescription"`
	SourceSignupDate  *Time             `json:"sourceSignupDate,omitempty"`
	SignupMethod      string            `json:"signupMethod"`
	DateJoined        *Time             `json:"dateJoined,omitempty"`
	Demographics      map[string]string `json:"-"`
}

func (*Recipient) MarshalJSON

func (r *Recipient) MarshalJSON() ([]byte, error)

func (*Recipient) UnmarshalJSON

func (r *Recipient) UnmarshalJSON(data []byte) error

type SubscribeRecipientRequest

type SubscribeRecipientRequest struct {
	Recipient *Recipient
	List      *List
	SourceID  string
	Confirmed bool
}

type SubscribeRecipientResponse

type SubscribeRecipientResponse struct {
	MailingID    interface{}        `json:"mailingId"`
	RecipientID  int                `json:"recipientId"`
	ListID       int                `json:"listId"`
	Status       SubscriptionStatus `json:"status"`
	ListStatus   string             `json:"listStatus"`
	GlobalStatus string             `json:"globalStatus"`
	DateUnsub    *Time              `json:"dateUnsub,omitempty"`
	DateJoined   *Time              `json:"dateJoined,omitempty"`
	SourceID     string             `json:"sourceId,omitempty"`
	Confirmed    bool               `json:"confirmed"`
}

type SubscriptionStatus

type SubscriptionStatus string
const SubscriptionStatusNormal SubscriptionStatus = "NORMAL"
const SubscriptionStatusUnsub SubscriptionStatus = "UNSUB"

type Time

type Time struct {
	// contains filtered or unexported fields
}

Time is a time struct that can be unmarshalled from PostUps time encoding.

func NewTime

func NewTime(t time.Time) Time

func (*Time) GetTime

func (t *Time) GetTime() time.Time

func (*Time) MarshalJSON

func (t *Time) MarshalJSON() ([]byte, error)

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

type UnsubscribeRecipientRequest

type UnsubscribeRecipientRequest struct {
	Recipient *Recipient
	List      *List
}

type UnsubscribeRecipientResponse

type UnsubscribeRecipientResponse struct {
	MailingID    interface{}        `json:"mailingId"`
	RecipientID  int                `json:"recipientId"`
	ListID       int                `json:"listId"`
	Status       SubscriptionStatus `json:"status"`
	ListStatus   string             `json:"listStatus"`
	GlobalStatus string             `json:"globalStatus"`
	DateUnsub    *Time              `json:"dateUnsub,omitempty"`
	DateJoined   *Time              `json:"dateJoined,omitempty"`
	SourceID     string             `json:"sourceId,omitempty"`
	Confirmed    bool               `json:"confirmed"`
}

type UpdateRecipientRequest

type UpdateRecipientRequest struct {
	Address           string            `json:"address"`
	ExternalID        string            `json:"externalId"`
	Channel           string            `json:"channel"`
	Status            string            `json:"status"`
	Comment           string            `json:"comment"`
	Password          string            `json:"password"`
	SourceDescription string            `json:"sourceDescription"`
	Demographics      map[string]string `json:"-"`
}

func (*UpdateRecipientRequest) MarshalJSON

func (urr *UpdateRecipientRequest) MarshalJSON() ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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