gosdktemp

package
v1.0.53 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

README

Go SDK Custom Files

Place your custom files for the Go SDK here.

Directory Structure

go/
├── helpers.go         # Custom utilities and helpers
├── extensions/        # Extended API methods
├── types/            # Additional type definitions
├── examples/         # Custom examples
├── docs/             # Custom documentation
└── config/           # Custom configuration files

Example Usage

To add a custom utility file:

  1. Create api/custom/go/helpers.go
  2. Run make generate-go-sdk
  3. The file will be copied to api/go/helpers.go

Documentation

Overview

nolint

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncClient

type AsyncClient struct {
	// contains filtered or unexported fields
}

AsyncClient provides an enhanced asynchronous client for the FlexPrice API It builds on top of the FlexPrice Go SDK to provide batching and asynchronous event sending capabilities.

func (*AsyncClient) Close

func (c *AsyncClient) Close() error

Close shuts down the client

func (*AsyncClient) Enqueue

func (c *AsyncClient) Enqueue(eventName, externalCustomerID string, properties map[string]interface{}) error

Enqueue adds an event to the processing queue

func (*AsyncClient) EnqueueWithOptions

func (c *AsyncClient) EnqueueWithOptions(opts EventOptions) error

EnqueueWithOptions adds an event to the processing queue with additional options

func (*AsyncClient) Flush

func (c *AsyncClient) Flush() error

Flush forces all queued events to be sent immediately

type AsyncConfig

type AsyncConfig struct {
	// BatchSize defines maximum number of events to batch before sending
	BatchSize int

	// FlushInterval defines how often the queue is flushed even if the batch size hasn't been reached
	FlushInterval time.Duration

	// MaxQueueSize is the maximum size of the queue before blocking
	MaxQueueSize int

	// MaxConcurrentRequests is the maximum number of concurrent API requests
	MaxConcurrentRequests int

	// DefaultSource is the default source to apply to events if not specified
	DefaultSource string

	// Debug enables debug logging
	Debug bool
}

AsyncConfig provides configuration options for the enhanced FlexPrice client

func DefaultAsyncConfig

func DefaultAsyncConfig() AsyncConfig

DefaultAsyncConfig returns a default configuration for the async client

type CustomHelpers

type CustomHelpers struct{}

CustomHelpers provides utility functions for the FlexPrice Go SDK

func NewCustomHelpers

func NewCustomHelpers() *CustomHelpers

NewCustomHelpers creates a new instance of CustomHelpers

func (*CustomHelpers) FormatCurrency

func (h *CustomHelpers) FormatCurrency(amount float64, currency string) string

FormatCurrency formats currency amount with proper formatting

func (*CustomHelpers) FormatDate

func (h *CustomHelpers) FormatDate(t time.Time) string

FormatDate formats date to ISO string

func (*CustomHelpers) GenerateID

func (h *CustomHelpers) GenerateID(prefix string) string

GenerateID generates a unique ID with optional prefix

func (*CustomHelpers) IsValidEmail

func (h *CustomHelpers) IsValidEmail(email string) bool

IsValidEmail validates email format

type EventOptions

type EventOptions struct {
	// EventName is the name of the event (required)
	EventName string

	// ExternalCustomerID is the external customer ID (required)
	ExternalCustomerID string

	// CustomerID is the internal FlexPrice customer ID
	CustomerID string

	// EventID is a custom event ID
	EventID string

	// Properties contains event properties
	Properties map[string]interface{}

	// Source identifies the source of the event
	Source string

	// Timestamp is the event timestamp in RFC3339 format
	Timestamp string
}

EventOptions provides all available options for adding an event

Jump to

Keyboard shortcuts

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