uploader

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 24 Imported by: 63

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

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

API is the Upload API main struct.

func New

func New() (*API, error)

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

func NewWithConfiguration

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

NewWithConfiguration a new Upload API instance with the given Configuration.

func (*API) AddContext

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

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

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

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

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

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

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

func (*API) DownloadBackedUpAsset

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

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

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

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

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

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

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

func (u *API) PrivateDownloadURL(params PrivateDownloadURLParams) (string, error)

PrivateDownloadURL returns a URL that when invoked downloads the asset.

func (*API) RemoveAllContext

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

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

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

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

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

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

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

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

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

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  interface{}
}

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               []string         `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      interface{}
}

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 interface{}
}

DestroyResult is the result of Destroy.

type DownloadBackedUpAssetParams

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

DownloadBackedUpAssetParams are the parameters for DownloadBackedUpAsset.

type Eager

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 interface{}
}

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       interface{}
}

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

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

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

ModerationLabel represents moderation label.

type ModerationResponse

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  interface{}
}

MultiResult is the result of Multi.

type PrivateDownloadURLParams

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

type ResponsiveBreakpointsParams []SingleResponsiveBreakpointsParams

ResponsiveBreakpointsParams represents params for responsive breakpoints generation request.

func (ResponsiveBreakpointsParams) MarshalJSON

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

MarshalJSON writes a quoted string in the custom format.

type ResponsiveBreakpointsResult

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

ResponsiveBreakpointsResult represents a result of responsive breakpoints of an image.

type SingleResponsiveBreakpointsParams

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  interface{}
}

TagResult represents the tag result.

type TextParams

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"`
	PublicIDPrefix                 string                      `json:"public_id_prefix,omitempty"`
	PublicIDs                      api.CldAPIArray             `json:"public_ids,omitempty"`
	UseFilename                    *bool                       `json:"use_filename,omitempty"`
	UniqueFilename                 *bool                       `json:"unique_filename,omitempty"`
	UseFilenameAsDisplayName       *bool                       `json:"use_filename_as_display_name,omitempty"`
	FilenameOverride               string                      `json:"filename_override,omitempty"`
	DisplayName                    string                      `json:"display_name,omitempty"`
	UniqueDisplayName              *bool                       `json:"unique_display_name,omitempty"`
	Folder                         string                      `json:"folder,omitempty"`
	AssetFolder                    string                      `json:"asset_folder,omitempty"`
	UseAssetFolderAsPublicIDPrefix *bool                       `json:"use_asset_folder_as_public_id_prefix,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"`
	OnSuccess                      string                      `json:"on_success,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"`
	MediaMetadata                  *bool                       `json:"media_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"`
	VisualSearch                   *bool                       `json:"visual_search,omitempty"`
	AutoTagging                    float64                     `json:"auto_tagging,omitempty"`
	BackgroundRemoval              string                      `json:"background_removal,omitempty"`
	Detection                      string                      `json:"detection,omitempty"`
	OCR                            string                      `json:"ocr,omitempty"`
	Timestamp                      int64                       `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"`
	AssetFolder           string                        `json:"asset_folder"`
	DisplayName           string                        `json:"display_name"`
	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"`
	Phash                 string                        `json:"phash,omitempty"`
	Placeholder           bool                          `json:"placeholder,omitempty"`
	URL                   string                        `json:"url"`
	SecureURL             string                        `json:"secure_url"`
	PlaybackURL           string                        `json:"playback_url,omitempty"`
	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"`
	HookExecution         api.HookExecution             `json:"hook_execution"`
	Error                 api.ErrorResp                 `json:"error,omitempty"`
	Response              interface{}
}

UploadResult image success response struct.

Jump to

Keyboard shortcuts

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