pushover

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package pushover implements the bounded HTTP boundary for the Pushover API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backoff

type Backoff interface {
	Wait(context.Context, int) error
}

type HTTPClient

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

HTTPClient is safe for sequential reuse. The production constructor fixes its endpoint and transport; NewTestClient exists solely for hermetic TLS tests.

func New

func New(backoff Backoff) *HTTPClient

New is a compact alias for NewClient.

func NewClient

func NewClient(backoff Backoff) *HTTPClient

NewClient returns a production client with normal TLS verification and no proxy or redirect support.

func NewTestClient

func NewTestClient(baseURL string, client *http.Client, backoff Backoff) (*HTTPClient, error)

NewTestClient permits a hermetic HTTPS endpoint and client. It deliberately rejects cleartext endpoints so tests cannot accidentally weaken TLS policy.

func (*HTTPClient) Limits

func (c *HTTPClient) Limits(ctx context.Context, token string) (LimitsResponse, error)

func (*HTTPClient) Send

func (c *HTTPClient) Send(ctx context.Context, payload domain.TargetPayload) (SendResponse, error)

func (*HTTPClient) Sounds

func (c *HTTPClient) Sounds(ctx context.Context, token string) (SoundsResponse, error)

func (*HTTPClient) ValidateRecipient

func (c *HTTPClient) ValidateRecipient(ctx context.Context, token, user string, devices []string) (RecipientValidation, error)

type LimitsResponse

type LimitsResponse struct {
	Limit, Remaining int
	Reset            int64
	RequestID        string
}

type RecipientValidation

type RecipientValidation struct {
	Valid     bool
	Devices   []string
	Licenses  []string
	RequestID string
}

type SendError

type SendError struct {
	Cause                error
	Phase                TransmissionPhase
	TransmissionPossible bool
}

SendError retains an internal cause for programmatic classification. Its string form is fixed so credentials, paths, and hostile upstream text stay out of diagnostics.

func (*SendError) Error

func (e *SendError) Error() string

func (SendError) Format

func (e SendError) Format(state fmt.State, _ rune)

Format has a value receiver so both SendError values and pointers use the redacted rendering. The exported Cause must never be exposed by %#v.

func (*SendError) Unwrap

func (e *SendError) Unwrap() error

type SendResponse

type SendResponse struct {
	RequestID      string
	ReceiptID      string
	QuotaRemaining *int
	QuotaLimit     *int64
	QuotaReset     *int64
}

type Sound

type Sound struct{ Name, Description string }

type SoundsResponse

type SoundsResponse struct {
	Sounds    []Sound
	RequestID string
}

type TransmissionPhase

type TransmissionPhase string
const (
	PhaseBeforeDial TransmissionPhase = "before_dial"
	PhaseConnect    TransmissionPhase = "connect"
	PhaseTLS        TransmissionPhase = "tls"
	PhaseWrite      TransmissionPhase = "write"
	PhaseRead       TransmissionPhase = "read"
	PhaseDecode     TransmissionPhase = "decode"
)

Jump to

Keyboard shortcuts

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