Documentation ¶
Overview ¶
Package smartling is a client implementation of the Smartling Translation API as documented at https://docs.smartling.com/display/docs/Smartling+Translation+API
Index ¶
- Constants
- type Client
- func (c *Client) Delete(fileUri string) error
- func (c *Client) Get(req *GetRequest) ([]byte, error)
- func (c *Client) LastModified(req LastModifiedRequest) ([]LastModifiedItem, error)
- func (c *Client) List(req ListRequest) ([]FileStatus, error)
- func (c *Client) Locales() ([]Locale, error)
- func (c *Client) Rename(oldFileUri, newFileUri string) error
- func (c *Client) SetHttpTimeout(t time.Duration)
- func (c *Client) Status(fileUri, locale string) (FileStatus, error)
- func (c *Client) Upload(localFilePath string, req *UploadRequest) (*UploadResponse, error)
- func (c *Client) UploadReader(filename string, contents io.Reader, req *UploadRequest) (*UploadResponse, error)
- type FaultTolerantClient
- func (c *FaultTolerantClient) Delete(fileUri string) (err error)
- func (c *FaultTolerantClient) Get(req *GetRequest) (b []byte, err error)
- func (c *FaultTolerantClient) LastModified(req LastModifiedRequest) (ii []LastModifiedItem, err error)
- func (c *FaultTolerantClient) List(req ListRequest) (ff []FileStatus, err error)
- func (c *FaultTolerantClient) Rename(oldFileUri, newFileUri string) (err error)
- func (c *FaultTolerantClient) Status(fileUri, locale string) (f FileStatus, err error)
- func (c *FaultTolerantClient) Upload(localFilePath string, req *UploadRequest) (r *UploadResponse, err error)
- type FileStatus
- type FileType
- type GetRequest
- type Iso8601Time
- type LastModifiedItem
- type LastModifiedRequest
- type LastModifiedResponse
- type ListCondition
- type ListRequest
- type ListResponse
- type Locale
- type LocalesResponse
- type RetrievalType
- type SmartlingResponse
- type UploadRequest
- type UploadResponse
Constants ¶
View Source
const Format = "2006-01-02T15:04:05"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { BaseUrl string ApiKey string ProjectId string // contains filtered or unexported fields }
func NewSandboxClient ¶
func (*Client) LastModified ¶
func (c *Client) LastModified(req LastModifiedRequest) ([]LastModifiedItem, error)
func (*Client) List ¶
func (c *Client) List(req ListRequest) ([]FileStatus, error)
func (*Client) SetHttpTimeout ¶
func (*Client) Upload ¶
func (c *Client) Upload(localFilePath string, req *UploadRequest) (*UploadResponse, error)
func (*Client) UploadReader ¶
func (c *Client) UploadReader(filename string, contents io.Reader, req *UploadRequest) (*UploadResponse, error)
type FaultTolerantClient ¶
FaultTolerantClient decorates a Client and retries requests when Smartling returns with an error
func (*FaultTolerantClient) Delete ¶
func (c *FaultTolerantClient) Delete(fileUri string) (err error)
func (*FaultTolerantClient) Get ¶
func (c *FaultTolerantClient) Get(req *GetRequest) (b []byte, err error)
func (*FaultTolerantClient) LastModified ¶
func (c *FaultTolerantClient) LastModified(req LastModifiedRequest) (ii []LastModifiedItem, err error)
func (*FaultTolerantClient) List ¶
func (c *FaultTolerantClient) List(req ListRequest) (ff []FileStatus, err error)
func (*FaultTolerantClient) Rename ¶
func (c *FaultTolerantClient) Rename(oldFileUri, newFileUri string) (err error)
func (*FaultTolerantClient) Status ¶
func (c *FaultTolerantClient) Status(fileUri, locale string) (f FileStatus, err error)
func (*FaultTolerantClient) Upload ¶
func (c *FaultTolerantClient) Upload(localFilePath string, req *UploadRequest) (r *UploadResponse, err error)
type FileStatus ¶
type FileStatus struct { FileUri string `json:"fileUri"` StringCount int `json:"stringCount"` WordCount int `json:"wordCount"` ApprovedStringCount int `json:"approvedStringCount"` CompletedStringCount int `json:"completedStringCount"` LastUploaded Iso8601Time `json:"lastUploaded"` FileType FileType `json:"fileType"` }
func (FileStatus) AwaitingAuthorizationStringCount ¶
func (fs FileStatus) AwaitingAuthorizationStringCount() int
func (FileStatus) InProgressStringCount ¶
func (fs FileStatus) InProgressStringCount() int
func (FileStatus) NotCompletedStringCount ¶
func (fs FileStatus) NotCompletedStringCount() int
type FileType ¶
type FileType string
const ( Android FileType = "android" Ios FileType = "ios" Gettext FileType = "gettext" Html FileType = "html" JavaProperties FileType = "javaProperties" Yaml FileType = "yaml" Xliff FileType = "xliff" Xml FileType = "xml" Json FileType = "json" Docx FileType = "docx" Pptx FileType = "pptx" Xlsx FileType = "xlsx" Idml FileType = "idml" Qt FileType = "qt" Resx FileType = "resx" Plaintext FileType = "plaintext" Csv FileType = "csv" Stringsdict FileType = "stringsdict" )
func FileTypeByExtension ¶
FileTypeByExtension returns the FileType associated with the file extension ext. The extension ext should begin with a leading dot, as in ".html". When ext has no associated type, FileTypeByExtension returns "".
type GetRequest ¶
type GetRequest struct { FileUri string `url:"fileUri"` Locale string `url:"locale,omitempty"` RetrievalType RetrievalType `url:"retrievalType,omitempty"` IncludeOriginalStrings bool `url:"includeOriginalStrings,omitempty"` }
type Iso8601Time ¶ added in v1.0.0
func (Iso8601Time) EncodeValues ¶ added in v1.0.0
func (it Iso8601Time) EncodeValues(key string, v *url.Values) error
func (Iso8601Time) MarshalJSON ¶ added in v1.0.0
func (it Iso8601Time) MarshalJSON() ([]byte, error)
func (*Iso8601Time) UnmarshalJSON ¶ added in v1.0.0
func (it *Iso8601Time) UnmarshalJSON(data []byte) error
type LastModifiedItem ¶
type LastModifiedItem struct { Locale string `json:"locale"` LastModified Iso8601Time `json:"lastModified"` }
type LastModifiedRequest ¶
type LastModifiedResponse ¶
type LastModifiedResponse struct {
Items []LastModifiedItem `json:"items"`
}
type ListCondition ¶
type ListCondition string
const ( HaveAtLeastOneUnapproved ListCondition = "haveAtLeastOneUnapproved" HaveAtLeastOneApproved ListCondition = "haveAtLeastOneApproved" HaveAtLeastOneTranslated ListCondition = "haveAtLeastOneTranslated" HaveAllTranslated ListCondition = "haveAllTranslated" HaveAllApproved ListCondition = "haveAllApproved" HaveAllUnapproved ListCondition = "haveAllUnapproved" )
type ListRequest ¶
type ListRequest struct { Locale string `url:"locale,omitempty"` UriMask string `url:"uriMask,omitempty"` FileTypes []FileType `url:"fileTypes,omitempty"` LastUploadedAfter *Iso8601Time `url:"lastUploadedAfter,omitempty"` LastUploadedBefore *Iso8601Time `url:"lastUploadedBefore,omitempty"` Offset int `url:"offset,omitempty"` Limit int `url:"limit,omitempty"` Conditions []ListCondition `url:"conditions,omitempty"` OrderBy string `url:"orderBy,omitempty"` }
type ListResponse ¶
type ListResponse struct { FileCount int `json:"fileCount"` Files []FileStatus `json:"fileList"` }
type LocalesResponse ¶
type LocalesResponse struct {
Locales []Locale `json:"locales"`
}
type RetrievalType ¶
type RetrievalType string
const ( Pending RetrievalType = "pending" Published RetrievalType = "published" Pseudo RetrievalType = "pseudo" ContextMatchingInstrumented RetrievalType = "contextMatchingInstrumented" )
type SmartlingResponse ¶
type SmartlingResponse struct { Code string `json:"code"` Messages []string `json:"messages"` Data json.RawMessage `json:"data"` }
func (SmartlingResponse) Error ¶
func (sr SmartlingResponse) Error() string
func (SmartlingResponse) IsError ¶
func (sr SmartlingResponse) IsError() bool
func (SmartlingResponse) IsNotFoundError ¶
func (sr SmartlingResponse) IsNotFoundError() bool
func (SmartlingResponse) IsResourceLockedError ¶
func (sr SmartlingResponse) IsResourceLockedError() bool
func (SmartlingResponse) IsValidationError ¶
func (sr SmartlingResponse) IsValidationError() bool
type UploadRequest ¶
type UploadRequest struct { FileUri string `url:"fileUri,"` Approved bool `url:"approved,omitempty"` LocalesToApprove []string `url:"localesToApprove,omitempty"` FileType FileType `url:"fileType"` CallbackUrl *url.URL `url:"callbackUrl,omitempty"` ParserConfig map[string]string `url:"-"` }
func (*UploadRequest) AddParserConfig ¶
func (u *UploadRequest) AddParserConfig(k, v string)
type UploadResponse ¶
Directories ¶
Path | Synopsis |
---|---|
Godeps
|
|
_workspace/src/github.com/codegangsta/cli
Package cli provides a minimal framework for creating and organizing command line Go applications.
|
Package cli provides a minimal framework for creating and organizing command line Go applications. |
_workspace/src/github.com/google/go-querystring/query
Package query implements encoding of structs into URL query parameters.
|
Package query implements encoding of structs into URL query parameters. |
_workspace/src/gopkg.in/yaml.v2
Package yaml implements YAML support for the Go language.
|
Package yaml implements YAML support for the Go language. |
cli
|
|
Click to show internal directories.
Click to hide internal directories.