Documentation ¶
Index ¶
- Variables
- type Assembly
- type AssemblyInfo
- type AssemblyList
- type AssemblyListItem
- type AssemblyReplay
- type AssemblyWatcher
- type Client
- func (client *Client) CancelAssembly(assemblyUrl string) (Response, error)
- func (client *Client) CreateAssembly() *Assembly
- func (client *Client) CreateTemplate(template *Template) (string, error)
- func (client *Client) DeleteTemplate(templateId string) error
- func (client *Client) EditTemplate(templateId string, newTemplate *Template) error
- func (client *Client) GetAssembly(assemblyUrl string) (*AssemblyInfo, error)
- func (client *Client) GetTemplate(templateId string) (*Template, error)
- func (client *Client) ListAssemblies(options *ListOptions) (*AssemblyList, error)
- func (client *Client) ListNotifications(options *ListOptions) (*NotificationList, error)
- func (client *Client) ListTemplates(options *ListOptions) (*TemplateList, error)
- func (client *Client) ReplayAssembly(assemblyId string) *AssemblyReplay
- func (client *Client) ReplayNotification(assemblyId string, notifyUrl string) (Response, error)
- func (client *Client) WaitForAssembly(assemblyUrl string) *AssemblyWatcher
- func (client *Client) Watch(options *WatchOptions) *Watcher
- type Config
- type FileInfo
- type ListOptions
- type NotificationList
- type NotificationListItem
- type Response
- type Template
- type TemplateList
- type TemplateListItem
- type WatchOptions
- type Watcher
Constants ¶
This section is empty.
Variables ¶
var DefaultConfig = Config{
Region: "us-east-1",
Endpoint: "http://api2.transloadit.com",
}
Functions ¶
This section is empty.
Types ¶
type Assembly ¶
type Assembly struct { NotifyUrl string TemplateId string Blocking bool // contains filtered or unexported fields }
func (*Assembly) AddReader ¶
func (assembly *Assembly) AddReader(field, name string, reader io.ReadCloser)
Add another reader to upload later.
func (*Assembly) Upload ¶
func (assembly *Assembly) Upload() (*AssemblyInfo, error)
Start the assembly and upload all files.
type AssemblyInfo ¶
type AssemblyInfo struct { AssemblyId string `json:"assembly_id"` ParentId string `json:"parent_id"` AssemblyUrl string `json:"assembly_url"` AssemblySslUrl string `json:"assembly_ssl_url"` BytesReceived int `json:"bytes_received"` BytesExpected int `json:"bytes_expected"` ClientAgent string `json:"client_agent"` ClientIp string `json:"client_ip"` ClientReferer string `json:"client_referer"` StartDate string `json:"start_date"` IsInfinite bool `json:"is_infinite"` HasDupeJobs bool `json:"has_dupe_jobs"` UploadDuration float32 `json:"upload_duration"` NotifyUrl string `json:"notify_url"` NotifyStart string `json:"notify_start"` NotifyStatus string `json:"notify_status"` NotifyDuation float32 `json:"notify_duration"` LastJobCompleted string `json:"last_job_completed"` ExecutionDuration float32 `json:"execution_duration"` ExecutionStart string `json:"execution_start"` Created string `json:"created"` Ok string `json:"ok"` Message string `json:"message"` Files string `json:"files"` Fields map[string]interface{} `json:"fields"` BytesUsage int `json:"bytes_usage"` FilesToStoreOnS3 int `json:"files_to_store_on_s3"` QueuedFilesToStoreOnS3 int `json:"queued_files_to_store_on_s3"` ExecutingJobs []interface{} `json:"executing_jobs"` StartedJobs []interface{} `json:"started_jobs"` ParentAssemblyStatus *AssemblyInfo `json:"parent_assembly_status"` Uploads []*FileInfo `json:"uploads"` Results map[string][]*FileInfo `json:"results"` Params string `json:"params"` Error string `json:"error"` }
type AssemblyList ¶
type AssemblyList struct { Assemblies []*AssemblyListItem `json:"items"` Count int `json:"count"` }
type AssemblyListItem ¶
type AssemblyListItem struct { AssemblyId string `json:"id"` AccountId string `json:"account_id"` TemplateId string `json:"template_id"` Instance string `json:"instance"` NotifyUrl string `json:"notify_url"` RedirectUrl string `json:"redirect_url"` ExecutionDuration float32 `json:"execution_duration"` ExecutionStart time.Time `json:"execution_start"` Created time.Time `json:"created"` Ok string `json:"ok"` Error string `json:"error"` Files string `json:"files"` }
type AssemblyReplay ¶
type AssemblyReplay struct { NotifyUrl string Blocking bool // contains filtered or unexported fields }
func (*AssemblyReplay) AddStep ¶
func (assembly *AssemblyReplay) AddStep(name string, details map[string]interface{})
Add a step to override the original ones.
func (*AssemblyReplay) ReparseTemplate ¶
func (assembly *AssemblyReplay) ReparseTemplate()
Reparse the template when replaying. Useful if the template has changed since the orignal assembly was created.
func (*AssemblyReplay) Start ¶
func (assembly *AssemblyReplay) Start() (*AssemblyInfo, error)
Start the assembly replay.
type AssemblyWatcher ¶
type AssemblyWatcher struct { Response chan *AssemblyInfo Error chan error // contains filtered or unexported fields }
func (*AssemblyWatcher) Stop ¶
func (watcher *AssemblyWatcher) Stop()
Stop the watcher and close all channels.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
Create a new client using the provided configuration object. An error will be returned if no AuthKey or AuthSecret is found in config.
func (*Client) CancelAssembly ¶
Cancel an assembly using its url.
func (*Client) CreateAssembly ¶
Create a new assembly instance which can be executed later.
func (*Client) CreateTemplate ¶
Save the template.
func (*Client) DeleteTemplate ¶
Delete a template from the list.
func (*Client) EditTemplate ¶
Update the name and content of the template defined using the id.
func (*Client) GetAssembly ¶
func (client *Client) GetAssembly(assemblyUrl string) (*AssemblyInfo, error)
Get information about an assembly using its url.
func (*Client) GetTemplate ¶
Get information about a template using its id.
func (*Client) ListAssemblies ¶
func (client *Client) ListAssemblies(options *ListOptions) (*AssemblyList, error)
List all assemblies matching the criterias.
func (*Client) ListNotifications ¶
func (client *Client) ListNotifications(options *ListOptions) (*NotificationList, error)
List all notificaions matching the criterias.
func (*Client) ListTemplates ¶
func (client *Client) ListTemplates(options *ListOptions) (*TemplateList, error)
List all templates matching the criterias.
func (*Client) ReplayAssembly ¶
func (client *Client) ReplayAssembly(assemblyId string) *AssemblyReplay
Create a new AssemblyReplay instance.
func (*Client) ReplayNotification ¶
Replay a notification which was trigger by assembly defined using the assemblyId. If notifyUrl is not empty it will override the original notify url.
func (*Client) WaitForAssembly ¶
func (client *Client) WaitForAssembly(assemblyUrl string) *AssemblyWatcher
Wait until the status of an assembly is either completed, canceled or aborted.
func (*Client) Watch ¶
func (client *Client) Watch(options *WatchOptions) *Watcher
type FileInfo ¶
type FileInfo struct { Id string `json:"id"` Name string `json:"name"` Basename string `json:"basename"` Ext string `json:"ext"` Size int `json:"size"` Mime string `json:"mime"` Type string `json:"type"` Field string `json:"field"` Md5Hash string `json:"md5hash"` OriginalMd5Hash string `json:"original_md5hash"` OriginalId string `json:"original_id"` OriginalBasename string `json:"original_basename"` Url string `json:"url"` SslUrl string `json:"ssl_url"` Meta map[string]interface{} `json:"meta"` }
type ListOptions ¶
type ListOptions struct { Page int `json:"page,omitempty"` PageSize int `json:"pagesize,omitempty"` Sort string `json:"sort,omitempty"` Order string `json:"order,omitempty"` Fields []string `json:"fields,omitempty"` Type string `json:"type,omitempty"` Keywords []string `json:"keyword,omitempty"` AssemblyId string `json:"assembly_id,omitempty"` FromDate *time.Time `json:"fromdate,omitempty"` ToDate *time.Time `json:"todate,omitempty"` Auth struct { Key string `json:"key"` Expires string `json:"expires"` } `json:"auth"` }
type NotificationList ¶
type NotificationList struct { Notifications []*NotificationListItem `json:"items"` Count int `json:"count"` }
type NotificationListItem ¶
type NotificationListItem struct { Id string `json:"id"` AssemblyId string `json:"assembly_id"` AccountId string `json:"account_id"` Url string `json:"url"` ResponseCode int `json:"response_code"` RespandeData string `json:"response_data"` Duration float32 `json:"duration"` Created time.Time `json:"created"` Error string `json:"error"` }
type Template ¶
type Template struct { Name string `json:"template_name"` Steps map[string]map[string]interface{} `json:"template_content"` }
func NewTemplate ¶
Creates a new template instance which can be saved to transloadit.
type TemplateList ¶
type TemplateList struct { Templates []TemplateListItem `json:"items"` Count int `json:"count"` }