Skip to content

developertom01/klaviyo-go

Repository files navigation

Klaviyo's Unofficial Golang SDK

Other Klaviyo Resources

Design & Approach

This SDK is a thin wrapper around our API. See our API Reference for full documentation on API behavior.

This SDK exactly mirrors the organization and naming convention of the above language-agnostic resources, with a few namespace changes to make it fit better with Golang

Organization

This SDK is organized into the following resources:

  • AccountsApi
  • CampaignsApi
  • FlowsApi

Installation

 go get github.com/developertom01/klaviyo-go

Usage Example

var apiKey = "test-key"

opt := options.NewOptionsWithDefaultValues().WithApiKey(apiKey)

klaviyoApi := klaviyo.NewKlaviyoApi(opt, nil)

ctx, cancel := context.WithTimeout(context.Background(), time.Second*15)
defer cancel()

accounts, err := klaviyoApi.Accounts.GetAccounts(ctx, []models.AccountsField{models.AccountsFieldContactInformation, models.AccountsFieldContactInformation_DefaultSenderName})

if err != nil {
 log.Fatal(err)
}

fmt.Println(accounts)

Filter Builder

fb := commons.NewFilerBuilder()

//Simple operations

// equals
fb.Contains("name","test name") 
fb.Build()// "contains(name, test name)"

//Chain operators
fb.Equals("field1","value1").LessThan("field2","value2") 
fb.Build()// "equals(field1,value1),less-than(field2,value2)"

//Boolean Operators

op1 := commons.NewFilerBuilder()
api.Equals("field1","value1")
op2 := commons.NewFilerBuilder()
api.LessThan("field2","value2")

fb.And(op1,op2)

fb.Build() // and(equals(field1,value1),less-than(field2,value2))

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages