trans

package
v0.5.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const TypeKey = "type"

TypeKey should be set on a TransEntry to indicate the type of entry it is.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Type                  Type            `json:"type" bun:"-"`
	ID                    string          `json:"id" bun:",nullzero"`
	CreatedAt             *time.Time      `json:"createdAt" bun:",nullzero"`
	Username              string          `json:"username" bun:",nullzero"`
	Domain                string          `json:"domain,omitempty" bun:",nullzero"`
	HeaderRemoteURL       string          `json:"headerRemoteURL,omitempty" bun:",nullzero"`
	AvatarRemoteURL       string          `json:"avatarRemoteURL,omitempty" bun:",nullzero"`
	DisplayName           string          `json:"displayName,omitempty" bun:",nullzero"`
	Note                  string          `json:"note,omitempty" bun:",nullzero"`
	NoteRaw               string          `json:"noteRaw,omitempty" bun:",nullzero"`
	Memorial              *bool           `json:"memorial"`
	Bot                   *bool           `json:"bot"`
	Reason                string          `json:"reason,omitempty" bun:",nullzero"`
	Locked                *bool           `json:"locked"`
	Discoverable          *bool           `json:"discoverable"`
	Privacy               string          `json:"privacy,omitempty" bun:",nullzero"`
	Sensitive             *bool           `json:"sensitive"`
	Language              string          `json:"language,omitempty" bun:",nullzero"`
	StatusFormat          string          `json:"statusFormat,omitempty" bun:",nullzero"`
	URI                   string          `json:"uri" bun:",nullzero"`
	URL                   string          `json:"url" bun:",nullzero"`
	LastWebfingeredAt     *time.Time      `json:"lastWebfingeredAt,omitempty" bun:",nullzero"`
	InboxURI              string          `json:"inboxURI" bun:",nullzero"`
	OutboxURI             string          `json:"outboxURI" bun:",nullzero"`
	FollowingURI          string          `json:"followingUri" bun:",nullzero"`
	FollowersURI          string          `json:"followersUri" bun:",nullzero"`
	FeaturedCollectionURI string          `json:"featuredCollectionUri" bun:",nullzero"`
	ActorType             string          `json:"actorType" bun:",nullzero"`
	PrivateKey            *rsa.PrivateKey `json:"-" mapstructure:"-"`
	PrivateKeyString      string          `json:"privateKey,omitempty" mapstructure:"privateKey" bun:"-"`
	PublicKey             *rsa.PublicKey  `json:"-" mapstructure:"-"`
	PublicKeyString       string          `json:"publicKey,omitempty" mapstructure:"publicKey" bun:"-"`
	PublicKeyURI          string          `json:"publicKeyUri" bun:",nullzero"`
	SensitizedAt          *time.Time      `json:"sensitizedAt,omitempty" bun:",nullzero"`
	SilencedAt            *time.Time      `json:"silencedAt,omitempty" bun:",nullzero"`
	SuspendedAt           *time.Time      `json:"suspendedAt,omitempty" bun:",nullzero"`
	HideCollections       *bool           `json:"hideCollections"`
	SuspensionOrigin      string          `json:"suspensionOrigin,omitempty" bun:",nullzero"`
}

Account represents the minimum viable representation of an account for export/import.

type Block

type Block struct {
	Type            Type       `json:"type" bun:"-"`
	ID              string     `json:"id" bun:",nullzero"`
	CreatedAt       *time.Time `json:"createdAt" bun:",nullzero"`
	URI             string     `json:"uri" bun:",nullzero"`
	AccountID       string     `json:"accountId" bun:",nullzero"`
	TargetAccountID string     `json:"targetAccountId" bun:",nullzero"`
}

Block represents an account block as serialized in an exported file.

type DomainBlock

type DomainBlock struct {
	Type               Type       `json:"type" bun:"-"`
	ID                 string     `json:"id" bun:",nullzero"`
	CreatedAt          *time.Time `json:"createdAt" bun:",nullzero"`
	Domain             string     `json:"domain" bun:",nullzero"`
	CreatedByAccountID string     `json:"createdByAccountID" bun:",nullzero"`
	PrivateComment     string     `json:"privateComment,omitempty" bun:",nullzero"`
	PublicComment      string     `json:"publicComment,omitempty" bun:",nullzero"`
	Obfuscate          *bool      `json:"obfuscate" bun:",nullzero,notnull,default:false"`
	SubscriptionID     string     `json:"subscriptionID,omitempty" bun:",nullzero"`
}

DomainBlock represents a domain block as serialized in an exported file.

type Entry

type Entry map[string]interface{}

Entry is used for deserializing trans entries into a rough interface so that the TypeKey can be fetched, before continuing with full parsing.

type Follow

type Follow struct {
	Type            Type       `json:"type" bun:"-"`
	ID              string     `json:"id" bun:",nullzero"`
	CreatedAt       *time.Time `json:"createdAt" bun:",nullzero"`
	URI             string     `json:"uri" bun:",nullzero"`
	AccountID       string     `json:"accountId" bun:",nullzero"`
	TargetAccountID string     `json:"targetAccountId" bun:",nullzero"`
}

Follow represents an account follow as serialized in an export file.

type FollowRequest

type FollowRequest struct {
	Type            Type       `json:"type" bun:"-"`
	ID              string     `json:"id" bun:",nullzero"`
	CreatedAt       *time.Time `json:"createdAt" bun:",nullzero"`
	URI             string     `json:"uri" bun:",nullzero"`
	AccountID       string     `json:"accountId" bun:",nullzero"`
	TargetAccountID string     `json:"targetAccountId" bun:",nullzero"`
}

FollowRequest represents an account follow request as serialized in an export file.

type Instance

type Instance struct {
	Type                   Type       `json:"type" bun:"-"`
	ID                     string     `json:"id" bun:",nullzero"`
	CreatedAt              *time.Time `json:"createdAt" bun:",nullzero"`
	Domain                 string     `json:"domain" bun:",nullzero"`
	Title                  string     `json:"title,omitempty" bun:",nullzero"`
	URI                    string     `json:"uri" bun:",nullzero"`
	SuspendedAt            *time.Time `json:"suspendedAt,omitempty" bun:",nullzero"`
	DomainBlockID          string     `json:"domainBlockID,omitempty" bun:",nullzero"`
	ShortDescription       string     `json:"shortDescription,omitempty" bun:",nullzero"`
	Description            string     `json:"description,omitempty" bun:",nullzero"`
	Terms                  string     `json:"terms,omitempty" bun:",nullzero"`
	ContactEmail           string     `json:"contactEmail,omitempty" bun:",nullzero"`
	ContactAccountUsername string     `json:"contactAccountUsername,omitempty" bun:",nullzero"`
	ContactAccountID       string     `json:"contactAccountID,omitempty" bun:",nullzero"`
	Reputation             int64      `json:"reputation"`
	Version                string     `json:"version,omitempty" bun:",nullzero"`
}

Instance represents an instance entry as serialized in an export file.

type Type

type Type string

Type describes the type of a trans entry, and how it should be read/serialized.

const (
	TransAccount          Type = "account"
	TransBlock            Type = "block"
	TransDomainBlock      Type = "domainBlock"
	TransEmailDomainBlock Type = "emailDomainBlock"
	TransFollow           Type = "follow"
	TransFollowRequest    Type = "followRequest"
	TransInstance         Type = "instance"
	TransUser             Type = "user"
)

Type of the trans entry. Describes how it should be read from file.

type User

type User struct {
	Type                Type       `json:"type" bun:"-"`
	ID                  string     `json:"id" bun:",nullzero"`
	CreatedAt           *time.Time `json:"createdAt" bun:",nullzero"`
	Email               string     `json:"email,omitempty" bun:",nullzero"`
	AccountID           string     `json:"accountID" bun:",nullzero"`
	EncryptedPassword   string     `json:"encryptedPassword" bun:",nullzero"`
	CurrentSignInAt     *time.Time `json:"currentSignInAt,omitempty" bun:",nullzero"`
	LastSignInAt        *time.Time `json:"lastSignInAt,omitempty" bun:",nullzero"`
	InviteID            string     `json:"inviteID,omitempty" bun:",nullzero"`
	ChosenLanguages     []string   `json:"chosenLanguages,omitempty" bun:",nullzero"`
	FilteredLanguages   []string   `json:"filteredLanguage,omitempty" bun:",nullzero"`
	Locale              string     `json:"locale" bun:",nullzero"`
	LastEmailedAt       time.Time  `json:"lastEmailedAt,omitempty" bun:",nullzero"`
	ConfirmationToken   string     `json:"confirmationToken,omitempty" bun:",nullzero"`
	ConfirmationSentAt  *time.Time `json:"confirmationTokenSentAt,omitempty" bun:",nullzero"`
	ConfirmedAt         *time.Time `json:"confirmedAt,omitempty" bun:",nullzero"`
	UnconfirmedEmail    string     `json:"unconfirmedEmail,omitempty" bun:",nullzero"`
	Moderator           *bool      `json:"moderator" bun:",nullzero,notnull,default:false"`
	Admin               *bool      `json:"admin" bun:",nullzero,notnull,default:false"`
	Disabled            *bool      `json:"disabled" bun:",nullzero,notnull,default:false"`
	Approved            *bool      `json:"approved" bun:",nullzero,notnull,default:false"`
	ResetPasswordToken  string     `json:"resetPasswordToken,omitempty" bun:",nullzero"`
	ResetPasswordSentAt *time.Time `json:"resetPasswordSentAt,omitempty" bun:",nullzero"`
}

User represents a local instance user as serialized to an export file.

Jump to

Keyboard shortcuts

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