asset

package
v0.0.0-...-c580262 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoProjectID = rerror.NewE(i18n.T("projectID is required"))
	ErrZeroSize    = rerror.NewE(i18n.T("file size cannot be zero"))
	ErrNoUser      = rerror.NewE(i18n.T("createdBy is required"))
	ErrNoThread    = rerror.NewE(i18n.T("thread is required"))
	ErrNoUUID      = rerror.NewE(i18n.T("uuid is required"))
)
View Source
var ErrInvalidID = id.ErrInvalidID
View Source
var IDFrom = id.AssetIDFrom
View Source
var IDFromRef = id.AssetIDFromRef
View Source
var MustID = id.MustAssetID
View Source
var MustProjectID = id.MustProjectID
View Source
var MustThreadID = id.MustThreadID
View Source
var MustUserID = id.MustUserID
View Source
var NewID = id.NewAssetID
View Source
var NewIntegrationID = id.NewIntegrationID
View Source
var NewProjectID = id.NewProjectID
View Source
var NewThreadID = id.NewThreadID
View Source
var ProjectIDFrom = id.ProjectIDFrom
View Source
var ProjectIDFromRef = id.ProjectIDFromRef
View Source
var ThreadIDFrom = id.ThreadIDFrom
View Source
var ThreadIDFromRef = id.ThreadIDFromRef

Functions

This section is empty.

Types

type ArchiveExtractionStatus

type ArchiveExtractionStatus string
const (
	ArchiveExtractionStatusSkipped    ArchiveExtractionStatus = "skipped"
	ArchiveExtractionStatusPending    ArchiveExtractionStatus = "pending"
	ArchiveExtractionStatusInProgress ArchiveExtractionStatus = "in_progress"
	ArchiveExtractionStatusDone       ArchiveExtractionStatus = "done"
	ArchiveExtractionStatusFailed     ArchiveExtractionStatus = "failed"
)

func ArchiveExtractionStatusFrom

func ArchiveExtractionStatusFrom(s string) (ArchiveExtractionStatus, bool)

func ArchiveExtractionStatusFromRef

func ArchiveExtractionStatusFromRef(s *string) *ArchiveExtractionStatus

func (ArchiveExtractionStatus) String

func (s ArchiveExtractionStatus) String() string

func (*ArchiveExtractionStatus) StringRef

func (s *ArchiveExtractionStatus) StringRef() *string

type Asset

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

func (*Asset) ArchiveExtractionStatus

func (a *Asset) ArchiveExtractionStatus() *ArchiveExtractionStatus

func (*Asset) Clone

func (a *Asset) Clone() *Asset

func (*Asset) CreatedAt

func (a *Asset) CreatedAt() time.Time

func (*Asset) FileName

func (a *Asset) FileName() string

func (*Asset) FlatFiles

func (a *Asset) FlatFiles() bool

func (*Asset) ID

func (a *Asset) ID() ID

func (*Asset) Integration

func (a *Asset) Integration() *IntegrationID

func (*Asset) PreviewType

func (a *Asset) PreviewType() *PreviewType

func (*Asset) Project

func (a *Asset) Project() ProjectID

func (*Asset) Size

func (a *Asset) Size() uint64

func (*Asset) Thread

func (a *Asset) Thread() ThreadID

func (*Asset) UUID

func (a *Asset) UUID() string

func (*Asset) UpdateArchiveExtractionStatus

func (a *Asset) UpdateArchiveExtractionStatus(s *ArchiveExtractionStatus)

func (*Asset) UpdatePreviewType

func (a *Asset) UpdatePreviewType(p *PreviewType)

func (*Asset) User

func (a *Asset) User() *accountdomain.UserID

type Builder

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

func New

func New() *Builder

func (*Builder) ArchiveExtractionStatus

func (b *Builder) ArchiveExtractionStatus(s *ArchiveExtractionStatus) *Builder

func (*Builder) Build

func (b *Builder) Build() (*Asset, error)

func (*Builder) CreatedAt

func (b *Builder) CreatedAt(createdAt time.Time) *Builder

func (*Builder) CreatedByIntegration

func (b *Builder) CreatedByIntegration(createdBy IntegrationID) *Builder

func (*Builder) CreatedByUser

func (b *Builder) CreatedByUser(createdBy accountdomain.UserID) *Builder

func (*Builder) FileName

func (b *Builder) FileName(name string) *Builder

func (*Builder) FlatFiles

func (b *Builder) FlatFiles(flatFiles bool) *Builder

func (*Builder) ID

func (b *Builder) ID(id ID) *Builder

func (*Builder) MustBuild

func (b *Builder) MustBuild() *Asset

func (*Builder) NewID

func (b *Builder) NewID() *Builder

func (*Builder) NewUUID

func (b *Builder) NewUUID() *Builder

func (*Builder) Project

func (b *Builder) Project(pid ProjectID) *Builder

func (*Builder) Size

func (b *Builder) Size(size uint64) *Builder

func (*Builder) Thread

func (b *Builder) Thread(th ThreadID) *Builder

func (*Builder) Type

func (b *Builder) Type(t *PreviewType) *Builder

func (*Builder) UUID

func (b *Builder) UUID(uuid string) *Builder

type File

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

func FoldFiles

func FoldFiles(files []*File, parent *File) *File

FoldFiles organizes files into directories and returns the files as children of the parent directory. The parent directory refers to a zip file located in the root directory and is treated as the root directory.

func (*File) AppendChild

func (f *File) AppendChild(c *File)

func (*File) Children

func (f *File) Children() []*File

func (*File) Clone

func (f *File) Clone() *File

func (*File) ContentType

func (f *File) ContentType() string

func (*File) FilePaths

func (f *File) FilePaths() []string

func (*File) Files

func (f *File) Files() []*File

func (*File) FlattenChildren

func (f *File) FlattenChildren() (res []*File)

FlattenChildren recursively collects all children of the File object into a flat slice. It returns a slice of File objects containing all children in a flattened structure.

func (*File) IsDir

func (f *File) IsDir() bool

func (*File) Name

func (f *File) Name() string

func (*File) Path

func (f *File) Path() string

func (*File) RootPath

func (f *File) RootPath(uuid string) string

func (*File) SetFiles

func (f *File) SetFiles(s []*File)

func (*File) SetName

func (f *File) SetName(n string)

func (*File) Size

func (f *File) Size() uint64

type FileBuilder

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

func NewFile

func NewFile() *FileBuilder

func (*FileBuilder) Build

func (b *FileBuilder) Build() *File

func (*FileBuilder) Children

func (b *FileBuilder) Children(children []*File) *FileBuilder

func (*FileBuilder) ContentType

func (b *FileBuilder) ContentType(contentType string) *FileBuilder

func (*FileBuilder) Dir

func (b *FileBuilder) Dir() *FileBuilder

func (*FileBuilder) Files

func (b *FileBuilder) Files(files []*File) *FileBuilder

func (*FileBuilder) GuessContentType

func (b *FileBuilder) GuessContentType() *FileBuilder

func (*FileBuilder) Name

func (b *FileBuilder) Name(name string) *FileBuilder

func (*FileBuilder) Path

func (b *FileBuilder) Path(filePath string) *FileBuilder

func (*FileBuilder) Size

func (b *FileBuilder) Size(size uint64) *FileBuilder

type ID

type ID = id.AssetID

type IDList

type IDList = id.AssetIDList

type IntegrationID

type IntegrationID = id.IntegrationID

type List

type List []*Asset

func (List) Clone

func (l List) Clone() List

func (List) IDs

func (l List) IDs() (ids id.AssetIDList)

func (List) Map

func (l List) Map() Map

func (List) SortByID

func (l List) SortByID() List

type Map

type Map map[ID]*Asset

func (Map) List

func (m Map) List() List

func (Map) ListFrom

func (m Map) ListFrom(ids IDList) (res List)

type PreviewType

type PreviewType string
const (
	PreviewTypeImage      PreviewType = "image"
	PreviewTypeImageSvg   PreviewType = "image_svg"
	PreviewTypeGeo        PreviewType = "geo"
	PreviewTypeGeo3dTiles PreviewType = "geo_3d_tiles"
	PreviewTypeGeoMvt     PreviewType = "geo_mvt"
	PreviewTypeModel3d    PreviewType = "model_3d"
	PreviewTypeCSV        PreviewType = "csv"
	PreviewTypeUnknown    PreviewType = "unknown"
)

func DetectPreviewType

func DetectPreviewType(f *file.File) *PreviewType

func PreviewTypeFrom

func PreviewTypeFrom(p string) (PreviewType, bool)

func PreviewTypeFromContentType

func PreviewTypeFromContentType(c string) PreviewType

func PreviewTypeFromExtension

func PreviewTypeFromExtension(ext string) PreviewType

func PreviewTypeFromRef

func PreviewTypeFromRef(p *string) *PreviewType

func (PreviewType) Ref

func (p PreviewType) Ref() *PreviewType

func (PreviewType) String

func (p PreviewType) String() string

func (*PreviewType) StringRef

func (p *PreviewType) StringRef() *string

type ProjectID

type ProjectID = id.ProjectID

type ThreadID

type ThreadID = id.ThreadID

type URLResolver

type URLResolver = func(*Asset) string

type Upload

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

func (*Upload) ContentLength

func (u *Upload) ContentLength() int64

func (*Upload) Expired

func (u *Upload) Expired(t time.Time) bool

func (*Upload) ExpiresAt

func (u *Upload) ExpiresAt() time.Time

func (*Upload) FileName

func (u *Upload) FileName() string

func (*Upload) Project

func (u *Upload) Project() ProjectID

func (*Upload) UUID

func (u *Upload) UUID() string

type UploadBuilder

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

func NewUpload

func NewUpload() *UploadBuilder

func (*UploadBuilder) Build

func (b *UploadBuilder) Build() *Upload

func (*UploadBuilder) ContentLength

func (b *UploadBuilder) ContentLength(contentLength int64) *UploadBuilder

func (*UploadBuilder) ExpiresAt

func (b *UploadBuilder) ExpiresAt(expiresAt time.Time) *UploadBuilder

func (*UploadBuilder) FileName

func (b *UploadBuilder) FileName(fileName string) *UploadBuilder

func (*UploadBuilder) Project

func (b *UploadBuilder) Project(project ProjectID) *UploadBuilder

func (*UploadBuilder) UUID

func (b *UploadBuilder) UUID(uuid string) *UploadBuilder

type UserID

type UserID = accountdomain.UserID

Jump to

Keyboard shortcuts

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