asset

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: BSD-3-Clause Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dependencies

type Dependencies struct {
	archive.ArchiveFactory
}

type FileAsset

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

Represents a publication stored as a file on the local file system.

func File

func File(uri url.URL) *FileAsset

func FileWithMediaType

func FileWithMediaType(uri url.URL, mediatype *mediatype.MediaType) *FileAsset

Creates a FileAsset from a File and an optional media type, when known.

func FileWithMediaTypeHint

func FileWithMediaTypeHint(uri url.URL, mediatypeHint string) *FileAsset

Creates a FileAsset from a File and an optional media type hint. Providing a media type hint will improve performances when sniffing the media type.

func (*FileAsset) CreateFetcher

func (a *FileAsset) CreateFetcher(ctx context.Context, dependencies Dependencies, credentials string) (fetcher.Fetcher, error)

CreateFetcher implements PublicationAsset

func (*FileAsset) MediaType

func (a *FileAsset) MediaType(ctx context.Context) mediatype.MediaType

MediaType implements PublicationAsset

func (*FileAsset) Name

func (a *FileAsset) Name() string

Name implements PublicationAsset

type GCSAsset added in v0.9.0

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

Represents a publication stored on an Amazon S3-compatible remote server.

func GCS added in v0.9.0

func GCS(client *storage.Client, uri url.AbsoluteURL) *GCSAsset

func GCSWithMediaType added in v0.9.0

func GCSWithMediaType(client *storage.Client, uri url.AbsoluteURL, mediatype *mediatype.MediaType) *GCSAsset

Creates a S3Asset from a File and an optional media type, when known.

func (*GCSAsset) CreateFetcher added in v0.9.0

func (a *GCSAsset) CreateFetcher(ctx context.Context, dependencies Dependencies, credentials string) (fetcher.Fetcher, error)

CreateFetcher implements PublicationAsset

func (*GCSAsset) MediaType added in v0.9.0

func (a *GCSAsset) MediaType(ctx context.Context) mediatype.MediaType

MediaType implements PublicationAsset

func (*GCSAsset) Name added in v0.9.0

func (a *GCSAsset) Name() string

Name implements PublicationAsset

type HTTPAsset added in v0.9.0

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

Represents a publication stored on an Amazon S3-compatible remote server.

func HTTP added in v0.9.0

func HTTP(client *http.Client, url url.AbsoluteURL) *HTTPAsset

func HTTPWithMediaType added in v0.9.0

func HTTPWithMediaType(client *http.Client, url url.AbsoluteURL, mediatype *mediatype.MediaType) *HTTPAsset

Creates a HTTPAsset from a File and an optional media type, when known.

func (*HTTPAsset) CreateFetcher added in v0.9.0

func (a *HTTPAsset) CreateFetcher(ctx context.Context, dependencies Dependencies, credentials string) (fetcher.Fetcher, error)

CreateFetcher implements PublicationAsset

func (*HTTPAsset) MediaType added in v0.9.0

func (a *HTTPAsset) MediaType(ctx context.Context) mediatype.MediaType

MediaType implements PublicationAsset

func (*HTTPAsset) Name added in v0.9.0

func (a *HTTPAsset) Name() string

Name implements PublicationAsset

type PublicationAsset

type PublicationAsset interface {
	Name() string                                                                                              // Name of the asset, e.g. a filename.
	MediaType(ctx context.Context) mediatype.MediaType                                                         // Media type of the asset. If unknown, fallback on `MediaType.Binary`.
	CreateFetcher(ctx context.Context, dependencies Dependencies, credentials string) (fetcher.Fetcher, error) // Creates a fetcher used to access the asset's content.
}

Represents a digital medium (e.g. a file) offering access to a publication.

type S3Asset added in v0.9.0

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

Represents a publication stored on an Amazon S3-compatible remote server.

func S3 added in v0.9.0

func S3(client *s3.Client, uri url.AbsoluteURL) *S3Asset

func S3WithMediaType added in v0.9.0

func S3WithMediaType(client *s3.Client, uri url.AbsoluteURL, mediatype *mediatype.MediaType) *S3Asset

Creates a S3Asset from a File and an optional media type, when known.

func (*S3Asset) CreateFetcher added in v0.9.0

func (a *S3Asset) CreateFetcher(ctx context.Context, dependencies Dependencies, credentials string) (fetcher.Fetcher, error)

CreateFetcher implements PublicationAsset

func (*S3Asset) MediaType added in v0.9.0

func (a *S3Asset) MediaType(ctx context.Context) mediatype.MediaType

MediaType implements PublicationAsset

func (*S3Asset) Name added in v0.9.0

func (a *S3Asset) Name() string

Name implements PublicationAsset

Jump to

Keyboard shortcuts

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