import { CrowdinApi , DownloadLink , PatchRequest , ResponseList , ResponseObject , Status } from '../core' ; export class Glossaries extends CrowdinApi { param groupId param limit param offset listGlossaries ( groupId ? , limit ? , offset ? ) { let url = `${ this . url }/glossaries` ; url = this . addQueryParam ( url , 'groupId' , groupId ) ; return this . getList ( url , limit , offset ) ; } param request addGlossary ( request ) { const url = `${ this . url }/glossaries` ; return this . post ( url , request , this . defaultConfig ( ) ) ; } param glossaryId getGlossary ( glossaryId ) { const url = `${ this . url }/glossaries/${ glossaryId }` ; return this . get ( url , this . defaultConfig ( ) ) ; } param glossaryId deleteGlossary ( glossaryId ) { const url = `${ this . url }/glossaries/${ glossaryId }` ; return this . delete ( url , this . defaultConfig ( ) ) ; } param glossaryId param request editGlossary ( glossaryId , request ) { const url = `${ this . url }/glossaries/${ glossaryId }` ; return this . patch ( url , request , this . defaultConfig ( ) ) ; } param glossaryId param request exportGlossary ( glossaryId , request ) { const url = `${ this . url }/glossaries/${ glossaryId }/exports` ; return this . post ( url , request , this . defaultConfig ( ) ) ; } param glossaryId param exportId downloadGlossary ( glossaryId , exportId ) { const url = `${ this . url }/glossaries/${ glossaryId }/exports/${ exportId }/download` ; return this . get ( url , this . defaultConfig ( ) ) ; } param glossaryId param exportId checkGlossaryExportStatus ( glossaryId , exportId ) { const url = `${ this . url }/glossaries/${ glossaryId }/exports/${ exportId }` ; return this . get ( url , this . defaultConfig ( ) ) ; } param glossaryId param request importGlossaryFile ( glossaryId , request ) { const url = `${ this . url }/glossaries/${ glossaryId }/imports` ; return this . post ( url , request , this . defaultConfig ( ) ) ; } param glossaryId param importId checkGlossaryImportStatus ( glossaryId , importId ) { const url = `${ this . url }/glossaries/${ glossaryId }/imports/${ importId }` ; return this . get ( url , this . defaultConfig ( ) ) ; } listTerms ( glossaryId , request ) ; param glossaryId param userId param limit param offset param languageId param translationOfTermId listTerms ( glossaryId , userId ? , limit ? , offset ? , languageId ? , translationOfTermId ? ) ; listTerms ( glossaryId , userIdOrRequest ? , limit ? , offset ? , languageId ? , translationOfTermId ? ) { let url = `${ this . url }/glossaries/${ glossaryId }/terms` ; let request ; if ( userIdOrRequest && typeof userIdOrRequest === 'object' ) { request = userIdOrRequest ; } else { request = { userId : userIdOrRequest , limit , offset , languageId , translationOfTermId } ; } url = this . addQueryParam ( url , 'userId' , request . userId ) ; url = this . addQueryParam ( url , 'languageId' , request . languageId ) ; url = this . addQueryParam ( url , 'translationOfTermId' , request . translationOfTermId ) ; return this . getList ( url , request . limit , request . offset ) ; } param glossaryId param request addTerm ( glossaryId , request ) { const url = `${ this . url }/glossaries/${ glossaryId }/terms` ; return this . post ( url , request , this . defaultConfig ( ) ) ; } param glossaryId param languageId param translationOfTermId clearGlossary ( glossaryId , languageId ? , translationOfTermId ? ) { let url = `${ this . url }/glossaries/${ glossaryId }/terms` ; url = this . addQueryParam ( url , 'languageId' , languageId ) ; url = this . addQueryParam ( url , 'translationOfTermId' , translationOfTermId ) ; return this . delete ( url , this . defaultConfig ( ) ) ; } param glossaryId param termId getTerm ( glossaryId , termId ) { const url = `${ this . url }/glossaries/${ glossaryId }/terms/${ termId }` ; return this . get ( url , this . defaultConfig ( ) ) ; } param glossaryId param termId deleteTerm ( glossaryId , termId ) { const url = `${ this . url }/glossaries/${ glossaryId }/terms/${ termId }` ; return this . delete ( url , this . defaultConfig ( ) ) ; } param glossaryId param termId param request editTerm ( glossaryId , termId , request ) { const url = `${ this . url }/glossaries/${ glossaryId }/terms/${ termId }` ; return this . patch ( url , request , this . defaultConfig ( ) ) ; } } export namespace GlossariesModel { export interface Glossary { id : number ; name : string ; groupId : number ; userId : number ; terms : number ; languageIds : string [ ] ; projectIds : number [ ] ; createdAt : string ; } export interface CreateGlossaryRequest { name : string ; groupId ? : number ; } export interface ExportGlossaryRequest { format : GlossaryFormat ; } export interface GlossaryExportStatusAttribute { format : string ; } export interface GlossaryImportStatusAttribute { storageId : number ; scheme : any ; firstLineContainsHeader : boolean ; } export interface GlossaryFile { storageId : number ; scheme ? : GlossaryFileScheme ; firstLineContainsHeader ? : boolean ; } export interface ListTermsRequest { userId ? : number ; limit ? : number ; offset ? : number ; languageId ? : string ; translationOfTermId ? : number ; } export interface Term { id : number ; userId : number ; glossaryId : number ; languageId : string ; text : string ; description : string ; partOfSpeech : string ; lemma : string ; createdAt : string ; updatedAt : string ; } export interface CreateTermRequest { languageId : string ; text : string ; description ? : string ; partOfSpeech ? : PartOfSpeech ; translationOfTermId ? : number ; } export enum GlossaryFormat { TBX = 'tbx' , CSV = 'csv' , XLSX = 'xlsx' } export interface GlossaryFileScheme { [ key ] : number ; } export enum PartOfSpeech { ADJECTIVE = 'adjective' , ADPOSITION = 'adposition' , ADVERB = 'adverb' , AUXILIARY = 'auxiliary' , COORDINATING_CONJUNCTION = 'coordinating conjunction' , DETERMINER = 'determiner' , INTERJECTION = 'interjection' , NOUN = 'noun' , NUMERAL = 'numeral' , PARTICLE = 'particle' , PRONOUN = 'pronoun' , PROPER_NOUN = 'proper noun' , SUBORDINATING_CONJUNCTION = 'subordinating conjunction' , VERB = 'verb' , OTHER = 'other' } }