v1

package
v0.0.0-...-0f594a8 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const InstanceHostnameCache = 60 * 60 // 1 hour

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Cache cache.Cache
	DB    db.DB
	HTTP  *http.Client
	Tokz  *token.Tokenizer

	AppName      string
	AppWebsite   string
	ServerSchema string
	ServerHost   string
}
type Link struct {
	Href     string `json:"href,omitempty"`
	Rel      string `json:"rel,omitempty" xml:"rel,attr"`
	Template string `json:"template,omitempty" xml:"template,attr"`
	Type     string `json:"type,omitempty"`
}

Link represents a link.

type Logic

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

func New

func New(config *Config) *Logic

func (*Logic) CountInstances

func (l *Logic) CountInstances(ctx context.Context) (int64, error)

func (*Logic) CountTags

func (l *Logic) CountTags(ctx context.Context) (int64, error)

func (*Logic) CreateInstance

func (l *Logic) CreateInstance(ctx context.Context, instance *models.Instance) error

func (*Logic) CreateTag

func (l *Logic) CreateTag(ctx context.Context, tag *models.Tag) error

func (*Logic) GetLoginURL

func (l *Logic) GetLoginURL(ctx context.Context, instance *models.Instance) (*url.URL, error)

func (*Logic) GetOrCreateInstance

func (l *Logic) GetOrCreateInstance(ctx context.Context, domain string) (*models.Instance, error)

func (*Logic) MastodonOauth

func (l *Logic) MastodonOauth(r *http.Request, instance *models.Instance) (*models.Account, int, error)

func (*Logic) NewInstanceFromDomain

func (l *Logic) NewInstanceFromDomain(ctx context.Context, domain string) (*models.Instance, error)

func (*Logic) ReadAccount

func (l *Logic) ReadAccount(ctx context.Context, id int64) (*models.Account, error)

func (*Logic) ReadAccountByUsername

func (l *Logic) ReadAccountByUsername(ctx context.Context, username string, instanceID int64) (*models.Account, error)

func (*Logic) ReadInstance

func (l *Logic) ReadInstance(ctx context.Context, id int64) (*models.Instance, error)

func (*Logic) ReadInstanceByDomain

func (l *Logic) ReadInstanceByDomain(ctx context.Context, domain string) (*models.Instance, error)

func (*Logic) ReadInstanceByToken

func (l *Logic) ReadInstanceByToken(ctx context.Context, t string) (*models.Instance, error)

func (*Logic) ReadInstancesPage

func (l *Logic) ReadInstancesPage(ctx context.Context, index, count int) ([]*models.Instance, error)

func (*Logic) ReadTagByName

func (l *Logic) ReadTagByName(ctx context.Context, name string) (*models.Tag, error)

func (*Logic) ReadTagsPage

func (l *Logic) ReadTagsPage(ctx context.Context, index, count int) ([]*models.Tag, error)

Jump to

Keyboard shortcuts

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