listmonk

package module
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: MIT Imports: 11 Imported by: 0

README

go-listmonk

A Golang SDK for listmonkAPI.

All the REST APIs listed in listmonk API document are implemented.

For best compatibility, please use Go >= 1.19.

Make sure you have read listmonk API document before continuing.

Installation
go get github.com/Ezexchange-API/go-listmonk
Importing
import (
    listmonk "github.com/Ezexchange-API/go-listmonk"
)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAPIError

func IsAPIError(e error) bool

IsAPIError check if e is an API error

func WithHeader

func WithHeader(key, value string, replace bool) requestOption

WithHeader set or add a header value to the request

func WithHeaders

func WithHeaders(header http.Header) requestOption

WithHeaders set or replace the headers of the request

Types

type APIError

type APIError struct {
	Code    int
	Message string `json:"message"`
}

func (APIError) Error

func (e APIError) Error() string

Error return error code and message

type BlocklistsQuerySubscriberService

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

func (*BlocklistsQuerySubscriberService) Do

func (s *BlocklistsQuerySubscriberService) Do(ctx context.Context, opts ...requestOption) (*bool, error)

func (*BlocklistsQuerySubscriberService) Query

type BlocklistsSubscriberService

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

func (*BlocklistsSubscriberService) Do

func (s *BlocklistsSubscriberService) Do(ctx context.Context, opts ...requestOption) (*bool, error)

func (*BlocklistsSubscriberService) Id

type Campaign

type Campaign struct {
	Id          uint           `json:"id"`
	CreatedAt   time.Time      `json:"created_at"`
	UpdatedAt   time.Time      `json:"updated_at"`
	CampaignId  uint           `json:"CampaignID"`
	View        uint           `json:"view"`
	Clicks      uint           `json:"clicks"`
	Lists       []CampaignList `json:"lists"`
	StartedAt   time.Time      `json:"started_at"`
	ToSend      uint           `json:"to_send"`
	Sent        uint           `json:"sent"`
	Uuid        string         `json:"uuid"`
	Name        string         `json:"name"`
	Type        string         `json:"type"`
	Subject     string         `json:"subject"`
	FromEmail   string         `json:"from_email"`
	Body        string         `json:"body"`
	SendAt      time.Time      `json:"send_at"`
	Status      string         `json:"status"`
	ContentType string         `json:"content_type"`
	Tags        []string       `json:"tags"`
	TemplateId  uint           `json:"template_id"`
	Messenger   string         `json:"messenger"`
}

type CampaignList added in v1.0.2

type CampaignList struct {
	Id   uint   `json:"id"`
	Name string `json:"name"`
}

type Client

type Client struct {
	ClientInterface
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseURL string, username, password *string) *Client

func NewClientWithCustomHTTPClient

func NewClientWithCustomHTTPClient(baseURL string, username, password *string, httpClient *http.Client) *Client

func (*Client) NewBlocklistsQuerySubscriberService

func (c *Client) NewBlocklistsQuerySubscriberService() *BlocklistsQuerySubscriberService

func (*Client) NewBlocklistsSubscriberService

func (c *Client) NewBlocklistsSubscriberService() *BlocklistsSubscriberService

func (*Client) NewCreateCampaignService

func (c *Client) NewCreateCampaignService() *CreateCampaignService

func (*Client) NewCreateListService

func (c *Client) NewCreateListService() *CreateListService

func (*Client) NewCreateMediaService added in v1.0.1

func (c *Client) NewCreateMediaService() *CreateMediaService

func (*Client) NewCreateSubscriberService

func (c *Client) NewCreateSubscriberService() *CreateSubscriberService

func (*Client) NewDeleteCampaignService

func (c *Client) NewDeleteCampaignService() *DeleteCampaignService

func (*Client) NewDeleteListService

func (c *Client) NewDeleteListService() *DeleteListService

func (*Client) NewDeleteMediaService added in v1.0.1

func (c *Client) NewDeleteMediaService() *DeleteMediaService

func (*Client) NewDeleteSubscriberService

func (c *Client) NewDeleteSubscriberService() *DeleteSubscriberService

func (*Client) NewDeleteSubscribersQueryService

func (c *Client) NewDeleteSubscribersQueryService() *DeleteSubscribersQueryService

func (*Client) NewDeleteSubscribersService

func (c *Client) NewDeleteSubscribersService() *DeleteSubscribersService

func (*Client) NewDeleteTemplateService added in v1.0.1

func (c *Client) NewDeleteTemplateService() *DeleteTemplateService

func (*Client) NewGetCampaignService

func (c *Client) NewGetCampaignService() *GetCampaignService

func (*Client) NewGetCampaignsService

func (c *Client) NewGetCampaignsService() *GetCampaignsService

func (*Client) NewGetListService

func (c *Client) NewGetListService() *GetListService

func (*Client) NewGetListsService

func (c *Client) NewGetListsService() *GetListsService

func (*Client) NewGetMediaService added in v1.0.1

func (c *Client) NewGetMediaService() *GetMediaService

func (*Client) NewGetSubscriberService

func (c *Client) NewGetSubscriberService() *GetSubscriberService

func (*Client) NewGetSubscribersService

func (c *Client) NewGetSubscribersService() *GetSubscribersService

func (*Client) NewGetTemplatePreviewService added in v1.0.1

func (c *Client) NewGetTemplatePreviewService() *GetTemplatePreviewService

func (*Client) NewGetTemplateService added in v1.0.1

func (c *Client) NewGetTemplateService() *GetTemplateService

func (*Client) NewGetTemplatesService added in v1.0.1

func (c *Client) NewGetTemplatesService() *GetTemplatesService

func (*Client) NewPostTransactionalService added in v1.0.1

func (c *Client) NewPostTransactionalService() *PostTransactionalService

func (*Client) NewUpdateCampaignStatusService

func (c *Client) NewUpdateCampaignStatusService() *UpdateCampaignStatusService

func (*Client) NewUpdateListService

func (c *Client) NewUpdateListService() *UpdateListService

func (*Client) NewUpdateSubscriberService

func (c *Client) NewUpdateSubscriberService() *UpdateSubscriberService

func (*Client) NewUpdateSubscribersListsService

func (c *Client) NewUpdateSubscribersListsService() *UpdateSubscribersListsService

func (*Client) NewUpdateTemplateAsDefaultService added in v1.0.1

func (c *Client) NewUpdateTemplateAsDefaultService() *UpdateTemplateAsDefaultService

type ClientInterface

type ClientInterface interface {
	// contains filtered or unexported methods
}

type CreateCampaignService

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

func (*CreateCampaignService) AltBody

func (s *CreateCampaignService) AltBody(altBody string) *CreateCampaignService

func (*CreateCampaignService) Body

func (*CreateCampaignService) ContentType

func (s *CreateCampaignService) ContentType(contentType string) *CreateCampaignService

func (*CreateCampaignService) Do

func (s *CreateCampaignService) Do(ctx context.Context, opts ...requestOption) (*Campaign, error)

func (*CreateCampaignService) FromEmail

func (s *CreateCampaignService) FromEmail(fromEmail string) *CreateCampaignService

func (*CreateCampaignService) Lists

func (*CreateCampaignService) Messenger

func (s *CreateCampaignService) Messenger(messenger string) *CreateCampaignService

func (*CreateCampaignService) Name

func (*CreateCampaignService) SendAt

func (*CreateCampaignService) Subject

func (s *CreateCampaignService) Subject(subject string) *CreateCampaignService

func (*CreateCampaignService) Tags

func (*CreateCampaignService) TemplateId

func (s *CreateCampaignService) TemplateId(templateId uint) *CreateCampaignService

func (*CreateCampaignService) Type

type CreateListService

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

func (*CreateListService) Do

func (s *CreateListService) Do(ctx context.Context, opts ...requestOption) (*List, error)

func (*CreateListService) Name

func (*CreateListService) Optin

func (s *CreateListService) Optin(optin string) *CreateListService

func (*CreateListService) Tags

func (s *CreateListService) Tags(tags []string) *CreateListService

func (*CreateListService) Type

func (s *CreateListService) Type(type_ string) *CreateListService

type CreateMediaService

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

func (*CreateMediaService) Do

func (s *CreateMediaService) Do(ctx context.Context, opts ...requestOption) (*Media, error)

func (*CreateMediaService) File

func (s *CreateMediaService) File(file []byte) *CreateMediaService

type CreateSubscriberService

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

func (*CreateSubscriberService) Attributes

func (s *CreateSubscriberService) Attributes(attributes map[string]interface{}) *CreateSubscriberService

func (*CreateSubscriberService) Do

func (s *CreateSubscriberService) Do(ctx context.Context, opts ...requestOption) (*Subscriber, error)

func (*CreateSubscriberService) Email

func (*CreateSubscriberService) ListIds

func (s *CreateSubscriberService) ListIds(listIds []uint) *CreateSubscriberService

func (*CreateSubscriberService) Name

func (*CreateSubscriberService) PreconfirmSubscriptions

func (s *CreateSubscriberService) PreconfirmSubscriptions(preconfirmSubscriptions bool) *CreateSubscriberService

func (*CreateSubscriberService) Status

type DeleteCampaignService

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

func (*DeleteCampaignService) Do

func (s *DeleteCampaignService) Do(ctx context.Context, opts ...requestOption) error

func (*DeleteCampaignService) Id

type DeleteImportService

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

func (*DeleteImportService) Do

func (s *DeleteImportService) Do(ctx context.Context, opts ...requestOption) error

type DeleteListService

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

func (*DeleteListService) Do

func (s *DeleteListService) Do(ctx context.Context, opts ...requestOption) error

func (*DeleteListService) Id

type DeleteMediaService

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

func (*DeleteMediaService) Do

func (s *DeleteMediaService) Do(ctx context.Context, opts ...requestOption) error

func (*DeleteMediaService) Id

type DeleteSubscriberService

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

func (*DeleteSubscriberService) Do

func (s *DeleteSubscriberService) Do(ctx context.Context, opts ...requestOption) (*bool, error)

func (*DeleteSubscriberService) Id

type DeleteSubscribersQueryService

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

func (*DeleteSubscribersQueryService) Do

func (s *DeleteSubscribersQueryService) Do(ctx context.Context, opts ...requestOption) (*bool, error)

func (*DeleteSubscribersQueryService) Query

type DeleteSubscribersService

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

func (*DeleteSubscribersService) Do

func (s *DeleteSubscribersService) Do(ctx context.Context, opts ...requestOption) (*bool, error)

func (*DeleteSubscribersService) Ids

type DeleteTemplateService

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

func (*DeleteTemplateService) Do

func (s *DeleteTemplateService) Do(ctx context.Context, opts ...requestOption) error

func (*DeleteTemplateService) Id

type GetCampaignPreviewService

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

func (*GetCampaignPreviewService) Do

func (s *GetCampaignPreviewService) Do(ctx context.Context, opts ...requestOption) ([]byte, error)

func (*GetCampaignPreviewService) Id

type GetCampaignService

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

func (*GetCampaignService) Do

func (s *GetCampaignService) Do(ctx context.Context, opts ...requestOption) (*Campaign, error)

func (*GetCampaignService) Id

type GetCampaignsService

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

func (*GetCampaignsService) Do

func (s *GetCampaignsService) Do(ctx context.Context, opts ...requestOption) ([]*Campaign, error)

func (*GetCampaignsService) Order

func (*GetCampaignsService) OrderBy

func (s *GetCampaignsService) OrderBy(orderBy string) *GetCampaignsService

func (*GetCampaignsService) Page

func (*GetCampaignsService) PerPage

func (s *GetCampaignsService) PerPage(perPage string) *GetCampaignsService

func (*GetCampaignsService) Query

type GetImportLogsService

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

func (*GetImportLogsService) Do

func (s *GetImportLogsService) Do(ctx context.Context, opts ...requestOption) (*string, error)

type GetImportStatusService

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

func (*GetImportStatusService) Do

func (s *GetImportStatusService) Do(ctx context.Context, opts ...requestOption) (*ImportStatus, error)

type GetListService

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

func (*GetListService) Do

func (s *GetListService) Do(ctx context.Context, opts ...requestOption) (*List, error)

func (*GetListService) Id

func (s *GetListService) Id(id uint) *GetListService

type GetListsService

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

func (*GetListsService) Do

func (s *GetListsService) Do(ctx context.Context, opts ...requestOption) ([]*List, error)

func (*GetListsService) Order

func (s *GetListsService) Order(order string) *GetListsService

func (*GetListsService) OrderBy

func (s *GetListsService) OrderBy(orderBy string) *GetListsService

func (*GetListsService) Page

func (s *GetListsService) Page(page uint) *GetListsService

func (*GetListsService) PerPage

func (s *GetListsService) PerPage(perPage string) *GetListsService

func (*GetListsService) Query

func (s *GetListsService) Query(query string) *GetListsService

type GetMediaService

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

func (*GetMediaService) Do

func (s *GetMediaService) Do(ctx context.Context, opts ...requestOption) ([]*Media, error)

type GetSubscriberService

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

func (*GetSubscriberService) Do

func (s *GetSubscriberService) Do(ctx context.Context, opts ...requestOption) (*Subscriber, error)

func (*GetSubscriberService) Id

type GetSubscribersService

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

func (*GetSubscribersService) Do

func (s *GetSubscribersService) Do(ctx context.Context, opts ...requestOption) ([]*Subscriber, error)

func (*GetSubscribersService) ListIds

func (s *GetSubscribersService) ListIds(listIds []uint) *GetSubscribersService

func (*GetSubscribersService) Page

func (*GetSubscribersService) PerPage

func (s *GetSubscribersService) PerPage(perPage string) *GetSubscribersService

func (*GetSubscribersService) Query

type GetTemplatePreviewService

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

func (*GetTemplatePreviewService) Do

func (s *GetTemplatePreviewService) Do(ctx context.Context, opts ...requestOption) (string, error)

func (*GetTemplatePreviewService) Id

type GetTemplateService

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

func (*GetTemplateService) Do

func (s *GetTemplateService) Do(ctx context.Context, opts ...requestOption) (*Template, error)

func (*GetTemplateService) Id

type GetTemplatesService

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

func (*GetTemplatesService) Do

func (s *GetTemplatesService) Do(ctx context.Context, opts ...requestOption) ([]*Template, error)

type ImportStatus

type ImportStatus struct {
	Name     string `json:"name"`
	Total    uint   `json:"total"`
	Imported uint   `json:"imported"`
	Status   string `json:"status"`
}

type ImportSubscribersService

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

func (*ImportSubscribersService) Do

func (s *ImportSubscribersService) Do(ctx context.Context, opts ...requestOption) error

func (*ImportSubscribersService) File

func (*ImportSubscribersService) Params

func (s *ImportSubscribersService) Params(params map[string]interface{}) *ImportSubscribersService

type List

type List struct {
	Id               uint      `json:"id"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
	Uuid             string    `json:"uuid"`
	Name             string    `json:"name"`
	Type             string    `json:"type"`
	Optin            string    `json:"optin"`
	Tags             []string  `json:"tags"`
	SubscribersCount uint      `json:"subscribers_count"`
}

type Media

type Media struct {
	Id        uint      `json:"id"`
	CreatedAt time.Time `json:"created_at"`
	Uuid      string    `json:"uuid"`
	Filename  string    `json:"filename"`
	ThumbUrl  string    `json:"thumb_url"`
	Uri       string    `json:"uri"`
}

type PostTransactionalService

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

func (*PostTransactionalService) ContentType

func (s *PostTransactionalService) ContentType(content_type string) *PostTransactionalService

func (*PostTransactionalService) Data

func (*PostTransactionalService) Do

func (s *PostTransactionalService) Do(ctx context.Context, opts ...requestOption) error

func (*PostTransactionalService) FromEmail

func (*PostTransactionalService) Headers

func (*PostTransactionalService) Messenger

func (s *PostTransactionalService) Messenger(messenger string) *PostTransactionalService

func (*PostTransactionalService) SubscriberEmail

func (s *PostTransactionalService) SubscriberEmail(email string) *PostTransactionalService

func (*PostTransactionalService) SubscriberEmails

func (s *PostTransactionalService) SubscriberEmails(emails []string) *PostTransactionalService

func (*PostTransactionalService) SubscriberId

func (*PostTransactionalService) SubscriberIds

func (s *PostTransactionalService) SubscriberIds(ids []uint) *PostTransactionalService

func (*PostTransactionalService) TemplateId

type Subscriber

type Subscriber struct {
	Id         uint                   `json:"id"`
	CreatedAt  time.Time              `json:"created_at"`
	UpdatedAt  time.Time              `json:"updated_at"`
	Uuid       string                 `json:"uuid"`
	Email      string                 `json:"email"`
	Name       string                 `json:"name"`
	Status     string                 `json:"status"`
	Lists      []SubscriberList       `json:"lists"`
	Attributes map[string]interface{} `json:"attribs"`
}

type SubscriberList added in v1.0.2

type SubscriberList struct {
	Id                 uint      `json:"id"`
	CreatedAt          time.Time `json:"created_at"`
	UpdatedAt          time.Time `json:"updated_at"`
	Uuid               string    `json:"uuid"`
	Name               string    `json:"name"`
	Type               string    `json:"type"`
	Tags               []string  `json:"tags"`
	SubscriptionStatus string    `json:"subscription_status"`
}

type Template

type Template struct {
	Id        uint      `json:"id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Name      string    `json:"name"`
	Body      string    `json:"body"`
	Type      string    `json:"type"`
	IsDefault bool      `json:"is_default"`
}

type UpdateCampaignStatusService

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

func (*UpdateCampaignStatusService) Do

func (s *UpdateCampaignStatusService) Do(ctx context.Context, opts ...requestOption) (*Campaign, error)

func (*UpdateCampaignStatusService) Id

func (*UpdateCampaignStatusService) Status

type UpdateListService

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

func (*UpdateListService) Do

func (s *UpdateListService) Do(ctx context.Context, opts ...requestOption) (*List, error)

func (*UpdateListService) Id

func (*UpdateListService) Optin

func (s *UpdateListService) Optin(optin string) *UpdateListService

func (*UpdateListService) Tags

func (s *UpdateListService) Tags(tags []string) *UpdateListService

func (*UpdateListService) Type

func (s *UpdateListService) Type(type_ string) *UpdateListService

type UpdateSubscriberService

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

func (*UpdateSubscriberService) Attributes

func (s *UpdateSubscriberService) Attributes(attributes map[string]interface{}) *UpdateSubscriberService

func (*UpdateSubscriberService) Do

func (s *UpdateSubscriberService) Do(ctx context.Context, opts ...requestOption) (*Subscriber, error)

func (*UpdateSubscriberService) Email

func (*UpdateSubscriberService) Id

func (*UpdateSubscriberService) ListIds

func (s *UpdateSubscriberService) ListIds(listIds []uint) *UpdateSubscriberService

func (*UpdateSubscriberService) Name

func (*UpdateSubscriberService) PreconfirmSubscriptions

func (s *UpdateSubscriberService) PreconfirmSubscriptions(preconfirmSubscriptions bool) *UpdateSubscriberService

func (*UpdateSubscriberService) Status

type UpdateSubscribersListsService

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

func (*UpdateSubscribersListsService) Action

func (*UpdateSubscribersListsService) Do

func (s *UpdateSubscribersListsService) Do(ctx context.Context, opts ...requestOption) (*bool, error)

func (*UpdateSubscribersListsService) Ids

func (*UpdateSubscribersListsService) ListIds

func (*UpdateSubscribersListsService) Status

type UpdateTemplateAsDefaultService

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

func (*UpdateTemplateAsDefaultService) Do

func (s *UpdateTemplateAsDefaultService) Do(ctx context.Context, opts ...requestOption) (*Template, error)

func (*UpdateTemplateAsDefaultService) Id

Jump to

Keyboard shortcuts

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