Documentation ¶
Index ¶
- Constants
- func SetDefaultTimeouts(cnctTO, rwTO time.Duration)
- type APIError
- type AddApprovalOptions
- type AddStorageOptions
- type BuildDirectoryTranslationOptions
- type BuildFileTranslationOptions
- type BuildProjectTranslationOptions
- type BuildTranslationAllLgOptions
- type CheckProjectBuildStatusOptions
- type Crowdin
- func (crowdin *Crowdin) AddApproval(options *AddApprovalOptions) (*ResponseAddApproval, error)
- func (crowdin *Crowdin) AddStorage(options *AddStorageOptions) (*ResponseAddStorage, error)
- func (crowdin *Crowdin) BuildAllLg(buildTO time.Duration, translatedOnly bool, minApprovalSteps int, ...) (buildId int, err error)
- func (crowdin *Crowdin) BuildDirectoryTranslation(directoryId int, options *BuildDirectoryTranslationOptions) (*ResponseBuildDirectoryTranslation, error)
- func (crowdin *Crowdin) BuildFileTranslation(fileId int, options *BuildFileTranslationOptions) (*ResponseBuildFileTranslation, error)
- func (crowdin *Crowdin) BuildProjectTranslation(options *BuildProjectTranslationOptions) (*ResponseBuildProjectTranslation, error)
- func (crowdin *Crowdin) BuildTranslationAllLg(opt BuildTranslationAllLgOptions) (buildId int, err error)
- func (crowdin *Crowdin) CheckProjectBuildStatus(options *CheckProjectBuildStatusOptions) (*ResponseCheckProjectBuildStatus, error)
- func (crowdin *Crowdin) Close()
- func (crowdin *Crowdin) DeleteStorage(options *DeleteStorageOptions) error
- func (crowdin *Crowdin) DownloadBuild(outputFileNamePath string, buildId int) (err error)
- func (crowdin *Crowdin) DownloadFile(url string, filepath string) error
- func (crowdin *Crowdin) DownloadProjectTranslations(options *DownloadProjectTranslationsOptions) (*ResponseDownloadProjectTranslations, error)
- func (crowdin *Crowdin) EditStrings(options *EditStringsOptions, stringId int) (*ResponseEditStrings, error)
- func (crowdin *Crowdin) GetBuildId() (buildId int, err error)
- func (crowdin *Crowdin) GetDebugWriter() (logWriter io.Writer)
- func (crowdin *Crowdin) GetFileProgress(options *GetFileProgressOptions) (*ResponseGetFileProgress, error)
- func (crowdin *Crowdin) GetFileRevision(fileId int, revId int) (*ResponseGetFileRevision, error)
- func (crowdin *Crowdin) GetPercentBuildProgress() int
- func (crowdin *Crowdin) GetProject() (*ResponseGetProject, error)
- func (crowdin *Crowdin) GetProjectId(projectName string) (projectId int, err error)
- func (crowdin *Crowdin) GetShortLangFileProgress(fileId int, langId string) (translationProgress int, approvalProgress int, err error)
- func (crowdin *Crowdin) GetStepsApprovTransId() (listTrans map[int][]int, err error)
- func (crowdin *Crowdin) GetStorage(options *GetStorageOptions) (*ResponseGetStorage, error)
- func (crowdin *Crowdin) GetStringIDs(fileName string, filter string, filterType string) (list []int, err error)
- func (crowdin *Crowdin) GetTimeouts() (connectionTO, rwTO time.Duration)
- func (crowdin *Crowdin) GetTranslation(options *GetTranslationOptions) (*ResponseGetTranslation, error)
- func (crowdin *Crowdin) ListAllDirectories(options *ListDirectoriesOptions) (*ResponseListDirectories, error)
- func (crowdin *Crowdin) ListDirectories(options *ListDirectoriesOptions) (*ResponseListDirectories, error)
- func (crowdin *Crowdin) ListFileRevisions(options *ListFileRevisionsOptions, fileId int) (*ResponseListFileRevisions, error)
- func (crowdin *Crowdin) ListFiles(options *ListFilesOptions) (*ResponseListFiles, error)
- func (crowdin *Crowdin) ListProjectBuilds(options *ListProjectBuildsOptions) (*ResponseListProjectBuilds, error)
- func (crowdin *Crowdin) ListProjects(options *ListProjectsOptions) (*ResponseListProjects, error)
- func (crowdin *Crowdin) ListStorages(options *ListStoragesOptions) (*ResponseListStorages, error)
- func (crowdin *Crowdin) ListStrings(options *ListStringsOptions) (*ResponseListStrings, error)
- func (crowdin *Crowdin) ListTranslationApprovals(options *ListTranslationApprovalsOptions) (*ResponseListTranslationApprovals, error)
- func (crowdin *Crowdin) ListWorkflowsSteps(options *ListWorkflowsStepsOptions) (*ResponseListWorkflowsSteps, error)
- func (crowdin *Crowdin) LookupDirId(CrowdinDirName string) (id int, name string, err error)
- func (crowdin *Crowdin) LookupFileId(CrowdinFileName string) (id int, name string, err error)
- func (crowdin *Crowdin) PopTimeouts()
- func (crowdin *Crowdin) PushTimeouts()
- func (crowdin *Crowdin) ResetTimeoutsToDefault()
- func (crowdin *Crowdin) SetDebug(debug bool, logWriter io.Writer)
- func (crowdin *Crowdin) SetTimeouts(connectionTO, rwTO time.Duration)
- func (crowdin *Crowdin) Update(CrowdinFileName string, LocalFileName string, updateOption string) (fileId int, revId int, err error)
- func (crowdin *Crowdin) UpdateFile(fileId int, options *UpdateFileOptions) (*ResponseUpdateFile, error)
- func (crowdin *Crowdin) UploadTranslationFile(params T_UploadTranslationFileParams) (fileId int, err error)
- func (crowdin *Crowdin) UploadTranslations(LanguageId string, options *UploadTranslationsOptions) (*ResponseUploadTranslations, error)
- type DeleteStorageOptions
- type DownloadProjectTranslationsOptions
- type EditStringsOptions
- type GetFileProgressOptions
- type GetStorageOptions
- type GetTranslationOptions
- type ListDirectoriesOptions
- type ListFileRevisionsOptions
- type ListFilesOptions
- type ListProjectBuildsOptions
- type ListProjectsOptions
- type ListStoragesOptions
- type ListStringsOptions
- type ListTranslationApprovalsOptions
- type ListWorkflowsStepsOptions
- type ResponseAddApproval
- type ResponseAddStorage
- type ResponseBuildDirectoryTranslation
- type ResponseBuildFileTranslation
- type ResponseBuildProjectTranslation
- type ResponseCheckProjectBuildStatus
- type ResponseDownloadProjectTranslations
- type ResponseEditStrings
- type ResponseGetFileProgress
- type ResponseGetFileRevision
- type ResponseGetProject
- type ResponseGetStorage
- type ResponseGetTranslation
- type ResponseListDirectories
- type ResponseListFileRevisions
- type ResponseListFiles
- type ResponseListProjectBuilds
- type ResponseListProjects
- type ResponseListStorages
- type ResponseListStrings
- type ResponseListTranslationApprovals
- type ResponseListWorkflowsSteps
- type ResponseUpdate
- type ResponseUpdateFile
- type ResponseUploadTranslations
- type T_UploadTranslationFileParams
- type UpdateFileOptions
- type UploadTranslationsOptions
Constants ¶
const API_CROWDINDOTCOM = "https://crowdin.com/api/v2/" // url for crowdin.com (non Enterprise version)
const DEFAULT_CONNEXION_TO = 5 // seconds
const DEFAULT_RW_TO = 40 // seconds
const MAX_RESULTS = 1000000 // 1M lines maximum for any api responses
const MAX_RES_PER_PAGE = 500 // Max nber of lines per page returned by API calls.
Variables ¶
This section is empty.
Functions ¶
func SetDefaultTimeouts ¶
Set connection and read/write timeouts for the subsequent new connections
Types ¶
type APIError ¶
type APIError struct {
What string
}
APIError holds data of errors returned from the API.
type AddApprovalOptions ¶
type AddApprovalOptions struct {
TranslationID int `json:"translationId,omitempty"`
}
Add Approval API call
type AddStorageOptions ¶
type AddStorageOptions struct {
FileName string `json:"filename"` // Filename and path of hte file to upload to storage
}
AddStorageOptions are options for AddStorage api call
type BuildDirectoryTranslationOptions ¶
type BuildDirectoryTranslationOptions struct { TargetLanguageIds []string `json:"targetLanguageIds,omitempty"` SkipUntranslatedStrings bool `json:"skipUntranslatedStrings,omitempty"` SkipUntranslatedFiles bool `json:"skipUntranslatedFiles,omitempty"` ExportApprovedOnly bool `json:"exportApprovedOnly,omitempty"` // crowdin.com specific ExportWithMinApprovalsCount int `json:"exportWithMinApprovalsCount,omitempty"` // Enterprise specific PreserveFolderHierarchy bool `json:"preserveFolderHierarchy,omitempty"` ExportStringsThatPassedWorkflow bool `json:"exportStringsThatPassedWorkflow,omitempty"` }
BuildDirectoryTranslationOptions are options for BuildDirectoryTranslation api call
type BuildFileTranslationOptions ¶
type BuildFileTranslationOptions struct { TargetLanguageID string `json:"targetLanguageId"` ExportAsXliff bool `json:"exportAsXliff"` SkipUntranslatedStrings bool `json:"skipUntranslatedStrings"` SkipUntranslatedFiles bool `json:"skipUntranslatedFiles"` ExportApprovedOnly bool `json:"exportApprovedOnly,omitempty"` // crowdin.com specific ExportWithMinApprovalsCount int `json:"exportWithMinApprovalsCount,omitempty"` // Enterprise specific ExportStringsThatPassedWorkflow bool `json:"exportStringsThatPassedWorkflow,omitempty"` }
BuildDirectoryFileOptions are options for BuildFileTranslation api call
type BuildProjectTranslationOptions ¶
type BuildProjectTranslationOptions struct { BranchId int `json:"branchId,omitempty"` // Branch Identifier. - optional // Specify target languages for build. // Leave this field empty to build all target languages Languages []string `json:"targetLanguageIds,omitempty"` SkipUntranslatedStrings bool `json:"skipUntranslatedStrings,omitempty"` SkipUntranslatedFiles bool `json:"skipUntranslatedFiles,omitempty"` ExportApprovedOnly bool `json:"exportApprovedOnly,omitempty"` // crowdin.com specific ExportWithMinApprovalsCount int `json:"exportWithMinApprovalsCount,omitempty"` // Enterprise specific ExportStringsThatPassedWorkflow bool `json:"exportStringsThatPassedWorkflow,omitempty"` }
BuildProjectTranslationOptions are options for BuildProjectTranslation api call
type CheckProjectBuildStatusOptions ¶
type CheckProjectBuildStatusOptions struct { // Project Identifier. // ProjectId int BuildId int }
GetProjectBuildProgressOptions are options for Check Project Build Status api call
type Crowdin ¶
type Crowdin struct {
// contains filtered or unexported fields
}
Crowdin API V2 wrapper
func (*Crowdin) AddApproval ¶
func (crowdin *Crowdin) AddApproval(options *AddApprovalOptions) (*ResponseAddApproval, error)
AddApproval - Add Approval API call. Set proofread approval to a translation. {protocol}://{host}/api/v2/storages
func (*Crowdin) AddStorage ¶
func (crowdin *Crowdin) AddStorage(options *AddStorageOptions) (*ResponseAddStorage, error)
AddStorage - Add storage API call. Upload a file to a storage space. {protocol}://{host}/api/v2/storages
func (*Crowdin) BuildAllLg ¶
func (crowdin *Crowdin) BuildAllLg(buildTO time.Duration, translatedOnly bool, minApprovalSteps int, fullyTranslatedFilesOnly bool) (buildId int, err error)
BuildAllLg - Build a project for all languages. Kept to maintain compatibility with older versions. Options to export:
- translated strings only Y/N
- approved strings only integer Enterprise: min nb of approval steps required to export a string crowdin.com: 0 means approval not required, diff from 0: approval required
- fully translated files only Y/N "translated strings only" and fully "translated files only" are mutually exclusive.
Update buildProgress
func (*Crowdin) BuildDirectoryTranslation ¶
func (crowdin *Crowdin) BuildDirectoryTranslation(directoryId int, options *BuildDirectoryTranslationOptions) (*ResponseBuildDirectoryTranslation, error)
BuildDirectoryTranslation - Build a directory {protocol}://{host}/api/v2/projects/{projectId}/translations/builds/directories/{directoryId}
func (*Crowdin) BuildFileTranslation ¶
func (crowdin *Crowdin) BuildFileTranslation(fileId int, options *BuildFileTranslationOptions) (*ResponseBuildFileTranslation, error)
BuildFileTranslation - Build a file {host}/api/v2/projects/{projectId}/translations/builds/files/{fileId}
func (*Crowdin) BuildProjectTranslation ¶
func (crowdin *Crowdin) BuildProjectTranslation(options *BuildProjectTranslationOptions) (*ResponseBuildProjectTranslation, error)
BuildProjectTranslation - Build a project {protocol}://{host}/api/v2/projects/{ProjectId}/translations/builds
func (*Crowdin) BuildTranslationAllLg ¶
func (crowdin *Crowdin) BuildTranslationAllLg(opt BuildTranslationAllLgOptions) (buildId int, err error)
func (*Crowdin) CheckProjectBuildStatus ¶
func (crowdin *Crowdin) CheckProjectBuildStatus(options *CheckProjectBuildStatusOptions) (*ResponseCheckProjectBuildStatus, error)
CheckProjectBuildStatus - Check Project Build Status api call {protocol}://{host}/api/v2/projects/{projectId}/translations/builds/{buildId}
func (*Crowdin) DeleteStorage ¶
func (crowdin *Crowdin) DeleteStorage(options *DeleteStorageOptions) error
deleteStorage - Delete a storage {protocol}://{host}/api/v2/storages/{storageId}
func (*Crowdin) DownloadBuild ¶
Download a build of the current project
outputFileNamePath required projectId required if projectName is not provided buildId optional
limitation: total number of project directories needs to be 500 max
func (*Crowdin) DownloadFile ¶
DownloadFile will download a url and store it in local filepath. No autorization token required here for this operation. Writes to the destination file as it downloads it, without loading the entire file into memory.
func (*Crowdin) DownloadProjectTranslations ¶
func (crowdin *Crowdin) DownloadProjectTranslations(options *DownloadProjectTranslationsOptions) (*ResponseDownloadProjectTranslations, error)
DownloadProjectTranslations - Download Project Translations api call {protocol}://{host}/api/v2/projects/{projectId}/translations/builds/{buildId}/download
func (*Crowdin) EditStrings ¶
func (crowdin *Crowdin) EditStrings(options *EditStringsOptions, stringId int) (*ResponseEditStrings, error)
func (*Crowdin) GetBuildId ¶
Lookup buildId for current project
func (*Crowdin) GetDebugWriter ¶
GetDebugWriter - get writer
func (*Crowdin) GetFileProgress ¶
func (crowdin *Crowdin) GetFileProgress(options *GetFileProgressOptions) (*ResponseGetFileProgress, error)
GetFileProgress() - Get file progress info {protocol}://{host}/api/v2/projects/{projectId}/files/{fileId}/languages/progress
func (*Crowdin) GetFileRevision ¶
func (crowdin *Crowdin) GetFileRevision(fileId int, revId int) (*ResponseGetFileRevision, error)
GetFileRevision - List a specific revision details for a file in current project {protocol}://{host}/api/v2/projects/{projectId}/files/{fileId}/revisions/{revisionId}
func (*Crowdin) GetPercentBuildProgress ¶
Read current build progress status from Crowdin structure That value is updated when a build is running and GetBuildProgress() polled.
func (*Crowdin) GetProject ¶
func (crowdin *Crowdin) GetProject() (*ResponseGetProject, error)
GetProject - Read project details {protocol}://{host}/api/v2/projects/{projectId}
func (*Crowdin) GetProjectId ¶
Lookup projectId
func (*Crowdin) GetShortLangFileProgress ¶
func (crowdin *Crowdin) GetShortLangFileProgress(fileId int, langId string) (translationProgress int, approvalProgress int, err error)
GetShortLangFileProgress() - Get a simple file completion info for a specific language
Returns a percentage of completion for both translation and approval (0 if error).
func (*Crowdin) GetStepsApprovTransId ¶
Get steps of all approved transactions from a given project.
Returns a map of all ADMIN approved transactions along with their approval steps.
func (*Crowdin) GetStorage ¶
func (crowdin *Crowdin) GetStorage(options *GetStorageOptions) (*ResponseGetStorage, error)
GetStorage - Read the file name associated to a storageId {protocol}://{host}/api/v2/storages/{storageId}
func (*Crowdin) GetStringIDs ¶
func (crowdin *Crowdin) GetStringIDs(fileName string, filter string, filterType string) (list []int, err error)
Obtain a list of string Ids for a given file of the current project. Use a filter on "identifier" "text" or "context" Parameters:
- provide path/filename
- a filter string (empty mean "all")
- filter on "identifier" "text" or "context"
Returns:
- string IDs in a slice of ints if results found
- err (nil if no error)
func (*Crowdin) GetTimeouts ¶
Get connection and read/write timeouts
func (*Crowdin) GetTranslation ¶
func (crowdin *Crowdin) GetTranslation(options *GetTranslationOptions) (*ResponseGetTranslation, error)
GetTranslation - Get translation details {protocol}://{host}/api/v2/projects/{projectId}/translations/{translationId}
func (*Crowdin) ListAllDirectories ¶
func (crowdin *Crowdin) ListAllDirectories(options *ListDirectoriesOptions) (*ResponseListDirectories, error)
ListAllDirectories - Helper function: list all directories in a given project (all pages) Ignore offset and limit in options.
func (*Crowdin) ListDirectories ¶
func (crowdin *Crowdin) ListDirectories(options *ListDirectoriesOptions) (*ResponseListDirectories, error)
ListDirectories - List directories in a given project {protocol}://{host}/api/v2/projects/{projectId}/files
func (*Crowdin) ListFileRevisions ¶
func (crowdin *Crowdin) ListFileRevisions(options *ListFileRevisionsOptions, fileId int) (*ResponseListFileRevisions, error)
ListFileRevisions - List all revisions for a file in current project {protocol}://{host}/api/v2/projects/{projectId}/files/{fileId}/revisions
func (*Crowdin) ListFiles ¶
func (crowdin *Crowdin) ListFiles(options *ListFilesOptions) (*ResponseListFiles, error)
ListFiles - List files in a given project {protocol}://{host}/api/v2/projects/{projectId}/files
func (*Crowdin) ListProjectBuilds ¶
func (crowdin *Crowdin) ListProjectBuilds(options *ListProjectBuildsOptions) (*ResponseListProjectBuilds, error)
ListProjectBuilds - List Project Builds API call. List the project builds {protocol}://{host}/api/v2/projects/{projectId}/translations/builds
func (*Crowdin) ListProjects ¶
func (crowdin *Crowdin) ListProjects(options *ListProjectsOptions) (*ResponseListProjects, error)
ListProjects - List projects API call. List the projects and their respective details (incl.Id.) {protocol}://{host}/api/v2/projects
func (*Crowdin) ListStorages ¶
func (crowdin *Crowdin) ListStorages(options *ListStoragesOptions) (*ResponseListStorages, error)
ListStorages - List existing storages {protocol}://{host}/api/v2/storages
func (*Crowdin) ListStrings ¶
func (crowdin *Crowdin) ListStrings(options *ListStringsOptions) (*ResponseListStrings, error)
ListStrings - List Source Strings {protocol}://{host}/api/v2/projects/{projectId}/strings
func (*Crowdin) ListTranslationApprovals ¶
func (crowdin *Crowdin) ListTranslationApprovals(options *ListTranslationApprovalsOptions) (*ResponseListTranslationApprovals, error)
ListTranslationApprovals - List translation approvals of a file, a string or a translation {protocol}://{host}/api/v2/projects/{projectId}/approvals
func (*Crowdin) ListWorkflowsSteps ¶
func (crowdin *Crowdin) ListWorkflowsSteps(options *ListWorkflowsStepsOptions) (*ResponseListWorkflowsSteps, error)
ListWorkflowsSteps - List workflow steps {protocol}://{host}/api/v2/projects/{projectId}/workflow-steps
func (*Crowdin) LookupDirId ¶
Lookup directoryId in current project
CrowdinDirName required - full Crowdin path to directory. Returns Id and crowdin dir name
func (*Crowdin) LookupFileId ¶
Lookup fileId in current project
CrowdinFileName required - full Crowdin path to file. Returns Id and crowdin file name
func (*Crowdin) PopTimeouts ¶
func (crowdin *Crowdin) PopTimeouts()
Restore previously saved timeout values
func (*Crowdin) ResetTimeoutsToDefault ¶
func (crowdin *Crowdin) ResetTimeoutsToDefault()
Reset communication timeouts to their default values
func (*Crowdin) Update ¶
func (crowdin *Crowdin) Update(CrowdinFileName string, LocalFileName string, updateOption string) (fileId int, revId int, err error)
Update a file of the current project
LocalFileName required CrowdinFileName required updateOption required needs to be either: clear_translations_and_approvals, keep_translations or keep_translations_and_approvals Returns file Id and rev
func (*Crowdin) UpdateFile ¶
func (crowdin *Crowdin) UpdateFile(fileId int, options *UpdateFileOptions) (*ResponseUpdateFile, error)
UpdateFile - Update a specific file {protocol}://{host}/api/v2/projects/{projectId}/files/{fileId} Default update mode is explicitely clear_translations_and_approvals
func (*Crowdin) UploadTranslationFile ¶
func (crowdin *Crowdin) UploadTranslationFile(params T_UploadTranslationFileParams) (fileId int, err error)
Upload a translation file Params:
- File containing the translations to upload
- File in Crowdin where the translations will end up
- Language ID as per Crowdin spec and defined as target in the project
- Defines whether to add translation if it's the same as the source string
- Mark uploaded translations as approved
- Allow translations upload to hidden source strings
- in seconds. The upload operation can take several minutes. 0 means no change. The original TO will be restored after operation finishes (ok or not) Returns the source fileId (0 if error) and err != nil if error
func (*Crowdin) UploadTranslations ¶
func (crowdin *Crowdin) UploadTranslations(LanguageId string, options *UploadTranslationsOptions) (*ResponseUploadTranslations, error)
UploadTranslations() - Upload translations into a file API call {protocol}://{host}/api/v2/projects/{projectId}/translations/{languageId}
type DeleteStorageOptions ¶
type DeleteStorageOptions struct {
StorageId int `json:"storageid"`
}
DelStorageOptions are options for DelStorage api call
type DownloadProjectTranslationsOptions ¶
type DownloadProjectTranslationsOptions struct { // Project Identifier. // ProjectId int // Build Identifier. BuildId int }
DownloadProjectTranslationsOptions are options for DownloadProjectTranslations api call
type EditStringsOptions ¶
type EditStringsOptions []struct { Value interface{} `json:"value"` // type depends on path value Op string `json:"op"` Path string `json:"path"` }
EditString - Edit a source string API call
type GetFileProgressOptions ¶
GetFileProgress - options for Language Progress API call
type GetStorageOptions ¶
type GetStorageOptions struct {
StorageId int
}
GetStorageOptions are options for GetStorage api call
type GetTranslationOptions ¶
type GetTranslationOptions struct { TranslationID int `json:"translationID,omitempty"` DenormalizePlaceholders int `json:"denormalizePlaceholders, omitempty"` }
List workflow steps API call
type ListDirectoriesOptions ¶
type ListDirectoriesOptions struct { BranchId int DirectoryId int Recursion int Limit int // Maximum number of items to retrieve (25 default, max 500) - optional Offset int // Offset in collection - optional }
ListDirectoriesOptions are options for ListDirectories api call
type ListFileRevisionsOptions ¶
type ListFileRevisionsOptions struct { Limit int // Maximum number of items to retrieve (25 default, max 500) - optional Offset int // Offset in collection - optional }
ListFilesOptions are options for ListFileRevisions api call
type ListFilesOptions ¶
type ListFilesOptions struct { BranchId int `json:"branchId,omitempty"` DirectoryId int `json:"directoryId,omitempty"` Recursion int `json:"recursion,omitempty"` Limit int `json:"limit,omitempty"` // Maximum number of items to retrieve (25 default, max 500) - optional Offset int `json:"offset,omitempty"` // Offset in collection - optional }
ListFilesOptions are options for ListFiles api call
type ListProjectBuildsOptions ¶
type ListProjectBuildsOptions struct { // ProjectId int // Body struct { BranchId int Limit int Offset int }
ListProjectBuilds - List Project Build API call
type ListProjectsOptions ¶
ListProjects - List Projects API call
type ListStoragesOptions ¶
type ListStoragesOptions struct { Limit int // Maximum number of items to retrieve (25 default, max 500) - optional Offset int // Offset in collection - optional }
ListStoragesOptions are options for ListStorages api call
type ListStringsOptions ¶
type ListStringsOptions struct { FileId int DenormalizePlaceholders int LabelIds string Filter string Scope string Limit int // Maximum number of items to retrieve (25 default, max 500) - optional Offset int // Offset in collection - optional }
ListStringsOptions are options for ListStrings api call
type ListTranslationApprovalsOptions ¶
type ListTranslationApprovalsOptions struct { TranslationID int `json:"translationId,omitempty"` FileID int `json:"fileId,omitempty"` StringID int `json:"stringId,omitempty"` LanguageID string `json:"languageId,omitempty"` Limit int `json:"limit,omitempty"` // Maximum number of items to retrieve (25 default, max 500) - optional Offset int `json:"offset,omitempty"` // Offset in collection - optional }
List Translation Approvals API call
type ListWorkflowsStepsOptions ¶
type ListWorkflowsStepsOptions struct { Limit int `json:"limit,omitempty"` // Maximum number of items to retrieve (25 default, max 500) - optional Offset int `json:"offset,omitempty"` // Offset in collection - optional }
List workflow steps API call
type ResponseAddApproval ¶
type ResponseAddApproval struct { Data struct { ID int `json:"id"` User struct { ID int `json:"id"` Username string `json:"username"` FullName string `json:"fullName"` AvatarURL string `json:"avatarUrl"` } `json:"user"` TranslationID int `json:"translationId"` StringID int `json:"stringId"` LanguageID string `json:"languageId"` WorkflowStepID int `json:"workflowStepId"` CreatedAt time.Time `json:"createdAt"` } `json:"data"` }
type ResponseAddStorage ¶
type ResponseAddStorage struct { Data struct { Id int `json:"id"` FileName string `json:"fileName"` } `json:"data"` }
ResponseAddStorage are response for AddStorage api call
type ResponseBuildDirectoryTranslation ¶
type ResponseBuildDirectoryTranslation struct { Data struct { ID int `json:"id"` ProjectID int `json:"projectId"` Status string `json:"status"` Progress int `json:"progress"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` FinishedAt time.Time `json:"finishedAt"` } `json:"data"` }
type ResponseBuildProjectTranslation ¶
type ResponseBuildProjectTranslation struct { Data struct { Id int `json:"id"` ProjectID int `json:"projectId"` Status string `json:"status"` Progress int `json:"progress"` Attributes struct { BranchID int `json:"branchId"` TargetLanguageIDs []string `json:"targetLanguageIds"` SkipUntranslatedStrings bool `json:"skipUntranslatedStrings"` SkipUntranslatedFiles bool `json:"skipUntranslatedFiles"` ExportApprovedOnly bool `json:"exportApprovedOnly"` ExportWithMinApprovalsCount int `json:"exportWithMinApprovalsCount"` ExportStringsThatPassedWorkflow bool `json:"exportStringsThatPassedWorkflow"` } `json:"attributes"` } `json:"data"` }
type ResponseCheckProjectBuildStatus ¶
type ResponseCheckProjectBuildStatus struct { Data struct { Id int `json:"id"` ProjectId int `json:"projectId"` Status string `json:"status"` Progress int `json:"progress"` Attributes struct { BranchId int `json:"branchId,omitempty"` TargetLanguageIds []string `json:"targetLanguageIds,omitempty"` SkipUntranslatedStrings bool `json:"skipUntranslatedStrings"` SkipUntranslatedFiles bool `json:"skipUntranslatedFiles"` ExportApprovedOnly bool `json:"exportApprovedOnly,omitempty"` // crowdin.com ExportWithMinApprovalsCount int `json:"exportWithMinApprovalsCount,omitempty"` // Enterprise } `json:"attributes"` } `json:"data"` }
type ResponseEditStrings ¶
type ResponseEditStrings struct { Data struct { ID int `json:"id"` ProjectID int `json:"projectId"` FileID int `json:"fileId"` Identifier string `json:"identifier"` Text string `json:"text"` Type string `json:"type"` Context string `json:"context"` MaxLength int `json:"maxLength"` IsHidden bool `json:"isHidden"` Revision int `json:"revision"` HasPlurals bool `json:"hasPlurals"` IsIcu bool `json:"isIcu"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` } `json:"data"` }
type ResponseGetFileProgress ¶
type ResponseGetFileProgress struct { Data []struct { Data struct { Words struct { Total int `json:"total"` Translated int `json:"translated"` Approved int `json:"approved"` } `json:"words"` Phrases struct { Total int `json:"total"` Translated int `json:"translated"` Approved int `json:"approved"` } `json:"phrases"` TranslationProgress int `json:"translationProgress"` ApprovalProgress int `json:"approvalProgress"` LanguageId string `json:"languageId"` ETag string `json:"eTag"` } `json:"data"` } `json:"data"` Pagination struct { Offset int `json:"offset"` Limit int `json:"limit"` } `json:"pagination"` }
GetFileProgress api call
type ResponseGetFileRevision ¶
type ResponseGetFileRevision struct { Data struct { Id int `json:"id"` ProjectId int `json:"projectId"` FileId int `json:"fileId"` RestoreToRevision int `json:"restoreToRevision"` Info struct { Added struct { Strings int `json:"strings"` Words int `json:"words"` } `json:"added"` Deleted struct { Strings int `json:"strings"` Words int `json:"words"` } `json:"deleted"` Updated struct { Strings int `json:"strings"` Words int `json:"words"` } `json:"updated"` } `json:"info"` Date time.Time `json:"date"` } `json:"data"` }
ResponseGetFileRevision are response for GetFileRevision api call
type ResponseGetProject ¶
type ResponseGetProject struct { Data struct { ID int `json:"id"` GroupID int `json:"groupId"` UserID int `json:"userId"` SourceLanguageID string `json:"sourceLanguageId"` TargetLanguageIds []string `json:"targetLanguageIds"` Name string `json:"name"` Identifier string `json:"identifier"` Description string `json:"description"` Logo string `json:"logo"` Background string `json:"background"` IsExternal bool `json:"isExternal"` ExternalType string `json:"externalType"` WorkflowID int `json:"workflowId"` HasCrowdsourcing bool `json:"hasCrowdsourcing"` PublicDownloads bool `json:"publicDownloads"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` LastActivity time.Time `json:"lastActivity"` TargetLanguages []struct { ID string `json:"id"` Name string `json:"name"` EditorCode string `json:"editorCode"` TwoLettersCode string `json:"twoLettersCode"` ThreeLettersCode string `json:"threeLettersCode"` Locale string `json:"locale"` AndroidCode string `json:"androidCode"` OsxCode string `json:"osxCode"` OsxLocale string `json:"osxLocale"` PluralCategoryNames []string `json:"pluralCategoryNames"` PluralRules string `json:"pluralRules"` PluralExamples []string `json:"pluralExamples"` TextDirection string `json:"textDirection"` DialectOf string `json:"dialectOf"` } `json:"targetLanguages"` } `json:"data"` }
Get Project details API call
type ResponseGetStorage ¶
type ResponseGetStorage struct { Data struct { Id int `json:"id"` FileName string `json:"fileName"` } `json:"data"` }
ResponseGetStorage are response for ListStorages api call
type ResponseGetTranslation ¶
type ResponseGetTranslation struct { Data struct { ID int `json:"id"` Text string `json:"text"` PluralCategoryName string `json:"pluralCategoryName"` User struct { ID int `json:"id"` Username string `json:"username"` FullName string `json:"fullName"` AvatarURL string `json:"avatarUrl"` } `json:"user"` Rating int `json:"rating"` CreatedAt time.Time `json:"createdAt"` } `json:"data"` }
type ResponseListDirectories ¶
type ResponseListDirectories struct { Data []struct { Data struct { Id int `json:"id"` ProjectId int `json:"projectId"` BranchId int `json:"branchId"` DirectoryId int `json:"directoryId"` // Actually parentId Name string `json:"name"` Title string `json:"title"` ExportPattern string `json:"exportPattern"` Priority string `json:"priority"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` } `json:"data"` } `json:"data"` Pagination struct { Offset int `json:"offset"` Limit int `json:"limit"` } `json:"pagination"` }
ResponseListDirectories are response for ListDirectories api call
type ResponseListFileRevisions ¶
type ResponseListFileRevisions struct { Data []struct { Data struct { Id int `json:"id"` ProjectId int `json:"projectId"` FileId int `json:"fileId"` RestoreToRevision int `json:"restoreToRevision"` Info struct { Added struct { Strings int `json:"strings"` Words int `json:"words"` } `json:"added"` Deleted struct { Strings int `json:"strings"` Words int `json:"words"` } `json:"deleted"` Updated struct { Strings int `json:"strings"` Words int `json:"words"` } `json:"updated"` } `json:"info"` Date time.Time `json:"date"` } `json:"data"` } `json:"data"` Pagination struct { Offset int `json:"offset"` Limit int `json:"limit"` } `json:"pagination"` }
ResponseListFiles are response for ListFiles api call
type ResponseListFiles ¶
type ResponseListFiles struct { Data []struct { Data struct { Id int `json:"id"` ProjectId int `json:"projectId"` BranchId int `json:"branchId"` DirectoryId int `json:"directoryId"` Name string `json:"name"` Title string `json:"title"` Type string `json:"type"` RevisionId int `json:"revisionId"` Status string `json:"status"` Priority string `json:"priority"` Attributes struct { MimeType string `json:"mimeType"` FileSize int `json:"fileSize"` } `json:"attributes"` ImportOptions struct { FirstLineContainsHeader bool `json:"firstLineContainsHeader"` ImportTranslations bool `json:"importTranslations"` Scheme struct { Identifier int `json:"identifier"` SourcePhrase int `json:"sourcePhrase"` En int `json:"en"` De int `json:"de"` } `json:"scheme"` } `json:"importOptions"` ExportOptions struct { ExportPattern string `json:"exportPattern"` } `json:"exportOptions"` ExportPattern string `json:"exportPattern"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` Revision int `json:"revision"` } `json:"data"` } `json:"data"` Pagination struct { Offset int `json:"offset"` Limit int `json:"limit"` } `json:"pagination"` }
ResponseListFiles are response for ListFiles api call
type ResponseListProjectBuilds ¶
type ResponseListProjectBuilds struct { Data []struct { Data struct { Id int `json:"id"` ProjectId int `json:"projectId"` Status string `json:"status"` Progress int `json:"progress"` Attributes struct { BranchId int `json:"branchId,omitempty"` TargetLanguageIds []string `json:"targetLanguageIds,omitempty"` SkipUntranslatedStrings bool `json:"SkipUntranslatedStrings,omitempty"` SkipUntranslatedFiles bool `json:"SkipUntranslatedFiles,omitempty"` ExportWithMinApprovalsCount int `json:"ExportWithMinApprovalsCount,omitempty"` ExportTranslatedOnly bool `json:"exportTranslatedOnly,omitempty"` ExportApprovedOnly bool `json:"exportApprovedOnly,omitempty"` } `json:"attributes"` } `json:"data"` } `json:"data"` Pagination struct { Offset int `json:"offset"` Limit int `json:"limit"` } `json:"pagination"` }
type ResponseListProjects ¶
type ResponseListProjects struct { Data []struct { Data struct { ID int `json:"id"` UserID int `json:"userId"` SourceLanguageID string `json:"sourceLanguageId"` TargetLanguageIds []string `json:"targetLanguageIds"` LanguageAccessPolicy string `json:"languageAccessPolicy"` Name string `json:"name"` Cname string `json:"cname"` Identifier string `json:"identifier"` Description string `json:"description"` Visibility string `json:"visibility"` Logo string `json:"logo"` PublicDownloads bool `json:"publicDownloads"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` LastActivity time.Time `json:"lastActivity"` TargetLanguages []struct { ID string `json:"id"` Name string `json:"name"` EditorCode string `json:"editorCode"` TwoLettersCode string `json:"twoLettersCode"` ThreeLettersCode string `json:"threeLettersCode"` Locale string `json:"locale"` AndroidCode string `json:"androidCode"` OsxCode string `json:"osxCode"` OsxLocale string `json:"osxLocale"` PluralCategoryNames []string `json:"pluralCategoryNames"` PluralRules string `json:"pluralRules"` PluralExamples []string `json:"pluralExamples"` TextDirection string `json:"textDirection"` DialectOf int `json:"dialectOf"` } `json:"targetLanguages"` } `json:"data"` } `json:"data"` Pagination struct { Offset int `json:"offset"` Limit int `json:"limit"` } `json:"pagination"` }
type ResponseListStorages ¶
type ResponseListStorages struct { Data []struct { Data struct { Id int `json:"id"` FileName string `json:"fileName"` } `json:"data"` } `json:"data"` Pagination []struct { Offset int `json:"offset"` Limit int `json:"limit"` } `json:"pagination"` }
ResponseListStorages are response for ListStorages api call
type ResponseListStrings ¶
type ResponseListStrings struct { Data []struct { Data struct { ID int `json:"id"` ProjectID int `json:"projectId"` FileID int `json:"fileId"` Identifier string `json:"identifier"` Text string `json:"text"` Type string `json:"type"` Context string `json:"context"` MaxLength int `json:"maxLength"` IsHidden bool `json:"isHidden"` Revision int `json:"revision"` HasPlurals bool `json:"hasPlurals"` IsIcu bool `json:"isIcu"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` } `json:"data"` } `json:"data"` Pagination struct { Offset int `json:"offset"` Limit int `json:"limit"` } `json:"pagination"` }
ResponseListStrings are response for ListStrings api call
type ResponseListTranslationApprovals ¶
type ResponseListTranslationApprovals struct { Data []struct { Data struct { ID int `json:"id"` User struct { ID int `json:"id"` Username string `json:"username"` FullName string `json:"fullName"` AvatarURL string `json:"avatarUrl"` } `json:"user"` TranslationID int `json:"translationId"` StringID int `json:"stringId"` LanguageID string `json:"languageId"` WorkflowStepID int `json:"workflowStepId"` CreatedAt time.Time `json:"createdAt"` } `json:"data"` } `json:"data"` Pagination struct { Offset int `json:"offset"` Limit int `json:"limit"` } `json:"pagination"` }
type ResponseListWorkflowsSteps ¶
type ResponseListWorkflowsSteps struct { Data []struct { Data struct { ID int `json:"id"` Title string `json:"title"` Type string `json:"type"` Languages []string `json:"languages"` Config interface{} `json:"config, omitempty"` } `json:"data"` } `json:"data"` Pagination struct { Offset int `json:"offset"` Limit int `json:"limit"` } `json:"pagination"` }
type ResponseUpdate ¶
type ResponseUpdate struct { Data struct { Id int `json:"id"` ProjectId int `json:"projectId"` BranchId int `json:"branchId"` DirectoryId int `json:"directoryId"` Name string `json:"name"` Title string `json:"title"` Type string `json:"type"` RevisionId int `json:"revisionId"` Status string `json:"status"` Priority string `json:"priority"` ImportOptions struct { FirstLineContainsHeader bool `json:"firstLineContainsHeader"` ImportTranslations bool `json:"importTranslations"` Scheme struct { Identifier int `json:"identifier"` SourcePhrase int `json:"sourcePhrase"` En int `json:"en"` De int `json:"de"` } `json:"scheme"` } `json:"importOptions"` ExportOptions struct { ExportPattern string `json:"exportPattern"` } `json:"exportOptions"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` } `json:"data"` }
type ResponseUpdateFile ¶
type ResponseUpdateFile struct { Data struct { Id int `json:"id"` ProjectId int `json:"projectId"` BranchId int `json:"branchId"` DirectoryId int `json:"directoryId"` Name string `json:"name"` Title string `json:"title"` Type string `json:"type"` RevisionId int `json:"revisionId"` Status string `json:"status"` Priority string `json:"priority"` ImportOptions struct { FirstLineContainsHeader bool `json:"firstLineContainsHeader"` ImportTranslations bool `json:"importTranslations"` Scheme struct { Identifier int `json:"identifier"` SourcePhrase int `json:"sourcePhrase"` En int `json:"en"` De int `json:"de"` } `json:"scheme"` } `json:"importOptions"` ExportOptions struct { ExportPattern string `json:"exportPattern"` } `json:"exportOptions"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` } `json:"data"` }
type T_UploadTranslationFileParams ¶
type T_UploadTranslationFileParams struct { LocalFileName string // File containing the translations to upload CrowdinFileName string // File in Crowdin where the translations will end up LanguageId string // Langugage ID as per Crowdin spec and defined as target in the project ImportEqSuggestions bool // Defines whether to add translation if it's the same as the source string AutoApproveImported bool // Mark uploaded translations as approved TranslateHidden bool // Allow translations upload to hidden source strings ResponseTimeOut time.Duration // in seconds. The upload operation can take several minutes. }
type UpdateFileOptions ¶
type UpdateFileOptions struct { StorageId int `json:"storageId"` UpdateOption string `json:"updateOption,omitempty"` // needs to be either: "clear_translations_and_approvals" "keep_translations" "keep_translations_and_approvals" ImportOptions struct { ContentSegmentation bool `json:"contentSegmentation,omitempty"` TranslateContent bool `json:"translateContent,omitempty"` TranslateAttributes bool `json:"translateAttributes,omitempty"` TranslatableElements []string `json:"translatableElements,omitempty"` } `json:"importOptions,omitempty"` ExportOptions struct { ContentSegmentation bool `json:"contentSegmentation,omitempty"` } `json:"exportOptions,omitempty"` }
UpdateFile - Update a file API call
type UploadTranslationsOptions ¶
type UploadTranslationsOptions struct { StorageID int `json:"storageId"` FileID int `json:"fileId"` ImportEqSuggestions bool `json:"importEqSuggestions,omitempty"` AutoApproveImported bool `json:"autoApproveImported,omitempty"` TranslateHidden bool `json:"translateHidden,omitempty"` }
Upload translations API call