Skip to content

kvarts/sendpulse-sdk-go

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SendPulse REST client library (unofficial)

An unofficial SendPulse SDK client library for Go (Golang). This library allows to use the SendPulse API via Go.

SendPulse API official documentation https://sendpulse.com/api

Build Status codecov Go Report Card License

Installation

go get -u github.com/kvarts/sendpulse-sdk-go/sendpulse

Usage

package main

import (
    "context"
    "fmt"
    sendpulse "github.com/kvarts/sendpulse-sdk-go/v7"
    "net/http"
)

func main() {
    config := &sendpulse.Config{
        UserID: "",
        Secret: "",
    }
    client := sendpulse.NewClient(http.DefaultClient, config)

    emails := []*sendpulse.EmailToAdd {
        &sendpulse.EmailToAdd{
            Email:     "test@test.com",
            Variables: map[string]interface{}{"age": 21, "weight": 99},
        },
    }
    
    ctx := context.Background()
    if err := client.Emails.MailingLists.SingleOptIn(ctx, 1266208, emails); err != nil {
        fmt.Println(err)
    }
    fmt.Println(*emails[0])
}

The tests should be considered a part of the documentation.

License

The MIT License (MIT)

About

Go library for sending mail with the Sendpuse.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%