Help us shape the future of Go! Take the 2026 Go Developer Survey

integration

package
v1.21.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package integration defines provider metadata shared by payment and messaging integrations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequestError added in v1.21.0

func RequestError(provider string, err error) error

RequestError reports a failed provider call, prefixed with the provider's name and without the request URL. net/http reports a failed round trip as a *url.Error that prints the whole URL, and a provider's URL can carry the account, a password hash, the recipient's number or the code it delivers; the sending tasks log the error, so only the underlying failure is kept.

Types

type ClientCache added in v1.21.0

type ClientCache[C any] struct {
	// contains filtered or unexported fields
}

ClientCache keeps the provider client built for the configuration in force, so a send reuses the client — and the connections it holds — instead of building one per message. It is rebuilt when the configuration changes. The configuration is kept only as a digest.

func (*ClientCache[C]) Get added in v1.21.0

func (c *ClientCache[C]) Get(build func() (C, error), parts ...string) (C, error)

Get returns the client for the configuration parts, building it with build when they differ from the cached client's. A failed build leaves the cache as it was.

type Info

type Info struct {
	Platform                 string            `json:"platform"`
	PlatformURL              string            `json:"platform_url"`
	PlatformFieldDescription map[string]string `json:"platform_field_description"`
}

Info describes a supported provider and the configuration fields it accepts. It deliberately lives outside the HTTP DTO layer so infrastructure packages can expose their capabilities without importing internal application types.

type Platforms added in v1.21.0

type Platforms[P comparable] struct {
	// contains filtered or unexported fields
}

Platforms is a two-way table between the provider names stored in a configuration and a provider enum.

func NewPlatforms added in v1.21.0

func NewPlatforms[P comparable](unsupported P, names map[string]P) Platforms[P]

NewPlatforms builds the table from names; unsupported is the value an unknown name parses to.

func (Platforms[P]) Name added in v1.21.0

func (p Platforms[P]) Name(value P) string

Name returns the name value is stored under, or "unsupported".

func (Platforms[P]) Parse added in v1.21.0

func (p Platforms[P]) Parse(name string) P

Parse returns the provider named name, or the unsupported value.

Jump to

Keyboard shortcuts

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