collectors

package
v0.20.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllFields added in v0.17.7

func AllFields() map[string][]Field

AllFields returns a copy of the whole table, keyed by slug, for the frontend.

func FieldSlugs added in v0.17.7

func FieldSlugs() []string

FieldSlugs lists the slugs that declare collector-only fields, sorted.

Types

type Field added in v0.17.7

type Field struct {
	Key         string `json:"key"`
	Label       string `json:"label"`
	Description string `json:"description"`
	Secret      bool   `json:"secret,omitempty"`
	Required    bool   `json:"required,omitempty"`
}

Field is one credential input the earnings collector needs and the deploy form does not already ask for.

A service's wizard form is built from the catalog's docker.env plus these fields. The container's environment contract and the collector's login are frequently NOT the same thing: Repocket's container authenticates with RP_EMAIL/RP_API_KEY while its collector signs in to Firebase with the account email and password, and a cookie-driven collector (EarnApp, Salad, PacketStream) needs a browser cookie the container never sees.

These live here, next to the collectors that read them, because the frontend's copy silently went stale: a web-catalog rename of Repocket's docker.env keys left the wizard with no field for the collector's credentials at all, so the collector could only ever answer "Repocket email and password are required". The frontend now renders whatever this table declares (AppState.collectorFields), and TestEveryCollectorCanReachItsCredentialsFromTheWizardForm proves every collector's required keys are reachable from docker.env plus this table.

func Fields added in v0.17.7

func Fields(slug string) []Field

Fields returns the collector-only credential inputs for slug, or nil when the service's collector needs nothing beyond the container's own environment.

type Option added in v0.17.9

type Option func(*Registry)

Option customises a Registry at construction time.

func WithHTTPClient added in v0.17.9

func WithHTTPClient(c *http.Client) Option

WithHTTPClient replaces the HTTP client every collector sends its requests through. The collectors' provider URLs are fixed (they are the platforms' real endpoints), so this is the one seam an end-to-end test needs to point them at a stand-in server instead of the internet. A nil client is ignored, leaving the 30s-timeout default in place, so production wiring is unchanged.

type Registry

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

func NewRegistry

func NewRegistry(st *store.Store, opts ...Option) *Registry

func (*Registry) Collect

func (r *Registry) Collect(ctx context.Context, slug string, credentials map[string]string) (store.EarningsRecord, error)

func (*Registry) Supports added in v0.7.0

func (r *Registry) Supports(slug string) bool

Supports reports whether slug has a native collector wired up. The scheduler uses it to skip deployed services that have no automated collector rather than persisting a spurious "not ported yet" error row for them on every cycle.

type Result

type Result struct {
	Platform string
	Balance  float64
	Currency string
	Error    string
}

Jump to

Keyboard shortcuts

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