api

package
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: 13 Imported by: 4

Documentation

Overview

Package api contains packages used for accessing Cloudinary API functionality.

https://cloudinary.com/documentation/cloudinary_references

Index

Constants

View Source
const (
	// Image is the image asset type.
	Image AssetType = "image"
	// Video is the video asset type.
	Video = "video"
	// File is the raw asset type.
	File = "raw"
	// Auto is the auto asset type. Tells Cloudinary to automatically detect the type of the uploaded asset.
	Auto = "auto"
	// All is the all asset type. Used for downloading folders with all assets inside.
	All = "all"
)
View Source
const (
	// Upload is the upload delivery type.
	Upload DeliveryType = "upload"
	// Private is the private delivery type.
	Private = "private"
	// Public is the  delivery type.
	Public = "public"
	// Authenticated is the  delivery type.
	Authenticated = "authenticated"
	// Fetch is the fetch delivery type.
	Fetch = "fetch"
	// Sprite is the sprite delivery type.
	Sprite = "sprite"
	// Text is the text delivery type.
	Text = "text"
	// Multi is the multi delivery type.
	Multi = "multi"
	// Facebook is the facebook delivery type.
	Facebook = "facebook"
	// Twitter is the twitter delivery type.
	Twitter = "twitter"
	// TwitterName is the twitter name delivery type.
	TwitterName = "twitter_name"
	// Gravatar is the gravatar delivery type.
	Gravatar = "gravatar"
	// Youtube is the youtube delivery type.
	Youtube = "youtube"
	// Hulu is the hulu delivery type.
	Hulu = "hulu"
	// Vimeo is the vimeo delivery type.
	Vimeo = "vimeo"
	// Animoto is the animoto delivery type.
	Animoto = "animoto"
	// Worldstarhiphop is the world star hip hop delivery type.
	Worldstarhiphop = "worldstarhiphop"
	// Dailymotion is the daily motion delivery type.
	Dailymotion = "dailymotion"
)
View Source
const (
	// Pending is the pending moderation status.
	Pending ModerationStatus = "pending"
	// Approved is the approved moderation status.
	Approved = "approved"
	// Rejected is the rejected moderation status.
	Rejected = "rejected"
)
View Source
const Version = "1.7.0"

Version is the Cloudinary Go package version.

Variables

View Source
var UserAgent = fmt.Sprintf("CloudinaryGo/%s (Go %s)", Version, strings.TrimPrefix(runtime.Version(), "go"))

UserAgent contains information about the SDK user agent. Passed to the Cloudinary servers.

View Source
var UserPlatform = ""

UserPlatform provides additional information to be passed with the UserAgent, e.g. "CloudinaryIntegration/1.2.3".

This value is set in platform-specific implementations that use cloudinary-go.

The format of the value should be <ProductName>/Version[ (comment)]. http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43

**Do not set this value in application code!**

Functions

func BaseURL added in v1.0.0

func BaseURL(uploadPrefix string) string

BaseURL is the base API url.

func BuildPath

func BuildPath(parts ...interface{}) string

BuildPath builds (joins) the URL path from the provided parts.

func DeferredClose

func DeferredClose(c io.Closer)

DeferredClose is a wrapper around io.Closer.Close method. Logs error if occurred.

func GetUserAgent added in v1.6.0

func GetUserAgent() string

GetUserAgent provides the UserAgent string that is passed to the Cloudinary servers.

Prepends UserPlatform if it is defined.

func IsBase64Data

func IsBase64Data(base64Candidate string) bool

IsBase64Data checks whether base64Candidate represents a valid base64 encoded string.

func IsLocalFilePath

func IsLocalFilePath(path interface{}) bool

IsLocalFilePath determines whether the provided path can be a local file.

Since a unix file path can include almost any characters, the way to distinguish between file path and non-file path is to check if it can be URL or Base64 encoded data.

func IsValidURL added in v1.0.0

func IsValidURL(urlCandidate string) bool

IsValidURL checks whether urlCandidate string is a valid URL.

func SignParameters

func SignParameters(params url.Values, secret string) (string, error)

SignParameters signs parameters using the provided secret.

func StructToParams

func StructToParams(inputStruct interface{}) (url.Values, error)

StructToParams serializes struct to url.Values, which can be further sent to the http client.

Types

type AssetType

type AssetType string

AssetType is the type of the asset.

func (AssetType) String

func (a AssetType) String() string

String serializes AssetType to string.

type BriefAssetResult

type BriefAssetResult struct {
	AssetID     string    `json:"asset_id"`
	PublicID    string    `json:"public_id"`
	Format      string    `json:"format"`
	Version     int       `json:"version"`
	AssetType   string    `json:"resource_type"`
	Type        string    `json:"type"`
	CreatedAt   time.Time `json:"created_at"`
	Bytes       int       `json:"bytes"`
	Width       int       `json:"width"`
	Height      int       `json:"height"`
	Backup      bool      `json:"backup"`
	AccessMode  string    `json:"access_mode"`
	URL         string    `json:"url"`
	SecureURL   string    `json:"secure_url"`
	Tags        []string  `json:"tags,omitempty"`
	Context     Metadata  `json:"context,omitempty"`
	Metadata    Metadata  `json:"metadata,omitempty"`
	Placeholder bool      `json:"placeholder,omitempty"`
	Error       string    `json:"error,omitempty"`
}

BriefAssetResult represents a partial asset result that is returned when assets are listed.

type CldAPIArray added in v1.0.0

type CldAPIArray []string

CldAPIArray is not just an alias, in addition it has a custom MarshalJSON() for serialisation purposes.

func (CldAPIArray) MarshalJSON added in v1.0.0

func (cldAPIArr CldAPIArray) MarshalJSON() ([]byte, error)

MarshalJSON writes a quoted string in the custom format.

type CldAPIMap added in v1.0.0

type CldAPIMap map[string]string

CldAPIMap is not just an alias, in addition it has a custom MarshalJSON() for serialisation purposes.

func (CldAPIMap) MarshalJSON added in v1.0.0

func (cldAPIMap CldAPIMap) MarshalJSON() ([]byte, error)

MarshalJSON writes a quoted string in the custom format.

type Coordinates

type Coordinates [][]int

Coordinates represents coordinates on the asset.

type DeliveryType

type DeliveryType string

DeliveryType is the delivery type of the asset.

func (DeliveryType) String

func (d DeliveryType) String() string

String serializes DeliveryType to string.

type EndPoint

type EndPoint = string

EndPoint represents the API endpoint.

type ErrorResp

type ErrorResp struct {
	Message string `json:"message"`
}

ErrorResp is the failed api request main struct.

type Metadata

type Metadata map[string]interface{}

Metadata is the Cloudinary structured metadata.

func (Metadata) MarshalJSON added in v1.7.0

func (cldAPIMap Metadata) MarshalJSON() ([]byte, error)

MarshalJSON writes a quoted string in the custom format.

type ModerationStatus

type ModerationStatus string

ModerationStatus is the moderation status of the asset.

type Option

type Option map[string]interface{}

Option is the optional parameters custom struct.

Directories

Path Synopsis
Package admin is used for accessing Cloudinary Admin API functionality.
Package admin is used for accessing Cloudinary Admin API functionality.
metadata
Package metadata defines the structured metadata.
Package metadata defines the structured metadata.
Package uploader is used for accessing Cloudinary Upload API functionality.
Package uploader is used for accessing Cloudinary Upload API functionality.

Jump to

Keyboard shortcuts

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