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

invites

package
v0.2.2 Latest Latest
Warning

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

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

Documentation

Overview

Package invites implements expiring invitations with account-bound redemption.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	PlexID int64
	Email  string
}

type Deps

type Deps struct {
	Start func(context.Context) (id, code, authURL string, err error)
	Poll  func(context.Context, string) (*Account, error)
	Share func(context.Context, Account, Invite) error
	Apply func(context.Context, Account, Invite) error
	Now   func() time.Time
}

type Invite

type Invite struct {
	ID          int64         `json:"id"`
	Label       string        `json:"label"`
	Expires     time.Time     `json:"expires"`
	MaxUses     int           `json:"maxUses"`
	Uses        int           `json:"uses"`
	Policy      safety.Policy `json:"policy"`
	Sections    []int         `json:"sections"`
	Revoked     bool          `json:"revoked"`
	StreamLimit int           `json:"streamLimit"`
}

type Service

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

func New

func New(db *sql.DB, d Deps) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, in Invite) (Invite, string, error)

func (*Service) Handler

func (s *Service) Handler() http.Handler

func (*Service) PublicHandler

func (s *Service) PublicHandler() http.Handler

func (*Service) Redeem

func (s *Service) Redeem(ctx context.Context, in Invite, a Account) error

Jump to

Keyboard shortcuts

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