algorithmia-go: github.com/algorithmiaio/algorithmia-go Index | Files

package algorithmia

import "github.com/algorithmiaio/algorithmia-go"

Algorithmia API Client (Go)

Index

Package Files

acl.go algo_response.go algorithm.go async_response.go client.go data.go datadirectory.go datafile.go debug.go error.go get.go request.go utils.go

Variables

var InvalidPath = errors.New("Invalid path")
var NoAclProvided = errors.New("Response does not contain read ACL")
var ReadAclMyAlgos = &Acl{AclTypeMyAlgos}
var ReadAclPrivate = &Acl{AclTypePrivate}
var ReadAclPublic = &Acl{AclTypePublic}

func PathJoin Uses

func PathJoin(parent, base string) string

type Acl Uses

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

func (*Acl) ReadAcl Uses

func (a *Acl) ReadAcl() AclType

type AclType Uses

type AclType int
const (
    AclTypePublic AclType = iota
    AclTypeMyAlgos
    AclTypePrivate
    AclTypeDefault = AclTypeMyAlgos
)

func (AclType) AclString Uses

func (t AclType) AclString() string

func (AclType) Pseudonym Uses

func (t AclType) Pseudonym() string

func (AclType) String Uses

func (t AclType) String() string

type AlgoOptions Uses

type AlgoOptions struct {
    Timeout         int
    Stdout          bool
    Output          OutputType
    QueryParameters url.Values
}

type AlgoResponse Uses

type AlgoResponse struct {
    Result   interface{} `json:"result"`
    Metadata *Metadata   `json:"metadata"`
    Error    *Err        `json:"error"` //never set!
}

func (*AlgoResponse) String Uses

func (resp *AlgoResponse) String() string

type Algorithm Uses

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

func NewAlgorithm Uses

func NewAlgorithm(client *Client, ref string) (*Algorithm, error)

func (*Algorithm) Path Uses

func (algo *Algorithm) Path() string

func (*Algorithm) Pipe Uses

func (algo *Algorithm) Pipe(input1 interface{}) (interface{}, error)

Pipe an input into this algorithm

func (*Algorithm) SetOptions Uses

func (algo *Algorithm) SetOptions(opt AlgoOptions)

func (*Algorithm) Url Uses

func (algo *Algorithm) Url() string

type AsyncResponse Uses

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 Uses

func (resp *AsyncResponse) String() string

type Client Uses

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

func NewClient Uses

func NewClient(apiKey, apiAddress string) *Client

func (*Client) Algo Uses

func (c *Client) Algo(ref string) (*Algorithm, error)

func (*Client) Dir Uses

func (c *Client) Dir(dataUrl string) *DataDirectory

func (*Client) File Uses

func (c *Client) File(dataUrl string) *DataFile

type DataDirectory Uses

type DataDirectory struct {
    DataObjectType
    // contains filtered or unexported fields
}

func NewDataDirectory Uses

func NewDataDirectory(client *Client, dataUrl string) *DataDirectory

func (*DataDirectory) Create Uses

func (f *DataDirectory) Create(acl *Acl) error

Creates a directory, optionally include non-nil Acl argument to set permissions

func (*DataDirectory) Delete Uses

func (f *DataDirectory) Delete() error

Delete directory if it's empty

func (*DataDirectory) Dir Uses

func (f *DataDirectory) Dir(name string) *DataDirectory

func (*DataDirectory) Dirs Uses

func (f *DataDirectory) Dirs() <-chan SubobjectResult

func (*DataDirectory) Exists Uses

func (f *DataDirectory) Exists() (bool, error)

func (*DataDirectory) File Uses

func (f *DataDirectory) File(name string) *DataFile

func (*DataDirectory) Files Uses

func (f *DataDirectory) Files() <-chan SubobjectResult

func (*DataDirectory) ForceDelete Uses

func (f *DataDirectory) ForceDelete() error

Forcibly delete directory (even non-empty)

func (*DataDirectory) List Uses

func (f *DataDirectory) List() <-chan SubobjectResult

func (*DataDirectory) Name Uses

func (f *DataDirectory) Name() (string, error)

func (*DataDirectory) Path Uses

func (f *DataDirectory) Path() string

func (*DataDirectory) Permissions Uses

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 Uses

func (f *DataDirectory) SetAttributes(attr *DirAttributes) error

func (*DataDirectory) UpdatePermissions Uses

func (f *DataDirectory) UpdatePermissions(acl *Acl) error

func (*DataDirectory) Url Uses

func (f *DataDirectory) Url() string

type DataFile Uses

type DataFile struct {
    DataObjectType
    // contains filtered or unexported fields
}

func NewDataFile Uses

func NewDataFile(client *Client, dataUrl string) *DataFile

func (*DataFile) Bytes Uses

func (f *DataFile) Bytes() ([]byte, error)

func (*DataFile) Delete Uses

func (f *DataFile) Delete() error

Delete from data api

func (*DataFile) Exists Uses

func (f *DataFile) Exists() (bool, error)

func (*DataFile) File Uses

func (f *DataFile) File() (*os.File, error)

Get file from the data api

func (*DataFile) Json Uses

func (f *DataFile) Json(x interface{}) error

func (*DataFile) LastModified Uses

func (f *DataFile) LastModified() time.Time

func (*DataFile) Name Uses

func (f *DataFile) Name() (string, error)

func (*DataFile) Path Uses

func (f *DataFile) Path() string

func (*DataFile) Put Uses

func (f *DataFile) Put(data interface{}) error

Post to data api

func (*DataFile) PutBytes Uses

func (f *DataFile) PutBytes(data []byte) error

func (*DataFile) PutFile Uses

func (f *DataFile) PutFile(fpath string) error

Post file to data api

func (*DataFile) PutJson Uses

func (f *DataFile) PutJson(data interface{}) error

Post json to data api

func (*DataFile) SetAttributes Uses

func (f *DataFile) SetAttributes(attr *FileAttributes) error

func (*DataFile) Size Uses

func (f *DataFile) Size() int64

func (*DataFile) StringContents Uses

func (f *DataFile) StringContents() (string, error)

func (*DataFile) Url Uses

func (f *DataFile) Url() string

type DataObject Uses

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 Uses

type DataObjectType int
const (
    File DataObjectType = iota
    Directory
)
const DataObjectNone DataObjectType = -1

func (DataObjectType) IsDir Uses

func (obj DataObjectType) IsDir() bool

Returns whether object is a directory

func (DataObjectType) IsFile Uses

func (obj DataObjectType) IsFile() bool

Returns whether object is a file

func (DataObjectType) Type Uses

func (obj DataObjectType) Type() DataObjectType

Returns type of DataObject

type DirAttributes Uses

type DirAttributes struct {
    Name string `json:"name" mapstructure:"name"`
}

type Err Uses

type Err struct {
    Message    string `json:"message" mapstructure:"message"`
    Stacktrace string `json:"stacktrace" mapstructure:"stacktrace"`
}

func (*Err) Error Uses

func (e *Err) Error() string

type FileAttributes Uses

type FileAttributes struct {
    FileName     string `json:"filename"`
    LastModified string `json:"last_modified"`
    Size         int64  `json:"size"`
}

type Metadata Uses

type Metadata struct {
    ContentType string  `json:"content_type"`
    Duration    float64 `json:"duration"`
    Stdout      bool    `json:"stdout"`
}

func (*Metadata) String Uses

func (d *Metadata) String() string

type OutputType Uses

type OutputType int
const (
    Default OutputType = iota
    Raw
    Void
)

type SubobjectResult Uses

type SubobjectResult struct {
    Object DataObject
    Err    error
}

Package algorithmia imports 15 packages (graph). Updated 2016-12-09. Refresh now. Tools for package owners. This is a quick bug-fix fork (has fewer than three commits, and only during the week it was created).