Categorygithub.com/xitonix/createsend
modulepackage
0.0.2
Repository: https://github.com/xitonix/createsend.git
Documentation: pkg.go.dev

# README

createsend

GitHub release (latest by date including pre-releases) Build Status Go Report Card codecov GitHub license GitHub issues

Campaign Monitor API wrapper in Go

Installation

go get github.com/xitonix/createsend

Example

package main

import (
    "fmt"
    "log"

    "github.com/xitonix/createsend"
)

func main() {
    client, err := createsend.New(createsend.WithAPIKey("[Your API Key]"))
    if err != nil {
        log.Fatal(err)
    }
    
    clients, err := client.Accounts().Clients()
    if err != nil {
        log.Fatal(err)
    }
    
    for _, client := range clients {
        fmt.Printf("%s: %s\n", client.ID, client.Name)
    }
}

You can also use oAuth authentication token:

client, err := createsend.New(createsend.WithOAuthToken("[OAuth Token]"))
if err != nil {
  log.Fatal(err)
}

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

New creates a new client.
WithAccountsAPI overrides the internal object for accessing Accounts API.
WithAPIKey enables API key authentication.
WithBaseURL overrides the base URL.
WithClientsAPI overrides the internal object for accessing Clients API.
WithContext sets the context for all the HTTP requests.
WithHTTPClient sets the internal HTTP client.
WithOAuthToken enables Oauth token authentication.

# Constants

DefaultBaseURL the default API base URL.
ErrCodeAuthenticationNotSet neither API key nor Oauth token was provided.
ErrCodeDataProcessing indicates that processing the input/output data has failed.
ErrCodeEmptyAPIKey the provided API key was empty.
ErrCodeEmptyOAuthToken the provided Oauth token was empty.
ErrCodeEmptyURL the requested URL was empty.
ErrCodeInvalidJSON the provided JSON payload was invalid.
ErrCodeInvalidRequestBody the provided request was invalid.
ErrCodeInvalidURL the requested UTL was invalid.
ErrCodeNilHTTPClient the provided internal HTTP client is nil.

# Structs

Client represents a client to access Campaign Monitor API.
Error wraps server side and client side errors.
Options client configurations.

# Interfaces

HTTPClient is an interface for the internal HTTP client.

# Type aliases

ClientErrorCode client side error codes.
Option represents an optional client configuration function.