crowdin

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 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 BundlesService added in v0.3.0

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

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

func (*BundlesService) Add added in v0.3.0

func (s *BundlesService) Add(ctx context.Context, projectID int, req *model.BundleAddRequest) (
	*model.Bundle, *Response, error,
)

Add creates a new bundle.

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

func (*BundlesService) CheckExportStatus added in v0.3.0

func (s *BundlesService) CheckExportStatus(ctx context.Context, projectID, bundleID int, exportID string) (
	*model.BundleExport, *Response, error,
)

CheckExportStatus returns the status of the bundle export.

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

func (*BundlesService) Delete added in v0.3.0

func (s *BundlesService) Delete(ctx context.Context, projectID, bundleID int) (*Response, error)

Delete removes the bundle.

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

func (*BundlesService) Download added in v0.3.0

func (s *BundlesService) Download(ctx context.Context, projectID, bundleID int, exportID string) (
	*model.DownloadLink, *Response, error,
)

Download returns a download link for the bundle.

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

func (*BundlesService) Edit added in v0.3.0

func (s *BundlesService) Edit(ctx context.Context, projectID, bundleID int, req []*model.UpdateRequest) (
	*model.Bundle, *Response, error,
)

Edit updates the bundle.

Request body:

  • op: The operation to perform. Enum: replace, test.
  • path (json-pointer): A JSON Pointer as defined by RFC 6901. Enum: "/name", "/format", "/sourcePatterns", "/ignorePatterns", "/exportPattern", "/isMultilingual", "/labelIds", "/includeProjectSourceLanguage", "/excludeLabelIds".
  • value: The value to be used within the operations. The value must be string or integer.

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

func (*BundlesService) Export added in v0.3.0

func (s *BundlesService) Export(ctx context.Context, projectID, bundleID int) (
	*model.BundleExport, *Response, error,
)

Export starts the export process for the bundle.

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

func (*BundlesService) Get added in v0.3.0

func (s *BundlesService) Get(ctx context.Context, projectID, bundleID int) (*model.Bundle, *Response, error)

Get returns the bundle by its identifier.

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

func (*BundlesService) List added in v0.3.0

func (s *BundlesService) List(ctx context.Context, projectID int, opts *model.ListOptions) (
	[]*model.Bundle, *Response, error,
)

List returns a list of bundles.

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

func (*BundlesService) ListBranches added in v0.3.0

func (s *BundlesService) ListBranches(ctx context.Context, projectID, bundleID int, opts *model.ListOptions) (
	[]*model.Branch, *Response, error,
)

ListBranches returns a list of branches included in the bundle.

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

func (*BundlesService) ListFiles added in v0.3.0

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

ListFiles returns a list of files included in the bundle.

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

type Client

type Client struct {
	Storages                  *StorageService
	Languages                 *LanguagesService
	Groups                    *GroupsService
	Projects                  *ProjectsService
	Branches                  *BranchesService
	SourceFiles               *SourceFilesService
	SourceStrings             *SourceStringsService
	StringTranslations        *StringTranslationsService
	StringComments            *StringCommentsService
	Translations              *TranslationsService
	TranslationStatus         *TranslationStatusService
	Screenshots               *ScreenshotsService
	Bundles                   *BundlesService
	Labels                    *LabelsService
	Glossaries                *GlossariesService
	TranslationMemory         *TranslationMemoryService
	Users                     *UsersService
	MachineTranslationEngines *MachineTranslationEnginesService
	Tasks                     *TasksService
	// 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, v ...any) (*Response, error)

Delete makes a DELETE request to the specified path. If the provided parameter v is not nil, the result will be unmarshaled into it.

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 GlossariesService added in v0.3.0

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

Glossaries help to explain some specific terms or the ones often used in the project so that they can be properly and consistently translated.

Use API to manage glossaries or specific terms. Glossary export and import are asynchronous operations and shall be completed with sequence of API methods.

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

func (*GlossariesService) AddGlossary added in v0.3.0

AddGlossary creates a new glossary.

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

func (*GlossariesService) AddTerm added in v0.3.0

func (s *GlossariesService) AddTerm(ctx context.Context, glossaryID int, req *model.TermAddRequest) (
	*model.Term, *Response, error,
)

AddTerm adds a new term to a glossary.

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

func (*GlossariesService) CheckGlossaryExportStatus added in v0.3.0

func (s *GlossariesService) CheckGlossaryExportStatus(ctx context.Context, glossaryID int, exportID string) (
	*model.GlossaryExport, *Response, error,
)

CheckGlossaryExportStatus returns the status of a glossary export.

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

func (*GlossariesService) CheckGlossaryImportStatus added in v0.3.0

func (s *GlossariesService) CheckGlossaryImportStatus(ctx context.Context, glossaryID, importID int) (
	*model.GlossaryImport, *Response, error,
)

CheckGlossaryImportStatus returns the status of a glossary import.

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

func (*GlossariesService) ClearGlossary added in v0.3.0

func (s *GlossariesService) ClearGlossary(ctx context.Context, glossaryID int, opts *model.ClearGlossaryOptions) (
	*Response, error,
)

ClearGlossary deletes all terms from a glossary.

https://developer.crowdin.com/api/v2/#operation/api.glossaries.terms.deleteMany

func (*GlossariesService) ConcordanceSearch added in v0.3.0

func (s *GlossariesService) ConcordanceSearch(ctx context.Context, projectID int, req *model.GlossaryConcordanceSearchRequest) (
	[]*model.ConcordanceSearch, *Response, error,
)

ConcordanceSearch searches for concordance in the glossary.

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

func (*GlossariesService) DeleteConcept added in v0.3.0

func (s *GlossariesService) DeleteConcept(ctx context.Context, glossaryID, conceptID int) (*Response, error)

DeleteConcept deletes a specific concept from a glossary.

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

func (*GlossariesService) DeleteGlossary added in v0.3.0

func (s *GlossariesService) DeleteGlossary(ctx context.Context, glossaryID int) (*Response, error)

DeleteGlossary deletes a specific glossary.

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

func (*GlossariesService) DeleteTerm added in v0.3.0

func (s *GlossariesService) DeleteTerm(ctx context.Context, glossaryID, termID int) (*Response, error)

DeleteTerm deletes a specific term from a glossary.

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

func (*GlossariesService) DownloadGlossary added in v0.3.0

func (s *GlossariesService) DownloadGlossary(ctx context.Context, glossaryID int, exportID string) (
	*model.DownloadLink, *Response, error,
)

DownloadGlossary returns a download link for a glossary export.

https://developer.crowdin.com/api/v2/#operation/api.glossaries.exports.download.download

func (*GlossariesService) EditGlossary added in v0.3.0

func (s *GlossariesService) EditGlossary(ctx context.Context, glossaryID int, req []*model.UpdateRequest) (
	*model.Glossary, *Response, error,
)

EditGlossary updates a specific glossary.

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

func (*GlossariesService) EditTerm added in v0.3.0

func (s *GlossariesService) EditTerm(ctx context.Context, glossaryID, termID int, req []*model.UpdateRequest) (
	*model.Term, *Response, error,
)

EditTerm updates a specific term.

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

func (*GlossariesService) ExportGlossary added in v0.3.0

func (s *GlossariesService) ExportGlossary(ctx context.Context, glossaryID int, req *model.GlossaryExportRequest) (
	*model.GlossaryExport, *Response, error,
)

ExportGlossary performs an export of a glossary. The export operation is asynchronous and returns the status of the export process.

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

func (*GlossariesService) GetConcept added in v0.3.0

func (s *GlossariesService) GetConcept(ctx context.Context, glossaryID, conceptID int) (
	*model.Concept, *Response, error,
)

GetConcept returns a specific concept from a glossary by its identifier.

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

func (*GlossariesService) GetGlossary added in v0.3.0

func (s *GlossariesService) GetGlossary(ctx context.Context, glossaryID int) (*model.Glossary, *Response, error)

GetGlossary returns a specific glossary by its identifier.

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

func (*GlossariesService) GetTerm added in v0.3.0

func (s *GlossariesService) GetTerm(ctx context.Context, glossaryID, termID int) (
	*model.Term, *Response, error,
)

GetTerm returns a specific term from a glossary by its identifier.

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

func (*GlossariesService) ImportGlossary added in v0.3.0

func (s *GlossariesService) ImportGlossary(ctx context.Context, glossaryID int, req *model.GlossaryImportRequest) (
	*model.GlossaryImport, *Response, error,
)

ImportGlossary performs an import of a glossary. The import operation is asynchronous and returns the status of the import process.

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

func (*GlossariesService) ListConcepts added in v0.3.0

func (s *GlossariesService) ListConcepts(ctx context.Context, glossaryID int, opts *model.ConceptsListOptions) (
	[]*model.Concept, *Response, error,
)

ListConcepts returns a list of concepts from a glossary.

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

func (*GlossariesService) ListGlossaries added in v0.3.0

func (s *GlossariesService) ListGlossaries(ctx context.Context, opts *model.GlossariesListOptions) (
	[]*model.Glossary, *Response, error,
)

ListGlossaries returns a list of glossaries.

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

func (*GlossariesService) ListTerms added in v0.3.0

func (s *GlossariesService) ListTerms(ctx context.Context, glossaryID int, opts *model.TermsListOptions) (
	[]*model.Term, *Response, error,
)

ListTerms returns a list of terms from a glossary.

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

func (*GlossariesService) UpdateConcept added in v0.3.0

func (s *GlossariesService) UpdateConcept(ctx context.Context, glossaryID, conceptID int, req *model.ConceptUpdateRequest) (
	*model.Concept, *Response, error,
)

UpdateConcept updates a specific concept in a glossary.

https://developer.crowdin.com/api/v2/#operation/api.glossaries.concepts.put

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 LabelsService added in v0.3.0

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

LabelsService provides access to the Labels API.

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

func (*LabelsService) Add added in v0.3.0

func (s *LabelsService) Add(ctx context.Context, projectID int, req *model.LabelAddRequest) (
	*model.Label, *Response, error,
)

Add creates a new label in the project.

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

func (*LabelsService) AssignToScreenshots added in v0.3.0

func (s *LabelsService) AssignToScreenshots(ctx context.Context, projectID, labelID int, screenshotIDs []int) (
	[]*model.Screenshot, *Response, error,
)

AssignToScreenshots assigns label to screenshots and returns a list of screenshots which the label was assigned to. Note: You can assign up to 500 screenshots at a time.

https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.labels.screenshots.post

func (*LabelsService) AssignToStrings added in v0.3.0

func (s *LabelsService) AssignToStrings(ctx context.Context, projectID, labelID int, stringIDs []int) (
	[]*model.SourceString, *Response, error,
)

AssignToStrings assigns label to strings and returns a list of strings which the label was assigned to. Note: You can assign up to 500 strings at a time.

https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.labels.strings.post

func (*LabelsService) Delete added in v0.3.0

func (s *LabelsService) Delete(ctx context.Context, projectID, labelID int) (*Response, error)

Delete removes a label by its identifier.

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

func (*LabelsService) Edit added in v0.3.0

func (s *LabelsService) Edit(ctx context.Context, projectID, labelID int, req []*model.UpdateRequest) (
	*model.Label, *Response, error,
)

Edit updates a label by its identifier.

Request body: - op - operation to perform with the label. Enum: replace, test. - path (json-pointer) - path to the field to update. Enum: "/title". - value (string) - new value for the field. Must be a string.

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

func (*LabelsService) Get added in v0.3.0

func (s *LabelsService) Get(ctx context.Context, projectID, labelID int) (*model.Label, *Response, error)

Get returns a label by its identifier.

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

func (*LabelsService) List added in v0.3.0

func (s *LabelsService) List(ctx context.Context, projectID int, opts *model.LabelsListOptions) (
	[]*model.Label, *Response, error,
)

List returns a list of labels in the project.

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

func (*LabelsService) UnassignFromScreenshots added in v0.3.0

func (s *LabelsService) UnassignFromScreenshots(ctx context.Context, projectID, labelID int, screenshotIDs []int) (
	[]*model.Screenshot, *Response, error,
)

UnassignFromScreenshots unassigns label from screenshots and returns a list of screenshots which the label was unassigned from. Note: You can unassign up to 500 screenshots at a time.

https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.labels.screenshots.deleteMany

func (*LabelsService) UnassignFromStrings added in v0.3.0

func (s *LabelsService) UnassignFromStrings(ctx context.Context, projectID, labelID int, stringIDs []int) (
	[]*model.SourceString, *Response, error,
)

UnassignFromStrings unassigns label from strings and returns a list of strings which the label was unassigned from. Note: You can unassign up to 500 strings at a time.

https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.labels.strings.deleteMany

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 MachineTranslationEnginesService added in v0.3.0

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

Machine Translation Engines (MTE) are the sources for pre-translations. You can currently connect Google Translate, Microsoft Translator, Translate, DeepL Pro, Amazon Translate, and Watson (IBM) Translate engines.

Use API to add, update, and delete specific MTE.

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

func (*MachineTranslationEnginesService) AddMT added in v0.3.0

AddMT creates a new machine translation.

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

func (*MachineTranslationEnginesService) DeleteMT added in v0.3.0

DeleteMT removes an existing machine translation.

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

func (*MachineTranslationEnginesService) EditMT added in v0.3.0

EditMT updates an existing machine translation.

Request body:

  • op (string): Operation to perform. Possible values: replace, test.
  • path (string): Path to the field to update (a JSON Pointer as defined by RFC 6901). Enum: /name, /type, /credentials, /enabledLanguageIds, /enabledProjectIds, /isEnabled.
  • value (any): New value for the field. Value must be one of string or object.

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

func (*MachineTranslationEnginesService) GetMT added in v0.3.0

GetMT returns a specific machine translation by its identifier.

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

func (*MachineTranslationEnginesService) ListMT added in v0.3.0

ListMT returns a list of all machine translations.

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

func (*MachineTranslationEnginesService) Translate added in v0.3.0

Translate translates strings using a specific MTE.

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

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 ScreenshotsService added in v0.3.0

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

Screenshots provide translators with additional context for the source strings. Screenshot tags allow specifying which source strings are displayed on each screenshot.

Use API to manage screenshots and their tags.

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

func (*ScreenshotsService) AddScreenshot added in v0.3.0

func (s *ScreenshotsService) AddScreenshot(ctx context.Context, projectID int, req *model.ScreenshotAddRequest) (
	*model.Screenshot, *Response, error,
)

AddScreenshot adds a new screenshot to the project.

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

func (*ScreenshotsService) AddTag added in v0.3.0

func (s *ScreenshotsService) AddTag(ctx context.Context, projectID, screenshotID int, req *model.TagAddRequest) (
	*model.Tag, *Response, error,
)

AddTag adds a new tag to the screenshot.

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

func (*ScreenshotsService) AutoTag added in v0.3.0

func (s *ScreenshotsService) AutoTag(ctx context.Context, projectID, screenshotID int, req *model.AutoTagRequest) (
	*Response, error,
)

AutoTag automatically tags the screenshot with the source strings that are displayed on it.

https://developer.crowdin.com/api/v2/#operation/api.projects.screenshots.tags.putMany

func (*ScreenshotsService) ClearTags added in v0.3.0

func (s *ScreenshotsService) ClearTags(ctx context.Context, projectID, screenshotID int) (*Response, error)

ClearTags deletes all tags from the screenshot.

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

func (*ScreenshotsService) DeleteScreenshot added in v0.3.0

func (s *ScreenshotsService) DeleteScreenshot(ctx context.Context, projectID, screenshotID int) (*Response, error)

DeleteScreenshot deletes a specific screenshot by its identifier.

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

func (*ScreenshotsService) DeleteTag added in v0.3.0

func (s *ScreenshotsService) DeleteTag(ctx context.Context, projectID, screenshotID, tagID int) (*Response, error)

DeleteTag deletes a specific tag by its identifier.

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

func (*ScreenshotsService) EditScreenshot added in v0.3.0

func (s *ScreenshotsService) EditScreenshot(ctx context.Context, projectID, screenshotID int, req []*model.UpdateRequest) (
	*model.Screenshot, *Response, error,
)

EditScreenshot edit a specific screenshot by its identifier.

Request body:

  • op (string): Operation to perform with the screenshot. Enum: replace, test
  • path (string <json-pointer>): JSON path to the field that needs to be updated (RFC 6901). Enum: "/name", "labelIds"
  • value (string): New value for the field. Must be a string.

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

func (*ScreenshotsService) EditTag added in v0.3.0

func (s *ScreenshotsService) EditTag(ctx context.Context, projectID, screenshotID, tagID int, req []*model.UpdateRequest) (
	*model.Tag, *Response, error,
)

EditTag edit a specific tag by its identifier.

Request body:

  • op (string): Operation to perform with the tag. Enum: replace, test
  • path (string <json-pointer>): JSON path to the field that needs to be updated (RFC 6901). Enum: "/stringId", "/position"
  • value (string or int): New value for the field. Must be a string or int.

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

func (*ScreenshotsService) GetScreenshot added in v0.3.0

func (s *ScreenshotsService) GetScreenshot(ctx context.Context, projectID, screenshotID int) (
	*model.Screenshot, *Response, error,
)

GetScreenshot returns a specific screenshot by its identifier.

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

func (*ScreenshotsService) GetTag added in v0.3.0

func (s *ScreenshotsService) GetTag(ctx context.Context, projectID, screenshotID, tagID int) (
	*model.Tag, *Response, error,
)

GetTag returns a specific tag by its identifier.

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

func (*ScreenshotsService) ListScreenshots added in v0.3.0

func (s *ScreenshotsService) ListScreenshots(ctx context.Context, projectID int, opts *model.ScreenshotListOptions) (
	[]*model.Screenshot, *Response, error,
)

ListScreenshots returns a list of all screenshots in the project.

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

func (*ScreenshotsService) ListTags added in v0.3.0

func (s *ScreenshotsService) ListTags(ctx context.Context, projectID, screenshotID int, opts *model.ListOptions) (
	[]*model.Tag, *Response, error,
)

ListTags returns a list of all tags for the screenshot.

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

func (*ScreenshotsService) ReplaceTags added in v0.3.0

func (s *ScreenshotsService) ReplaceTags(ctx context.Context, projectID, screenshotID int, req []*model.ReplaceTagsRequest) (
	*Response, error,
)

ReplaceTags replaces all tags on the screenshot.

https://developer.crowdin.com/api/v2/#operation/api.projects.screenshots.tags.putMany

func (*ScreenshotsService) UpdateScreenshot added in v0.3.0

func (s *ScreenshotsService) UpdateScreenshot(ctx context.Context, projectID, screenshotID int, req *model.ScreenshotUpdateRequest) (
	*model.Screenshot, *Response, error,
)

UpdateScreenshot updates a specific screenshot by its identifier.

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

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 int, 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 int) (*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 int, 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 int, 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 int, 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 StringCommentsService added in v0.3.0

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

Use API to list, add, edit or remove string comments.

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

func (*StringCommentsService) Add added in v0.3.0

Add creates a new string comment.

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

func (*StringCommentsService) Delete added in v0.3.0

func (s *StringCommentsService) Delete(ctx context.Context, projectID, commentID int) (*Response, error)

Delete removes a string comment.

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

func (*StringCommentsService) Edit added in v0.3.0

func (s *StringCommentsService) Edit(ctx context.Context, projectID, commentID int, req []*model.UpdateRequest) (
	*model.StringComment, *Response, error,
)

Edit updates a string comment.

Request body:

  • op: The operation to perform. Enum: replace, test.
  • path: A JSON Pointer as defined by RFC 6901. Enum: "/text", "/issueStatus".
  • value: The value to be used within the operations. The value must be string.

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

func (*StringCommentsService) Get added in v0.3.0

func (s *StringCommentsService) Get(ctx context.Context, projectID, commentID int) (
	*model.StringComment, *Response, error,
)

Get returns a string comment by its ID.

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

func (*StringCommentsService) List added in v0.3.0

List returns a list of string comments.

https://developer.crowdin.com/api/v2/#operation/api.projects.comments.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 TasksService added in v0.3.0

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

Create and assign tasks to get files translated or proofread by specific people. You can set the due dates, split words between people, and receive notifications about the changes and updates on tasks. Tasks are project-specific, so you’ll have to create them within a project.

Use API to create, modify, and delete specific tasks.

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

func (*TasksService) Add added in v0.3.0

func (s *TasksService) Add(ctx context.Context, projectID int, req model.TaskAddRequest) (*model.Task, *Response, error)

Add creates a new task in a project.

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

func (*TasksService) AddSettingsTemplate added in v0.3.0

func (s *TasksService) AddSettingsTemplate(ctx context.Context, projectID int, req *model.TaskSettingsTemplateAddRequest) (
	*model.TaskSettingsTemplate, *Response, error,
)

AddSettingsTemplate creates a new task settings template in a project.

https://developer.crowdin.com/api/v2/string-based/#operation/api.projects.tasks.settings-templates.post

func (*TasksService) Delete added in v0.3.0

func (s *TasksService) Delete(ctx context.Context, projectID, taskID int) (*Response, error)

Delete removes a task from a project by its identifier.

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

func (*TasksService) DeleteSettingsTemplate added in v0.3.0

func (s *TasksService) DeleteSettingsTemplate(ctx context.Context, projectID, taskSettingTemplateID int) (*Response, error)

DeleteSettingsTemplate removes a task settings template from a project by its identifier.

https://developer.crowdin.com/api/v2/string-based/#operation/api.projects.tasks.settings-templates.delete

func (*TasksService) Edit added in v0.3.0

func (s *TasksService) Edit(ctx context.Context, projectID, taskID int, req []*model.UpdateRequest) (*model.Task, *Response, error)

Edit updates a task in a project by its identifier.

Request body (one of the following): 1. TaskOperation

  • op (string): Operation to perform. Enum: replace, test.
  • path (string <json-pointer>): JSON path to the field to be updated. Enum: "/status", "/title", "/description", "/deadline", "/startedAt", "/resolvedAt", "/splitFiles", "/splitContent", "/fileIds", "/stringIds", "/assignees", "/dateFrom", "/dateTo", "/labelIds", "/excludeLabelIds".
  • value (any): Value to be set. Enum: string, bool, array of integers, array of objects.

2. VendorTaskOperation

  • op (string): Operation to perform. Enum: replace, test.
  • path (string <json-pointer>): JSON path to the field to be updated. Enum: "/title", "/description", "/sttaus".
  • value (any): Value to be set. Enum: string, bool, array of integers, array of objects.

3. PendingTaskOperation

  • op (string): Operation to perform. Enum: replace, test.
  • path (string <json-pointer>): JSON path to the field to be updated. Enum: "/title", "/description", "/assignees", "/deadline".
  • value (any): Value to be set. Enum: string, bool, array of integers, array of objects.

4. VendorPendingTaskOperation

  • op (string): Operation to perform. Enum: replace, test.
  • path (string <json-pointer>): JSON path to the field to be updated. Enum: "/title", "/description".
  • value (any): Value to be set. Enum: string, bool, array of integers, array of objects.

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

func (*TasksService) EditArchivedStatus added in v0.3.0

func (s *TasksService) EditArchivedStatus(ctx context.Context, projectID, taskID int, req []*model.UpdateRequest) (
	*model.Task, *Response, error,
)

EditArchivedStatus changes the archived status of the task.

Request body: - op (string): Operation to perform. Enum: replace. - path (string <json-pointer>): JSON path to the field to be updated. Enum: "/isArchived". - value (bool): Value to be set. Enum: true - archive task, false - move a task from archived to a list of all tasks

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

func (*TasksService) EditSettingsTemplate added in v0.3.0

func (s *TasksService) EditSettingsTemplate(ctx context.Context, projectID, taskSettingTemplateID int, req []*model.UpdateRequest) (
	*model.TaskSettingsTemplate, *Response, error,
)

EditSettingsTemplate updates a task settings template in a project by its identifier.

Request body: - op (string): Operation to perform. Enum: replace, test. - path (string <json-pointer>): JSON path to the field to be updated. Enum: "/name", "/config". - value (string|int): Value to be set. Enum: string, integer.

https://developer.crowdin.com/api/v2/string-based/#operation/api.projects.tasks.settings-templates.patch

func (*TasksService) ExportStrings added in v0.3.0

func (s *TasksService) ExportStrings(ctx context.Context, projectID, taskID int) (*model.DownloadLink, *Response, error)

ExportStrings returns a download link.

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

func (*TasksService) Get added in v0.3.0

func (s *TasksService) Get(ctx context.Context, projectID, taskID int) (*model.Task, *Response, error)

Get returns a single task in a project by its identifier.

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

func (*TasksService) GetSettingsTemplate added in v0.3.0

func (s *TasksService) GetSettingsTemplate(ctx context.Context, projectID, taskSettingTemplateID int) (
	*model.TaskSettingsTemplate, *Response, error,
)

GetSettingsTemplate returns a single task settings template in a project by its identifier.

https://developer.crowdin.com/api/v2/string-based/#operation/api.projects.tasks.settings-templates.get

func (*TasksService) List added in v0.3.0

func (s *TasksService) List(ctx context.Context, projectID int, opts *model.TasksListOptions) ([]*model.Task, *Response, error)

List returns a list of tasks in a project.

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

func (*TasksService) ListSettingsTemplates added in v0.3.0

func (s *TasksService) ListSettingsTemplates(ctx context.Context, projectID int, opts *model.ListOptions) (
	[]*model.TaskSettingsTemplate, *Response, error,
)

ListSettingsTemplates returns a list of task settings templates in a project.

https://developer.crowdin.com/api/v2/string-based/#operation/api.projects.tasks.settings-templates.getMany

func (*TasksService) ListUserTasks added in v0.3.0

func (s *TasksService) ListUserTasks(ctx context.Context, opts *model.UserTasksListOptions) ([]*model.Task, *Response, error)

ListUserTasks returns a list of tasks assigned to the user.

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

type TranslationMemoryService added in v0.3.0

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

Translation Memory (TM) is a vault of translations that were previously made in other projects. Those translations can be reused to speed up the translation process. Every translation made in the project is automatically added to the project Translation Memory.

Use API to create, upload, download, or remove specific TM. Translation Memory export and import are asynchronous operations and shall be completed with sequence of API methods.

func (*TranslationMemoryService) AddTM added in v0.3.0

AddTM creates a new translation memory.

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

func (*TranslationMemoryService) CheckTMExportStatus added in v0.3.0

func (s *TranslationMemoryService) CheckTMExportStatus(ctx context.Context, tmID int, exportID string) (
	*model.TranslationMemoryExport, *Response, error,
)

CheckTMExportStatus returns the status of a specific translation memory export.

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

func (*TranslationMemoryService) CheckTMImportStatus added in v0.3.0

func (s *TranslationMemoryService) CheckTMImportStatus(ctx context.Context, tmID int, importID string) (
	*model.TranslationMemoryImport, *Response, error,
)

CheckTMImportStatus returns the status of a specific translation memory import.

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

func (*TranslationMemoryService) ClearTM added in v0.3.0

func (s *TranslationMemoryService) ClearTM(ctx context.Context, tmID int) (*Response, error)

ClearTM removes all segments from a specific translation memory.

https://developer.crowdin.com/api/v2/#operation/api.tms.segments.clear

func (*TranslationMemoryService) ConcordanceSearch added in v0.3.0

ConcordanceSearch searches for concordance in a translation memory.

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

func (*TranslationMemoryService) CreateTMSegment added in v0.3.0

CreateTMSegment creates a new translation memory segment.

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

func (*TranslationMemoryService) DeleteTM added in v0.3.0

func (s *TranslationMemoryService) DeleteTM(ctx context.Context, tmID int) (*Response, error)

DeleteTM removes a specific translation memory by its identifier.

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

func (*TranslationMemoryService) DeleteTMSegment added in v0.3.0

func (s *TranslationMemoryService) DeleteTMSegment(ctx context.Context, tmID, segmentID int) (*Response, error)

DeleteTMSegment removes a specific translation memory segment by its identifier.

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

func (*TranslationMemoryService) DownloadTM added in v0.3.0

func (s *TranslationMemoryService) DownloadTM(ctx context.Context, tmID int, exportID string) (
	*model.DownloadLink, *Response, error,
)

DownloadTM returns a download link for a specific translation memory export.

https://developer.crowdin.com/api/v2/#operation/api.tms.exports.download.download

func (*TranslationMemoryService) EditTM added in v0.3.0

EditTM updates a specific translation memory by its identifier.

Request body: - op (string): Operation to perform. Enum: replace, test. - path (string): JSON Pointer to the field to update as defined in RFC 6901. - value (string): Value to set.

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

func (*TranslationMemoryService) EditTMSegment added in v0.3.0

func (s *TranslationMemoryService) EditTMSegment(ctx context.Context, tmID, segmentID int, req []*model.UpdateRequest) (
	*model.TMSegment, *Response, error,
)

EditTMSegment updates a specific translation memory segment by its identifier.

Request body: 1. TMSegmentRecordOperationAdd: Add a new record to the segment.

  • op (string): Value: "add".
  • path (string): "/records/-".
  • value (object): Possible fields: text, languageId. Example: {"text":"string","languageId":"string"}

2. TMSegmentRecordOperationReplace: Replace the text of a specific record.

  • op (string): Value: "replace".
  • path (string): "/records/{recordId}/text".
  • value (string): Value to set.

3. TMSegmentRecordOperationRemove: Remove a specific record.

  • op (string): Value: "remove".
  • path (string): "/records/{recordId}".

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

func (*TranslationMemoryService) ExportTM added in v0.3.0

ExportTM creates a new translation memory export.

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

func (*TranslationMemoryService) GetTM added in v0.3.0

GetTM returns a specific translation memory by its identifier.

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

func (*TranslationMemoryService) GetTMSegment added in v0.3.0

func (s *TranslationMemoryService) GetTMSegment(ctx context.Context, tmID, segmentID int) (
	*model.TMSegment, *Response, error,
)

GetTMSegment returns a specific translation memory segment by its identifier.

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

func (*TranslationMemoryService) ImportTM added in v0.3.0

ImportTM creates a new translation memory import.

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

func (*TranslationMemoryService) ListTMSegments added in v0.3.0

func (s *TranslationMemoryService) ListTMSegments(ctx context.Context, tmID int, opts *model.TMSegmentsListOptions) (
	[]*model.TMSegment, *Response, error,
)

ListTMSegments returns a list of translation memory segments.

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

func (*TranslationMemoryService) ListTMs added in v0.3.0

ListTMs returns a list of translation memories.

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

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

type UsersService added in v0.3.0

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

Users are the members of your organization with the defined access levels (e.g. manager, admin, contributor).

Use API to get the list of organization users and to check the information on a specific user.

CrowdIn API docs: https://developer.crowdin.com/api/v2/#tag/Users

func (*UsersService) AddProjectMember added in v0.3.0

func (s *UsersService) AddProjectMember(ctx context.Context, projectID int, req *model.ProjectMemberAddRequest) (
	map[string][]*model.ProjectMember, *Response, error,
)

AddProjectMember adds a new member to the project. Returns a list of added and skipped members.

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

func (*UsersService) Delete added in v0.3.0

func (s *UsersService) Delete(ctx context.Context, userID int) (*Response, error)

Delete removes a user from the organization.

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

func (*UsersService) DeleteProjectMember added in v0.3.0

func (s *UsersService) DeleteProjectMember(ctx context.Context, projectID, memberID int) (*Response, error)

DeleteProjectMember removes a member from the project.

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

func (*UsersService) Edit added in v0.3.0

func (s *UsersService) Edit(ctx context.Context, userID int, req []*model.UpdateRequest) (*model.User, *Response, error)

Edit updates information about a specific user.

Request body:

  • op (string): Operation to perform. Enum: replace.
  • path (string <json-pointer>): Path to the field to update. Enum: "/firstName", "/lastName", "/timezone", "/status", "/adminAccess".
  • value (string): Value to set.

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

func (*UsersService) Get added in v0.3.0

func (s *UsersService) Get(ctx context.Context, userID int) (*model.User, *Response, error)

Get returns information about a specific user.

https://developer.crowdin.com/enterprise/api/v2/#operation/api.users.getById

func (*UsersService) GetAuthenticated added in v0.3.0

func (s *UsersService) GetAuthenticated(ctx context.Context) (*model.User, *Response, error)

GetAuthenticated returns information about the authenticated user.

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

func (*UsersService) GetProjectMember added in v0.3.0

func (s *UsersService) GetProjectMember(ctx context.Context, projectID, memberID int) (
	*model.ProjectMember, *Response, error,
)

GetProjectMember returns information or permissions of a specific project member.

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

func (*UsersService) Invite added in v0.3.0

Invite sends an invitation to a new user.

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

func (*UsersService) List added in v0.3.0

List returns a list of users in the organization.

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

func (*UsersService) ListProjectMembers added in v0.3.0

func (s *UsersService) ListProjectMembers(ctx context.Context, projectID int, opts *model.ProjectMembersListOptions) (
	[]*model.ProjectMember, *Response, error,
)

ListProjectMembers returns a list of project members.

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

func (*UsersService) ReplaceProjectMemberPermissions added in v0.3.0

func (s *UsersService) ReplaceProjectMemberPermissions(
	ctx context.Context, projectID, memberID int, req *model.ProjectMemberReplaceRequest,
) (*model.ProjectMember, *Response, error)

ReplaceProjectMemberPermissions replaces permissions of a specific project member.

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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