import { BooleanInt, CrowdinApi, PaginationOptions, PatchRequest, ResponseList, ResponseObject } from '../core'; /** * Use API to add or remove strings translations, approvals, and votes. */ export declare class StringTranslations extends CrowdinApi { /** * @requiredScope project.translation:read * @param projectId project identifier * @param options optional parameters for the request * @see https://developer.crowdin.com/api/v2/#operation/api.projects.approvals.getMany */ listTranslationApprovals(projectId: number, options?: StringTranslationsModel.ListTranslationApprovalsOptions): Promise>; /** * @requiredScope project.translation:read * @param projectId project identifier * @param stringId string identifier * @param languageId language identifier * @param translationId translation identifier * @param limit maximum number of items to retrieve (default 25) * @param offset starting offset in the collection (default 0) * @param fileId file identifier * @param labelIds label Identifiers * @param excludeLabelIds exclude label Identifiers * @deprecated optional parameters should be passed through an object * @see https://developer.crowdin.com/api/v2/#operation/api.projects.approvals.getMany */ listTranslationApprovals(projectId: number, stringId?: number, languageId?: string, translationId?: number, limit?: number, offset?: number, fileId?: number, labelIds?: string, excludeLabelIds?: string): Promise>; /** * @requiredScope project.translation:write * @param projectId project identifier * @param request request body * @see https://developer.crowdin.com/api/v2/#operation/api.projects.approvals.post */ addApproval(projectId: number, request: StringTranslationsModel.AddApprovalRequest | StringTranslationsModel.AddCorrectionApprovalRequest): Promise>; /** * @requiredScope project.translation:write * @param projectId project identifier * @param stringId string identifier * @see https://support.crowdin.com/developer/api/v2/#tag/String-Translations/operation/api.projects.approvals.deleteMany */ removeStringApprovals(projectId: number, stringId: number): Promise; /** * @requiredScope project.translation:write * @param projectId project identifier * @param options parameters for the request * @see https://support.crowdin.com/developer/api/v2/#tag/String-Translations/operation/api.projects.approvals.deleteMany */ removeStringApprovals(projectId: number, options: StringTranslationsModel.RemoveStringApprovalsOptions): Promise; /** * @requiredScope project.translation:read * @param projectId project identifier * @param approvalId approval identifier * @see https://developer.crowdin.com/api/v2/#operation/api.projects.approvals.get */ approvalInfo(projectId: number, approvalId: number): Promise>; /** * @requiredScope project.translation:write * @param projectId project identifier * @param request request body * @see https://developer.crowdin.com/api/v2/#operation/api.projects.approvals.patch */ approvalBatchOperations(projectId: number, request: PatchRequest[]): Promise>; /** * @requiredScope project.translation:write * @param projectId project identifier * @param approvalId approval identifier * @see https://developer.crowdin.com/api/v2/#operation/api.projects.approvals.delete */ removeApproval(projectId: number, approvalId: number): Promise; /** * @requiredScope project.translation:read * @param projectId project identifier * @param languageId language identifier * @param options optional parameters for the request * @see https://developer.crowdin.com/api/v2/#operation/api.projects.languages.translations.getMany */ listLanguageTranslations(projectId: number, languageId: string, options?: StringTranslationsModel.ListLanguageTranslationsOptions): Promise>; /** * @requiredScope project.translation:read * @param projectId project identifier * @param languageId language identifier * @param stringIds filter translations by stringIds * @param fileId filter translations by fileId * @param limit maximum number of items to retrieve (default 25) * @param offset starting offset in the collection (default 0) * @param labelIds filter translations by fileId * @param denormalizePlaceholders enable denormalize placeholders * @param croql filter translations by CroQL (Can't be used with `stringIds`, `labelIds` or `fileId` in same request) * @deprecated optional parameters should be passed through an object * @see https://developer.crowdin.com/api/v2/#operation/api.projects.languages.translations.getMany */ listLanguageTranslations(projectId: number, languageId: string, stringIds?: string, fileId?: number, limit?: number, offset?: number, labelIds?: string, denormalizePlaceholders?: BooleanInt, croql?: string): Promise>; /** * @requiredScope project.translation:write * @param projectId project identifier * @param request request body * @see https://developer.crowdin.com/api/v2/#operation/api.projects.translations.alignment.post */ translationAlignment(projectId: number, request: StringTranslationsModel.TranslationAlignmentRequest): Promise>; /** * @requiredScope project.translation:read * @param projectId project identifier * @param stringId string identifier * @param languageId language identifier * @param options optional parameters for the request * @see https://developer.crowdin.com/api/v2/#operation/api.projects.translations.getMany */ listStringTranslations(projectId: number, stringId: number, languageId: string, options?: StringTranslationsModel.ListStringTranslationsOptions): Promise>; /** * @requiredScope project.translation:read * @param projectId project identifier * @param stringId string identifier * @param languageId language identifier * @param limit maximum number of items to retrieve (default 25) * @param offset starting offset in the collection (default 0) * @param denormalizePlaceholders enable denormalize placeholders * @deprecated optional parameters should be passed through an object * @see https://developer.crowdin.com/api/v2/#operation/api.projects.translations.getMany */ listStringTranslations(projectId: number, stringId: number, languageId: string, limit?: number, offset?: number, denormalizePlaceholders?: BooleanInt): Promise>; /** * @requiredScope project.translation:write * @param projectId project identifier * @param request request body * @see https://developer.crowdin.com/api/v2/#operation/api.projects.translations.post */ addTranslation(projectId: number, request: StringTranslationsModel.AddStringTranslationRequest): Promise>; /** * @requiredScope project.translation:write * @param projectId project identifier * @param stringId string identifier * @param languageId language identifier * @see https://developer.crowdin.com/api/v2/#operation/api.projects.translations.deleteMany */ deleteAllTranslations(projectId: number, stringId: number, languageId?: string): Promise; /** * @requiredScope project.translation:write * @param projectId project identifier * @param options parameters for the request * @see https://developer.crowdin.com/api/v2/#operation/api.projects.translations.deleteMany */ deleteAllTranslations(projectId: number, options: StringTranslationsModel.DeleteAllTranslationsOptions): Promise; /** * @requiredScope project.translation:read * @param projectId project identifier * @param translationId translation identifier * @param options optional parameters for the request * @see https://developer.crowdin.com/api/v2/#operation/api.projects.translations.get */ translationInfo(projectId: number, translationId: number, options?: StringTranslationsModel.TranslationInfoOptions): Promise>; /** * @requiredScope project.translation:write * @param projectId project identifier * @param translationId translation identifier * @see https://developer.crowdin.com/api/v2/#operation/api.projects.translations.put */ restoreTranslation(projectId: number, translationId: number): Promise>; /** * @requiredScope project.translation:write * @param projectId project identifier * @param request request body * @see https://developer.crowdin.com/api/v2/#operation/api.projects.translations.patch */ translationBatchOperations(projectId: number, request: PatchRequest[]): Promise>; /** * @requiredScope project.translation:write * @param projectId project identifier * @param translationId translation identifier * @see https://developer.crowdin.com/api/v2/#operation/api.projects.translations.delete */ deleteTranslation(projectId: number, translationId: number): Promise; /** * @requiredScope project.translation:read * @param projectId project identifier * @param options optional parameters for the request * @see https://developer.crowdin.com/api/v2/#operation/api.projects.votes.getMany */ listTranslationVotes(projectId: number, options?: StringTranslationsModel.ListTranslationVotesOptions): Promise>; /** * @requiredScope project.translation:read * @param projectId project identifier * @param stringId string identifier * @param languageId language identifier * @param translationId translation identifier * @param labelIds label Identifiers * @param excludeLabelIds exclude label Identifiers * @param limit maximum number of items to retrieve (default 25) * @param offset starting offset in the collection (default 0) * @deprecated optional parameters should be passed through an object * @see https://developer.crowdin.com/api/v2/#operation/api.projects.votes.getMany */ listTranslationVotes(projectId: number, stringId?: number, languageId?: string, translationId?: number, labelIds?: string, excludeLabelIds?: string, limit?: number, offset?: number): Promise>; /** * @requiredScope project.translation:write * @param projectId project identifier * @param request request body * @see https://developer.crowdin.com/api/v2/#operation/api.projects.votes.post */ addVote(projectId: number, request: StringTranslationsModel.AddVoteRequest): Promise>; /** * @requiredScope project.translation:read * @param projectId project identifier * @param voteId vote identifier * @see https://developer.crowdin.com/api/v2/#operation/api.projects.votes.get */ voteInfo(projectId: number, voteId: number): Promise>; /** * @requiredScope project.translation:write * @param projectId project identifier * @param voteId vote identifier * @see https://developer.crowdin.com/api/v2/#operation/api.projects.votes.delete */ cancelVote(projectId: number, voteId: number): Promise; } export declare namespace StringTranslationsModel { interface ListTranslationApprovalsOptions extends PaginationOptions { stringId?: number; languageId?: string; translationId?: number; fileId?: number; labelIds?: string; excludeLabelIds?: string; orderBy?: string; /** * Enterprise only */ correctionId?: number; } interface RemoveStringApprovalsOptions { stringId?: number; /** * for file-based projects */ fileId?: number; } interface Approval { id: number; user: User; translationId: number; stringId: number; languageId: string; createdAt: string; /** * for asset approvals */ fileId?: number; /** * Enterprise only */ workflowStepId?: number; /** * Enterprise only. For correction approvals */ correctionId?: number; } interface AddApprovalRequest { translationId: number; } /** * Enterprise only */ interface AddCorrectionApprovalRequest { correctionId: number; } interface StringTranslation { id: number; text: string; pluralCategoryName: PluralCategoryName; user: User; rating: number; provider: string | null; providerId?: number | null; isPreTranslated: boolean; matchRate?: number | null; matchType?: MatchType | null; createdAt: string; /** * Enterprise only */ workflowStepId?: number; } type Provider = 'tm' | 'google' | 'microsoft' | 'crowdin' | 'deepl' | 'amazon' | 'watson' | 'global_tm' | 'google_automl' | 'modernmt' | 'custom_mt' | 'ai'; type MatchType = 'perfect' | 'exact' | 'fuzzy'; type QaIssuesStatus = 'inProgress' | 'failed' | 'passed'; interface DeleteAllTranslationsOptions { stringId?: number; /** * for file-based projects */ fileId?: number; languageId?: string; } interface TranslationInfoOptions { denormalizePlaceholders?: BooleanInt; } interface ListLanguageTranslationsOptions extends PaginationOptions { stringIds?: string; fileId?: number; labelIds?: string; denormalizePlaceholders?: BooleanInt; croql?: string; approvedOnly?: BooleanInt; passedWorkflow?: BooleanInt; orderBy?: string; branchId?: number; minApprovalCount?: number; directoryId?: number; } interface PlainLanguageTranslation { stringId: number; contentType: string; translationId: number; text: string; user: User; createdAt: string; provider?: Provider | null; providerId?: number | null; isPreTranslated?: boolean; matchRate?: number | null; matchType?: MatchType | null; qaIssuesStatus?: QaIssuesStatus; } interface PluralLanguageTranslation { stringId: number; contentType: string; plurals: Plural[]; qaIssuesStatus?: QaIssuesStatus; } interface IcuLanguageTranslation { stringId: number; contentType: string; translationId: number; text: string; user: User; createdAt: string; qaIssuesStatus?: QaIssuesStatus; } interface Plural { translationId: number; text: string; pluralForm: string; user: User; createdAt: string; } interface TranslationAlignmentRequest { sourceLanguageId: string; targetLanguageId: string; text: string; } interface TranslationAlignmentResponse { words: { text: string; alignments: { sourceWord: string; sourceLemma: string; targetWord: string; targetLemma: string; match: number; probability: number; }[]; }[]; } interface AddStringTranslationRequest { stringId: number; languageId: string; text: string; pluralCategoryName?: PluralCategoryName; addToTm?: boolean; provider?: Exclude | null; providerId?: number; isPreTranslated?: boolean; } interface ListTranslationVotesOptions extends PaginationOptions { stringId?: number; languageId?: string; translationId?: number; fileId?: number; labelIds?: string; excludeLabelIds?: string; } interface Vote { id: number; user: User; translationId: number; votedAt: string; mark: Mark; } interface AddVoteRequest { mark: Mark; translationId: number; } interface User { id: number; username: string; fullName: string; avatarUrl: string; } type Mark = 'up' | 'down'; interface ListStringTranslationsOptions extends PaginationOptions { denormalizePlaceholders?: BooleanInt; orderBy?: string; /** * for file-based projects */ fileId?: number; } type PluralCategoryName = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other'; }