api

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: MIT Imports: 11 Imported by: 5

Documentation

Overview

Package api contains packages used for accessing Cloudinary API functionality.

https://cloudinary.com/documentation/cloudinary_references

Index

Constants

View Source
const (
	Image AssetType = "image"
	Video           = "video"
	File            = "raw"
	Auto            = "auto"
	All             = "all"
)
View Source
const (
	Upload          DeliveryType = "upload"
	Private                      = "private"
	Public                       = "public"
	Authenticated                = "authenticated"
	Fetch                        = "fetch"
	Sprite                       = "sprite"
	Text                         = "text"
	Multi                        = "multi"
	Facebook                     = "facebook"
	Twitter                      = "twitter"
	TwitterName                  = "twitter_name"
	Gravatar                     = "gravatar"
	Youtube                      = "youtube"
	Hulu                         = "hulu"
	Vimeo                        = "vimeo"
	Animoto                      = "animoto"
	Worldstarhiphop              = "worldstarhiphop"
	Dailymotion                  = "dailymotion"
)
View Source
const (
	Pending  ModerationStatus = "pending"
	Approved                  = "approved"
	Rejected                  = "rejected"
)
View Source
const UserAgent = "CloudinaryGo/" + Version
View Source
const Version = "0.2.0"

Variables

This section is empty.

Functions

func BaseUrl

func BaseUrl(uploadPrefix string) string

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 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

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

func (AssetType) String

func (a AssetType) String() 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     CldApiMap `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

type CldApiArray []string

func (CldApiArray) MarshalJSON

func (cldApiArr CldApiArray) MarshalJSON() ([]byte, error)

MarshalJSON writes a quoted string in the custom format.

type CldApiMap

type CldApiMap map[string]string

func (CldApiMap) MarshalJSON

func (cldApiMap CldApiMap) MarshalJSON() ([]byte, error)

MarshalJSON writes a quoted string in the custom format.

type Coordinates

type Coordinates [][]int

type DeliveryType

type DeliveryType string

func (DeliveryType) String

func (d DeliveryType) String() string

type EndPoint

type EndPoint string

func (EndPoint) String

func (e EndPoint) String() string

type ErrorResp

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

ErrorResp is the failed api request main struct.

type Metadata

type Metadata map[string]interface{}

type ModerationStatus

type ModerationStatus string

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