mailerlite

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 13 Imported by: 1

README

MailerLite Golang SDK

MIT licensed Go Reference

Table of Contents

Subscribers

Get a list of subscribers
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	listOptions := &mailerlite.ListSubscriberOptions{
		Limit:  200,
		Page:   0, 
		Filters: &[]mailerlite.Filter{{
			Name:  "status", 
			Value: "active",
		}},
	}

	subscribers, _, err := client.Subscriber.List(ctx, listOptions)
	if err != nil {
		log.Fatal(err)
	}

	log.Print(subscribers.Meta.Total)
}
Get a single subscriber
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	getOptions := &mailerlite.GetSubscriberOptions{
		SubscriberID: "subscriber-id",
		//Email: "client@example.com"
	}

	subscriber, _, err := client.Subscriber.Get(ctx, getOptions)
	if err != nil {
		log.Fatal(err)
	}

	log.Print(subscribers.Data.Email)
}
Count all subscribers
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	count, _, err := client.Subscriber.Count(ctx)
	if err != nil {
		log.Fatal(err)
	}

	log.Print(count.Total)
}
Create a subscriber
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	subscriber := &mailerlite.Subscriber{
		Email: "example@example.com",
		Fields: map[string]interface{}{
			"city": "Vilnius",
		},
	}

	newSubscriber, _, err := client.Subscriber.Create(ctx, subscriber)
	if err != nil {
		log.Fatal(err)
	}

	log.Print(newSubscriber.Data.Email)
}
Update a subscriber
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	subscriber := &mailerlite.Subscriber{
		Email: "example@example.com",
		Fields: map[string]interface{}{
			"company": "MailerLite",
		},
	}

	newSubscriber, _, err := client.Subscriber.Create(ctx, subscriber)
	if err != nil {
		log.Fatal(err)
	}

	log.Print(newSubscriber.Data.Email)
}
Delete a subscriber
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	_, _, err := client.Subscriber.Delete(ctx, "subscriber-id")
	if err != nil {
		log.Fatal(err)
	}

	log.Print("Subscriber Deleted")
}

Groups

Get a list of groups
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	listOptions := &mailerlite.ListGroupOptions{
		Page:  1,
		Limit: 10,
		Sort: mailerlite.SortByName,
	}

	groups, _, err := client.Group.List(ctx, listOptions)
	if err != nil {
		log.Fatal(err)
	}

	log.Print(groups.Meta.Total)
}
Create a group
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	_, _, err := client.Group.Create(ctx, "group-name")
	if err != nil {
		log.Fatal(err)
	}
}
Update a group
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	_, _, err := client.Group.Update(ctx, "group-id", "Group Name")
	if err != nil {
		log.Fatal(err)
	}
}
Delete a group
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	_, err := client.Group.Delete(ctx, "69861610909337422")
	if err != nil {
		log.Fatal(err)
	}
}
Get subscribers belonging to a group
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	listSubscriberOptions := &mailerlite.ListGroupSubscriberOptions{
		GroupID: "group-id",
		Filters: &[]mailerlite.Filter{{
			Name:  "status",
			Value: "active",
		}},
	}
		
	subscribers, _, err := client.Group.Subscribers(ctx, listSubscriberOptions)
	if err != nil {
		log.Fatal(err)
	}

	log.Print(subscribers.Meta.Total)
}
Assign subscriber to a group
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	_, _, err := client.Group.Assign(ctx, "group-id", "subscriber-id")
	if err != nil {
		log.Fatal(err)
	}
}
Unassign subscriber from a group
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	_, _, err := client.Group.UnAssign(ctx, "group-id", "subscriber-id")
	if err != nil {
		log.Fatal(err)
	}
}

Segments

Get a list of segments
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	listOptions := &mailerlite.ListSegmentOptions{
		Page:  1,
		Limit: 10,
	}

	_, _, err := client.Segment.List(ctx, listOptions)
	if err != nil {
		log.Fatal(err)
	}
}
Update a segment
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	_, _, err := client.Segment.Update(ctx, "segment-id", "Segment Name")
	if err != nil {
		log.Fatal(err)
	}
}
Delete a segment
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	_, err := client.Segment.Delete(ctx, "segment-id")
	if err != nil {
		log.Fatal(err)
	}
}
Get subscribers belonging to a segment
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	listSubscriberOptions := &mailerlite.ListSegmentSubscriberOptions{
		SegmentID: "segment-id",
		Filters: &[]mailerlite.Filter{{
			Name:  "status",
			Value: "active",
		}},
	}
	
	_, _, err := client.Segment.Subscribers(ctx, listSubscriberOptions)
	if err != nil {
		log.Fatal(err)
	}
}

Fields

Get a list of fields
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	listOptions := &mailerlite.ListFieldOptions{
		Page:   1,
		Limit:  10,
		Filters: &[]mailerlite.Filter{{
			Name:  "keyword",
			Value: "name",
		}},
		Sort:   mailerlite.SortByName,
	}
	
	_, _, err := client.Field.List(ctx, listOptions)
	if err != nil {
		log.Fatal(err)
	}
}
Create a field
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	// text, number or data
	_, _, err := client.Field.Create(ctx, "field-name", "field-type")
	if err != nil {
		log.Fatal(err)
	}
}
Update a field
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	_, _, err := client.Field.Update(ctx, "field-id", "Field name")
	if err != nil {
		log.Fatal(err)
	}
}
Delete a field
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	_, err := client.Field.Delete(ctx, "field-id")
	if err != nil {
		log.Fatal(err)
	}
}

Automations

Get a list of automations
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	listOptions := &mailerlite.ListAutomationOptions{
		Filters: &[]mailerlite.Filter{{
			Name:  "status",
			Value: true,
		}},
		Page:  1,
		Limit: 10,
	}
	
	_, _, err := client.Automation.List(ctx, listOptions)
	if err != nil {
		log.Fatal(err)
	}
}
Get an automation
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	_, _, err := client.Automation.Get(ctx, "automation-id")
	if err != nil {
		log.Fatal(err)
	}
}
Get subscribers activity for an automation
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	listOptions := &mailerlite.ListAutomationSubscriberOptions{
		Filters: &[]mailerlite.Filter{{
			Name:  "status",
			Value: "active",
		}},
		AutomationID: "automation-id",
		Page:         1,
		Limit:        10,
	}

	_, _, err := client.Automation.Subscribers(ctx, listOptions)
	if err != nil {
		log.Fatal(err)
	}
}

Campaigns

Get a list of campaigns
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	listOptions := &mailerlite.ListCampaignOptions{
		Filters: &[]mailerlite.Filter{{
			Name:  "status",
			Value: "draft",
		}},
		Page:  1,
		Limit: 10,
	}
	
	_, _, err := client.Campaign.List(ctx, listOptions)
	if err != nil {
		log.Fatal(err)
	}
}
Get a campaign
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	_, _, err := client.Campaign.Get(ctx, "campaign-id")
	if err != nil {
		log.Fatal(err)
	}
}
Create a campaign
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	emails := &[]mailerlite.Emails{
		{
			Subject:  "Subject",
			FromName: "Your Name",
			From:     "your@domain.com",
			Content:  "<p>This is the HTML content</p>",
		},
	}
	
	campaign := &mailerlite.CreateCampaign{
		Name:   "Campaign Name",
		Type:   mailerlite.CampaignTypeRegular,
		Emails: *emails,
	}
	
	_, _, err := client.Campaign.Create(ctx, campaign)
	if err != nil {
		log.Fatal(err)
	}
}
Update a campaign
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	emails := &[]mailerlite.Emails{
		{
			Subject:  "Subject",
			FromName: "Your Name",
			From:     "your@domain.com",
			Content:  "<p>This is the HTML content</p>",
		},
	}
	
	campaign := &mailerlite.UpdateCampaign{
		Name:   "Campaign Name",
		Type:   mailerlite.CampaignTypeRegular,
		Emails: *emails,
	}
	
	_, _, err := client.Campaign.Update(ctx, "campaign-id", campaign)
	if err != nil {
		log.Fatal(err)
	}
}
Schedule a campaign
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	schedule := &mailerlite.ScheduleCampaign{
		Delivery: mailerlite.CampaignScheduleTypeInstant,
	}
	
	_, _, err := client.Campaign.Schedule(ctx, "campaign-id", schedule)
	if err != nil {
		log.Fatal(err)
	}
}
Cancel a ready campaign
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	_, _, err := client.Campaign.Cancel(ctx, "campaign-id")
	if err != nil {
		log.Fatal(err)
	}
}
Delete a campaign
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	_, err := client.Campaign.Delete(ctx, "campaign-id")
	if err != nil {
		log.Fatal(err)
	}
}
Get subscribers activity for a campaign
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	listOptions := &mailerlite.ListCampaignSubscriberOptions{
		CampaignID: "campaign-id",
		Page:       1,
		Limit:      10,
	}
	
	_, _, err := client.Campaign.Subscribers(ctx, listOptions)
	if err != nil {
		log.Fatal(err)
	}
}

Forms

Get a list of forms
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	listOptions := &mailerlite.ListFormOptions{
		Type:   mailerlite.FormTypePopup,
		Page:   1,
		Limit:  10,
      	Filters: &[]mailerlite.Filter{{
      		Name:  "name",
      		Value: "Form Name",
      	}},
		Sort:   mailerlite.SortByName,
	}
	
	_, _, err := client.Form.List(ctx, listOptions)
	if err != nil {
		log.Fatal(err)
	}
}
Get a form
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	form, _, err := client.Form.Get(ctx, "form-id")
	if err != nil {
		log.Fatal(err)
	}
}
Update a form
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	_, _, err := client.Form.Update(ctx, "form-id", "Form Name")
	if err != nil {
		log.Fatal(err)
	}
}
Delete a form
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	_, err := client.Form.Delete(ctx, "form-id")
	if err != nil {
		log.Fatal(err)
	}
}
Get subscribers of a form
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	listOptions := &mailerlite.ListFormSubscriberOptions{
		Page:  1,
		Limit: 10,
		Filters: &[]mailerlite.Filter{{
			Name:  "status",
			Value: "active",
		}},
	}

	_, _, err := client.Form.Subscribers(ctx, listOptions)
	if err != nil {
		log.Fatal(err)
	}
}

Batching

Create a new batch

TBC

Webhooks

Get a list of webhooks
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	options := &mailerlite.ListWebhookOptions{
		Sort:  mailerlite.SortByName,
		Page:  1,
		Limit: 10,
	}

	_, _, err := client.Webhook.List(ctx, options)
	if err != nil {
		log.Fatal(err)
	}
}
Get a webhook
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	_, _, err := client.Webhook.Get(ctx, "webhook-id")
	if err != nil {
		log.Fatal(err)
	}
}
Create a webhook
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	options := &mailerlite.CreateWebhookOptions{
		Name:   "",
		Events: []string{"subscriber.bounced"},
		Url:    "https://example.com/webhook",
	}
	
	_, _, err := client.Webhook.Create(ctx, options)
	if err != nil {
		log.Fatal(err)
	}
}
Update a webhook
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	options := &mailerlite.UpdateWebhookOptions{
		WebhookID: "webhook-id",
		Events:    []string{"subscriber.bounced", "subscriber.unsubscribed"},
		Name:      "Update",
	}
	
	_, _, err := client.Webhook.Update(ctx, options)
	if err != nil {
		log.Fatal(err)
	}
}
Delete a webhook
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	_, err := client.Webhook.Delete(ctx, "75000728688526795")
	if err != nil {
		log.Fatal(err)
	}
}

Timezones

Get a list of timezones
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	_, _, err := client.Timezone.List(ctx)
	if err != nil {
		log.Fatal(err)
	}
}

Campaign languages

Get a list of languages
package main

import (
	"context"
	"log"

	"github.com/mailerlite/mailerlite-go"
)

var APIToken = "Api Token Here"

func main() {
	client := mailerlite.NewClient(APIToken)

	ctx := context.TODO()

	_, _, err := client.Campaign.Languages(ctx)
	if err != nil {
		log.Fatal(err)
	}
}

Testing

pkg/testing

$ go test

Support and Feedback

In case you find any bugs, submit an issue directly here in GitHub.

You are welcome to create SDK for any other programming language.

If you have any trouble using our API or SDK feel free to contact our support by email info@mailerlite.com

The official API documentation is at https://developers.mailerlite.com

License

The MIT License (MIT)

Documentation

Index

Constants

View Source
const (
	Version    = "0.0.2"
	APIVersion = "2023-18-04"

	HeaderAPIVersion     = "X-Version"
	HeaderRateLimit      = "X-RateLimit-Limit"
	HeaderRateRemaining  = "X-RateLimit-Remaining"
	HeaderRateRetryAfter = "Retry-After"
)

Variables

View Source
var (
	SortByID                           = "id"
	SortByIDDescending                 = "-id"
	SortByName                         = "name"
	SortByNameDescending               = "-name"
	SortByType                         = "type"
	SortByTypeDescending               = "-type"
	SortByTotal                        = "total"
	SortByTotalDescending              = "-total"
	SortByOpenRate                     = "open_rate"
	SortByOpenRateDescending           = "-open_rate"
	SortByClickRate                    = "click_rate"
	SortByClickRateDescending          = "-click_rate"
	SortByConversionsCount             = "conversions_count"
	SortByConversionsCountDescending   = "-conversions_count"
	SortByConversionRate               = "conversion_rate"
	SortByConversionRateDescending     = "-conversion_rate"
	SortByClicksCount                  = "clicks_count"
	SortByClicksCountDescending        = "-clicks_count"
	SortByOpensCount                   = "opens_count"
	SortByOpensCountDescending         = "-opens_count"
	SortByVisitors                     = "visitors"
	SortByVisitorsDescending           = "-visitors"
	SortByLastRegistrationAt           = "last_registration_at"
	SortByLastRegistrationAtDescending = "-created_at"
	SortByCreatedAt                    = "created_at"
	SortByCreatedAtDescending          = "-created_at"
	SortByUpdatedAt                    = "updated_at"
	SortByUpdatedAtDescending          = "-updated_at"

	FormTypePopup     = "popup"
	FormTypeEmbedded  = "embedded"
	FormTypePromotion = "promotion"

	CampaignTypeRegular = "regular"
	CampaignTypeAB      = "ab"
	CampaignTypeResend  = "resend"

	CampaignScheduleTypeInstant   = "instant"
	CampaignScheduleTypeScheduled = "scheduled"
	CampaignScheduleTypeTimezone  = "timezone_based"
)

Functions

func Bool

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func Int

func Int(v int) *int

Int is a helper routine that allocates a new int value to store v and returns a pointer to it.

func Int64

func Int64(v int64) *int64

Int64 is a helper routine that allocates a new int64 value to store v and returns a pointer to it.

func String

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it.

Types

type AbSettings

type AbSettings struct {
	TestType        string `json:"test_type"`
	SelectWinnerBy  string `json:"select_winner_by"`
	AfterTimeAmount int    `json:"after_time_amount"`
	AfterTimeUnit   string `json:"after_time_unit"`
	TestSplit       int    `json:"test_split"`
	BValue          BValue `json:"b_value"`
}

type Aggregations

type Aggregations struct {
	Total int `json:"total"`
	Draft int `json:"draft"`
	Ready int `json:"ready"`
	Sent  int `json:"sent"`
}

type AuthError

type AuthError ErrorResponse

AuthError occurs when using HTTP Authentication fails

func (*AuthError) Error

func (r *AuthError) Error() string

type Automation

type Automation struct {
	ID                        string          `json:"id"`
	Name                      string          `json:"name"`
	Enabled                   bool            `json:"enabled"`
	TriggerData               TriggerData     `json:"trigger_data"`
	Steps                     []Step          `json:"steps"`
	Triggers                  []Triggers      `json:"triggers"`
	Complete                  bool            `json:"complete"`
	Broken                    bool            `json:"broken"`
	Warnings                  []interface{}   `json:"warnings"`
	EmailsCount               int             `json:"emails_count"`
	FirstEmailScreenshotURL   interface{}     `json:"first_email_screenshot_url"`
	Stats                     AutomationStats `json:"stats"`
	CreatedAt                 string          `json:"created_at"`
	HasBannedContent          bool            `json:"has_banned_content"`
	QualifiedSubscribersCount int             `json:"qualified_subscribers_count"`
}

type AutomationEmailMeta

type AutomationEmailMeta struct {
	ID   string      `json:"id"`
	Name string      `json:"name"`
	URL  interface{} `json:"url"`
}

type AutomationGroupMeta

type AutomationGroupMeta struct {
	ID   string      `json:"id"`
	Name string      `json:"name"`
	URL  interface{} `json:"url"`
}

type AutomationService

type AutomationService service

func (*AutomationService) Get

func (s *AutomationService) Get(ctx context.Context, automationID string) (*rootAutomation, *Response, error)

func (*AutomationService) List

func (s *AutomationService) List(ctx context.Context, options *ListAutomationOptions) (*rootAutomations, *Response, error)

func (*AutomationService) Subscribers

func (s *AutomationService) Subscribers(ctx context.Context, options *ListAutomationSubscriberOptions) (*rootAutomationsSubscriber, *Response, error)

type AutomationStats

type AutomationStats struct {
	CompletedSubscribersCount int              `json:"completed_subscribers_count"`
	SubscribersInQueueCount   int              `json:"subscribers_in_queue_count"`
	BounceRate                *BounceRate      `json:"bounce_rate,omitempty"`
	ClickToOpenRate           *ClickToOpenRate `json:"click_to_open_rate,omitempty"`
	Sent                      int              `json:"sent"`
	OpensCount                int              `json:"opens_count"`
	UniqueOpensCount          interface{}      `json:"unique_opens_count"`
	OpenRate                  *OpenRate        `json:"open_rate,omitempty"`
	ClicksCount               int              `json:"clicks_count"`
	UniqueClicksCount         interface{}      `json:"unique_clicks_count"`
	ClickRate                 *ClickRate       `json:"click_rate,omitempty"`
	UnsubscribesCount         int              `json:"unsubscribes_count"`
	UnsubscribeRate           *UnsubscribeRate `json:"unsubscribe_rate,omitempty"`
	SpamCount                 int              `json:"spam_count"`
	SpamRate                  *SpamRate        `json:"spam_rate,omitempty"`
	HardBouncesCount          int              `json:"hard_bounces_count"`
	HardBounceRate            *HardBounceRate  `json:"hard_bounce_rate,omitempty"`
	SoftBouncesCount          int              `json:"soft_bounces_count"`
	SoftBounceRate            *SoftBounceRate  `json:"soft_bounce_rate,omitempty"`
}

type AutomationSubscriber

type AutomationSubscriber struct {
	ID                string                   `json:"id"`
	Status            string                   `json:"status"`
	Date              string                   `json:"date"`
	Reason            interface{}              `json:"reason"`
	ReasonDescription string                   `json:"reason_description"`
	Subscriber        AutomationSubscriberMeta `json:"subscriber"`
	StepRuns          []StepRun                `json:"stepRuns"`
	NextStep          Step                     `json:"nextStep"`
	CurrentStep       Step                     `json:"currentStep"`
}

type AutomationSubscriberMeta

type AutomationSubscriberMeta struct {
	ID    string `json:"id"`
	Email string `json:"email"`
}

type BValue

type BValue struct {
	Subject  string `json:"subject,omitempty"`
	FromName string `json:"from_name,omitempty"`
	From     string `json:"from,omitempty"`
}

type BounceRate

type BounceRate struct {
	Float  float64 `json:"float"`
	String string  `json:"string"`
}

type Campaign

type Campaign struct {
	ID                         string             `json:"id"`
	AccountID                  string             `json:"account_id"`
	Name                       string             `json:"name"`
	Type                       string             `json:"type"`
	Status                     string             `json:"status"`
	MissingData                []interface{}      `json:"missing_data"`
	Settings                   CampaignSettings   `json:"settings"`
	Filter                     [][]CampaignFilter `json:"filter"`
	FilterForHumans            [][]string         `json:"filter_for_humans"`
	DeliverySchedule           string             `json:"delivery_schedule"`
	LanguageID                 string             `json:"language_id"`
	CreatedAt                  string             `json:"created_at"`
	UpdatedAt                  string             `json:"updated_at"`
	ScheduledFor               string             `json:"scheduled_for"`
	QueuedAt                   string             `json:"queued_at"`
	StartedAt                  string             `json:"started_at"`
	FinishedAt                 string             `json:"finished_at"`
	StoppedAt                  interface{}        `json:"stopped_at"`
	DefaultEmailID             string             `json:"default_email_id"`
	Emails                     []Email            `json:"emails"`
	UsedInAutomations          bool               `json:"used_in_automations"`
	TypeForHumans              string             `json:"type_for_humans"`
	Stats                      Stats              `json:"stats"`
	IsStopped                  bool               `json:"is_stopped"`
	HasWinner                  interface{}        `json:"has_winner"`
	WinnerVersionForHuman      interface{}        `json:"winner_version_for_human"`
	WinnerSendingTimeForHumans interface{}        `json:"winner_sending_time_for_humans"`
	WinnerSelectedManuallyAt   interface{}        `json:"winner_selected_manually_at"`
	UsesEcommerce              bool               `json:"uses_ecommerce"`
	UsesSurvey                 bool               `json:"uses_survey"`
	CanBeScheduled             bool               `json:"can_be_scheduled"`
	Warnings                   []interface{}      `json:"warnings"`
	InitialCreatedAt           interface{}        `json:"initial_created_at"`
	IsCurrentlySendingOut      bool               `json:"is_currently_sending_out"`
}

type CampaignFilter

type CampaignFilter struct {
	Operator string        `json:"operator"`
	Args     []interface{} `json:"args"`
}

type CampaignLanguage

type CampaignLanguage struct {
	Id        string `json:"id"`
	Shortcode string `json:"shortcode"`
	Iso639    string `json:"iso639"`
	Name      string `json:"name"`
	Direction string `json:"direction"`
}

type CampaignService

type CampaignService service

func (*CampaignService) Cancel

func (s *CampaignService) Cancel(ctx context.Context, campaignID string) (*rootCampaign, *Response, error)

Cancel - cancel a single campaign

func (*CampaignService) Create

func (s *CampaignService) Create(ctx context.Context, campaign *CreateCampaign) (*rootCampaign, *Response, error)

func (*CampaignService) Delete

func (s *CampaignService) Delete(ctx context.Context, campaignID string) (*Response, error)

func (*CampaignService) Get

func (s *CampaignService) Get(ctx context.Context, campaignID string) (*rootCampaign, *Response, error)

Get - get a single campaign ID

func (*CampaignService) Languages

func (s *CampaignService) Languages(ctx context.Context) (*rootCampaignLanguages, *Response, error)

func (*CampaignService) List

func (s *CampaignService) List(ctx context.Context, options *ListCampaignOptions) (*rootCampaigns, *Response, error)

List - list of campaigns

func (*CampaignService) Schedule

func (s *CampaignService) Schedule(ctx context.Context, campaignID string, campaign *ScheduleCampaign) (*rootCampaign, *Response, error)

func (*CampaignService) Subscribers

func (s *CampaignService) Subscribers(ctx context.Context, options *ListCampaignSubscriberOptions) (*rootCampaignSubscribers, *Response, error)

Subscribers - get subscribers activity of a campaign

func (*CampaignService) Update

func (s *CampaignService) Update(ctx context.Context, campaignID string, campaign *UpdateCampaign) (*rootCampaign, *Response, error)

type CampaignSettings

type CampaignSettings struct {
	TrackOpens         string `json:"track_opens"`
	UseGoogleAnalytics string `json:"use_google_analytics"`
	EcommerceTracking  string `json:"ecommerce_tracking"`
}

type CampaignSubscriber

type CampaignSubscriber struct {
	ID          string     `json:"id"`
	OpensCount  int        `json:"opens_count"`
	ClicksCount int        `json:"clicks_count"`
	Subscriber  Subscriber `json:"subscriber"`
}

type Can

type Can struct {
	Update bool `json:"update"`
}

type ClickRate

type ClickRate struct {
	Float  float64 `json:"float"`
	String string  `json:"string"`
}

type ClickToOpenRate

type ClickToOpenRate struct {
	Float  float64 `json:"float"`
	String string  `json:"string"`
}

type Client

type Client struct {
	Subscriber *SubscriberService // Subscriber service
	Group      *GroupService      // Group service
	Field      *FieldService      // Field service
	Form       *FormService       // Form service
	Segment    *SegmentService    // Segment service
	Webhook    *WebhookService    // Webhook service
	Campaign   *CampaignService   // Campaign service
	Automation *AutomationService // Automation service
	Timezone   *TimezoneService   // Timezone service
	// contains filtered or unexported fields
}

Client - base api client

func NewClient

func NewClient(apiKey string) *Client

NewClient - creates a new client instance.

func (*Client) APIKey

func (c *Client) APIKey() string

APIKey - Get api key after it has been created

func (*Client) Client

func (c *Client) Client() *http.Client

Client - Get the current client

func (*Client) SetAPIKey

func (c *Client) SetAPIKey(apikey string)

SetAPIKey - Set the client api key

func (*Client) SetHttpClient

func (c *Client) SetHttpClient(client *http.Client)

SetHttpClient - Set the client if you want more control over the client implementation

type Condition

type Condition struct {
	Type    string              `json:"type"`
	EmailID string              `json:"email_id"`
	Action  string              `json:"action"`
	LinkID  interface{}         `json:"link_id"`
	Email   AutomationEmailMeta `json:"email"`
}

type ConversionRate

type ConversionRate struct {
	Float  int    `json:"float"`
	String string `json:"string"`
}

type Counts

type Counts struct {
	All          int `json:"all"`
	Opened       int `json:"opened"`
	Unopened     int `json:"unopened"`
	Clicked      int `json:"clicked"`
	Unsubscribed int `json:"unsubscribed"`
	Forwarded    int `json:"forwarded"`
	Hardbounced  int `json:"hardbounced"`
	Softbounced  int `json:"softbounced"`
	Junk         int `json:"junk"`
}

type CreateCampaign

type CreateCampaign struct {
	Name           string          `json:"name"`
	LanguageID     int             `json:"language_id,omitempty"`
	Type           string          `json:"type"`
	Emails         []Emails        `json:"emails"`
	Groups         []string        `json:"groups,omitempty"`
	Segments       []string        `json:"segments,omitempty"`
	AbSettings     *AbSettings     `json:"ab_settings,omitempty"`
	ResendSettings *ResendSettings `json:"resend_settings,omitempty"`
}

CreateCampaign - modifies the behavior of CampaignService.Create method

type CreateWebhookOptions

type CreateWebhookOptions struct {
	Name   string   `json:"name,omitempty"`
	Events []string `json:"events"`
	Url    string   `json:"url"`
}

CreateWebhookOptions - modifies the behavior of WebhookService.Create method

type Email

type Email struct {
	ID            string      `json:"id"`
	AccountID     string      `json:"account_id"`
	EmailableID   string      `json:"emailable_id"`
	EmailableType string      `json:"emailable_type"`
	Type          string      `json:"type"`
	From          string      `json:"from"`
	FromName      string      `json:"from_name"`
	Name          string      `json:"name"`
	Subject       string      `json:"subject"`
	PlainText     string      `json:"plain_text"`
	ScreenshotURL string      `json:"screenshot_url"`
	PreviewURL    string      `json:"preview_url"`
	CreatedAt     string      `json:"created_at"`
	UpdatedAt     string      `json:"updated_at"`
	IsDesigned    bool        `json:"is_designed"`
	LanguageID    float64     `json:"language_id"`
	IsWinner      bool        `json:"is_winner"`
	Stats         Stats       `json:"stats"`
	SendAfter     interface{} `json:"send_after"`
	TrackOpens    bool        `json:"track_opens"`
}

type Emails

type Emails struct {
	Subject  string `json:"subject"`
	FromName string `json:"from_name"`
	From     string `json:"from"`
	Content  string `json:"content"`
}

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response      // HTTP response that caused this error
	Message  string              `json:"message"` // error message
	Errors   map[string][]string `json:"errors"`
}

ErrorResponse is a MailerLite API error response. This wraps the standard http.Response

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

type Field

type Field struct {
	Id   string `json:"id"`
	Name string `json:"name"`
	Key  string `json:"key"`
	Type string `json:"type"`
}

type FieldService

type FieldService service

func (*FieldService) Create

func (s *FieldService) Create(ctx context.Context, fieldName, fieldType string) (*rootField, *Response, error)

func (*FieldService) Delete

func (s *FieldService) Delete(ctx context.Context, fieldID string) (*Response, error)

func (*FieldService) List

func (s *FieldService) List(ctx context.Context, options *ListFieldOptions) (*rootFields, *Response, error)

func (*FieldService) Update

func (s *FieldService) Update(ctx context.Context, fieldID, fieldName string) (*rootField, *Response, error)

type Fields

type Fields struct {
	Name     string `json:"name"`
	LastName string `json:"last_name"`
}

type Filter

type Filter struct {
	// Name is the name of the field.
	Name string `json:"name"`
	// Value is the value which the entry should be filtered by.
	Value interface{} `json:"value"`
}

Filter is one of the arguments which has a name and a value

func NewFilter

func NewFilter(name string, value interface{}) *Filter

NewFilter returns a new filter initialized with the given name and value.

type Form

type Form struct {
	Id                 string                 `json:"id"`
	Type               string                 `json:"type"`
	Slug               string                 `json:"slug"`
	Name               string                 `json:"name"`
	CreatedAt          string                 `json:"created_at"`
	ConversionsCount   int                    `json:"conversions_count"`
	ConversionsRate    ConversionRate         `json:"conversions_rate"`
	OpensCount         int                    `json:"opens_count"`
	Settings           map[string]interface{} `json:"settings"`
	LastRegistrationAt interface{}            `json:"last_registration_at"`
	Active             bool                   `json:"active"`
	IsBroken           bool                   `json:"is_broken"`
	HasContent         bool                   `json:"has_content"`
	Can                Can                    `json:"can"`
	UsedInAutomations  bool                   `json:"used_in_automations"`
	Warnings           []interface{}          `json:"warnings"`
	DoubleOptin        interface{}            `json:"double_optin"`
	ScreenshotUrl      interface{}            `json:"screenshot_url"`
}

type FormService

type FormService service

func (*FormService) Delete

func (s *FormService) Delete(ctx context.Context, formID string) (*Response, error)

func (*FormService) Get

func (s *FormService) Get(ctx context.Context, formID string) (*rootForm, *Response, error)

func (*FormService) List

func (s *FormService) List(ctx context.Context, options *ListFormOptions) (*rootForms, *Response, error)

func (*FormService) Subscribers

func (s *FormService) Subscribers(ctx context.Context, options *ListFormSubscriberOptions) (*rootSubscribers, *Response, error)

func (*FormService) Update

func (s *FormService) Update(ctx context.Context, formID, formName string) (*rootForm, *Response, error)

type GetCampaignOptions

type GetCampaignOptions struct {
	ID int `json:"id,omitempty"`
}

GetCampaignOptions - modifies the behavior of CampaignService.Get method

type GetSubscriberOptions

type GetSubscriberOptions struct {
	SubscriberID string `json:"id,omitempty"`
	Email        string `json:"email,omitempty"`
}

GetSubscriberOptions - modifies the behavior of SubscriberService.Get method

type Group

type Group struct {
	ID                string    `json:"id"`
	Name              string    `json:"name"`
	ActiveCount       int       `json:"active_count"`
	SentCount         int       `json:"sent_count"`
	OpensCount        int       `json:"opens_count"`
	OpenRate          OpenRate  `json:"open_rate"`
	ClicksCount       int       `json:"clicks_count"`
	ClickRate         ClickRate `json:"click_rate"`
	UnsubscribedCount int       `json:"unsubscribed_count"`
	UnconfirmedCount  int       `json:"unconfirmed_count"`
	BouncedCount      int       `json:"bounced_count"`
	JunkCount         int       `json:"junk_count"`
	CreatedAt         string    `json:"created_at"`
}

type GroupService

type GroupService service

func (*GroupService) Assign

func (s *GroupService) Assign(ctx context.Context, groupID, subscriberID string) (*rootGroup, *Response, error)

func (*GroupService) Create

func (s *GroupService) Create(ctx context.Context, groupName string) (*rootGroup, *Response, error)

func (*GroupService) Delete

func (s *GroupService) Delete(ctx context.Context, groupID string) (*Response, error)

func (*GroupService) List

func (s *GroupService) List(ctx context.Context, options *ListGroupOptions) (*rootGroups, *Response, error)

func (*GroupService) Subscribers

func (s *GroupService) Subscribers(ctx context.Context, options *ListGroupSubscriberOptions) (*rootSubscribers, *Response, error)

func (*GroupService) UnAssign

func (s *GroupService) UnAssign(ctx context.Context, groupID, subscriberID string) (*Response, error)

func (*GroupService) Update

func (s *GroupService) Update(ctx context.Context, groupID, groupName string) (*rootGroup, *Response, error)

type HardBounceRate

type HardBounceRate struct {
	Float  float64 `json:"float"`
	String string  `json:"string"`
}
type Links struct {
	First string `json:"first"`
	Last  string `json:"last"`
	Prev  string `json:"prev"`
	Next  string `json:"next"`
}

Links manages links that are returned along with a List

func (*Links) IsLastPage

func (l *Links) IsLastPage() bool

IsLastPage returns true if the current page is the last

func (*Links) NextPageToken

func (l *Links) NextPageToken() (string, error)

NextPageToken is the page token to request the next page of the list

func (*Links) PrevPageToken

func (l *Links) PrevPageToken() (string, error)

PrevPageToken is the page token to request the previous page of the list

type ListAutomationOptions

type ListAutomationOptions struct {
	Filters *[]Filter `json:"filters,omitempty"`
	Page    int       `url:"page,omitempty"`
	Limit   int       `url:"limit,omitempty"`
}

ListAutomationOptions - modifies the behavior of AutomationService.List method

type ListAutomationSubscriberOptions

type ListAutomationSubscriberOptions struct {
	AutomationID string    `url:"-"`
	Filters      *[]Filter `json:"filters,omitempty"`
	Page         int       `url:"page,omitempty"`
	Limit        int       `url:"limit,omitempty"`
}

ListAutomationSubscriberOptions - modifies the behavior of AutomationService.Subscribers method

type ListCampaignOptions

type ListCampaignOptions struct {
	Filters *[]Filter `json:"filters,omitempty"`
	Page    int       `url:"page,omitempty"`
	Limit   int       `url:"limit,omitempty"`
}

ListCampaignOptions - modifies the behavior of CampaignService.List method

type ListCampaignSubscriberOptions

type ListCampaignSubscriberOptions struct {
	CampaignID string    `url:"-"`
	Filters    *[]Filter `json:"filters,omitempty"`
	Page       int       `url:"page,omitempty"`
	Sort       string    `url:"sort,omitempty"`
	Limit      int       `url:"limit,omitempty"`
}

type ListFieldOptions

type ListFieldOptions struct {
	Filters *[]Filter `json:"filters,omitempty"`
	Page    int       `url:"page,omitempty"`
	Limit   int       `url:"limit,omitempty"`
	Sort    string    `url:"sort,omitempty"`
}

ListFieldOptions - modifies the behavior of FieldService.List method

type ListFormOptions

type ListFormOptions struct {
	Type    string    `url:"-"`
	Filters *[]Filter `json:"filters,omitempty"`
	Page    int       `url:"page,omitempty"`
	Limit   int       `url:"limit,omitempty"`
	Sort    string    `url:"sort,omitempty"`
}

ListFormOptions - modifies the behavior of FormService.List method

type ListFormSubscriberOptions

type ListFormSubscriberOptions struct {
	FormID  string    `url:"-"`
	Filters *[]Filter `json:"filters,omitempty"`
	Page    int       `url:"page,omitempty"`
	Limit   int       `url:"limit,omitempty"`
}

ListFormSubscriberOptions - modifies the behavior of FormService.Subscribers method

type ListGroupOptions

type ListGroupOptions struct {
	Filters *[]Filter `json:"filters,omitempty"`
	Page    int       `url:"page,omitempty"`
	Limit   int       `url:"limit,omitempty"`
	Sort    string    `url:"sort,omitempty"`
}

ListGroupOptions - modifies the behavior of GroupService.List method

type ListGroupSubscriberOptions

type ListGroupSubscriberOptions struct {
	GroupID string    `url:"-"`
	Filters *[]Filter `json:"filters,omitempty"`
	Page    int       `url:"page,omitempty"`
	Limit   int       `url:"limit,omitempty"`
}

type ListSegmentOptions

type ListSegmentOptions struct {
	Page  int `url:"page,omitempty"`
	Limit int `url:"limit,omitempty"`
}

ListSegmentOptions - modifies the behavior of SegmentService.List method

type ListSegmentSubscriberOptions

type ListSegmentSubscriberOptions struct {
	SegmentID string    `url:"-"`
	Filters   *[]Filter `json:"filters,omitempty"`
	Limit     int       `url:"limit,omitempty"`
	After     int       `url:"after,omitempty"`
}

ListSegmentSubscriberOptions - modifies the behavior of SegmentService.Subscribers method

type ListSubscriberOptions

type ListSubscriberOptions struct {
	Filters *[]Filter `json:"filters,omitempty"`
	Page    int       `url:"page,omitempty"`
	Limit   int       `url:"limit,omitempty"`
}

ListSubscriberOptions - modifies the behavior of SubscriberService.List method

type ListWebhookOptions

type ListWebhookOptions struct {
	Sort  string `url:"sort,omitempty"`
	Page  int    `url:"page,omitempty"`
	Limit int    `url:"limit,omitempty"`
}

ListWebhookOptions - modifies the behavior of WebhookService.List method

type Meta

type Meta struct {
	// offset  based pagination
	CurrentPage int         `json:"current_page"`
	From        int         `json:"from"`
	LastPage    int         `json:"last_page"`
	Links       []MetaLinks `json:"links"`
	Path        string      `json:"path"`
	PerPage     int         `json:"per_page"`
	To          int         `json:"to"`

	*Aggregations `json:"aggregations,omitempty"`
	*Counts       `json:"counts,omitempty"`

	// cursor based pagination
	Count int `json:"count"`
	Last  int `json:"last"`

	Total           int `json:"total"`
	TotalUnfiltered int `json:"total_unfiltered,omitempty"`
}
type MetaLinks struct {
	URL    interface{} `json:"url"`
	Label  string      `json:"label"`
	Active bool        `json:"active"`
}

type OpenRate

type OpenRate struct {
	Float  float64 `json:"float"`
	String string  `json:"string"`
}

type Rate

type Rate struct {
	// The number of requests per minute the client is currently limited to.
	Limit int `json:"limit"`

	// The number of remaining requests the client can make this minute.
	Remaining int `json:"remaining"`

	// Retry After
	RetryAfter *time.Duration `json:"retry"`
}

Rate represents the rate limit for the current client.

type RateLimitError

type RateLimitError struct {
	Rate     Rate           // Rate specifies last known rate limit for the client
	Response *http.Response // HTTP response that caused this error
	Message  string         `json:"message"` // error message
}

RateLimitError occurs when MailerLite returns 403 Forbidden response with a rate limit remaining value of 0.

func (*RateLimitError) Error

func (r *RateLimitError) Error() string

type Resend

type Resend struct {
	Delivery   string `json:"delivery"`
	Date       string `json:"date"`
	Hours      string `json:"hours"`
	Minutes    string `json:"minutes"`
	TimezoneID int    `json:"timezone_id,omitempty"`
}

type ResendSettings

type ResendSettings struct {
	TestType       string `json:"test_type"`
	SelectWinnerBy string `json:"select_winner_by"`
	BValue         BValue `json:"b_value"`
}

type Response

type Response struct {
	*http.Response

	// Explicitly specify the Rate type so Rate's String() receiver doesn't
	// propagate to Response.
	Rate Rate
}

Response is a MailerLite API response. This wraps the standard http.Response

type Schedule

type Schedule struct {
	Date       string `json:"date"`
	Hours      string `json:"hours"`
	Minutes    string `json:"minutes"`
	TimezoneID int    `json:"timezone_id,omitempty"`
}

type ScheduleCampaign

type ScheduleCampaign struct {
	Delivery string    `json:"delivery"`
	Schedule *Schedule `json:"schedule,omitempty"`
	Resend   *Resend   `json:"resend,omitempty"`
}

ScheduleCampaign - modifies the behavior of CampaignService.Schedule method

type Segment

type Segment struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Total     int       `json:"total"`
	OpenRate  OpenRate  `json:"open_rate"`
	ClickRate ClickRate `json:"click_rate"`
	CreatedAt string    `json:"created_at"`
}

type SegmentService

type SegmentService service

func (*SegmentService) Delete

func (s *SegmentService) Delete(ctx context.Context, segmentID string) (*Response, error)

func (*SegmentService) List

func (s *SegmentService) List(ctx context.Context, options *ListSegmentOptions) (*rootSegments, *Response, error)

func (*SegmentService) Subscribers

func (s *SegmentService) Subscribers(ctx context.Context, options *ListSegmentSubscriberOptions) (*rootSubscribers, *Response, error)

func (*SegmentService) Update

func (s *SegmentService) Update(ctx context.Context, segmentID, segmentName string) (*rootSegment, *Response, error)

type SoftBounceRate

type SoftBounceRate struct {
	Float  float64 `json:"float"`
	String string  `json:"string"`
}

type SpamRate

type SpamRate struct {
	Float  float64 `json:"float"`
	String string  `json:"string"`
}

type Stats

type Stats struct {
	Sent              int             `json:"sent"`
	OpensCount        int             `json:"opens_count"`
	UniqueOpensCount  int             `json:"unique_opens_count"`
	OpenRate          OpenRate        `json:"open_rate"`
	ClicksCount       int             `json:"clicks_count"`
	UniqueClicksCount int             `json:"unique_clicks_count"`
	ClickRate         ClickRate       `json:"click_rate"`
	UnsubscribesCount int             `json:"unsubscribes_count"`
	UnsubscribeRate   UnsubscribeRate `json:"unsubscribe_rate"`
	SpamCount         int             `json:"spam_count"`
	SpamRate          SpamRate        `json:"spam_rate"`
	HardBouncesCount  int             `json:"hard_bounces_count"`
	HardBounceRate    HardBounceRate  `json:"hard_bounce_rate"`
	SoftBouncesCount  int             `json:"soft_bounces_count"`
	SoftBounceRate    SoftBounceRate  `json:"soft_bounce_rate"`
	ForwardsCount     int             `json:"forwards_count"`
	ClickToOpenRate   ClickToOpenRate `json:"click_to_open_rate"`
}

type Step

type Step struct {
	ID                  string       `json:"id"`
	Type                string       `json:"type"`
	ParentID            string       `json:"parent_id"`
	Unit                string       `json:"unit,omitempty"`
	Complete            bool         `json:"complete,omitempty"`
	CreatedAt           string       `json:"created_at"`
	YesStepId           string       `json:"yes_step_id,omitempty"`
	NoStepId            string       `json:"no_step_id,omitempty"`
	Broken              bool         `json:"broken"`
	UpdatedAt           string       `json:"updated_at"`
	Value               string       `json:"value,omitempty"`
	MatchingType        string       `json:"matching_type,omitempty"`
	Description         string       `json:"description"`
	Name                string       `json:"name,omitempty"`
	Subject             string       `json:"subject,omitempty"`
	From                string       `json:"from,omitempty"`
	FromName            string       `json:"from_name,omitempty"`
	EmailID             string       `json:"email_id,omitempty"`
	Email               *Email       `json:"email,omitempty"`
	Conditions          *[]Condition `json:"conditions,omitempty"`
	LanguageID          int          `json:"language_id,omitempty"`
	TrackOpens          bool         `json:"track_opens,omitempty"`
	GoogleAnalytics     interface{}  `json:"google_analytics,omitempty"`
	TrackingWasDisabled bool         `json:"tracking_was_disabled,omitempty"`
}

type StepRun

type StepRun struct {
	ID           string `json:"id"`
	StepID       string `json:"step_id"`
	Description  string `json:"description"`
	ScheduledFor string `json:"scheduled_for"`
}

type Subscriber

type Subscriber struct {
	ID             string                 `json:"id,omitempty"`
	Email          string                 `json:"email,omitempty"`
	Status         string                 `json:"status,omitempty"`
	Source         string                 `json:"source,omitempty"`
	Sent           int                    `json:"sent,omitempty"`
	OpensCount     int                    `json:"opens_count,omitempty"`
	ClicksCount    int                    `json:"clicks_count,omitempty"`
	OpenRate       float64                `json:"open_rate,omitempty"`
	ClickRate      float64                `json:"click_rate,omitempty"`
	IPAddress      interface{}            `json:"ip_address,omitempty"`
	SubscribedAt   string                 `json:"subscribed_at,omitempty"`
	UnsubscribedAt interface{}            `json:"unsubscribed_at,omitempty"`
	CreatedAt      string                 `json:"created_at,omitempty"`
	UpdatedAt      string                 `json:"updated_at,omitempty"`
	Fields         map[string]interface{} `json:"fields,omitempty"`
	Groups         []Group                `json:"groups,omitempty"`
	OptedInAt      string                 `json:"opted_in_at,omitempty"`
	OptinIP        string                 `json:"optin_ip,omitempty"`
}

type SubscriberService

type SubscriberService service

func (*SubscriberService) Count

func (s *SubscriberService) Count(ctx context.Context) (*count, *Response, error)

Count - get a count of subscribers

func (*SubscriberService) Create

func (s *SubscriberService) Create(ctx context.Context, subscriber *Subscriber) (*rootSubscriber, *Response, error)

func (*SubscriberService) Delete

func (s *SubscriberService) Delete(ctx context.Context, subscriberID string) (*Response, error)

func (*SubscriberService) Forget added in v1.0.3

func (s *SubscriberService) Forget(ctx context.Context, subscriberID string) (*rootSubscriber, *Response, error)

func (*SubscriberService) Get

func (s *SubscriberService) Get(ctx context.Context, options *GetSubscriberOptions) (*rootSubscriber, *Response, error)

Get - get a single subscriber by email or ID

func (*SubscriberService) List

func (s *SubscriberService) List(ctx context.Context, options *ListSubscriberOptions) (*rootSubscribers, *Response, error)

func (*SubscriberService) Update

func (s *SubscriberService) Update(ctx context.Context, subscriber *Subscriber) (*rootSubscriber, *Response, error)

func (*SubscriberService) Upsert added in v1.0.4

func (s *SubscriberService) Upsert(ctx context.Context, subscriber *Subscriber) (*rootSubscriber, *Response, error)

type Timezone

type Timezone struct {
	Id            string `json:"id"`
	Name          string `json:"name"`
	NameForHumans string `json:"name_for_humans"`
	OffsetName    string `json:"offset_name"`
	Offset        int    `json:"offset"`
}

type TimezoneService

type TimezoneService service

func (*TimezoneService) List

func (s *TimezoneService) List(ctx context.Context) (*rootTimezones, *Response, error)

type TriggerData

type TriggerData struct {
	TrackEcommerce bool `json:"track_ecommerce"`
	Repeatable     bool `json:"repeatable"`
	Valid          bool `json:"valid"`
}

type Triggers

type Triggers struct {
	ID              string              `json:"id"`
	Type            string              `json:"type"`
	GroupID         string              `json:"group_id"`
	Group           AutomationGroupMeta `json:"group"`
	ExcludeGroupIds []interface{}       `json:"exclude_group_ids"`
	ExcludedGroups  []interface{}       `json:"excluded_groups"`
	Broken          bool                `json:"broken"`
}

type UnsubscribeRate

type UnsubscribeRate struct {
	Float  float64 `json:"float"`
	String string  `json:"string"`
}

type UpdateCampaign

type UpdateCampaign CreateCampaign

type UpdateWebhookOptions

type UpdateWebhookOptions struct {
	WebhookID string   `json:"-"`
	Name      string   `json:"name,omitempty"`
	Events    []string `json:"events,omitempty"`
	Url       string   `json:"url,omitempty"`
	Enabled   string   `json:"enabled,omitempty"`
}

UpdateWebhookOptions - modifies the behavior of WebhookService.Create method

type Webhook

type Webhook struct {
	Id        string   `json:"id"`
	Name      string   `json:"name"`
	Url       string   `json:"url"`
	Events    []string `json:"events"`
	Enabled   bool     `json:"enabled"`
	Secret    string   `json:"secret"`
	CreatedAt string   `json:"created_at"`
	UpdatedAt string   `json:"updated_at"`
}

type WebhookService

type WebhookService service

func (*WebhookService) Create

func (s *WebhookService) Create(ctx context.Context, options *CreateWebhookOptions) (*rootWebhook, *Response, error)

func (*WebhookService) Delete

func (s *WebhookService) Delete(ctx context.Context, webhookID string) (*Response, error)

func (*WebhookService) Get

func (s *WebhookService) Get(ctx context.Context, webhookID string) (*rootWebhook, *Response, error)

func (*WebhookService) List

func (s *WebhookService) List(ctx context.Context, options *ListWebhookOptions) (*rootWebhooks, *Response, error)

func (*WebhookService) Update

func (s *WebhookService) Update(ctx context.Context, options *UpdateWebhookOptions) (*rootWebhook, *Response, error)

Jump to

Keyboard shortcuts

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