invitation

package
v0.0.1-dev.7 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package invitation is the one operation Holon defines itself. SCIM 2.0 has no invitation and each backend invites differently, so no standard applies.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalid     = errors.New("invitation invalid")
	ErrUnavailable = errors.New("invitation unavailable")
)

Functions

func Handler

func Handler(backend Backend, bearer string) http.Handler

Handler serves backend at POST /v1/invitations. Every request carries the shared bearer.

Types

type Backend

type Backend interface {
	Invite(context.Context, Invitation) (Result, error)
}

Backend sends invitations. Invite is idempotent on Email: a repeat re-sends. ErrInvalid reports an address or group the backend refuses.

type Client

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

Client calls Handler from Holon's side.

func NewClient

func NewClient(endpoint, bearer string, transport *http.Client) (*Client, error)

NewClient returns a Client for the adapter at endpoint, the base URL that /v1/invitations hangs from.

func (*Client) Invite

func (c *Client) Invite(ctx context.Context, invitation Invitation) (Result, error)

Invite posts invitation. A refusal is ErrInvalid; an authentication failure or any other status is ErrUnavailable.

type Invitation

type Invitation struct {
	Email    string        `json:"email"`
	Groups   []string      `json:"groups,omitempty"`
	Lifetime time.Duration `json:"lifetime"`
}

Invitation asks the backend to make sure the person exists, place them in Groups, which are SCIM Group ids, and send them a way to finish setting up. The link is valid for Lifetime and no longer, and is refused once the person has finished setting up. On the wire Lifetime is an integer number of seconds.

func (Invitation) MarshalJSON

func (i Invitation) MarshalJSON() ([]byte, error)

func (*Invitation) UnmarshalJSON

func (i *Invitation) UnmarshalJSON(data []byte) error

type Result

type Result struct {
	UserID    string    `json:"userId"`
	Sent      bool      `json:"sent"`
	ExpiresAt time.Time `json:"expiresAt,omitzero"`
}

Result says what happened. Sent is false only when the backend cannot send mail; the user still exists and holds the groups.

Jump to

Keyboard shortcuts

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