cloudinary

package
v1.69.21 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package cloudinary provides an interface to the Cloudinary DAM

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFs

func NewFs(ctx context.Context, name string, root string, m configmap.Mapper) (fs.Fs, error)

NewFs constructs an Fs from the path, bucket:path

Types

type Fs

type Fs struct {
	// contains filtered or unexported fields
}

Fs represents a remote cloudinary server

func (*Fs) Features

func (f *Fs) Features() *fs.Features

Features returns the optional features of this Fs

func (*Fs) FromStandardFullPath

func (f *Fs) FromStandardFullPath(dir string) string

FromStandardFullPath encodes a full path to Cloudinary standard

func (*Fs) FromStandardName

func (f *Fs) FromStandardName(s string) string

FromStandardName implementation of the api.CloudinaryEncoder

func (*Fs) FromStandardPath

func (f *Fs) FromStandardPath(s string) string

FromStandardPath implementation of the api.CloudinaryEncoder

func (*Fs) Hashes

func (f *Fs) Hashes() hash.Set

Hashes returns the supported hash sets

func (*Fs) List

func (f *Fs) List(ctx context.Context, dir string) (fs.DirEntries, error)

List the objects and directories in dir into entries

func (*Fs) Mkdir

func (f *Fs) Mkdir(ctx context.Context, dir string) error

Mkdir creates empty folders

func (*Fs) Name

func (f *Fs) Name() string

Name of the remote (as passed into NewFs)

func (*Fs) NewObject

func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error)

NewObject finds the Object at remote. If it can't be found it returns the error fs.ErrorObjectNotFound.

func (*Fs) Precision

func (f *Fs) Precision() time.Duration

Precision of the remote

func (*Fs) Put

func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error)

Put uploads content to Cloudinary

func (*Fs) Rmdir

func (f *Fs) Rmdir(ctx context.Context, dir string) error

Rmdir deletes empty folders

func (*Fs) Root

func (f *Fs) Root() string

Root of the remote (as passed into NewFs)

func (*Fs) String

func (f *Fs) String() string

String converts this Fs to a string

func (*Fs) ToAssetFolderAPI

func (f *Fs) ToAssetFolderAPI(dir string) string

ToAssetFolderAPI encodes folders as expected by the Cloudinary SDK

func (*Fs) ToDisplayNameElastic

func (f *Fs) ToDisplayNameElastic(dir string) string

ToDisplayNameElastic encodes a special case of elasticsearch

func (*Fs) ToStandardName

func (f *Fs) ToStandardName(s string) string

ToStandardName implementation of the api.CloudinaryEncoder

func (*Fs) ToStandardPath

func (f *Fs) ToStandardPath(s string) string

ToStandardPath implementation of the api.CloudinaryEncoder

func (*Fs) WaitEventuallyConsistent

func (f *Fs) WaitEventuallyConsistent()

WaitEventuallyConsistent waits till the FS is eventually consistent

type Object

type Object struct {
	// contains filtered or unexported fields
}

Object describes a cloudinary object

func (*Object) Fs

func (o *Object) Fs() fs.Info

Fs returns the parent Fs

func (*Object) Hash

func (o *Object) Hash(ctx context.Context, ty hash.Type) (string, error)

Hash returns the MD5 of an object

func (*Object) ModTime

func (o *Object) ModTime(ctx context.Context) time.Time

ModTime returns the modification time of the object

func (*Object) Open

func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.ReadCloser, err error)

Open an object for read

func (*Object) Remote

func (o *Object) Remote() string

Remote returns the remote path

func (*Object) Remove

func (o *Object) Remove(ctx context.Context) error

Remove an object

func (*Object) SetModTime

func (o *Object) SetModTime(ctx context.Context, modTime time.Time) error

SetModTime sets the modification time of the local fs object

func (*Object) Size

func (o *Object) Size() int64

Size of object in bytes

func (*Object) Storable

func (o *Object) Storable() bool

Storable returns if this object is storable

func (*Object) String

func (o *Object) String() string

Return a string version

func (*Object) Update

func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) error

Update the object with the contents of the io.Reader

type Options

type Options struct {
	CloudName                 string               `config:"cloud_name"`
	APIKey                    string               `config:"api_key"`
	APISecret                 string               `config:"api_secret"`
	UploadPrefix              string               `config:"upload_prefix"`
	UploadPreset              string               `config:"upload_preset"`
	Enc                       encoder.MultiEncoder `config:"encoding"`
	EventuallyConsistentDelay fs.Duration          `config:"eventually_consistent_delay"`
}

Options defines the configuration for this backend

Directories

Path Synopsis
Package api has type definitions for cloudinary
Package api has type definitions for cloudinary

Jump to

Keyboard shortcuts

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