api

package
v0.0.0-...-22af0ca Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultEndpoint = "https://span.app/api/external/v1"
)

Variables

This section is empty.

Functions

func NewUnknownError

func NewUnknownError() error

Types

type ClientOption

type ClientOption func(*clientOptions) *clientOptions

func WithEndpoint

func WithEndpoint(endpoint string) ClientOption

func WithToken

func WithToken(token string) ClientOption

type Error

type Error struct {
	Code    ErrorCode
	Message string
}

Error is a proxy for API errors @TODO: Coerce to human readable

func (Error) Error

func (e Error) Error() string

type ErrorCode

type ErrorCode string
const (
	ErrorCodeUnknownError ErrorCode = "unknown_error"
)

type FindPeopleRequest

type FindPeopleRequest struct {
	Email   string
	TeamIDs []string
}

type FindPeopleResponse

type FindPeopleResponse struct {
	ResponseWithMeta
	Data []PersonWithTeam `json:"data"`
}

type FindTeamResponse

type FindTeamResponse struct {
	ResponseWithMeta
	Data TeamWithMembers `json:"data"`
}

type FindTeamsRequest

type FindTeamsRequest struct {
	Name string
}

type FindTeamsResponse

type FindTeamsResponse struct {
	ResponseWithMeta
	Data []Team `json:"data"`
}

type Meta

type Meta struct {
}

type NamedEntity

type NamedEntity struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Person

type Person struct {
	Email string `json:"email"`
	Name  string `json:"name"`
}

type PersonWithTeam

type PersonWithTeam struct {
	Person
	Teams []NamedEntity `json:"teams"`
}

type ResponseWithMeta

type ResponseWithMeta struct {
	Meta Meta `json:"meta"`
}

type SpanAPIClient

type SpanAPIClient interface {
	FindPeople(r FindPeopleRequest) ([]PersonWithTeam, error)
	FindTeams(r FindTeamsRequest) ([]Team, error)
	FindTeamByID(teamID string) (*TeamWithMembers, error)
}

func NewSpanAPIClient

func NewSpanAPIClient(opt ...ClientOption) (SpanAPIClient, error)

NewSpanAPIClient instantiates a new client able to connect to the SPAN api

type Team

type Team struct {
	NamedEntity
	Slug      string    `json:"slug"`
	CreatedAt time.Time `json:"createdAt"`
}

type TeamMember

type TeamMember struct {
	Person
	TeamLead bool `json:"teamLead"`
}

type TeamWithMembers

type TeamWithMembers struct {
	Team
	Members []TeamMember `json:"members"`
}

Jump to

Keyboard shortcuts

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