UNPKG

@crowdin/crowdin-api-client

Version:
176 lines (175 loc) 7.08 kB
import { BooleanInt, CrowdinApi, PaginationOptions, PatchRequest, ResponseList, ResponseObject, Status } from '../core'; import { SourceFilesModel } from '../sourceFiles'; /** * 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. */ export declare class SourceStrings extends CrowdinApi { /** * @param projectId project identifier * @param uploadId export identifier */ uploadStringsStatus(projectId: number, uploadId: string): Promise<ResponseObject<Status<SourceStringsModel.UploadStringsStatus>>>; /** * @param projectId project identifier * @param request request payload */ uploadStrings(projectId: number, request: SourceStringsModel.UploadStringsRequest): Promise<ResponseObject<Status<SourceStringsModel.UploadStringsStatus>>>; /** * @param projectId project identifier * @param options optional parameters for the request * @see https://developer.crowdin.com/api/v2/#operation/api.projects.strings.getMany */ listProjectStrings(projectId: number, options?: SourceStringsModel.ListProjectStringsOptions): Promise<ResponseList<SourceStringsModel.String>>; /** * @param projectId project identifier * @param fileId file identifier * @param limit maximum number of items to retrieve (default 25) * @param offset starting offset in the collection (default 0) * @param filter filter strings by text and context * @param denormalizePlaceholders enable denormalize placeholders * @param labelIds filter strings by labelIds * @param scope specify field to be the target of filtering * @param croql filter strings by CroQL (Can't be used with `labelIds`, `filter` or `scope` in same request) * @param branchId filter by branch identifier * @param directoryId filter by directory identifier * @deprecated optional parameters should be passed through an object * @see https://developer.crowdin.com/api/v2/#operation/api.projects.strings.getMany */ listProjectStrings(projectId: number, fileId?: number, limit?: number, offset?: number, filter?: string, denormalizePlaceholders?: BooleanInt, labelIds?: string, scope?: SourceStringsModel.Scope, croql?: string, branchId?: number, directoryId?: number): Promise<ResponseList<SourceStringsModel.String>>; /** * @param projectId project identifier * @param request request body * @see https://developer.crowdin.com/api/v2/#operation/api.projects.strings.post */ addString(projectId: number, request: SourceStringsModel.CreateStringRequest | SourceStringsModel.CreateStringStringsBasedRequest): Promise<ResponseObject<SourceStringsModel.String>>; /** * @param projectId project identifier * @param request request body * @see https://developer.crowdin.com/api/v2/#operation/api.projects.strings.batchPatch */ stringBatchOperations(projectId: number, request: PatchRequest[]): Promise<ResponseList<SourceStringsModel.String>>; /** * @param projectId project identifier * @param stringId string identifier * @param query query params * @see https://developer.crowdin.com/api/v2/#operation/api.projects.strings.get */ getString(projectId: number, stringId: number, query?: { denormalizePlaceholders: BooleanInt; }): Promise<ResponseObject<SourceStringsModel.String>>; /** * @param projectId project identifier * @param stringId string identifier * @see https://developer.crowdin.com/api/v2/#operation/api.projects.strings.delete */ deleteString(projectId: number, stringId: number): Promise<void>; /** * @param projectId project identifier * @param stringId string identifier * @param request request body * @see https://developer.crowdin.com/api/v2/#operation/api.projects.strings.patch */ editString(projectId: number, stringId: number, request: PatchRequest[]): Promise<ResponseObject<SourceStringsModel.String>>; } export declare namespace SourceStringsModel { type UploadStringsType = 'auto' | 'android' | 'macosx' | 'arb' | 'csv' | 'json' | 'xliff' | 'xliff_two' | 'xlsx'; interface UploadStringsStatus { branchId: number; storageId: number; fileType: UploadStringsType; parserVersion: number; labelIds: number[]; importOptions: { firstLineContainsHeader: boolean; importTranslations: boolean; scheme: SourceFilesModel.Scheme; }; updateStrings: boolean; cleanupMode: boolean; updateOption: UpdateOption; } interface UploadStringsRequest { branchId: number; storageId: number; type?: UploadStringsType; parserVersion?: number; labelIds?: number[]; updateStrings?: boolean; cleanupMode?: boolean; importOptions?: { firstLineContainsHeader: boolean; importTranslations: boolean; scheme: SourceFilesModel.Scheme; }; updateOption?: UpdateOption; } interface ListProjectStringsOptions extends PaginationOptions { orderBy?: string; denormalizePlaceholders?: BooleanInt; labelIds?: string; fileId?: number; branchId?: number; directoryId?: number; taskId?: number; croql?: string; filter?: string; scope?: SourceStringsModel.Scope; } interface String { id: number; projectId: number; branchId: number; identifier: string; text: string | PluralText; type: Type; context: string; maxLength: number; isHidden: boolean; isDuplicate: boolean; masterStringId: boolean; hasPlurals: boolean; isIcu: boolean; labelIds: number[]; webUrl: string; createdAt: string; updatedAt: string; fileId: number; directoryId: number; revision: number; } interface CreateStringRequest { text: string | PluralText; identifier?: string; fileId: number; context?: string; isHidden?: boolean; maxLength?: number; labelIds?: number[]; } interface CreateStringStringsBasedRequest { text: string | PluralText; identifier: string; branchId: number; context?: string; isHidden?: boolean; maxLength?: number; labelIds?: number[]; } interface PluralText { zero?: string; one?: string; two?: string; few?: string; many?: string; other?: string; } enum Type { TEXT = 0, ASSET = 1, ICU = 2 } type Scope = 'identifier' | 'text' | 'context'; type UpdateOption = 'clear_translations_and_approvals' | 'keep_translations' | 'keep_translations_and_approvals'; }