domainmodels

package
v0.0.0-...-bbaddd9 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: AGPL-3.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ImageResultPerPage = 24

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKey

type APIKey struct {
	Id                 string
	OrganizationUserId string
	Name               string
	KeyPrefix          string
	LastUsedAt         *time.Time
	RevokedAt          *time.Time
	CreatedAt          time.Time
}

APIKey is a credential that lets an organization user call the HTTP API (e.g. /api/v1/createImages) without a browser session. The secret itself is never stored; only its hash and a short, displayable prefix are kept.

type ExternalImageIdentifier

type ExternalImageIdentifier struct {
	StorageDefinitionIdentifier string
	FileIdentifier              string
}

type Image

type Image struct {
	Id              string
	CreatedById     string
	CreatedAt       time.Time
	Name            string
	Identifier      string
	RootId          string
	ParentId        string
	Changes         string
	UploaderIP      string
	MIMEType        string
	NominalWidth    int32
	NominalHeight   int32
	NominalByteSize int32
	// ExpiresAt is when the image expires. nil means it never expires.
	// Expiry is only designed to transition an image to deleted, with no
	// other special handling.
	ExpiresAt *time.Time
}

func (*Image) GetURL

func (i *Image) GetURL(imageDomain string, isSecure bool, storedImages []*ExternalImageIdentifier, format ImageURLFormat) string

func (*Image) HashStr

func (i *Image) HashStr() string

func (*Image) IsExpiredAt

func (i *Image) IsExpiredAt(t time.Time) bool

func (*Image) ToPublic

func (i *Image) ToPublic() *PublicImage

ToPublic returns the public view of the image.

type ImageOrderField

type ImageOrderField struct {
	pagination.BaseOrderField
}

func NewImageOrderField

func NewImageOrderField(name string, asc bool) *ImageOrderField

func (*ImageOrderField) GetValue

func (f *ImageOrderField) GetValue(object interface{}) string

func (*ImageOrderField) Reverse

func (f *ImageOrderField) Reverse() pagination.OrderField

type ImageURLFormat

type ImageURLFormat string
const (
	ImageURLFormat_CANONICAL      ImageURLFormat = "canonical"
	ImageURLFormat_DIRECT         ImageURLFormat = "direct"
	ImageURLFormat_BACKEND_DIRECT ImageURLFormat = "backend_direct"
)

func (ImageURLFormat) IsValid

func (f ImageURLFormat) IsValid() bool

type ListImageResult

type ListImageResult struct {
	Images  []*Image
	HasNext bool
	HasPrev bool
}

type Organization

type Organization struct {
	Id          string
	DisplayName string
	Slug        string
}

type OrganizationUser

type OrganizationUser struct {
	Id               string
	Organization     *Organization
	User             *User
	Roles            []*Role
	UploadLimitBytes *int64
}

func (*OrganizationUser) CanManage

func (ou *OrganizationUser) CanManage(other *OrganizationUser) bool

func (*OrganizationUser) HasAdminAccess

func (ou *OrganizationUser) HasAdminAccess() bool

func (*OrganizationUser) IsSiteOwner

func (ou *OrganizationUser) IsSiteOwner() bool

type PublicImage

type PublicImage struct {
	Id              string
	CreatedAt       time.Time
	Name            string
	Identifier      string
	MIMEType        string
	NominalWidth    int32
	NominalHeight   int32
	NominalByteSize int32
	// Not for display; lets callers tell whether the viewer owns the image.
	CreatedById string
}

PublicImage is the part of an Image that can be shown to anyone, including anonymous visitors.

Any live image can be fetched by its link without authentication, so this view only exposes what a link holder can already see (content, size, type), plus its name and upload time. It must not expose the owner or related images (lineage, edit changes, stored copies): e.g. a blurred image's base parent is the unblurred original.

func (*PublicImage) GetURL

func (i *PublicImage) GetURL(imageDomain string, isSecure bool, storedImages []*ExternalImageIdentifier, format ImageURLFormat) string

func (*PublicImage) IsOwnedBy

func (i *PublicImage) IsOwnedBy(organizationUserId string) bool

IsOwnedBy reports whether the image was uploaded by the given organization user.

type Role

type Role struct {
	Id   string
	Key  string
	Name string
}

type StorageDefinition

type StorageDefinition struct {
	Id          string
	Identifier  string
	StorageType StorageTypeName
	Config      string
	IsEnabled   bool
	Priority    int32
}

type StorageTypeName

type StorageTypeName string
const (
	S3StorageType      StorageTypeName = "s3"
	FSStorageType      StorageTypeName = "fs"
	WebDavStorageType  StorageTypeName = "webdav"
	IPFSMFSStorageType StorageTypeName = "ipfs_mfs"
)

func (StorageTypeName) IsValid

func (s StorageTypeName) IsValid() bool

type StoredImage

type StoredImage struct {
	Id                  string
	Image               *Image
	StorageDefinitionId string
	FileIdentifier      string
	CopiedFrom          *StoredImage
	IsFileDeleted       bool
}

type User

type User struct {
	Id    string
	Email string
}

type UserWithOrganizationUsers

type UserWithOrganizationUsers struct {
	User              *User
	OrganizationUsers []*OrganizationUser
}

Jump to

Keyboard shortcuts

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