api

package
v0.0.0-...-72a9cf7 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const BaseURL = "https://storage.bunnycdn.com"

BaseURL for BunnyCDN storage API

Variables

This section is empty.

Functions

This section is empty.

Types

type BCDNObject

type BCDNObject struct {
	GUID            string   `json:"Guid"`
	StorageZoneName string   `json:"StorageZoneName"`
	Path            string   `json:"Path"`
	ObjectName      string   `json:"ObjectName"`
	Length          int      `json:"Length"`
	LastChanged     BCDNTime `json:"LastChanged"`
	ServerID        int      `json:"ServerId"`
	IsDirectory     bool     `json:"IsDirectory"`
	UserID          string   `json:"UserId"`
	DateCreated     BCDNTime `json:"DateCreated"`
	StorageZoneID   int      `json:"StorageZoneId"`
	Checksum        string   `json:"Checksum"`
	ReplicatedZones string   `json:"ReplicatedZones"`
}

BCDNObject maps to BunnyCDN Storage API's response object

type BCDNStorage

type BCDNStorage struct {
	ZoneName string
	APIKey   string
}

BCDNStorage contains storage & access information

func (*BCDNStorage) Delete

func (s *BCDNStorage) Delete(path string) error

Delete path from BunnyCDN storage

func (*BCDNStorage) Get

func (s *BCDNStorage) Get(path string) (string, error)

Get fetches file from BCDN storage and returns the content.

func (*BCDNStorage) List

func (s *BCDNStorage) List(path string) ([]BCDNObject, error)

List returns BCDNObject list that exists under the path

func (*BCDNStorage) Upload

func (s *BCDNStorage) Upload(path string, content []byte, checksum string) error

Delete path from BunnyCDN storage

type BCDNTime

type BCDNTime struct {
	time.Time
}

BCDNTime is used to parse BCDNObject time

func (*BCDNTime) UnmarshalJSON

func (t *BCDNTime) UnmarshalJSON(buf []byte) error

UnmarshalJSON uses 3 formats for datetime objects

Jump to

Keyboard shortcuts

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