Documentation ¶
Overview ¶
Algorithmia API Client (Go)
Index ¶
- Variables
- func PathJoin(parent, base string) string
- type Acl
- type AclType
- type AlgoOptions
- type AlgoResponse
- type Algorithm
- type AsyncResponse
- type Client
- type DataDirectory
- func (f *DataDirectory) Create(acl *Acl) error
- func (f *DataDirectory) Delete() error
- func (f *DataDirectory) Dir(name string) *DataDirectory
- func (f *DataDirectory) Dirs() <-chan SubobjectResult
- func (f *DataDirectory) Exists() (bool, error)
- func (f *DataDirectory) File(name string) *DataFile
- func (f *DataDirectory) Files() <-chan SubobjectResult
- func (f *DataDirectory) ForceDelete() error
- func (f *DataDirectory) List() <-chan SubobjectResult
- func (f *DataDirectory) Name() (string, error)
- func (f *DataDirectory) Path() string
- func (f *DataDirectory) Permissions() (*Acl, error)
- func (f *DataDirectory) SetAttributes(attr *DirAttributes) error
- func (f *DataDirectory) UpdatePermissions(acl *Acl) error
- func (f *DataDirectory) Url() string
- type DataFile
- func (f *DataFile) Bytes() ([]byte, error)
- func (f *DataFile) Delete() error
- func (f *DataFile) Exists() (bool, error)
- func (f *DataFile) File() (*os.File, error)
- func (f *DataFile) Json(x interface{}) error
- func (f *DataFile) LastModified() time.Time
- func (f *DataFile) Name() (string, error)
- func (f *DataFile) Path() string
- func (f *DataFile) Put(data interface{}) error
- func (f *DataFile) PutBytes(data []byte) error
- func (f *DataFile) PutFile(fpath string) error
- func (f *DataFile) PutJson(data interface{}) error
- func (f *DataFile) SetAttributes(attr *FileAttributes) error
- func (f *DataFile) Size() int64
- func (f *DataFile) StringContents() (string, error)
- func (f *DataFile) Url() string
- type DataObject
- type DataObjectType
- type DirAttributes
- type Err
- type FileAttributes
- type Metadata
- type OutputType
- type SubobjectResult
Constants ¶
This section is empty.
Variables ¶
View Source
var InvalidPath = errors.New("Invalid path")
View Source
var NoAclProvided = errors.New("Response does not contain read ACL")
View Source
var ReadAclMyAlgos = &Acl{AclTypeMyAlgos}
View Source
var ReadAclPrivate = &Acl{AclTypePrivate}
View Source
var ReadAclPublic = &Acl{AclTypePublic}
Functions ¶
Types ¶
type AclType ¶
type AclType int
const ( AclTypePublic AclType = iota AclTypeMyAlgos AclTypePrivate AclTypeDefault = AclTypeMyAlgos )
type AlgoOptions ¶
type AlgoOptions struct { Timeout int Stdout bool Output OutputType QueryParameters url.Values }
type AlgoResponse ¶
type AlgoResponse struct { Result interface{} `json:"result"` Metadata *Metadata `json:"metadata"` Error *Err `json:"error"` //never set! }
func (*AlgoResponse) String ¶
func (resp *AlgoResponse) String() string
type Algorithm ¶
type Algorithm struct {
// contains filtered or unexported fields
}
func (*Algorithm) SetOptions ¶
func (algo *Algorithm) SetOptions(opt AlgoOptions)
type AsyncResponse ¶
type AsyncResponse struct { AsyncProtocol string `json:"async_protocol"` RequestId string `json:"request_id"` Error *Err `json:"error"` //never set! }
Response from the API for an asynchronous request (output=void)
func (*AsyncResponse) String ¶
func (resp *AsyncResponse) String() string
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Dir ¶
func (c *Client) Dir(dataUrl string) *DataDirectory
type DataDirectory ¶
type DataDirectory struct { DataObjectType // contains filtered or unexported fields }
func NewDataDirectory ¶
func NewDataDirectory(client *Client, dataUrl string) *DataDirectory
func (*DataDirectory) Create ¶
func (f *DataDirectory) Create(acl *Acl) error
Creates a directory, optionally include non-nil Acl argument to set permissions
func (*DataDirectory) Delete ¶
func (f *DataDirectory) Delete() error
Delete directory if it's empty
func (*DataDirectory) Dir ¶
func (f *DataDirectory) Dir(name string) *DataDirectory
func (*DataDirectory) Dirs ¶
func (f *DataDirectory) Dirs() <-chan SubobjectResult
func (*DataDirectory) Exists ¶
func (f *DataDirectory) Exists() (bool, error)
func (*DataDirectory) File ¶
func (f *DataDirectory) File(name string) *DataFile
func (*DataDirectory) Files ¶
func (f *DataDirectory) Files() <-chan SubobjectResult
func (*DataDirectory) ForceDelete ¶
func (f *DataDirectory) ForceDelete() error
Forcibly delete directory (even non-empty)
func (*DataDirectory) List ¶
func (f *DataDirectory) List() <-chan SubobjectResult
func (*DataDirectory) Name ¶
func (f *DataDirectory) Name() (string, error)
func (*DataDirectory) Path ¶
func (f *DataDirectory) Path() string
func (*DataDirectory) Permissions ¶
func (f *DataDirectory) Permissions() (*Acl, error)
Returns permissions for this directory or None if it's a special collection such as
.session or .algo
func (*DataDirectory) SetAttributes ¶
func (f *DataDirectory) SetAttributes(attr *DirAttributes) error
func (*DataDirectory) UpdatePermissions ¶
func (f *DataDirectory) UpdatePermissions(acl *Acl) error
func (*DataDirectory) Url ¶
func (f *DataDirectory) Url() string
type DataFile ¶
type DataFile struct { DataObjectType // contains filtered or unexported fields }
func NewDataFile ¶
func (*DataFile) LastModified ¶
func (*DataFile) SetAttributes ¶
func (f *DataFile) SetAttributes(attr *FileAttributes) error
func (*DataFile) StringContents ¶
type DataObject ¶
type DataObject interface { IsFile() bool //Returns whether object is a file IsDir() bool //Returns whether object is a directory Type() DataObjectType //Returns type of this DataObject Path() string Url() string }
type DataObjectType ¶
type DataObjectType int
const ( File DataObjectType = iota Directory )
const DataObjectNone DataObjectType = -1
func (DataObjectType) IsDir ¶
func (obj DataObjectType) IsDir() bool
Returns whether object is a directory
func (DataObjectType) IsFile ¶
func (obj DataObjectType) IsFile() bool
Returns whether object is a file
func (DataObjectType) Type ¶
func (obj DataObjectType) Type() DataObjectType
Returns type of DataObject
type DirAttributes ¶
type DirAttributes struct {
Name string `json:"name" mapstructure:"name"`
}
type Err ¶
type FileAttributes ¶
type Metadata ¶
type SubobjectResult ¶
type SubobjectResult struct { Object DataObject Err error }
Click to show internal directories.
Click to hide internal directories.