model

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

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

Go to latest
Published: Apr 30, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Snowflakes = util.NewSnowflake()
)

Functions

func FromVis

func FromVis(value PostVisibility) string

Types

type Account

type Account struct {
	Id         int64
	Sid        string
	FullName   string
	Nick       string
	Email      string
	Visibility AccountVisibility
	CreatedAt  *time.Time
	UpdatedAt  *time.Time
	RoleMask   RoleMask
	*AccountProfile
	*AccountSecurity
}

func (*Account) Created

func (a *Account) Created() string

func (*Account) URI

func (a *Account) URI() string

type AccountField

type AccountField struct {
	AccountID  uint
	Name       string
	Value      string
	VerifiedAt time.Time
}

type AccountProfile

type AccountProfile struct {
	AccountID uint
	Note      string
	Avatar    string
	Header    string
	Fields    []AccountField
}

type AccountSecurity

type AccountSecurity struct {
	AccountId    uint
	PasswordHash []byte
	PublicKey    []byte
	PrivateKey   []byte
}

type AccountVisibility

type AccountVisibility int32
const (
	Public    AccountVisibility = 0
	Protected AccountVisibility = 1
	Private   AccountVisibility = 2
)

type Actor

type Actor struct {
	Id             string
	Type           string
	Email          string
	PrivateKey     []byte
	PrivateKeySalt []byte
	PublicKey      string
	CreatedAt      time.Time
	Properties     string
}

type ActorFavorite

type ActorFavorite struct {
	Id        string
	ActorId   string
	ObjectId  string
	CreatedAt time.Time
}

type ActorFollowing

type ActorFollowing struct {
	Id                 string
	ActorId            string
	TargetActorId      string
	TargetActorAccount string
	State              string
	CreatedAt          time.Time
}

type ActorNotification

type ActorNotification struct {
	Id          int
	Type        string
	ActorId     string
	FromActorId string
	ObjectId    string
	CreatedAt   time.Time
}

type ActorReblog

type ActorReblog struct {
	Id        string
	ActorId   string
	ObjectId  string
	CreatedAt time.Time
}

type ActorReply

type ActorReply struct {
	Id                string
	ActorId           string
	ObjectId          string
	InReplyToObjectId string
	CreatedAt         time.Time
}

type Entry

type Entry struct {
	*Toot
	// contains filtered or unexported fields
}

func (*Entry) MediaAttachments

func (e *Entry) MediaAttachments() ([]*TootMedia, error)

func (*Entry) Tags

func (e *Entry) Tags() ([]*TootTag, error)

type InboxObject

type InboxObject struct {
	Id        string
	ActorId   string
	ObjectId  string
	CreatedAt time.Time
}

type OauthClient

type OauthClient struct {
	Id           uint64
	Name         string `json:"name"`
	ClientId     string `json:"client_id"`
	Secret       string `json:"client_secret"`
	RedirectUris string `json:"redirect_uri"`
	Website      string `json:"website"`
	AccountId    uint64
	Scopes       string
	CreatedAt    time.Time
}

func (*OauthClient) GetDomain

func (x *OauthClient) GetDomain() string

func (*OauthClient) GetID

func (x *OauthClient) GetID() string

func (*OauthClient) GetSecret

func (x *OauthClient) GetSecret() string

func (*OauthClient) GetUserID

func (x *OauthClient) GetUserID() string

type OauthToken

type OauthToken struct {
	ClientId            string
	AccountId           uint64
	RedirectUri         string
	Scope               string
	Code                string
	CodeChallenge       string
	CodeChallengeMethod string
	CodeCreatedAt       time.Time
	CodeExpiresIn       time.Duration
	Access              string
	AccessCreatedAt     time.Time
	AccessExpiresIn     time.Duration
	Refresh             string
	RefreshCreatedAt    time.Time
	RefreshExpiresIn    time.Duration
	CreatedAt           time.Time
}

func (*OauthToken) GetAccess

func (ot *OauthToken) GetAccess() string

func (*OauthToken) GetAccessCreateAt

func (ot *OauthToken) GetAccessCreateAt() time.Time

func (*OauthToken) GetAccessExpiresIn

func (ot *OauthToken) GetAccessExpiresIn() time.Duration

func (*OauthToken) GetClientID

func (ot *OauthToken) GetClientID() string

func (*OauthToken) GetCode

func (ot *OauthToken) GetCode() string

func (*OauthToken) GetCodeChallenge

func (ot *OauthToken) GetCodeChallenge() string

func (*OauthToken) GetCodeChallengeMethod

func (ot *OauthToken) GetCodeChallengeMethod() oauth2.CodeChallengeMethod

func (*OauthToken) GetCodeCreateAt

func (ot *OauthToken) GetCodeCreateAt() time.Time

func (*OauthToken) GetCodeExpiresIn

func (ot *OauthToken) GetCodeExpiresIn() time.Duration

func (*OauthToken) GetRedirectURI

func (ot *OauthToken) GetRedirectURI() string

func (*OauthToken) GetRefresh

func (ot *OauthToken) GetRefresh() string

func (*OauthToken) GetRefreshCreateAt

func (ot *OauthToken) GetRefreshCreateAt() time.Time

func (*OauthToken) GetRefreshExpiresIn

func (ot *OauthToken) GetRefreshExpiresIn() time.Duration

func (*OauthToken) GetScope

func (ot *OauthToken) GetScope() string

func (*OauthToken) GetUserID

func (ot *OauthToken) GetUserID() string

func (*OauthToken) New

func (ot *OauthToken) New() oauth2.TokenInfo

func (*OauthToken) SetAccess

func (ot *OauthToken) SetAccess(s string)

func (*OauthToken) SetAccessCreateAt

func (ot *OauthToken) SetAccessCreateAt(s time.Time)

func (*OauthToken) SetAccessExpiresIn

func (ot *OauthToken) SetAccessExpiresIn(s time.Duration)

func (*OauthToken) SetClientID

func (ot *OauthToken) SetClientID(ci string)

func (*OauthToken) SetCode

func (ot *OauthToken) SetCode(s string)

func (*OauthToken) SetCodeChallenge

func (ot *OauthToken) SetCodeChallenge(s string)

func (*OauthToken) SetCodeChallengeMethod

func (ot *OauthToken) SetCodeChallengeMethod(ccm oauth2.CodeChallengeMethod)

func (*OauthToken) SetCodeCreateAt

func (ot *OauthToken) SetCodeCreateAt(s time.Time)

func (*OauthToken) SetCodeExpiresIn

func (ot *OauthToken) SetCodeExpiresIn(s time.Duration)

func (*OauthToken) SetRedirectURI

func (ot *OauthToken) SetRedirectURI(ru string)

func (*OauthToken) SetRefresh

func (ot *OauthToken) SetRefresh(s string)

func (*OauthToken) SetRefreshCreateAt

func (ot *OauthToken) SetRefreshCreateAt(s time.Time)

func (*OauthToken) SetRefreshExpiresIn

func (ot *OauthToken) SetRefreshExpiresIn(s time.Duration)

func (*OauthToken) SetScope

func (ot *OauthToken) SetScope(s string)

func (*OauthToken) SetUserID

func (ot *OauthToken) SetUserID(ui string)

type Object

type Object struct {
	Id               string
	MastodonId       string
	Type             string
	CreatedAt        time.Time
	OriginalActorId  string
	OriginalObjectId string
	ReplyToObjectId  string
	Properties       string
	Local            int
}

type OutboxObjects

type OutboxObjects struct {
	Id          string
	ActorId     string
	ObjectId    string
	Target      string
	CreatedAt   time.Time
	PublishedAt time.Time
}

type PostVisibility

type PostVisibility int
var (
	VisPublic    PostVisibility = 0
	VisUnlisted  PostVisibility = 1
	VisPrivate   PostVisibility = 2
	VisDirect    PostVisibility = 3
	VisLimited   PostVisibility = 4
	Visibilities                = map[PostVisibility]string{
		VisPublic:   "public",
		VisUnlisted: "unlisted",
		VisPrivate:  "private",
		VisDirect:   "direct",
		VisLimited:  "limited",
	}
)

func ToVis

func ToVis(word string) PostVisibility

type QueryResult

type QueryResult struct {
	Toots []*Entry
}

func (*QueryResult) IsEmpty

func (qr *QueryResult) IsEmpty() bool

type RoleMask

type RoleMask int32
const (
	RoleUser RoleMask = 1 << iota
	RoleModerator
	RoleAdmin

	RoleAll RoleMask = RoleUser | RoleModerator | RoleAdmin
)

type Subscription

type Subscription struct {
	Id                 string
	ActorId            string
	ClientId           string
	Endpoint           string
	KeyP256dh          string
	KeyAuth            string
	AlertMention       int
	AlertStatus        int
	AlertReblog        int
	AlertFollow        int
	AlertFollowRequest int
	AlertFavorite      int
	AlertPoll          int
	AlertUpdate        int
	AlertAdminSignUp   int
	AlertAdminReport   int
	Policy             string
	CreatedAt          time.Time
}

type TimelineQuery

type TimelineQuery struct {
	// these parameters match Mastodon's API parameters
	MinId     string
	MaxId     string
	SinceId   string
	Limit     uint64
	ListId    uint64
	Local     bool
	Remote    bool
	OnlyMedia bool

	Visibility PostVisibility
	// contains filtered or unexported fields
}

func TQ

func TQ(db *sqlx.DB) *TimelineQuery

func (*TimelineQuery) Execute

func (tq *TimelineQuery) Execute() (*QueryResult, error)

type Toot

type Toot struct {
	Sid                string `json:"id"`
	Uri                string `json:"uri"`
	AccountId          uint64
	ActorId            uint64
	BoostOfId          *string
	InReplyTo          *string `json:"in_reply_to_id,omitempty"`
	InReplyToAccountId *uint64 `json:"in_reply_to_account_id,omitempty"`
	Summary            string  `json:"spoiler_text"`
	Content            string  `json:"content"`
	Lang               string  `json:"language"`
	Visibility         PostVisibility
	CreatedAt          time.Time `json:"created_at"`
	AuthorId           string
	CollectionId       *uint64
	PollId             *uint64
	AppId              *uint64
	LastEditAt         *time.Time
	UpdatedAt          time.Time
	DeletedAt          *time.Time
}

func (*Toot) Viz

func (t *Toot) Viz() string

type TootMedia

type TootMedia struct {
	Id            uint64
	Sid           string
	AccountId     string
	Salt          string
	MimeType      string
	Path          string
	ThumbMimeType string
	ThumbPath     string
	Meta          string
	Description   string
	Blurhash      string
	CreatedAt     time.Time
}
{
  "id": "22345792",
  "type": "image",
  "url": "https://files.mastodon.social/media_attachments/files/022/345/792/original/57859aede991da25.jpeg",
  "preview_url": "https://files.mastodon.social/media_attachments/files/022/345/792/small/57859aede991da25.jpeg",
  "remote_url": null,
  "text_url": "https://mastodon.social/media/2N4uvkuUtPVrkZGysms",
  "meta": {
    "original": {
      "width": 640,
      "height": 480,
      "size": "640x480",
      "aspect": 1.3333333333333333
    },
    "small": {
      "width": 461,
      "height": 346,
      "size": "461x346",
      "aspect": 1.3323699421965318
    },
    "focus": {
      "x": -0.27,
      "y": 0.51
    }
  },
  "description": "test media description",
  "blurhash": "UFBWY:8_0Jxv4mx]t8t64.%M-:IUWGWAt6M}"
}

func (*TootMedia) DiskPath

func (tm *TootMedia) DiskPath(variant string) string

func (*TootMedia) FullUri

func (tm *TootMedia) FullUri() string

func (*TootMedia) PublicUri

func (tm *TootMedia) PublicUri(variant string) string

func (*TootMedia) ThumbUri

func (tm *TootMedia) ThumbUri() string

type TootTag

type TootTag struct {
	Sid       string
	Tag       string
	CreatedAt time.Time
}

Jump to

Keyboard shortcuts

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