crowdin

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToPtr

func ToPtr[T any](v T) *T

ToPtr is a helper function that returns a pointer to the provided input.

Types

type BranchesService

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

Source branches are resources for translation. Use API to manage project branches. Note: Make sure your master branch is the first one you integrate with Crowdin.

func (*BranchesService) Add

func (s *BranchesService) Add(ctx context.Context, projectID int, req *model.BranchesAddRequest) (
	*model.Branch, *Response, error,
)

Add creates a new project branch.

https://developer.crowdin.com/api/v2/#operation/api.projects.branches.post

func (*BranchesService) CheckCloneStatus

func (s *BranchesService) CheckCloneStatus(ctx context.Context, projectID, branchID int, cloneID string) (
	*model.BranchMerge, *Response, error,
)

CheckCloneStatus checks the status of a branch clone.

https://developer.crowdin.com/api/v2/string-based/#operation/api.projects.branches.clones.get

func (*BranchesService) CheckMergeStatus

func (s *BranchesService) CheckMergeStatus(ctx context.Context, projectID, branchID int, mergeID string) (
	*model.BranchMerge, *Response, error,
)

CheckMergeStatus checks the status of a branch merge.

https://developer.crowdin.com/api/v2/string-based/#operation/api.projects.branches.merges.get

func (*BranchesService) Clone

func (s *BranchesService) Clone(ctx context.Context, projectID, branchID int, req *model.BranchesCloneRequest) (
	*model.BranchMerge, *Response, error,
)

Clone clones a project branch. Note: Only the main branch (oldest branch) can be cloned.

https://developer.crowdin.com/api/v2/string-based/#operation/api.projects.branches.clones.post

func (*BranchesService) Delete

func (s *BranchesService) Delete(ctx context.Context, projectID, branchID int) (*Response, error)

Delete deletes a project branch.

https://developer.crowdin.com/api/v2/#operation/api.projects.branches.delete

func (*BranchesService) Edit

func (s *BranchesService) Edit(ctx context.Context, projectID, branchID int, req []*model.UpdateRequest) (
	*model.Branch, *Response, error,
)

Edit updates a project branch.

Request body: - op: The operation to perform. Enum: replace, test. - path: A JSON Pointer as defined in RFC 6901. Enum: "/name", "/title", "/exportPattern", "/priority". - value: The value to be used within the operations. The value must be one of string.

https://developer.crowdin.com/api/v2/#operation/api.projects.branches.patch

func (*BranchesService) Get

func (s *BranchesService) Get(ctx context.Context, projectID, branchID int) (*model.Branch, *Response, error)

Get returns a single project branch.

https://developer.crowdin.com/api/v2/#operation/api.projects.branches.get

func (*BranchesService) GetClone

func (s *BranchesService) GetClone(ctx context.Context, projectID, branchID int, cloneID string) (*model.Branch, *Response, error)

GetClone returns a cloned project branch.

https://developer.crowdin.com/api/v2/string-based/#operation/api.projects.branches.clones.branch.get

func (*BranchesService) GetMergeSummary

func (s *BranchesService) GetMergeSummary(ctx context.Context, projectID, branchID int, mergeID string) (
	*model.BranchMergeSummary, *Response, error,
)

GetMergeSummary returns a summary of a branch merge.

https://developer.crowdin.com/api/v2/string-based/#operation/api.projects.branches.merges.summary.get

func (*BranchesService) List

func (s *BranchesService) List(ctx context.Context, projectID int, opts *model.BranchesListOptions) (
	[]*model.Branch, *Response, error,
)

List returns a list of project branches.

Query parameters: - name: Filter branches by name. - limit: A maximum number of items to retrieve (default 25, max 500). - offset: A starting offset in the collection of items (default 0).

https://developer.crowdin.com/api/v2/#operation/api.projects.branches.getMany

func (*BranchesService) Merge

func (s *BranchesService) Merge(ctx context.Context, projectID, branchID int, req *model.BranchesMergeRequest) (
	*model.BranchMerge, *Response, error,
)

Merge merges a project branch.

https://developer.crowdin.com/api/v2/string-based/#operation/api.projects.branches.merges.post

type Client

type Client struct {
	Storages           *StorageService
	Languages          *LanguagesService
	Groups             *GroupsService
	Projects           *ProjectsService
	Branches           *BranchesService
	SourceFiles        *SourceFilesService
	SourceStrings      *SourceStringsService
	StringTranslations *StringTranslationsService
	Translations       *TranslationsService
	TranslationStatus  *TranslationStatusService
	// contains filtered or unexported fields
}

Client is a Crowdin API client.

func NewClient

func NewClient(token string, opts ...ClientOption) (*Client, error)

NewClient creates a new Crowdin API client with provided options (ex. WithHTTPClient). `token` is a personal access token. To create a client, use the following code:

client, err := crowdin.NewClient("token")

To create an Enterprise client, use the WithOrganization() option as below:

client, err := crowdin.NewClient("token", crowdin.WithOrganization("organization"))

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, path string) (*Response, error)

Delete makes a DELETE request to the specified path.

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, params ListOptionsProvider, v any) (*Response, error)

Get makes a GET request to the specified path.

func (*Client) Patch

func (c *Client) Patch(ctx context.Context, path string, body, v any) (*Response, error)

Patch makes a PATCH request to the specified path.

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, body, v any, opts ...RequestOption) (*Response, error)

Post makes a POST request to the specified path.

func (*Client) Put

func (c *Client) Put(ctx context.Context, path string, body, v any) (*Response, error)

Put makes a PUT request to the specified path.

type ClientOption

type ClientOption func(*Client) error

ClientOption is a client functional option.

func WithHTTPClient

func WithHTTPClient(hc *http.Client) ClientOption

WithHTTPClient sets the custom HTTP client. If not set http.DefaultClient will be used.

func WithOrganization

func WithOrganization(organization string) ClientOption

WithOrganization sets the organization name.

type GroupsService

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

Groups allow you to organize your projects based on specific characteristics. Use API to manage projects and groups, change their settings, or remove them from organization if required.

Crowdin API docs: https://developer.crowdin.com/enterprise/api/v2/#tag/Projects-and-Groups

func (*GroupsService) Delete

func (s *GroupsService) Delete(ctx context.Context, id int) (*Response, error)

Delete removes a group from the organization.

https://developer.crowdin.com/enterprise/api/v2/#operation/api.groups.delete

func (*GroupsService) Edit

func (s *GroupsService) Edit(ctx context.Context, id int, req []*model.UpdateRequest) (*model.Group, *Response, error)

Edit updates a group.

Request body:

op: The operation to perform. Enum: replace, test.
path: A JSON Pointer as defined in RFC 6901. Enum: "/name", "/description", "/parentId".
value: The value to be used within the operations. The value must be one of string or integer.

https://developer.crowdin.com/enterprise/api/v2/#operation/api.groups.patch

func (*GroupsService) Get

func (s *GroupsService) Get(ctx context.Context, id int) (*model.Group, *Response, error)

Get returns a group by its identifier.

https://developer.crowdin.com/enterprise/api/v2/#operation/api.groups.get

func (*GroupsService) List

List returns a list of groups.

Query parameters:

parentId: A parent group identifier (default 0 - groups of root group).
limit: A maximum number of items to retrieve (default 25, max 500).
offset: A starting offset in the collection of items (default 0).

https://developer.crowdin.com/enterprise/api/v2/#operation/api.groups.getMany

type LanguagesService

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

Crowdin supports more than 300 world languages and custom languages created in the system. Use API to get the list of all supported languages and retrieve additional details (e.g. text direction, internal code) on specific language.

https://developer.crowdin.com/api/v2/#tag/Languages

func (*LanguagesService) Add

Add adds a new custom language.

https://developer.crowdin.com/api/v2/#operation/api.languages.post

func (*LanguagesService) Delete

func (s *LanguagesService) Delete(ctx context.Context, id string) (*Response, error)

Delete deletes a custom language by its identifier.

https://developer.crowdin.com/api/v2/#operation/api.languages.delete

func (*LanguagesService) Edit

Edit updates a custom language by its identifier.

Request body:

	op: The operation to perform. Enum: replace, test
	path: A JSON Pointer as defined in RFC 6901.
          Enum: "/name" "/textDirection" "/pluralCategoryNames" "/threeLettersCode" "/localeCode" "/dialectOf"
	value: The value to be used within the operations. The value must be one of string or array of strings.

https://developer.crowdin.com/api/v2/#operation/api.languages.patch

func (*LanguagesService) Get

Get returns a language by its identifier.

https://developer.crowdin.com/api/v2/#operation/api.languages.get

func (*LanguagesService) List

List returns a list of all supported languages.

Query parameters:

limit: A maximum number of items to retrieve (default 25, max 500).
offset: A starting offset in the collection of items (default 0).

https://developer.crowdin.com/api/v2/#operation/api.languages.getMany

type ListOptionsProvider

type ListOptionsProvider interface {
	Values() (url.Values, bool)
}

ListOptionsProvider interface provides query parameters for list methods. The Values method returns the url.Values representation of the optional query parameters and a boolean indicating whether they are set.

type ProjectsService

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

Using projects, you can keep your source files sorted. Use API to manage projects, change their settings, or remove them if required.

Crowdin API docs: https://developer.crowdin.com/api/v2/#tag/Projects

func (*ProjectsService) AddFileFormatSettings

AddFileFormatSettings adds a new project file format settings by its project identifier.

https://developer.crowdin.com/api/v2/#operation/api.projects.file-format-settings.post

func (*ProjectsService) AddStringsExporterSettings

AddStringsExporterSettings adds a new project strings exporter settings by its project identifier.

Request body:

format: Enum: "android", "macosx", "xliff"
settings: One of convertPlaceholders, languagePairMapping

https://developer.crowdin.com/api/v2/#operation/api.projects.strings-exporter-settings.post

func (*ProjectsService) Delete

func (s *ProjectsService) Delete(ctx context.Context, id int) (*Response, error)

Delete deletes a project by its identifier.

https://developer.crowdin.com/api/v2/#operation/api.projects.delete

func (*ProjectsService) DeleteFileFormatSettings

func (s *ProjectsService) DeleteFileFormatSettings(ctx context.Context, projectID, settingsID int) (*Response, error)

DeleteFileFormatSettings deletes a project file format settings by project and file format settings identifiers.

https://developer.crowdin.com/api/v2/#operation/api.projects.file-format-settings.delete

func (*ProjectsService) DeleteStringsExporterSettings

func (s *ProjectsService) DeleteStringsExporterSettings(ctx context.Context, projectID, settingsID int) (*Response, error)

DeleteStringsExporterSettings deletes a project strings exporter settings by project and strings exporter settings identifiers.

https://developer.crowdin.com/api/v2/#operation/api.projects.strings-exporter-settings.delete

func (*ProjectsService) DownloadFileFormatSettingsCustomSegmentation

func (s *ProjectsService) DownloadFileFormatSettingsCustomSegmentation(ctx context.Context, projectID, settingsID int) (
	*model.DownloadLink, *Response, error)

DownloadFileFormatSettingsCustomSegmentation returns a download link for custom segmentations by project and file format settings identifiers.

https://developer.crowdin.com/api/v2/#operation/api.projects.file-format-settings.custom-segmentations.get

func (*ProjectsService) Edit

Edit updates a project by its identifier.

Request body:

op: The operation to perform. Enum: add, replace, remove, test
path: A JSON Pointer as defined in RFC 6901.
value: The value to be used within the operations. The value must be one of string, integer, boolean and object

https://developer.crowdin.com/api/v2/#operation/api.projects.patch

func (*ProjectsService) EditFileFormatSettings

func (s *ProjectsService) EditFileFormatSettings(ctx context.Context, projectID, settingsID int, req []*model.UpdateRequest) (
	*model.ProjectsFileFormatSettings, *Response, error,
)

EditFileFormatSettings updates a project file format settings by project and file format settings identifiers.

Request body:

op: The operation to perform. Possible values: replace, test
path: A JSON Pointer as defined in RFC 6901. Possible values: /format, /settings
value: The value to be used within the operations. The value must be one of string or array of strings.

https://developer.crowdin.com/api/v2/#operation/api.projects.file-format-settings.patch

func (*ProjectsService) EditStringsExporterSettings

func (s *ProjectsService) EditStringsExporterSettings(
	ctx context.Context,
	projectID, settingsID int,
	req *model.ProjectsStringsExporterSettingsRequest,
) (*model.ProjectsStringsExporterSettings, *Response, error,
)

EditStringsExporterSettings updates a project strings exporter settings by project and strings exporter settings identifiers.

Request body:

format: Enum: "android", "macosx", "xliff"
settings: One of convertPlaceholders, languagePairMapping

https://developer.crowdin.com/api/v2/#operation/api.projects.strings-exporter-settings.patch

func (*ProjectsService) Get

func (s *ProjectsService) Get(ctx context.Context, id int) (*model.Project, *Response, error)

Get returns a project by its identifier.

https://developer.crowdin.com/api/v2/#operation/api.projects.get

func (*ProjectsService) GetFileFormatSettings

func (s *ProjectsService) GetFileFormatSettings(ctx context.Context, projectID, settingsID int) (
	*model.ProjectsFileFormatSettings, *Response, error,
)

GetFileFormatSettings returns a project file format settings by project and file format settings identifiers.

https://developer.crowdin.com/api/v2/#operation/api.projects.file-format-settings.get

func (*ProjectsService) GetStringsExporterSettings

func (s *ProjectsService) GetStringsExporterSettings(ctx context.Context, projectID, settingsID int) (
	*model.ProjectsStringsExporterSettings, *Response, error,
)

GetStringsExporterSettings returns a project strings exporter settings by project and strings exporter settings identifiers.

https://developer.crowdin.com/api/v2/#operation/api.projects.strings-exporter-settings.get

func (*ProjectsService) List

List returns a list of projects.

Query parameters:

userId: A user identifier.
hasManagerAccess: Filter by projects with manager access (default 0). Enum: 0, 1.
type: Set type to 1 to get all string based projects. Enum: 0, 1.
limit: A maximum number of items to retrieve (default 25, max 500).
offset: A starting offset in the collection of items (default 0).

https://developer.crowdin.com/api/v2/#operation/api.projects.getMany

func (*ProjectsService) ListFileFormatSettings

func (s *ProjectsService) ListFileFormatSettings(ctx context.Context, projectID int) (
	[]*model.ProjectsFileFormatSettings, *Response, error,
)

ListFileFormatSettings returns a list of project file format settings by project identifier.

https://developer.crowdin.com/api/v2/#operation/api.projects.file-format-settings.getMany

func (*ProjectsService) ListStringsExporterSettings

func (s *ProjectsService) ListStringsExporterSettings(ctx context.Context, projectID int) (
	[]*model.ProjectsStringsExporterSettings, *Response, error,
)

ListStringsExporterSettings returns a list of project strings exporter settings by project identifier.

https://developer.crowdin.com/api/v2/#operation/api.projects.strings-exporter-settings.getMany

func (*ProjectsService) ResetFileFormatSettingsCustomSegmentation

func (s *ProjectsService) ResetFileFormatSettingsCustomSegmentation(ctx context.Context, projectID, settingsID int) (*Response, error)

ResetFileFormatSettingsCustomSegmentation resets custom segmentations by project and file format settings identifiers.

https://developer.crowdin.com/api/v2/#operation/api.projects.file-format-settings.custom-segmentations.delete

type RequestOption

type RequestOption func(*http.Request) error

RequestOption represents an option that can be used to modify a http.Request.

func Header(key, value string) RequestOption

Header sets a header as an option for the request.

type RequestValidator

type RequestValidator interface {
	Validate() error
}

RequestValidator is an interface for validating requests.

type Response

type Response struct {
	*http.Response

	Pagination model.Pagination
}

Response is a Crowdin response that wraps http.Response.

type SourceFilesService

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

Source files are resources for translation. You can keep files structure using folders or manage different versions of the content via branches. Use API to keep the source files up to date, check on file revisions, and manage project branches. Before adding source files to the project, upload each file to the Storage first.

Note: If you use branches, make sure your master branch is the first one you integrate with Crowdin.

Crowdin API docs: https://developer.crowdin.com/api/v2/#tag/Source-Files

func (*SourceFilesService) AddDirectory

func (s *SourceFilesService) AddDirectory(ctx context.Context, projectID int, req *model.DirectoryAddRequest) (
	*model.Directory, *Response, error,
)

AddDirectory creates a new directory in the project.

https://developer.crowdin.com/api/v2/#operation/api.projects.directories.post

func (*SourceFilesService) AddFile

func (s *SourceFilesService) AddFile(ctx context.Context, projectID int, req *model.FileAddRequest) (
	*model.File, *Response, error,
)

AddFile adds a new file to the project.

https://developer.crowdin.com/api/v2/#operation/api.projects.files.post

func (*SourceFilesService) BuildReviewedFiles

func (s *SourceFilesService) BuildReviewedFiles(ctx context.Context, projectID int, req *model.ReviewedBuildRequest) (
	*model.ReviewedBuild, *Response, error,
)

BuildReviewedFiles starts a new build of reviewed source files.

https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.strings.reviewed-builds.post

func (*SourceFilesService) CheckReviewedBuildStatus

func (s *SourceFilesService) CheckReviewedBuildStatus(ctx context.Context, projectID, buildID int) (*model.ReviewedBuild, *Response, error)

CheckReviewedBuildStatus checks the status of a specific reviewed source files build.

https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.strings.reviewed-builds.get

func (*SourceFilesService) DeleteDirectory

func (s *SourceFilesService) DeleteDirectory(ctx context.Context, projectID, directoryID int) (*Response, error)

DeleteDirectory deletes a directory in the project.

https://developer.crowdin.com/api/v2/#operation/api.projects.directories.delete

func (*SourceFilesService) DeleteFile

func (s *SourceFilesService) DeleteFile(ctx context.Context, projectID, fileID int) (*Response, error)

DeleteFile deletes a file in the project.

https://developer.crowdin.com/api/v2/#operation/api.projects.files.delete

func (*SourceFilesService) DownloadFile

func (s *SourceFilesService) DownloadFile(ctx context.Context, projectID, fileID int) (*model.DownloadLink, *Response, error)

DownloadFile returns a download link for a specific file.

https://developer.crowdin.com/api/v2/#operation/api.projects.files.download.get

func (*SourceFilesService) DownloadFilePreview

func (s *SourceFilesService) DownloadFilePreview(ctx context.Context, projectID, fileID int) (*model.DownloadLink, *Response, error)

DownloadFilePreview returns a download link for a specific file preview.

https://developer.crowdin.com/api/v2/#operation/api.projects.files.preview.get

func (*SourceFilesService) DownloadReviewedBuild

func (s *SourceFilesService) DownloadReviewedBuild(ctx context.Context, projectID, buildID int) (*model.DownloadLink, *Response, error)

DownloadReviewedBuild returns a download link for a specific reviewed source files build.

https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.strings.reviewed-builds.download.download

func (*SourceFilesService) EditDirectory

func (s *SourceFilesService) EditDirectory(ctx context.Context, projectID, directoryID int, req []*model.UpdateRequest) (
	*model.Directory, *Response, error,
)

EditDirectory updates a directory in the project.

Request body:

  • op: The operation to perform. Enum: replace, test.
  • path: A JSON Pointer as defined in RFC 6901. Enum: "/branchId", "/directoryId", "/name", "/title", "/exportPattern", "/priority".
  • value: The value to be used within the operations. The value must be one of string or integer.

https://developer.crowdin.com/api/v2/#operation/api.projects.directories.patch

func (*SourceFilesService) EditFile

func (s *SourceFilesService) EditFile(ctx context.Context, projectID, fileID int, req []*model.UpdateRequest) (
	*model.File, *Response, error,
)

EditFile updates a file in the project.

https://developer.crowdin.com/api/v2/#operation/api.projects.files.patch

func (*SourceFilesService) GetDirectory

func (s *SourceFilesService) GetDirectory(ctx context.Context, projectID, directoryID int) (*model.Directory, *Response, error)

GetDirectory returns a single directory in the project.

https://developer.crowdin.com/api/v2/#operation/api.projects.directories.get

func (*SourceFilesService) GetFile

func (s *SourceFilesService) GetFile(ctx context.Context, projectID, fileID int) (*model.File, *Response, error)

GetFile returns a single file in the project.

https://developer.crowdin.com/api/v2/#operation/api.projects.files.get

func (*SourceFilesService) GetFileRevision

func (s *SourceFilesService) GetFileRevision(ctx context.Context, projectID, fileID, revisionID int) (*model.FileRevision, *Response, error)

GetFileRevision returns a single file revision.

https://developer.crowdin.com/api/v2/#operation/api.projects.files.revisions.get

func (*SourceFilesService) ListDirectories

func (s *SourceFilesService) ListDirectories(ctx context.Context, projectID int, opts *model.DirectoryListOptions) (
	[]*model.Directory, *Response, error,
)

ListDirectories returns a list of directories in the project.

Query parameters: - branchId: The identifier of the branch (filter by branch). - directoryId: The identifier of the directory (filter by directory). - filter: Filter directories by name. - recursion: List directories recursively. - limit: A maximum number of items to retrieve (default 25, max 500). - offset: A starting offset in the collection of items (default 0).

https://developer.crowdin.com/api/v2/#operation/api.projects.directories.getMany

func (*SourceFilesService) ListFileRevisions

func (s *SourceFilesService) ListFileRevisions(ctx context.Context, projectID, fileID int, opts *model.ListOptions) (
	[]*model.FileRevision, *Response, error,
)

ListFileRevisions returns a list of file revisions.

https://developer.crowdin.com/api/v2/#operation/api.projects.files.revisions.getMany

func (*SourceFilesService) ListFiles

func (s *SourceFilesService) ListFiles(ctx context.Context, projectID int, opts *model.FileListOptions) (
	[]*model.File, *Response, error,
)

ListFiles returns a list of files in the project.

Query parameters: - branchId: The identifier of the branch (filter by branch). - directoryId: The identifier of the directory (filter by directory). - filter: Filter files by name. - recursion: List files recursively. - limit: A maximum number of items to retrieve (default 25, max 500). - offset: A starting offset in the collection of items (default 0).

https://developer.crowdin.com/api/v2/#operation/api.projects.files.getMany

func (*SourceFilesService) ListReviewedBuilds

func (s *SourceFilesService) ListReviewedBuilds(ctx context.Context, projectID int, opts *model.ReviewedBuildListOptions) (
	[]*model.ReviewedBuild, *Response, error,
)

ListReviewedBuilds returns a list of reviewed source files builds.

https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.strings.reviewed-builds.getMany

func (*SourceFilesService) UpdateOrRestoreFile

func (s *SourceFilesService) UpdateOrRestoreFile(ctx context.Context, projectID, fileID int, req *model.FileUpdateRestoreRequest) (
	*model.File, *Response, error,
)

UpdateOrRestoreFile updates a file in the project or restores it to one of the previous revisions. For updating the file, use the `storageId` body parameter. For restoring the file, use the `revisionId` body parameter.

https://developer.crowdin.com/api/v2/#operation/api.projects.files.put

type SourceStringsService

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

Source strings are the text units for translation. Instead of modifying source files, you can manage source strings one by one. Use API to add, edit, or delete some specific strings in the source-based and files-based projects (available only for the following file formats: CSV, RESX, JSON, Android XML, iOS strings, PROPERTIES, XLIFF).

Crowdin API docs: https://developer.crowdin.com/api/v2/#tag/Source-Strings

func (*SourceStringsService) BatchOperations

func (s *SourceStringsService) BatchOperations(ctx context.Context, projectID int64, req []*model.UpdateRequest) (
	[]*model.SourceString, *Response, error,
)

BatchOperations allows performing multiple operations on source strings.

Request body:

  • op: The operation to perform. Enum: add, replace, remove
  • path: A JSON Pointer as defined in RFC 6901. Enum: "/{stringId}/identifier", "/{stringId}/text", "/{stringId}/context", "/{stringId}/isHidden", "/{stringId}/maxLength", "/{stringId}/labelIds"
  • value: The value to be used within the operations. The value must be one of string, integer, boolean or map

https://developer.crowdin.com/api/v2/#operation/api.projects.strings.batchPatch

func (*SourceStringsService) Delete

func (s *SourceStringsService) Delete(ctx context.Context, projectID, stringID int64) (*Response, error)

Delete removes a specific string by its identifier.

https://developer.crowdin.com/api/v2/#operation/api.projects.strings.delete

func (*SourceStringsService) Edit

func (s *SourceStringsService) Edit(ctx context.Context, projectID, stringID int64, req []*model.UpdateRequest) (
	*model.SourceString, *Response, error,
)

Edit updates a specific string by its identifier.

Request body:

  • op: The operation to perform. Enum: replace, test
  • path: A JSON Pointer as defined in RFC 6901. Enum: "/identifier", "/text", "/context", "/isHidden" "/maxLength" "/labelIds"
  • value: The value to be used within the operations. The value must be one of string, integer, boolean or object

https://developer.crowdin.com/api/v2/#operation/api.projects.strings.patch

func (*SourceStringsService) Get

func (s *SourceStringsService) Get(ctx context.Context, projectID, stringID int64, opts *model.SourceStringsGetOptions) (
	*model.SourceString, *Response, error,
)

Get returns a specific source string by its identifier.

https://developer.crowdin.com/api/v2/#operation/api.projects.strings.get

func (*SourceStringsService) GetUploadStatus

func (s *SourceStringsService) GetUploadStatus(ctx context.Context, projectID int64, uploadID string) (
	*model.SourceStringsUpload, *Response, error,
)

GetUploadStatus returns the status of the uploaded strings.

https://developer.crowdin.com/api/v2/string-based/#operation/api.projects.strings.uploads.get

func (*SourceStringsService) List

List returns a list of source strings. Use optional parameters to filter the list.

https://developer.crowdin.com/api/v2/#operation/api.projects.strings.getMany

type StorageService

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

Storages is a separate container for each file. You need to use Add method before adding files to your projects via API. Files that should be uploaded into storage include files for localization, screenshots, Glossaries, and Translation Memories. Storage `id` is the identifier of the file uploaded to the Storage.

Note: Files uploaded to the storage are kept during the next 24 hours.

Crowdin API docs: https://developer.crowdin.com/api/v2/#tag/Storage

func (*StorageService) Add

func (s *StorageService) Add(ctx context.Context, file *os.File) (*model.Storage, *Response, error)

Add adds a new file to the storage.

`file` is the file to be uploaded. It should be an os.File. ZIP files are not supported.

https://developer.crowdin.com/api/v2/#operation/api.storages.post

func (*StorageService) Delete

func (s *StorageService) Delete(ctx context.Context, id int) (*Response, error)

Delete deletes a file from the storage by its identifier. https://developer.crowdin.com/api/v2/#operation/api.storages.delete

func (*StorageService) Get

func (s *StorageService) Get(ctx context.Context, id int) (*model.Storage, *Response, error)

Get returns a file in the storage by its identifier. https://developer.crowdin.com/api/v2/#operation/api.storages.get

func (*StorageService) List

List returns a list of storages. opts (model.ListOptions) can be used to control pagination. If nil, default values will be used.

limit: A maximum number of items to retrieve (default 25, max 500).
offset: A starting offset in the collection of items (default 0).

https://developer.crowdin.com/api/v2/#operation/api.storages.getMany

type StringTranslationsService

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

Use API to add or remove strings translations, approvals, and votes.

Crowdin API docs: https://developer.crowdin.com/api/v2/#tag/String-Translations

func (*StringTranslationsService) AddApproval

func (s *StringTranslationsService) AddApproval(ctx context.Context, projectID, translationID int) (
	*model.Approval, *Response, error,
)

AddApproval adds a new translation approval.

https://developer.crowdin.com/api/v2/#operation/api.projects.approvals.post

func (*StringTranslationsService) AddTranslation

func (s *StringTranslationsService) AddTranslation(ctx context.Context, projectID int, req *model.TranslationAddRequest) (
	*model.Translation, *Response, error,
)

AddTranslation adds a new string translation.

https://developer.crowdin.com/api/v2/#operation/api.projects.translations.post

func (*StringTranslationsService) AddVote

func (s *StringTranslationsService) AddVote(ctx context.Context, projectID int, req *model.VoteAddRequest) (
	*model.Vote, *Response, error,
)

AddVote adds a vote for a translation.

https://developer.crowdin.com/api/v2/#operation/api.projects.votes.post

func (*StringTranslationsService) CancelVote

func (s *StringTranslationsService) CancelVote(ctx context.Context, projectID, voteID int) (*Response, error)

CancelVote cancels a vote for a translation by its identifier.

https://developer.crowdin.com/api/v2/#operation/api.projects.votes.delete

func (*StringTranslationsService) DeleteStringTranslations

func (s *StringTranslationsService) DeleteStringTranslations(ctx context.Context, projectID, stringID int, languageID string) (
	*Response, error,
)

DeleteStringTranslations deletes string translations by its identifiers.

https://developer.crowdin.com/api/v2/#operation/api.projects.translations.deleteMany

func (*StringTranslationsService) DeleteTranslation

func (s *StringTranslationsService) DeleteTranslation(ctx context.Context, projectID, translationID int) (*Response, error)

DeleteTranslation deletes a translation by its identifier.

https://developer.crowdin.com/api/v2/#operation/api.projects.translations.delete

func (*StringTranslationsService) GetApproval

func (s *StringTranslationsService) GetApproval(ctx context.Context, projectID, approvalID int) (*model.Approval, *Response, error)

GetApproval returns a single translation approval by its identifier.

https://developer.crowdin.com/api/v2/#operation/api.projects.approvals.get

func (*StringTranslationsService) GetTranslation

func (s *StringTranslationsService) GetTranslation(ctx context.Context, projectID, translationID int, opts *model.TranslationGetOptions) (
	*model.Translation, *Response, error,
)

GetTranslation returns a single string translation by its identifier.

https://developer.crowdin.com/api/v2/#operation/api.projects.translations.get

func (*StringTranslationsService) GetVote

func (s *StringTranslationsService) GetVote(ctx context.Context, projectID, voteID int) (*model.Vote, *Response, error)

GetVote gets a single translation vote by its identifier.

https://developer.crowdin.com/api/v2/#operation/api.projects.votes.get

func (*StringTranslationsService) ListApprovals

func (s *StringTranslationsService) ListApprovals(ctx context.Context, projectID int, opts *model.ApprovalsListOptions) (
	[]*model.Approval, *Response, error,
)

ListApprovals returns a list of translation approvals.

https://developer.crowdin.com/api/v2/#operation/api.projects.approvals.getMany

func (*StringTranslationsService) ListLanguageTranslations

func (s *StringTranslationsService) ListLanguageTranslations(
	ctx context.Context,
	projectID int,
	languageID string,
	opts *model.LanguageTranslationsListOptions) (
	[]*model.LanguageTranslation, *Response, error,
)

ListLanguageTranslations returns a list of translations for a specific language.

Note: For instant translation delivery to your mobile, web, server, or desktop apps, it is recommended to use OTA.

https://developer.crowdin.com/api/v2/#operation/api.projects.languages.translations.getMany

func (*StringTranslationsService) ListStringTranslations

func (s *StringTranslationsService) ListStringTranslations(ctx context.Context, projectID int, opts *model.StringTranslationsListOptions) (
	[]*model.Translation, *Response, error,
)

ListStringTranslations returns a list of string translations.

Note: For instant translation delivery to your mobile, web, server, or desktop apps, it is recommended to use OTA.

https://developer.crowdin.com/api/v2/#operation/api.projects.translations.getMany

func (*StringTranslationsService) ListVotes

func (s *StringTranslationsService) ListVotes(ctx context.Context, projectID int, opts *model.VotesListOptions) (
	[]*model.Vote, *Response, error,
)

ListVotes lists translation votes.

Note: Either `translationId` OR `fileId` OR `labelIds` OR `excludeLabelIds` with `languageId` OR `stringId` with `languageId` are required

https://developer.crowdin.com/api/v2/#operation/api.projects.votes.getMany

func (*StringTranslationsService) RemoveApproval

func (s *StringTranslationsService) RemoveApproval(ctx context.Context, projectID, approvalID int) (*Response, error)

RemoveApproval removes a translation approval by its identifier.

https://developer.crowdin.com/api/v2/#operation/api.projects.approvals.delete

func (*StringTranslationsService) RestoreTranslation

func (s *StringTranslationsService) RestoreTranslation(ctx context.Context, projectID, translationID int) (
	*model.Translation, *Response, error,
)

RestoreTranslation restores a translation by its identifier.

https://developer.crowdin.com/api/v2/#operation/api.projects.translations.put

func (*StringTranslationsService) TranslationAlignment

TranslationAlignment aligns translations.

https://developer.crowdin.com/api/v2/#operation/api.projects.translations.alignment.post

type TranslationStatusService

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

Status represents the general localization progress on both translations and proofreading. Use API to check translation and proofreading progress on different levels: file, language, branch, directory.

Crowdin API docs: https://developer.crowdin.com/api/v2/#tag/Translation-Status

func (*TranslationStatusService) GetBranchProgress

func (s *TranslationStatusService) GetBranchProgress(ctx context.Context, projectID, branchID int, opts *model.ListOptions) (
	[]*model.TranslationProgress, *Response, error,
)

GetBranchProgress returns the translation and proofreading progress on a branch level.

https://developer.crowdin.com/api/v2/#operation/api.projects.branches.languages.progress.getMany

func (*TranslationStatusService) GetDirectoryProgress

func (s *TranslationStatusService) GetDirectoryProgress(ctx context.Context, projectID, directoryID int, opts *model.ListOptions) (
	[]*model.TranslationProgress, *Response, error,
)

GetDirectoryProgress returns the translation and proofreading progress on a directory level.

https://developer.crowdin.com/api/v2/#operation/api.projects.directories.languages.progress.getMany

func (*TranslationStatusService) GetFileProgress

func (s *TranslationStatusService) GetFileProgress(ctx context.Context, projectID, fileID int, opts *model.ListOptions) (
	[]*model.TranslationProgress, *Response, error,
)

GetFileProgress returns the translation and proofreading progress on a file level.

https://developer.crowdin.com/api/v2/#operation/api.projects.files.languages.progress.getMany

func (*TranslationStatusService) GetLanguageProgress

func (s *TranslationStatusService) GetLanguageProgress(ctx context.Context, projectID int, languageID string, opts *model.ListOptions) (
	[]*model.TranslationProgress, *Response, error,
)

GetLanguageProgress returns the translation and proofreading progress on a language level.

https://developer.crowdin.com/api/v2/#operation/api.projects.languages.files.progress.getMany

func (*TranslationStatusService) GetProjectProgress

func (s *TranslationStatusService) GetProjectProgress(ctx context.Context, projectID int, opts *model.ProjectProgressListOptions) (
	[]*model.TranslationProgress, *Response, error,
)

GetProjectProgress returns the translation and proofreading progress on a project level.

Query parameters: - languageIds: Filter progress by Language Identifier. - limit: A maximum number of items to retrieve (default 25, max 500). - offset: A starting offset in the collection of items (default 0).

https://developer.crowdin.com/api/v2/#operation/api.projects.languages.progress.getMany

func (*TranslationStatusService) ListQAChecks

func (s *TranslationStatusService) ListQAChecks(ctx context.Context, projectID int, opts *model.QACheckListOptions) (
	[]*model.QACheck, *Response, error,
)

ListQAChecks returns a list of QA check issues.

Query parameters: - category: Filter progress by Category. - validation: Filter progress by Validation type. - languageId: Filter progress by Language Identifier. - limit: A maximum number of items to retrieve (default 25, max 500). - offset: A starting offset in the collection of items (default 0).

https://developer.crowdin.com/api/v2/#operation/api.projects.qa-checks.getMany

type TranslationsService

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

Translators can work with entirely untranslated project or you can pre-translate the files to ease the translations process. Use API to pre-translate files via Machine Translation (MT) or Translation Memory (TM), upload your existing translations, and download translations correspondingly. Pre-translate and build are asynchronous operations and shall be completed with sequence of API methods.

Note: If there are no new translations or changes in build parameters, Crowdin will return the current build for such requests.

func (*TranslationsService) ApplyPreTranslation

func (s *TranslationsService) ApplyPreTranslation(ctx context.Context, projectID int, req *model.PreTranslationRequest) (
	*model.PreTranslation, *Response, error,
)

ApplyPreTranslation applies pre-translation to the project.

https://developer.crowdin.com/api/v2/#operation/api.projects.pre-translations.post

func (*TranslationsService) BuildProjectDirectoryTranslation

func (s *TranslationsService) BuildProjectDirectoryTranslation(
	ctx context.Context,
	projectID, directoryID int,
	req *model.BuildProjectDirectoryTranslationRequest,
) (*model.BuildProjectDirectoryTranslation, *Response, error)

BuildProjectDirectoryTranslation builds translations for a specific directory in the project.

https://developer.crowdin.com/api/v2/#operation/api.projects.translations.builds.directories.post

func (*TranslationsService) BuildProjectFileTranslation

func (s *TranslationsService) BuildProjectFileTranslation(
	ctx context.Context,
	projectID, fileID int,
	req *model.BuildProjectFileTranslationRequest,
	etag string,
) (*model.DownloadLink, *Response, error)

BuildProjectFileTranslation builds translations for a specific file in the project.

Note: Pass `etag` identifier to see whether any changes were applied to the file. If etag is not empty, it would be added to the If-None-Match request header. In case the file was changed it would be built. If not you'll receive a 304 (Not Modified) status code.

https://developer.crowdin.com/api/v2/#operation/api.projects.translations.builds.files.post

func (*TranslationsService) BuildProjectTranslation

BuildProjectTranslation builds project translations. Request body can be either `model.BuildProjectRequest` or `model.PseudoBuildProjectRequest`.

https://developer.crowdin.com/api/v2/#operation/api.projects.translations.builds.post

func (*TranslationsService) CancelBuild

func (s *TranslationsService) CancelBuild(ctx context.Context, projectID, buildID int) (*Response, error)

CancelBuild cancels a build by its identifier.

https://developer.crowdin.com/api/v2/#operation/api.projects.translations.builds.delete

func (*TranslationsService) CheckBuildStatus

func (s *TranslationsService) CheckBuildStatus(ctx context.Context, projectID, buildID int) (
	*model.TranslationsProjectBuild, *Response, error,
)

CheckBuildStatus checks the status of a project build by its identifier.

https://developer.crowdin.com/api/v2/#operation/api.projects.translations.builds.get

func (*TranslationsService) DownloadProjectTranslations

func (s *TranslationsService) DownloadProjectTranslations(ctx context.Context, projectID, buildID int) (
	*model.DownloadLink, *Response, error,
)

DownloadProjectTranslations returns a download link for a specific build.

https://developer.crowdin.com/api/v2/#operation/api.projects.translations.builds.download.download

func (*TranslationsService) ExportProjectTranslation

func (s *TranslationsService) ExportProjectTranslation(ctx context.Context, projectID int, req *model.ExportTranslationRequest) (
	*model.DownloadLink, *Response, error,
)

ExportProjectTranslation exports project translations for a specific language.

Note: For instant translation delivery to your mobile, web, server, or desktop apps, it is recommended to use OTA.

https://developer.crowdin.com/api/v2/#operation/api.projects.translations.exports.post

func (*TranslationsService) ListProjectBuilds

ListProjectBuilds returns a list of builds for a specific project.

Query parameters: - branchId: The identifier of the branch (filter by branch). - limit: A maximum number of items to retrieve (default 25, max 500). - offset: A starting offset in the collection of items (default 0).

https://developer.crowdin.com/api/v2/#operation/api.projects.translations.builds.getMany

func (*TranslationsService) PreTranslationStatus

func (s *TranslationsService) PreTranslationStatus(ctx context.Context, projectID int, preTranslationID string) (
	*model.PreTranslation, *Response, error,
)

PreTranslationStatus returns a pre-translation status for project by its identifier.

https://developer.crowdin.com/api/v2/#operation/api.projects.pre-translations.get

func (*TranslationsService) UploadTranslations

func (s *TranslationsService) UploadTranslations(ctx context.Context, projectID int, languageID string, req *model.UploadTranslationsRequest) (
	*model.UploadTranslations, *Response, error,
)

UploadTranslations uploads translations for a specific language in the project.

https://developer.crowdin.com/api/v2/#operation/api.projects.translations.postOnLanguage

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL