Documentation ¶
Index ¶
- Variables
- type AddProjectLanguageRequest
- type AddProjectLanguageResponse
- type AddProjectRequest
- type AddProjectResponse
- type Client
- type ClientImpl
- func (c *ClientImpl) AddProject(ctx context.Context, r AddProjectRequest) (*AddProjectResponse, error)
- func (c *ClientImpl) AddProjectlanguage(ctx context.Context, r AddProjectLanguageRequest) (*AddProjectLanguageResponse, error)
- func (c *ClientImpl) DeleteProject(ctx context.Context, r DeleteProjectRequest) (*DeleteProjectResponse, error)
- func (c *ClientImpl) DeleteProjectLanguage(ctx context.Context, r DeleteProjectLanguageRequest) (*DeleteProjectLanguageResponse, error)
- func (c *ClientImpl) ExportProject(ctx context.Context, r ExportProjectRequest) (*ExportProjectResponse, error)
- func (c *ClientImpl) ListAvailableLanguages(ctx context.Context) (*ListAvailableLanguagesResponse, error)
- func (c *ClientImpl) ListProjectLanguages(ctx context.Context, r ListProjectLanguagesRequest) (*ListProjectLanguagesResponse, error)
- func (c *ClientImpl) ListProjects(ctx context.Context) (*ListProjectsResponse, error)
- func (c *ClientImpl) SyncProjectTerms(ctx context.Context, r SyncProjectTermsRequest) (*SyncProjectTermsResponse, error)
- func (c *ClientImpl) UpdateProjectLanguage(ctx context.Context, r UpdateProjectLanguageRequest) (*UpdateProjectLanguageResponse, error)
- func (c *ClientImpl) UpdateProjectSettings(ctx context.Context, r UpdateProjectSettingsRequest) (*UpdateProjectSettingsResponse, error)
- func (c *ClientImpl) UploadProject(ctx context.Context, r UploadProjectRequest) (*UploadProjectResponse, error)
- func (c *ClientImpl) ViewProject(ctx context.Context, r ViewProjectRequest) (*ViewProjectResponse, error)
- type ContentMeta
- type DeleteProjectLanguageRequest
- type DeleteProjectLanguageResponse
- type DeleteProjectRequest
- type DeleteProjectResponse
- type ErrLanguageNotFound
- type ErrProjectPermissionDenied
- type ExportProjectRequest
- type ExportProjectResponse
- type ListAvailableLanguagesResponse
- type ListProjectLanguagesRequest
- type ListProjectLanguagesResponse
- type ListProjectsResponse
- type SyncProjectTermsRequest
- type SyncProjectTermsResponse
- type UpdateProjectLanguageRequest
- type UpdateProjectLanguageResponse
- type UpdateProjectSettingsRequest
- type UpdateProjectSettingsResponse
- type UploadProjectRequest
- type UploadProjectResponse
- type ViewProjectRequest
- type ViewProjectResponse
Constants ¶
This section is empty.
Variables ¶
var ( ErrFailedToUnmarshalResponse = errors.New("Failed to unmarshal response") ErrNotImplemented = errors.New("Method is not implemented") )
var ContentMetaMap = map[string]ContentMeta{
"pot": {Extension: "pot", Type: "text/plain; charset=utf-8"},
"po": {Extension: "po", Type: "text/plain; charset=utf-8"},
"mo": {Extension: "mo", Type: "application/octet-stream"},
"xls": {Extension: "xls", Type: "application/vnd.ms-excel"},
"xlsx": {Extension: "xlsx", Type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},
"csv": {Extension: "csv", Type: "text/csv; charset=utf-8"},
"ini": {Extension: "ini", Type: "text/plain; charset=utf-8"},
"resw": {Extension: "resw", Type: "application/xml"},
"resx": {Extension: "resx", Type: "application/xml"},
"android_strings": {Extension: "xml", Type: "application/xml"},
"apple_strings": {Extension: "strings", Type: "text/plain; charset=utf-8"},
"xliff": {Extension: "xliff", Type: "application/xml"},
"properties": {Extension: "properties", Type: "text/plain; charset=utf-8"},
"key_value_json": {Extension: "json", Type: "application/json"},
"json": {Extension: "json", Type: "application/json"},
"yml": {Extension: "yml", Type: "text/plain; charset=utf-8"},
"xlf": {Extension: "xlf", Type: "application/xml"},
"xmb": {Extension: "xmb", Type: "application/xml"},
"xtb": {Extension: "xtb", Type: "application/xml"},
"arb": {Extension: "arb", Type: "application/json"},
"rise_360_xliff": {Extension: "xliff", Type: "application/xml"},
}
var ErrNoExtensionMetaFound = errors.New("no extension meta found for specified format")
Functions ¶
This section is empty.
Types ¶
type AddProjectRequest ¶
type AddProjectResponse ¶
type AddProjectResponse struct { Response struct { Status string `json:"status"` Code string `json:"code"` Message string `json:"message"` } `json:"response"` Result struct { Project struct { ID int64 `json:"id"` Name string `json:"name"` Description string `json:"description"` Public int64 `json:"public"` Open int64 `json:"open"` ReferenceLanguage string `json:"reference_language"` Terms int64 `json:"terms"` Created string `json:"created"` } `json:"project"` } `json:"result"` }
type Client ¶
type Client interface {
ExportProject(ctx context.Context, req ExportProjectRequest) (result *ExportProjectResponse, err error)
}
Client is an interface to poeditors api
type ClientImpl ¶
type ClientImpl struct {
// contains filtered or unexported fields
}
ClientImpl is an implementation of the poeditor client interface
func NewClient ¶
func NewClient(apiToken string, httpClient *http.Client) *ClientImpl
NewClient creates a new poeditor api client
func (*ClientImpl) AddProject ¶
func (c *ClientImpl) AddProject(ctx context.Context, r AddProjectRequest) (*AddProjectResponse, error)
AddProject creates a new project. Returns project details (if successful).
func (*ClientImpl) AddProjectlanguage ¶
func (c *ClientImpl) AddProjectlanguage(ctx context.Context, r AddProjectLanguageRequest) (*AddProjectLanguageResponse, error)
AddProjectLanguage Adds a new language to project.
func (*ClientImpl) DeleteProject ¶
func (c *ClientImpl) DeleteProject(ctx context.Context, r DeleteProjectRequest) (*DeleteProjectResponse, error)
DeleteProject Deletes the project from the account. You must be the owner of the project.
func (*ClientImpl) DeleteProjectLanguage ¶
func (c *ClientImpl) DeleteProjectLanguage(ctx context.Context, r DeleteProjectLanguageRequest) (*DeleteProjectLanguageResponse, error)
DeleteProjectLanguage Deletes existing language from project.
func (*ClientImpl) ExportProject ¶
func (c *ClientImpl) ExportProject(ctx context.Context, r ExportProjectRequest) (*ExportProjectResponse, error)
ExportProject Returns the link of the file (expires after 10 minutes).
func (*ClientImpl) ListAvailableLanguages ¶
func (c *ClientImpl) ListAvailableLanguages(ctx context.Context) (*ListAvailableLanguagesResponse, error)
ListAvailableLanguages Returns a comprehensive list of all languages supported by POEditor.
func (*ClientImpl) ListProjectLanguages ¶
func (c *ClientImpl) ListProjectLanguages(ctx context.Context, r ListProjectLanguagesRequest) (*ListProjectLanguagesResponse, error)
ListProjectLanguages Returns project languages, percentage of translation done for each and the datetime (UTC - ISO 8601) when the last change was made.
func (*ClientImpl) ListProjects ¶
func (c *ClientImpl) ListProjects(ctx context.Context) (*ListProjectsResponse, error)
ListProjects returns the list of projects owned by user.
func (*ClientImpl) SyncProjectTerms ¶
func (c *ClientImpl) SyncProjectTerms(ctx context.Context, r SyncProjectTermsRequest) (*SyncProjectTermsResponse, error)
SyncProjectTerms Syncs your project with the array you send (terms that are not found in the JSON object will be deleted from project and the new ones added). Please use with caution. If wrong data is sent, existing terms and their translations might be irreversibly lost.
func (*ClientImpl) UpdateProjectLanguage ¶
func (c *ClientImpl) UpdateProjectLanguage(ctx context.Context, r UpdateProjectLanguageRequest) (*UpdateProjectLanguageResponse, error)
UpdateProjectLanguage Inserts / overwrites translations.
https://poeditor.com/docs/api#languages_update
NOT IMPLEMENTED in this sdk
func (*ClientImpl) UpdateProjectSettings ¶
func (c *ClientImpl) UpdateProjectSettings(ctx context.Context, r UpdateProjectSettingsRequest) (*UpdateProjectSettingsResponse, error)
UpdateProjectSettings Updates project settings (name, description, reference language) If optional parameters are not sent, their respective fields are not updated.
func (*ClientImpl) UploadProject ¶
func (c *ClientImpl) UploadProject(ctx context.Context, r UploadProjectRequest) (*UploadProjectResponse, error)
UploadProject Updates terms / translations - No more than one request every 30 seconds.
https://poeditor.com/docs/api#projects_upload
NOT IMPLEMENTED In this sdk
func (*ClientImpl) ViewProject ¶
func (c *ClientImpl) ViewProject(ctx context.Context, r ViewProjectRequest) (*ViewProjectResponse, error)
ViewProject returns project's details.
type ContentMeta ¶
type ContentMeta struct {
Extension, Type string
}
func GetContentMeta ¶
func GetContentMeta(format string) (*ContentMeta, error)
type DeleteProjectRequest ¶
type DeleteProjectRequest struct {
ID int
}
type DeleteProjectResponse ¶
type ErrLanguageNotFound ¶
func (*ErrLanguageNotFound) Error ¶
func (e *ErrLanguageNotFound) Error() string
type ErrProjectPermissionDenied ¶
type ErrProjectPermissionDenied struct {
ProjectID int
}
func (*ErrProjectPermissionDenied) Error ¶
func (e *ErrProjectPermissionDenied) Error() string
type ExportProjectRequest ¶
type ExportProjectResponse ¶
type ListAvailableLanguagesResponse ¶
type ListAvailableLanguagesResponse struct { Response struct { Status string `json:"status"` Code string `json:"code"` Message string `json:"message"` } `json:"response"` Result struct { Languages []struct { Name string `json:"name"` Code string `json:"code"` } `json:"languages"` } `json:"result"` }
type ListProjectLanguagesRequest ¶
type ListProjectLanguagesRequest struct {
ID int
}
type ListProjectLanguagesResponse ¶
type ListProjectLanguagesResponse struct { Response struct { Status string `json:"status"` Code string `json:"code"` Message string `json:"message"` } `json:"response"` Result struct { Languages []struct { Name string `json:"name"` Code string `json:"code"` Translations int64 `json:"translations"` Percentage float64 `json:"percentage"` Updated string `json:"updated"` } `json:"languages"` } `json:"result"` }
type ListProjectsResponse ¶
type ListProjectsResponse struct { Response struct { Status string `json:"status"` Code string `json:"code"` Message string `json:"message"` } `json:"response"` Result struct { Projects []struct { ID int64 `json:"id"` Name string `json:"name"` Public int64 `json:"public"` Open int64 `json:"open"` Created string `json:"created"` } `json:"projects"` } `json:"result"` }
type SyncProjectTermsRequest ¶
type SyncProjectTermsResponse ¶
type SyncProjectTermsResponse struct { Response struct { Status string `json:"status"` Code string `json:"code"` Message string `json:"message"` } `json:"response"` Result struct { Terms struct { Parsed int64 `json:"parsed"` Added int64 `json:"added"` Updated int64 `json:"updated"` Deleted int64 `json:"deleted"` } `json:"terms"` } `json:"result"` }
type UpdateProjectLanguageRequest ¶
type UpdateProjectLanguageRequest struct { ID int Data []struct{} }
type UpdateProjectLanguageResponse ¶
type UpdateProjectLanguageResponse struct { Response struct { Status string `json:"status"` Code string `json:"code"` Message string `json:"message"` } `json:"response"` Result struct { Translations struct { Parsed int64 `json:"parsed"` Added int64 `json:"added"` Updated int64 `json:"updated"` } `json:"translations"` } `json:"result"` }
type UpdateProjectSettingsResponse ¶
type UpdateProjectSettingsResponse struct { Response struct { Status string `json:"status"` Code string `json:"code"` Message string `json:"message"` } `json:"response"` Result struct { Project struct { ID int64 `json:"id"` Name string `json:"name"` Description string `json:"description"` Public int64 `json:"public"` Open int64 `json:"open"` ReferenceLanguage string `json:"reference_language"` Terms int64 `json:"terms"` Created string `json:"created"` } `json:"project"` } `json:"result"` }
type UploadProjectRequest ¶
type UploadProjectResponse ¶
type UploadProjectResponse struct { Response struct { Status string `json:"status"` Code string `json:"code"` Message string `json:"message"` } `json:"response"` Result struct { Terms struct { Parsed int64 `json:"parsed"` Added int64 `json:"added"` Deleted int64 `json:"deleted"` } `json:"terms"` Translations struct { Parsed int64 `json:"parsed"` Added int64 `json:"added"` Updated int64 `json:"updated"` } `json:"translations"` } `json:"result"` }
type ViewProjectRequest ¶
type ViewProjectRequest struct {
ID int
}
type ViewProjectResponse ¶
type ViewProjectResponse struct { Response struct { Status string `json:"status"` Code string `json:"code"` Message string `json:"message"` } `json:"response"` Result struct { Project struct { ID int64 `json:"id"` Name string `json:"name"` Description string `json:"description"` Public int64 `json:"public"` Open int64 `json:"open"` ReferenceLanguage string `json:"reference_language"` // nolint:tagliatelle Terms int64 `json:"terms"` Created string `json:"created"` } `json:"project"` } `json:"result"` }
ViewProjectResponse is the response as it is resturned by the poeditor api.