import { BooleanInt , CrowdinApi , PatchRequest , ResponseList , ResponseObject } from '../core' ; export class SourceStrings extends CrowdinApi { listProjectStrings ( projectId , request ) ; param projectId param fileId param limit param offset param filter param denormalizePlaceholders param labelIds param scope param croql param branchId param directoryId listProjectStrings ( projectId , fileId ? , limit ? , offset ? , filter ? , denormalizePlaceholders ? , labelIds ? , scope ? , croql ? , branchId ? , directoryId ? ) ; listProjectStrings ( projectId , fileIdOrRequest ? , limit ? , offset ? , filter ? , denormalizePlaceholders ? , labelIds ? , scope ? , croql ? , branchId ? , directoryId ? ) { let url = `${ this . url }/projects/${ projectId }/strings` ; let request ; if ( fileIdOrRequest && typeof fileIdOrRequest === 'object' ) { request = fileIdOrRequest ; } else { request = { fileId : fileIdOrRequest , limit , offset , filter , denormalizePlaceholders , labelIds , scope , croql , branchId , directoryId , } ; } url = this . addQueryParam ( url , 'fileId' , request . fileId ) ; url = this . addQueryParam ( url , 'filter' , request . filter ) ; url = this . addQueryParam ( url , 'denormalizePlaceholders' , request . denormalizePlaceholders ) ; url = this . addQueryParam ( url , 'labelIds' , request . labelIds ) ; url = this . addQueryParam ( url , 'scope' , request . scope ) ; url = this . addQueryParam ( url , 'croql' , request . croql ) ; url = this . addQueryParam ( url , 'branchId' , request . branchId ) ; url = this . addQueryParam ( url , 'directoryId' , request . directoryId ) ; return this . getList ( url , request . limit , request . offset ) ; } param projectId param request addString ( projectId , request ) { const url = `${ this . url }/projects/${ projectId }/strings` ; return this . post ( url , request , this . defaultConfig ( ) ) ; } param projectId param stringId getString ( projectId , stringId ) { const url = `${ this . url }/projects/${ projectId }/strings/${ stringId }` ; return this . get ( url , this . defaultConfig ( ) ) ; } param projectId param stringId deleteString ( projectId , stringId ) { const url = `${ this . url }/projects/${ projectId }/strings/${ stringId }` ; return this . delete ( url , this . defaultConfig ( ) ) ; } param projectId param stringId param request editString ( projectId , stringId , request ) { const url = `${ this . url }/projects/${ projectId }/strings/${ stringId }` ; return this . patch ( url , request , this . defaultConfig ( ) ) ; } } export namespace SourceStringsModel { export interface ListProjectStringsRequest { fileId ? : number ; limit ? : number ; offset ? : number ; filter ? : string ; denormalizePlaceholders ? : BooleanInt ; labelIds ? : string ; scope ? : SourceStringsModel . Scope ; croql ? : string ; branchId ? : number ; directoryId ? : number ; } export interface String { id : number ; projectId : number ; fileId : number ; branchId : number ; identifier : string ; text : string | PluralText ; type : Type ; context : string ; maxLength : number ; isHidden : boolean ; revision : number ; hasPlurals : boolean ; isIcu : boolean ; labelIds : number [ ] ; createdAt : string ; updatedAt : string ; } export interface CreateStringRequest { identifier : string ; fileId ? : number ; text : string ; context ? : string ; isHidden ? : boolean ; maxLength ? : number ; labelIds ? : number [ ] ; } export interface PluralText { zero ? : string ; one ? : string ; two ? : string ; few ? : string ; many ? : string ; other ? : string ; } export enum Type { TEXT = 0 , ASSET = 1 , ICU = 2 } export enum Scope { IDENTIFIER = 'identifier' , TEXT = 'text' , CONTEXT = 'context' } }