handle

package
v0.0.0-...-5c487ac Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Feature

func Feature(
	instrumentationFactory request.InstrumentationFactory,
	featureDecisionMakerFactory feature.DecisionMakerFactory,
	authenticator authenticator.Authenticator,
) router.Handle

Feature retrieves the status of feature toggle.

func LongLink(
	instrumentationFactory request.InstrumentationFactory,
	shortLinkRetriever shortlink.Retriever,
	timer timer.Timer,
	webFrontendURL url.URL,
) router.Handle

LongLink translates alias to the original long link.

func SSOSignIn

func SSOSignIn(
	singleSignOn sso.SingleSignOn,
	webFrontendURL string,
) router.Handle

SSOSignIn redirects user to the sign in page.

func SSOSignInCallback

func SSOSignInCallback(
	singleSignOn sso.SingleSignOn,
	webFrontendURL url.URL,
) router.Handle

SSOSignInCallback generates Short's authentication token given identity provider's authorization code.

func Search(
	instrumentationFactory request.InstrumentationFactory,
	searcher search.Search,
	authenticator authenticator.Authenticator,
) router.Handle

Search fetches resources under certain criteria.

func ServeDir

func ServeDir(dir string) router.Handle

ServeDir reads files in the given directory and makes them accessible on the web.

func ServeFile

func ServeFile(fileName string) router.Handle

ServeFile reads a given file and makes it accessible on the web.

func Track

func Track(instrumentationFactory request.InstrumentationFactory) router.Handle

Track records event happened in the API caller.

Types

type Filter

type Filter struct {
	MaxResults int
	Resources  []search.Resource
	Orders     []order.By
}

Filter represents the filter field received from Search API.

func (*Filter) UnmarshalJSON

func (f *Filter) UnmarshalJSON(data []byte) error

UnmarshalJSON parses json into Filter.

type SearchRequest

type SearchRequest struct {
	Query  string `json:"query"`
	Filter Filter `json:"filter"`
}

SearchRequest represents the request received from Search API.

type SearchResponse

type SearchResponse struct {
	ShortLinks []ShortLink `json:"short_links,omitempty"`
	Users      []User      `json:"users,omitempty"`
}

SearchResponse represents the response to the Search API request.

type ShortLink struct {
	Alias     string     `json:"alias,omitempty"`
	LongLink  string     `json:"long_link,omitempty"`
	ExpireAt  *time.Time `json:"expire_at,omitempty"`
	CreatedAt *time.Time `json:"created_at,omitempty"`
	UpdatedAt *time.Time `json:"updated_at,omitempty"`
}

ShortLink represents the short_link field of Search API respond.

type User

type User struct {
	ID             string     `json:"id,omitempty"`
	Name           string     `json:"name,omitempty"`
	Email          string     `json:"email,omitempty"`
	LastSignedInAt *time.Time `json:"last_signed_in_at,omitempty"`
	CreatedAt      *time.Time `json:"created_at,omitempty"`
	UpdatedAt      *time.Time `json:"updated_at,omitempty"`
}

User represents the user field of Search API respond.

Jump to

Keyboard shortcuts

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