uploader

package
Version: v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: MIT Imports: 23 Imported by: 5

Documentation

Overview

Package uploader is used for accessing Cloudinary Upload API functionality.

https://cloudinary.com/documentation/image_upload_api_reference

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API added in v1.0.0

type API struct {
	Config config.Configuration
	Logger *logger.Logger
	Client http.Client
}

API is the Upload API main struct.

func New added in v1.0.0

func New() (*API, error)

New creates a new Admin API instance from the environment variable.

func NewWithConfiguration added in v1.6.0

func NewWithConfiguration(c *config.Configuration) (*API, error)

NewWithConfiguration a new Upload API instance with the given Configuration.

func (*API) AddContext added in v1.0.0

func (u *API) AddContext(ctx context.Context, params AddContextParams) (*AddContextResult, error)

AddContext adds context metadata as key-value pairs to the the specified assets.

https://cloudinary.com/documentation/image_upload_api_reference#context_method

func (*API) AddTag added in v1.0.0

func (u *API) AddTag(ctx context.Context, params AddTagParams) (*AddTagResult, error)

AddTag adds a tag to the assets specified.

https://cloudinary.com/documentation/image_upload_api_reference#tags_method

func (*API) CreateArchive added in v1.0.0

func (u *API) CreateArchive(ctx context.Context, params CreateArchiveParams) (*CreateArchiveResult, error)

CreateArchive creates a new archive in the server and returns information in JSON format.

func (*API) CreateZip added in v1.0.0

func (u *API) CreateZip(ctx context.Context, params CreateArchiveParams) (*CreateArchiveResult, error)

CreateZip creates a new zip archive in the server and returns information in JSON format.

func (*API) Destroy added in v1.0.0

func (u *API) Destroy(ctx context.Context, params DestroyParams) (*DestroyResult, error)

Destroy immediately and permanently deletes a single asset from your Cloudinary account.

Backed up assets are not deleted, and any assets and transformed assets already downloaded by visitors to your website might still be accessible through cached copies on the CDN. You can invalidate any cached copies on the CDN with the `Invalidate` parameter.

https://cloudinary.com/documentation/image_upload_api_reference#destroy_method

func (*API) DownloadArchiveURL added in v1.0.0

func (u *API) DownloadArchiveURL(params CreateArchiveParams) (string, error)

DownloadArchiveURL creates a URL that when invoked generates an archive and returns it.

func (*API) DownloadBackedUpAsset added in v1.0.0

func (u *API) DownloadBackedUpAsset(params DownloadBackedUpAssetParams) (string, error)

DownloadBackedUpAsset creates a URL that allows downloading the backed-up asset based on the asset ID and the version ID.

func (*API) DownloadFolder added in v1.0.0

func (u *API) DownloadFolder(folderPath string, params CreateArchiveParams) (string, error)

DownloadFolder creates a URL that when invoked generates an archive of a folder.

func (*API) DownloadZipURL added in v1.0.0

func (u *API) DownloadZipURL(params CreateArchiveParams) (string, error)

DownloadZipURL creates a URL that when invokes generates a zip archive and returns it.

func (*API) Explicit added in v1.0.0

func (u *API) Explicit(ctx context.Context, params ExplicitParams) (*ExplicitResult, error)

Explicit applies actions to already uploaded assets.

https://cloudinary.com/documentation/image_upload_api_reference#explicit_method

func (*API) Explode added in v1.0.0

func (u *API) Explode(ctx context.Context, params ExplodeParams) (*ExplodeResult, error)

Explode creates derived images for all of the individual pages in a multi-page file (PDF or animated GIF).

Each derived image is stored with the same public ID as the original file, and can be accessed using the page parameter, in order to deliver a specific image.

https://cloudinary.com/documentation/image_upload_api_reference#explode_method

func (*API) GenerateSprite added in v1.0.0

func (u *API) GenerateSprite(ctx context.Context, params GenerateSpriteParams) (*GenerateSpriteResult, error)

GenerateSprite creates a sprite from all images that have been assigned a specified tag.

The process produces two files: * A single image file containing all the images with the specified tag (PNG by default). * A CSS file that includes the style class names and the location of the individual images in the sprite.

https://cloudinary.com/documentation/image_upload_api_reference#sprite_method

func (*API) Multi added in v1.0.0

func (u *API) Multi(ctx context.Context, params MultiParams) (*MultiResult, error)

Multi Creates a single animated image, video or PDF from all image assets that have been assigned a specified tag.

https://cloudinary.com/documentation/image_upload_api_reference#multi_method

func (*API) PrivateDownloadUrl added in v1.0.0

func (u *API) PrivateDownloadUrl(params PrivateDownloadUrlParams) (string, error)

PrivateDownloadUrl returns a URL that when invoked downloads the asset.

func (*API) RemoveAllContext added in v1.0.0

func (u *API) RemoveAllContext(ctx context.Context, params RemoveAllContextParams) (*RemoveAllContextResult, error)

RemoveAllContext removes all context metadata from the specified assets.

https://cloudinary.com/documentation/image_upload_api_reference#context_method

func (*API) RemoveAllTags added in v1.0.0

func (u *API) RemoveAllTags(ctx context.Context, params RemoveAllTagsParams) (*RemoveAllTagsResult, error)

RemoveAllTags removes all tags from the assets specified.

https://cloudinary.com/documentation/image_upload_api_reference#tags_method

func (*API) RemoveTag added in v1.0.0

func (u *API) RemoveTag(ctx context.Context, params RemoveTagParams) (*RemoveTagResult, error)

RemoveTag removes a tag from the assets specified.

https://cloudinary.com/documentation/image_upload_api_reference#tags_method

func (*API) Rename added in v1.0.0

func (u *API) Rename(ctx context.Context, params RenameParams) (*RenameResult, error)

Rename renames the specified asset in your Cloudinary account.

The existing URLs of renamed assets and their associated derived resources are no longer valid, although any assets and transformed assets already downloaded by visitors to your website might still be accessible through cached copies on the CDN. You can invalidate any cached copies on the CDN with the `invalidate` parameter.

https://cloudinary.com/documentation/image_upload_api_reference#rename_method

func (*API) ReplaceTag added in v1.0.0

func (u *API) ReplaceTag(ctx context.Context, params ReplaceTagParams) (*ReplaceTagResult, error)

ReplaceTag replaces all existing tags on the assets specified with the tag specified.

https://cloudinary.com/documentation/image_upload_api_reference#tags_method

func (*API) Text added in v1.0.0

func (u *API) Text(ctx context.Context, params TextParams) (*UploadResult, error)

Text dynamically generates an image from a given textual string.

https://cloudinary.com/documentation/image_upload_api_reference#text_method

func (*API) UnsignedUpload added in v1.0.0

func (u *API) UnsignedUpload(ctx context.Context, file interface{}, uploadPreset string, uploadParams UploadParams) (*UploadResult, error)

UnsignedUpload uploads an asset to a Cloudinary account.

The upload is not signed so an upload preset is required.

https://cloudinary.com/documentation/image_upload_api_reference#unsigned_upload_syntax

func (*API) UpdateMetadata added in v1.0.0

func (u *API) UpdateMetadata(ctx context.Context, params UpdateMetadataParams) (*UpdateMetadataResult, error)

UpdateMetadata populates metadata fields with the given values. Existing values will be overwritten.

Any metadata-value pairs given are merged with any existing metadata-value pairs (an empty value for an existing metadata field clears the value).

https://cloudinary.com/documentation/image_upload_api_reference#metadata_method

func (*API) Upload added in v1.0.0

func (u *API) Upload(ctx context.Context, file interface{}, uploadParams UploadParams) (*UploadResult, error)

Upload uploads an asset to a Cloudinary account.

The asset can be:

  • a local file path
  • the actual data (io.Reader)
  • the Data URI (Base64 encoded), max ~60 MB (62,910,000 chars)
  • the remote FTP, HTTP or HTTPS URL address of an existing file
  • a private storage bucket (S3 or Google Storage) URL of a whitelisted bucket

https://cloudinary.com/documentation/image_upload_api_reference#upload_method

type AddContextParams

type AddContextParams struct {
	Context      api.CldAPIMap   `json:"context,omitempty"`
	PublicIDs    api.CldAPIArray `json:"public_ids"`
	Type         string          `json:"type,omitempty"`
	ResourceType string          `json:"-"`
}

AddContextParams are the parameters for AddContext.

type AddContextResult

type AddContextResult = ContextResult

AddContextResult is the result of AddContext.

type AddTagParams

type AddTagParams struct {
	Tag          string   `json:"tag,omitempty"` // The name of the tag to add.
	PublicIDs    []string `json:"public_ids"`    // The public IDs of the assets to add the tag to.
	Type         string   `json:"type,omitempty"`
	ResourceType string   `json:"-"`
}

AddTagParams are the parameters for

type AddTagResult

type AddTagResult struct {
	TagResult
}

AddTagResult is the result of AddTag.

type ArchiveFormat

type ArchiveFormat = string

ArchiveFormat is the supported archive format.

const (
	// Zip archive format.
	Zip ArchiveFormat = "zip"
	// Tgz archive format.
	Tgz ArchiveFormat = "tgz"
)

type ArchiveMode

type ArchiveMode string

ArchiveMode is the supported mode for Archive.

const (
	// CreateArchive creates the archive as a new asset in your cloud.
	CreateArchive ArchiveMode = "create"
	// DownloadArchive returns the archive contents in the response.
	DownloadArchive ArchiveMode = "download"
)

type BreakpointResult added in v1.5.0

type BreakpointResult struct {
	Width     int    `json:"width"`
	Height    int    `json:"height"`
	Bytes     int    `json:"bytes"`
	URL       string `json:"url"`
	SecureURL string `json:"secure_url"`
}

BreakpointResult represents a result of a single responsive breakpoints image.

type ContextResult

type ContextResult struct {
	PublicIds []string      `json:"public_ids"`
	Error     api.ErrorResp `json:"error,omitempty"`
	Response  http.Response
}

ContextResult is the result of Context APIs.

type CreateArchiveParams

type CreateArchiveParams struct {
	AllowMissing            bool             `json:"allow_missing,omitempty"`
	Async                   bool             `json:"async,omitempty"`
	ExpiresAt               *time.Time       `json:"expires_at,omitempty"`
	FlattenFolders          bool             `json:"flatten_folders,omitempty"`
	FlattenTransformations  bool             `json:"flatten_transformations,omitempty"`
	FullyQualifiedPublicIds api.CldAPIArray  `json:"fully_qualified_public_ids,omitempty"`
	KeepDerived             bool             `json:"keep_derived,omitempty"`
	Mode                    ArchiveMode      `json:"mode,omitempty"`
	NotificationURL         string           `json:"notification_url,omitempty"`
	Phash                   string           `json:"phash,omitempty"`
	Prefixes                api.CldAPIArray  `json:"prefixes,omitempty"`
	PublicIds               api.CldAPIArray  `json:"public_ids,omitempty"`
	ResourceType            api.AssetType    `json:"-"`
	SkipTransformationName  bool             `json:"skip_transformation_name,omitempty"`
	TargetFormat            ArchiveFormat    `json:"target_format,omitempty"`
	TargetPublicID          string           `json:"target_public_id,omitempty"`
	TargetTags              api.CldAPIArray  `json:"target_tags,omitempty"`
	Tags                    api.CldAPIArray  `json:"tags,omitempty"`
	Transformations         string           `json:"transformations,omitempty"`
	Type                    api.DeliveryType `json:"type,omitempty"`
	UseOriginalFilename     bool             `json:"use_original_filename,omitempty"`
}

CreateArchiveParams are the parameters for CreateArchive.

type CreateArchiveResult

type CreateArchiveResult struct {
	AssetID       string        `json:"asset_id"`
	PublicID      string        `json:"public_id"`
	Version       int           `json:"version"`
	VersionID     string        `json:"version_id"`
	Signature     string        `json:"signature"`
	ResourceType  string        `json:"resource_type"`
	CreatedAt     time.Time     `json:"created_at"`
	Tags          []string      `json:"tags"`
	Bytes         int           `json:"bytes"`
	Type          string        `json:"type"`
	Etag          string        `json:"etag"`
	Placeholder   bool          `json:"placeholder"`
	URL           string        `json:"url"`
	SecureURL     string        `json:"secure_url"`
	AccessMode    string        `json:"access_mode"`
	ResourceCount int           `json:"resource_count"`
	FileCount     int           `json:"file_count"`
	Error         api.ErrorResp `json:"error,omitempty"`
	Response      http.Response
}

CreateArchiveResult is the result of CreateArchive.

type DestroyParams

type DestroyParams struct {
	PublicID     string `json:"public_id,omitempty"`
	Type         string `json:"type,omitempty"`
	ResourceType string `json:"-"`
	Invalidate   bool   `json:"invalidate,omitempty"`
}

DestroyParams are the parameters for Destroy.

type DestroyResult

type DestroyResult struct {
	Result   string        `json:"result"`
	Error    api.ErrorResp `json:"error,omitempty"`
	Response http.Response
}

DestroyResult is the result of Destroy.

type DownloadBackedUpAssetParams added in v1.0.0

type DownloadBackedUpAssetParams struct {
	AssetID   string `json:"asset_id"`
	VersionID string `json:"version_id,omitempty"`
}

DownloadBackedUpAssetParams are the parameters for DownloadBackedUpAsset.

type Eager added in v1.0.0

type Eager struct {
	Transformation string `json:"transformation"`
	Width          int    `json:"width"`
	Height         int    `json:"height"`
	Bytes          int    `json:"bytes"`
	Format         string `json:"format"`
	URL            string `json:"url"`
	SecureURL      string `json:"secure_url"`
}

Eager contains information about eagerly transformed derived assets.

type ExplicitParams

type ExplicitParams = UploadParams

ExplicitParams are the parameters for Explicit.

type ExplicitResult

type ExplicitResult struct {
	UploadResult
}

ExplicitResult is the result of Explicit.

type ExplodeParams

type ExplodeParams struct {
	PublicID        string `json:"public_id"`
	Format          string `json:"format,omitempty"`
	Type            string `json:"type,omitempty"`
	NotificationURL string `json:"notification_url,omitempty"`
	Transformation  string `json:"transformation,omitempty"`
	ResourceType    string `json:"-"`
}

ExplodeParams are the parameters for Explode.

type ExplodeResult

type ExplodeResult struct {
	Status   string        `json:"status"`
	BatchID  string        `json:"batch_id"`
	Error    api.ErrorResp `json:"error,omitempty"`
	Response http.Response
}

ExplodeResult is the result of Explode.

type GenerateSpriteParams

type GenerateSpriteParams struct {
	Tag             string `json:"tag,omitempty"`
	NotificationURL string `json:"notification_url,omitempty"`
	Async           bool   `json:"async,omitempty"`
	Transformation  string `json:"transformation,omitempty"`
	ResourceType    string `json:"-"`
}

GenerateSpriteParams are the parameters for GenerateSprite.

type GenerateSpriteResult

type GenerateSpriteResult struct {
	CSSURL         string               `json:"css_url"`
	ImageURL       string               `json:"image_url"`
	SecureCSSURL   string               `json:"secure_css_url"`
	SecureImageURL string               `json:"secure_image_url"`
	JSONURL        string               `json:"json_url"`
	SecureJSONURL  string               `json:"secure_json_url"`
	Version        int                  `json:"version"`
	PublicID       string               `json:"public_id"`
	ImageInfos     map[string]ImageInfo `json:"image_infos"`
	Error          api.ErrorResp        `json:"error,omitempty"`
	Response       http.Response
}

GenerateSpriteResult is the result of GenerateSprite.

type ImageInfo

type ImageInfo struct {
	Width  int `json:"width"`
	Height int `json:"height"`
	X      int `json:"x"`
	Y      int `json:"y"`
}

ImageInfo contains information about the image.

type Moderation added in v1.4.0

type Moderation struct {
	Status    api.ModerationStatus `json:"status"`
	Kind      string               `json:"kind"`
	Response  ModerationResponse   `json:"response"`
	UpdatedAt time.Time            `json:"updated_at"`
}

Moderation represents moderation result.

type ModerationLabel added in v1.4.0

type ModerationLabel struct {
	Confidence float64 `json:"confidence"`
	Name       string  `json:"name"`
	ParentName string  `json:"parent_name"`
}

ModerationLabel represents moderation label.

type ModerationResponse added in v1.4.0

type ModerationResponse struct {
	ModerationLabels []ModerationLabel `json:"moderation_labels"`
}

ModerationResponse represents moderation response.

type MultiParams

type MultiParams struct {
	Tag             string `json:"tag,omitempty"`
	Format          string `json:"format,omitempty"`
	NotificationURL string `json:"notification_url,omitempty"`
	Async           bool   `json:"async,omitempty"`
	Transformation  string `json:"transformation,omitempty"`
	ResourceType    string `json:"-"`
}

MultiParams are the parameters for Multi.

type MultiResult

type MultiResult struct {
	URL       string        `json:"url"`
	SecureURL string        `json:"secure_url"`
	AssetID   string        `json:"asset_id"`
	PublicID  string        `json:"public_id"`
	Version   int           `json:"version"`
	Error     api.ErrorResp `json:"error,omitempty"`
	Response  http.Response
}

MultiResult is the result of Multi.

type PrivateDownloadUrlParams added in v1.0.0

type PrivateDownloadUrlParams struct {
	PublicID     string        `json:"public_id"`
	Format       string        `json:"format"`
	DeliveryType string        `json:"type,omitempty"`
	Attachment   string        `json:"attachment,omitempty"`
	ExpiresAt    *time.Time    `json:"expires_at,omitempty"`
	ResourceType api.AssetType `json:"-"`
}

PrivateDownloadUrlParams are the parameters for PrivateDownloadUrl.

type RemoveAllContextParams

type RemoveAllContextParams struct {
	PublicIDs    api.CldAPIArray `json:"public_ids"`
	Type         string          `json:"type,omitempty"`
	ResourceType string          `json:"-"`
}

RemoveAllContextParams struct

type RemoveAllContextResult

type RemoveAllContextResult = ContextResult

RemoveAllContextResult is the result of RemoveAllContext.

type RemoveAllTagsParams

type RemoveAllTagsParams struct {
	PublicIDs    []string `json:"public_ids"` // The public IDs of the assets to remove all tags from.
	Type         string   `json:"type,omitempty"`
	ResourceType string   `json:"-"`
}

RemoveAllTagsParams are the parameters for RemoveAllTags.

type RemoveAllTagsResult

type RemoveAllTagsResult struct {
	TagResult
}

RemoveAllTagsResult is the result of RemoveAllTags.

type RemoveTagParams

type RemoveTagParams struct {
	Tag          string   `json:"tag,omitempty"` // The name of the tag to remove.
	PublicIDs    []string `json:"public_ids"`    // The public IDs of the assets to remove the tags from.
	Type         string   `json:"type,omitempty"`
	ResourceType string   `json:"-"`
}

RemoveTagParams are the parameters for RemoveTag.

type RemoveTagResult

type RemoveTagResult struct {
	TagResult
}

RemoveTagResult is the result of RemoveTag.

type RenameParams

type RenameParams struct {
	FromPublicID string `json:"from_public_id,omitempty"`
	ToPublicID   string `json:"to_public_id,omitempty"`
	Type         string `json:"type,omitempty"`
	ToType       string `json:"to_type,omitempty"`
	ResourceType string `json:"-"`
	Overwrite    bool   `json:"overwrite,omitempty"`
	Invalidate   bool   `json:"invalidate,omitempty"`
}

RenameParams are the parameters for Rename.

type RenameResult

type RenameResult struct {
	api.BriefAssetResult
	Error interface{} `json:"error,omitempty"`
}

RenameResult is the result of Rename.

type ReplaceTagParams

type ReplaceTagParams struct {
	Tag          string   `json:"tag"`        // The new tag with which to replace the existing tags.
	PublicIDs    []string `json:"public_ids"` // The public IDs of the assets to replace the tags of.
	Type         string   `json:"type,omitempty"`
	ResourceType string   `json:"-"`
}

ReplaceTagParams are the parameters for ReplaceTag.

type ReplaceTagResult

type ReplaceTagResult struct {
	TagResult
}

ReplaceTagResult is the result of ReplaceTag.

type ResponsiveBreakpointsParams added in v1.5.0

type ResponsiveBreakpointsParams []SingleResponsiveBreakpointsParams

ResponsiveBreakpointsParams represents params for responsive breakpoints generation request.

func (ResponsiveBreakpointsParams) MarshalJSON added in v1.5.0

func (rbpParams ResponsiveBreakpointsParams) MarshalJSON() ([]byte, error)

MarshalJSON writes a quoted string in the custom format.

type ResponsiveBreakpointsResult added in v1.5.0

type ResponsiveBreakpointsResult struct {
	Breakpoints    []BreakpointResult `json:"breakpoints"`
	Transformation string             `json:"transformation"`
}

ResponsiveBreakpointsResult represents a result of responsive breakpoints of an image.

type SingleResponsiveBreakpointsParams added in v1.5.0

type SingleResponsiveBreakpointsParams struct {
	CreateDerived  bool   `json:"create_derived"`
	Transformation string `json:"transformation,omitempty"`
	MinWidth       int    `json:"min_width,omitempty"`
	MaxWidth       int    `json:"max_width,omitempty"`
	BytesStep      int    `json:"bytes_step,omitempty"`
	MaxImages      int    `json:"max_images,omitempty"`
	Format         string `json:"format,omitempty"`
}

SingleResponsiveBreakpointsParams represents params for a single responsive breakpoints generation request.

type TagResult

type TagResult struct {
	PublicIds []string      `json:"public_ids"` // The public IDs of the assets that were affected.
	Error     api.ErrorResp `json:"error,omitempty"`
	Response  http.Response
}

TagResult represents the tag result.

type TextParams added in v1.0.0

type TextParams struct {
	Text           string `json:"text"`
	PublicID       string `json:"public_id,omitempty"`
	FontFamily     string `json:"font_family,omitempty"`
	FontSize       int    `json:"font_size,omitempty"`
	FontColor      string `json:"font_color,omitempty"`
	TextAlign      string `json:"text_align,omitempty"`
	FontWeight     string `json:"font_weight,omitempty"`
	FontStyle      string `json:"font_style,omitempty"`
	Background     string `json:"background,omitempty"`
	Opacity        string `json:"opacity,omitempty"`
	TextDecoration string `json:"text_decoration,omitempty"`
	ResourceType   string `json:"-"`
}

TextParams are the parameters for Text.

type UpdateMetadataParams

type UpdateMetadataParams struct {
	PublicIDs    []string      `json:"public_ids"`
	Metadata     api.CldAPIMap `json:"metadata"`
	Type         string        `json:"type,omitempty"`
	ResourceType string        `json:"-"`
}

UpdateMetadataParams are the parameters for UpdateMetadata.

type UpdateMetadataResult

type UpdateMetadataResult struct {
	PublicIds []string    `json:"public_ids"`
	Error     interface{} `json:"error,omitempty"`
}

UpdateMetadataResult is the result of UpdateMetadata.

type UploadParams

type UploadParams struct {
	PublicID                string                      `json:"public_id,omitempty"`
	PublicIds               api.CldAPIArray             `json:"public_ids,omitempty"`
	UseFilename             bool                        `json:"use_filename,omitempty"`
	UniqueFilename          bool                        `json:"unique_filename,omitempty"`
	FilenameOverride        string                      `json:"filename_override,omitempty"`
	Folder                  string                      `json:"folder,omitempty"`
	Overwrite               bool                        `json:"overwrite,omitempty"`
	ResourceType            string                      `json:"resource_type,omitempty"`
	Type                    api.DeliveryType            `json:"type,omitempty"`
	Tags                    api.CldAPIArray             `json:"tags,omitempty"`
	Context                 api.CldAPIMap               `json:"context,omitempty"`
	Metadata                api.Metadata                `json:"metadata,omitempty"`
	Transformation          string                      `json:"transformation,omitempty"`
	Format                  string                      `json:"format,omitempty"`
	AllowedFormats          api.CldAPIArray             `json:"allowed_formats,omitempty"`
	Eager                   string                      `json:"eager,omitempty"`
	ResponsiveBreakpoints   ResponsiveBreakpointsParams `json:"responsive_breakpoints,omitempty"`
	Eval                    string                      `json:"eval,omitempty"`
	Async                   bool                        `json:"async,omitempty"`
	EagerAsync              bool                        `json:"eager_async,omitempty"`
	Unsigned                bool                        `json:"unsigned,omitempty"`
	Proxy                   string                      `json:"proxy,omitempty"`
	Headers                 string                      `json:"headers,omitempty"`
	Callback                string                      `json:"callback,omitempty"`
	NotificationURL         string                      `json:"notification_url,omitempty"`
	EagerNotificationURL    string                      `json:"eager_notification_url,omitempty"`
	Faces                   bool                        `json:"faces,omitempty"`
	ImageMetadata           bool                        `json:"image_metadata,omitempty"`
	Exif                    bool                        `json:"exif,omitempty"`
	Colors                  bool                        `json:"colors,omitempty"`
	Phash                   bool                        `json:"phash,omitempty"`
	FaceCoordinates         api.Coordinates             `json:"face_coordinates,omitempty"`
	CustomCoordinates       api.Coordinates             `json:"custom_coordinates,omitempty"`
	Backup                  bool                        `json:"backup,omitempty"`
	ReturnDeleteToken       bool                        `json:"return_delete_token,omitempty"`
	Invalidate              bool                        `json:"invalidate,omitempty"`
	DiscardOriginalFilename bool                        `json:"discard_original_filename,omitempty"`
	Moderation              string                      `json:"moderation,omitempty"`
	UploadPreset            string                      `json:"upload_preset,omitempty"`
	RawConvert              string                      `json:"raw_convert,omitempty"`
	Categorization          string                      `json:"categorization,omitempty"`
	AutoTagging             float64                     `json:"auto_tagging,omitempty"`
	BackgroundRemoval       string                      `json:"background_removal,omitempty"`
	Detection               string                      `json:"detection,omitempty"`
	OCR                     string                      `json:"ocr,omitempty"`
	Timestamp               time.Time                   `json:"timestamp,omitempty"`
	QualityAnalysis         bool                        `json:"quality_analysis,omitempty"`
	AccessibilityAnalysis   bool                        `json:"accessibility_analysis,omitempty"`
	CinemagraphAnalysis     bool                        `json:"cinemagraph_analysis,omitempty"`
}

UploadParams struct allows to customize upload behaviour. For additional information about each one of the parameters please use the link below.

https://cloudinary.com/documentation/image_upload_api_reference#upload_optional_parameters

type UploadResult

type UploadResult struct {
	AssetID               string                        `json:"asset_id"`
	PublicID              string                        `json:"public_id"`
	Version               int                           `json:"version"`
	VersionID             string                        `json:"version_id"`
	Signature             string                        `json:"signature"`
	Width                 int                           `json:"width,omitempty"`
	Height                int                           `json:"height,omitempty"`
	Format                string                        `json:"format"`
	ResourceType          string                        `json:"resource_type"`
	CreatedAt             time.Time                     `json:"created_at"`
	Tags                  api.CldAPIArray               `json:"tags,omitempty"`
	Pages                 int                           `json:"pages,omitempty"`
	Bytes                 int                           `json:"bytes"`
	Type                  string                        `json:"type"`
	Etag                  string                        `json:"etag"`
	Placeholder           bool                          `json:"placeholder,omitempty"`
	URL                   string                        `json:"url"`
	SecureURL             string                        `json:"secure_url"`
	AccessMode            string                        `json:"access_mode"`
	Context               api.Metadata                  `json:"context,omitempty"`
	Metadata              api.Metadata                  `json:"metadata,omitempty"`
	Moderation            []Moderation                  `json:"moderation,omitempty"`
	Overwritten           bool                          `json:"overwritten"`
	OriginalFilename      string                        `json:"original_filename"`
	Eager                 []Eager                       `json:"eager"`
	ResponsiveBreakpoints []ResponsiveBreakpointsResult `json:"responsive_breakpoints"`
	Error                 api.ErrorResp                 `json:"error,omitempty"`
}

UploadResult image success response struct.

Jump to

Keyboard shortcuts

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