Files
commerce/thirdparty/mailchimp/mailchimp.go
zeekay 1943f1c093 Hanzo Commerce
Multi-tenant commerce and billing: orders, subscriptions, invoices, plans,
usage metering and a credit ledger. One Go binary. MIT OR Apache-2.0.

Claude-Session: https://claude.ai/code/session_01SAtaDFm8VDiWrhYHNNtxMw
2026-09-23 21:52:16 -07:00

40 lines
704 B
Go

package mailchimp
import (
"context"
"net/http"
"time"
"github.com/hanzoai/gochimp3"
"github.com/hanzoai/commerce/types/integration"
)
type API struct {
Context context.Context
Client *gochimp3.API
Key string
}
func New(ctx context.Context, settings integration.Mailchimp) *API {
// Update timeout
var cancel context.CancelFunc
ctx, cancel = context.WithTimeout(ctx, time.Second*55)
defer cancel()
apiKey := settings.APIKey
client := gochimp3.New(apiKey)
// Use standard HTTP transport with timeout
client.Transport = &http.Transport{
ResponseHeaderTimeout: time.Second * 55,
}
client.Debug = true
return &API{
Context: ctx,
Client: client,
Key: apiKey,
}
}