Documentation
¶
Index ¶
- Constants
- func ContentIDValidator(value string, errorReporter structure.ErrorReporter)
- func ContentIntentValidator(value string, errorReporter structure.ErrorReporter)
- func ContentIntents() []string
- func ErrorImageContentIntentUnexpected(value string) error
- func ErrorImageMalformed(reason string) error
- func ErrorValueRenditionNotParsable(value string) error
- func ErrorValueStringAsColorNotValid(value string) error
- func ErrorValueStringAsContentIDNotValid(value string) error
- func ErrorValueStringAsContentIntentNotValid(value string) error
- func ErrorValueStringAsIDNotValid(value string) error
- func ErrorValueStringAsRenditionsIDNotValid(value string) error
- func ExtensionFromMediaType(mediaType string) (string, bool)
- func ExtensionValidator(value string, errorReporter structure.ErrorReporter)
- func IDValidator(value string, errorReporter structure.ErrorReporter)
- func IsValidContentID(value string) bool
- func IsValidContentIntent(value string) bool
- func IsValidExtension(value string) bool
- func IsValidID(value string) bool
- func IsValidMediaType(value string) bool
- func IsValidRenditionsID(value string) bool
- func MediaTypeFromExtension(extension string) (string, bool)
- func MediaTypeSupportsQuality(mediaType string) bool
- func MediaTypeSupportsTransparency(mediaType string) bool
- func MediaTypeValidator(value string, errorReporter structure.ErrorReporter)
- func MediaTypes() []string
- func Modes() []string
- func NewContentID() string
- func NewID() string
- func NewRenditionsID() string
- func NormalizeMode(mode string) string
- func RenditionsIDValidator(value string, errorReporter structure.ErrorReporter)
- func Statuses() []string
- func ValidateContentID(value string) error
- func ValidateContentIntent(value string) error
- func ValidateExtension(value string) error
- func ValidateID(value string) error
- func ValidateMediaType(value string) error
- func ValidateRenditionsID(value string) error
- type Client
- type Color
- type Content
- type ContentAttributes
- type Filter
- type Image
- type ImageArray
- type Metadata
- type Rendition
- func (r *Rendition) ConstrainHeight(aspectRatio float64)
- func (r *Rendition) ConstrainWidth(aspectRatio float64)
- func (r *Rendition) Parse(parser structure.ObjectParser)
- func (r *Rendition) String() string
- func (r *Rendition) SupportsQuality() bool
- func (r *Rendition) SupportsTransparency() bool
- func (r *Rendition) Validate(validator structure.Validator)
- func (r *Rendition) WithDefaults(aspectRatio float64) *Rendition
Constants ¶
View Source
const ( ErrorCodeImageContentIntentUnexpected = "image-content-intent-unexpected" ErrorCodeImageMalformed = "image-malformed" )
View Source
const ( ContentIntentAlternate = "alternate" ContentIntentOriginal = "original" HeightMaximum = 10000 HeightMinimum = 1 MediaTypeImageJPEG = "image/jpeg" MediaTypeImagePNG = "image/png" ModeDefault = ModeFit ModeFill = "fill" ModeFillDown = "fillDown" ModeFit = "fit" ModeFitDown = "fitDown" ModePad = "pad" ModePadDown = "padDown" ModeScale = "scale" ModeScaleDown = "scaleDown" NameLengthMaximum = 100 QualityDefault = 95 QualityMaximum = 100 QualityMinimum = 1 RenditionExtensionSeparator = "." RenditionFieldSeparator = "_" RenditionKeyValueSeparator = "=" RenditionsLengthMaximum = 10 SizeMaximum = 100 * 1024 * 1024 StatusAvailable = "available" StatusCreated = "created" WidthMaximum = 10000 WidthMinimum = 1 )
Variables ¶
This section is empty.
Functions ¶
func ContentIDValidator ¶
func ContentIDValidator(value string, errorReporter structure.ErrorReporter)
func ContentIntentValidator ¶
func ContentIntentValidator(value string, errorReporter structure.ErrorReporter)
func ContentIntents ¶
func ContentIntents() []string
func ErrorImageMalformed ¶
func ExtensionFromMediaType ¶
func ExtensionValidator ¶
func ExtensionValidator(value string, errorReporter structure.ErrorReporter)
func IDValidator ¶
func IDValidator(value string, errorReporter structure.ErrorReporter)
func IsValidContentID ¶
func IsValidContentIntent ¶
func IsValidExtension ¶
func IsValidMediaType ¶
func IsValidRenditionsID ¶
func MediaTypeFromExtension ¶
func MediaTypeValidator ¶
func MediaTypeValidator(value string, errorReporter structure.ErrorReporter)
func MediaTypes ¶
func MediaTypes() []string
func NewContentID ¶
func NewContentID() string
func NewRenditionsID ¶
func NewRenditionsID() string
func NormalizeMode ¶
func RenditionsIDValidator ¶
func RenditionsIDValidator(value string, errorReporter structure.ErrorReporter)
func ValidateContentID ¶
func ValidateContentIntent ¶
func ValidateExtension ¶
func ValidateID ¶
func ValidateMediaType ¶
func ValidateRenditionsID ¶
Types ¶
type Client ¶
type Client interface {
List(ctx context.Context, userID string, filter *Filter, pagination *page.Pagination) (ImageArray, error)
Create(ctx context.Context, userID string, metadata *Metadata, contentIntent string, content *Content) (*Image, error)
CreateWithMetadata(ctx context.Context, userID string, metadata *Metadata) (*Image, error)
CreateWithContent(ctx context.Context, userID string, contentIntent string, content *Content) (*Image, error)
DeleteAll(ctx context.Context, userID string) error
Get(ctx context.Context, id string) (*Image, error)
GetMetadata(ctx context.Context, id string) (*Metadata, error)
GetContent(ctx context.Context, id string, mediaType *string) (*Content, error)
GetRenditionContent(ctx context.Context, id string, rendition *Rendition) (*Content, error)
PutMetadata(ctx context.Context, id string, condition *request.Condition, metadata *Metadata) (*Image, error)
PutContent(ctx context.Context, id string, condition *request.Condition, contentIntent string, content *Content) (*Image, error)
Delete(ctx context.Context, id string, condition *request.Condition) (bool, error)
}
type Content ¶
type Content struct {
Body io.ReadCloser `json:"-"`
DigestMD5 *string `json:"digestMD5,omitempty"`
MediaType *string `json:"mediaType,omitempty"`
}
func NewContent ¶
func NewContent() *Content
type ContentAttributes ¶
type ContentAttributes struct {
DigestMD5 *string `json:"digestMD5,omitempty" bson:"digestMD5,omitempty"`
MediaType *string `json:"mediaType,omitempty" bson:"mediaType,omitempty"`
Width *int `json:"width,omitempty" bson:"width,omitempty"`
Height *int `json:"height,omitempty" bson:"height,omitempty"`
Size *int `json:"size,omitempty" bson:"size,omitempty"`
CreatedTime *time.Time `json:"createdTime,omitempty" bson:"createdTime,omitempty"`
ModifiedTime *time.Time `json:"modifiedTime,omitempty" bson:"modifiedTime,omitempty"`
}
func NewContentAttributes ¶
func NewContentAttributes() *ContentAttributes
func ParseContentAttributes ¶
func ParseContentAttributes(parser structure.ObjectParser) *ContentAttributes
func (*ContentAttributes) Parse ¶
func (c *ContentAttributes) Parse(parser structure.ObjectParser)
func (*ContentAttributes) SupportsQuality ¶
func (c *ContentAttributes) SupportsQuality() bool
func (*ContentAttributes) SupportsTransparency ¶
func (c *ContentAttributes) SupportsTransparency() bool
func (*ContentAttributes) Validate ¶
func (c *ContentAttributes) Validate(validator structure.Validator)
type Filter ¶
type Filter struct {
Status *[]string `json:"status,omitempty"`
ContentIntent *[]string `json:"contentIntent,omitempty"`
}
func (*Filter) Parse ¶
func (f *Filter) Parse(parser structure.ObjectParser)
type Image ¶
type Image struct {
ID *string `json:"id,omitempty" bson:"id,omitempty"`
UserID *string `json:"userId,omitempty" bson:"userId,omitempty"`
Status *string `json:"status,omitempty" bson:"status,omitempty"`
Metadata *Metadata `json:"metadata,omitempty" bson:"metadata,omitempty"`
ContentID *string `json:"contentId,omitempty" bson:"contentId,omitempty"`
ContentIntent *string `json:"contentIntent,omitempty" bson:"contentIntent,omitempty"`
ContentAttributes *ContentAttributes `json:"contentAttributes,omitempty" bson:"contentAttributes,omitempty"`
RenditionsID *string `json:"renditionsId,omitempty" bson:"renditionsId,omitempty"`
Renditions *[]string `json:"renditions,omitempty" bson:"renditions,omitempty"`
CreatedTime *time.Time `json:"createdTime,omitempty" bson:"createdTime,omitempty"`
ModifiedTime *time.Time `json:"modifiedTime,omitempty" bson:"modifiedTime,omitempty"`
DeletedTime *time.Time `json:"deletedTime,omitempty" bson:"deletedTime,omitempty"`
Revision *int `json:"revision,omitempty" bson:"revision,omitempty"`
}
func (*Image) HasContent ¶
func (*Image) HasRendition ¶
func (*Image) Parse ¶
func (i *Image) Parse(parser structure.ObjectParser)
type ImageArray ¶
type ImageArray []*Image
type Metadata ¶
type Metadata struct {
Associations *association.AssociationArray `json:"associations,omitempty" bson:"associations,omitempty"`
Location *location.Location `json:"location,omitempty" bson:"location,omitempty"`
Metadata *metadata.Metadata `json:"metadata,omitempty" bson:"metadata,omitempty"`
Name *string `json:"name,omitempty" bson:"name,omitempty"`
Origin *origin.Origin `json:"origin,omitempty" bson:"origin,omitempty"`
}
func NewMetadata ¶
func NewMetadata() *Metadata
func ParseMetadata ¶
func ParseMetadata(parser structure.ObjectParser) *Metadata
func (*Metadata) Parse ¶
func (m *Metadata) Parse(parser structure.ObjectParser)
type Rendition ¶
type Rendition struct {
MediaType *string `json:"mediaType,omitempty"`
Width *int `json:"width,omitempty"`
Height *int `json:"height,omitempty"`
Mode *string `json:"mode,omitempty"`
Background *Color `json:"background,omitempty"`
Quality *int `json:"quality,omitempty"`
}
func NewRendition ¶
func NewRendition() *Rendition
func (*Rendition) ConstrainHeight ¶
func (*Rendition) ConstrainWidth ¶
func (*Rendition) Parse ¶
func (r *Rendition) Parse(parser structure.ObjectParser)
func (*Rendition) SupportsQuality ¶
func (*Rendition) SupportsTransparency ¶
func (*Rendition) WithDefaults ¶
Click to show internal directories.
Click to hide internal directories.