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>>; /** * @param projectId project identifier * @param request request payload */ uploadStrings(projectId: number, request: SourceStringsModel.UploadStringsRequest): Promise>>; /** * @requiredScope project.source.string:read * @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>; /** * @requiredScope project.source.string:read * @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>; /** * @requiredScope project.source.string:write * @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>; /** * @requiredScope project.source.string:write * @param projectId project identifier * @param request request body * @param query query params * @see https://developer.crowdin.com/api/v2/#operation/api.projects.strings.batchPatch */ stringBatchOperations(projectId: number, request: PatchRequest[], query?: { updateOption?: SourceStringsModel.UpdateOption; }): Promise>; /** * @requiredScope project.source.string:read * @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>; /** * @requiredScope project.source.string:write * @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; /** * @requiredScope project.source.string:write * @param projectId project identifier * @param stringId string identifier * @param request request body * @param query query params * @see https://developer.crowdin.com/api/v2/#operation/api.projects.strings.patch */ editString(projectId: number, stringId: number, request: PatchRequest[], query?: { updateOption?: SourceStringsModel.UpdateOption; }): Promise>; /** * @requiredScope project.source.string:read * @param options optional parameters for the request * @see https://developer.crowdin.com/enterprise/api/v2/#operation/api.strings.getMany */ listStrings(options: SourceStringsModel.ListStringsOptions): Promise>; } export declare namespace SourceStringsModel { type UploadStringsType = 'auto' | 'android' | 'macosx' | 'arb' | 'csv' | 'json' | 'xliff' | 'xliff_two' | 'xlsx' | 'resx' | 'gettext' | 'i18next_json' | 'properties' | 'properties_xml' | 'properties_play' | 'yaml' | 'string_catalog' | 'nestjs_i18n' | 'stringsdict'; 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?: SpreadsheetImportOptions | StringCatalogImportOptions | OtherFilesImportOptions; updateOption?: UpdateOption; } interface SpreadsheetImportOptions { firstLineContainsHeader?: boolean; importTranslations?: boolean; scheme?: SourceFilesModel.Scheme; } interface StringCatalogImportOptions { importKeyAsSource?: boolean; importTranslations?: boolean; } interface OtherFilesImportOptions { contentSegmentation?: boolean; srxStorageId?: number; } 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 | null; identifier: string; text: string | PluralText; type: Type; context: string; maxLength: number; isHidden: boolean; isDuplicate: boolean; masterStringId: number | null; /** * @deprecated */ hasPlurals: boolean; /** * @deprecated */ isIcu: boolean; labelIds: number[]; webUrl: string; createdAt: string; updatedAt: string | null; fileId: number; directoryId: number | null; revision: number; fields: Record | null; } interface CreateStringRequest { text: string | PluralText; identifier?: string; fileId: number; context?: string; isHidden?: boolean; maxLength?: number; labelIds?: number[]; fields?: Record; } interface CreateStringStringsBasedRequest { text: string | PluralText; identifier: string; branchId: number; context?: string; isHidden?: boolean; maxLength?: number; labelIds?: number[]; fields?: Record; } 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'; interface ListStringsOptions extends PaginationOptions { filter: string; projectIds?: number[]; userId?: number; scope?: 'all' | 'text' | 'context' | 'key'; denormalizePlaceholders?: BooleanInt; } }