attendeeservice

package
v0.0.0-...-f663f49 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attendee

type Attendee struct {
	ID       int64  `json:"id"`       // badge number
	Nickname string `json:"nickname"` // fan name

	Email string `json:"email"`

	SpokenLanguages      string `json:"spoken_languages"`      // configurable subset of configured language codes, comma separated (de,en)
	RegistrationLanguage string `json:"registration_language"` // one out of configurable subset of RFC 5646 locales (default en-US)

	// comma separated lists, allowed choices are convention dependent
	Flags    string `json:"flags"`    // hc,anon,ev
	Packages string `json:"packages"` // room-none,attendance,stage,sponsor,sponsor2
	Options  string `json:"options"`  // art,anim,music,suit
}

type AttendeeIdList

type AttendeeIdList struct {
	Ids []int64 `json:"ids"`
}

type AttendeeService

type AttendeeService interface {
	// ListMyRegistrationIds which attendee ids belong to the current user?
	//
	// If your request was made with an api token, this will fail and should not be called.
	//
	// Admins are treated like normal users for this request, and will also only receive badge numbers
	// they have personally registered.
	//
	// Forwards the jwt from the request.
	ListMyRegistrationIds(ctx context.Context) ([]int64, error)

	// GetStatus obtains the status for a given attendee id.
	//
	// Nonexistent registrations will return StatusDeleted because the distinction isn't important.
	//
	// If your request was made by an admin, you can read everyone's status. A user can only read their own status.
	//
	// Forwards the jwt from the request.
	GetStatus(ctx context.Context, id int64) (Status, error)

	// GetAttendee obtains part of the registration information for given attendee id.
	//
	// Used for internal nickname lookups, etc.
	//
	// Uses the api token for full access, so access control must be performed in the implementation.
	GetAttendee(ctx context.Context, id int64) (Attendee, error)
}

func New

func New(attendeeServiceBaseUrl string) (AttendeeService, error)

type Impl

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

func (*Impl) GetAttendee

func (i *Impl) GetAttendee(ctx context.Context, id int64) (Attendee, error)

func (*Impl) GetStatus

func (i *Impl) GetStatus(ctx context.Context, id int64) (Status, error)

func (*Impl) ListMyRegistrationIds

func (i *Impl) ListMyRegistrationIds(ctx context.Context) ([]int64, error)

type Mock

type Mock interface {
	AttendeeService

	Reset()
	Unavailable()
	SetupRegistered(subject string, badgeNo int64, status Status, nickname string, email string)
}

func NewMock

func NewMock() Mock

type MockImpl

type MockImpl struct {
	IdsBySubject  map[string][]int64
	StatusById    map[int64]Status
	AttendeeById  map[int64]Attendee
	IsUnavailable bool
}

func (*MockImpl) GetAttendee

func (m *MockImpl) GetAttendee(ctx context.Context, id int64) (Attendee, error)

func (*MockImpl) GetStatus

func (m *MockImpl) GetStatus(ctx context.Context, id int64) (Status, error)

func (*MockImpl) ListMyRegistrationIds

func (m *MockImpl) ListMyRegistrationIds(ctx context.Context) ([]int64, error)

func (*MockImpl) Reset

func (m *MockImpl) Reset()

func (*MockImpl) SetupRegistered

func (m *MockImpl) SetupRegistered(subject string, badgeNo int64, status Status, nickname string, email string)

func (*MockImpl) Unavailable

func (m *MockImpl) Unavailable()

type Status

type Status string
var (
	StatusNew           Status = "new"
	StatusApproved      Status = "approved"
	StatusPartiallyPaid Status = "partially paid"
	StatusPaid          Status = "paid"
	StatusCheckedIn     Status = "checked in"
	StatusCancelled     Status = "cancelled"
	StatusWaiting       Status = "waiting"
	StatusDeleted       Status = "deleted"
)

type StatusDto

type StatusDto struct {
	Status Status `json:"status"`
}

Jump to

Keyboard shortcuts

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