import { BooleanInt , CrowdinApi , ResponseList , ResponseObject } from '../core' ; export class StringTranslations extends CrowdinApi { param projectId param stringId param languageId param translationId param limit param offset param fileId listTranslationApprovals ( projectId , stringId ? , languageId ? , translationId ? , limit ? , offset ? , fileId ? ) ; listTranslationApprovals ( projectId , stringIdOrRequest ? , languageId ? , translationId ? , limit ? , offset ? , fileId ? ) { let url = `${ this . url }/projects/${ projectId }/approvals` ; let request ; if ( stringIdOrRequest && typeof stringIdOrRequest === 'object' ) { request = stringIdOrRequest ; } else { request = { stringId : stringIdOrRequest , languageId , translationId , limit , offset , fileId } ; } url = this . addQueryParam ( url , 'stringId' , request . stringId ) ; url = this . addQueryParam ( url , 'languageId' , request . languageId ) ; url = this . addQueryParam ( url , 'translationId' , request . translationId ) ; url = this . addQueryParam ( url , 'fileId' , request . fileId ) ; return this . getList ( url , request . limit , request . offset ) ; } param projectId param request addApproval ( projectId , request ) { const url = `${ this . url }/projects/${ projectId }/approvals` ; return this . post ( url , request , this . defaultConfig ( ) ) ; } param projectId param approvalId approvalInfo ( projectId , approvalId ) { const url = `${ this . url }/projects/${ projectId }/approvals/${ approvalId }` ; return this . get ( url , this . defaultConfig ( ) ) ; } param projectId param approvalId removeApproval ( projectId , approvalId ) { const url = `${ this . url }/projects/${ projectId }/approvals/${ approvalId }` ; return this . delete ( url , this . defaultConfig ( ) ) ; } param projectId param languageId param stringIds param fileId param limit param offset param labelIds param denormalizePlaceholders param croql listLanguageTranslations ( projectId , languageId , stringIds ? , fileId ? , limit ? , offset ? , labelIds ? , denormalizePlaceholders ? , croql ? ) ; listLanguageTranslations ( projectId , languageId , stringIdsOrRequest ? , fileId ? , limit ? , offset ? , labelIds ? , denormalizePlaceholders ? , croql ? ) { let url = `${ this . url }/projects/${ projectId }/languages/${ languageId }/translations` ; let request ; if ( stringIdsOrRequest && typeof stringIdsOrRequest === 'object' ) { request = stringIdsOrRequest ; } else { request = { stringIds : stringIdsOrRequest , fileId , limit , offset , labelIds , denormalizePlaceholders , croql , } ; } url = this . addQueryParam ( url , 'stringIds' , request . stringIds ) ; url = this . addQueryParam ( url , 'fileId' , request . fileId ) ; url = this . addQueryParam ( url , 'labelIds' , request . labelIds ) ; url = this . addQueryParam ( url , 'denormalizePlaceholders' , request . denormalizePlaceholders ) ; url = this . addQueryParam ( url , 'croql' , request . croql ) ; return this . getList ( url , request . limit , request . offset ) ; } param projectId param stringId param languageId param limit param offset param denormalizePlaceholders listStringTranslations ( projectId , stringId , languageId , limit ? , offset ? , denormalizePlaceholders ? ) { let url = `${ this . url }/projects/${ projectId }/translations` ; url = this . addQueryParam ( url , 'stringId' , stringId ) ; url = this . addQueryParam ( url , 'languageId' , languageId ) ; url = this . addQueryParam ( url , 'denormalizePlaceholders' , denormalizePlaceholders ) ; return this . getList ( url , limit , offset ) ; } param projectId param request addTranslation ( projectId , request ) { const url = `${ this . url }/projects/${ projectId }/translations` ; return this . post ( url , request , this . defaultConfig ( ) ) ; } param projectId param stringId param languageId deleteAllTranslations ( projectId , stringId , languageId ) { let url = `${ this . url }/projects/${ projectId }/translations` ; url = this . addQueryParam ( url , 'stringId' , stringId ) ; url = this . addQueryParam ( url , 'languageId' , languageId ) ; return this . delete ( url , this . defaultConfig ( ) ) ; } param projectId param translationId translationInfo ( projectId , translationId ) { const url = `${ this . url }/projects/${ projectId }/translations/${ translationId }` ; return this . get ( url , this . defaultConfig ( ) ) ; } param projectId param translation deleteTranslation ( projectId , translationId ) { const url = `${ this . url }/projects/${ projectId }/translations/${ translationId }` ; return this . delete ( url , this . defaultConfig ( ) ) ; } param projectId param translation restoreTranslation ( projectId , translationId ) { const url = `${ this . url }/projects/${ projectId }/translations/${ translationId }/restore` ; return this . put ( url , { } , this . defaultConfig ( ) ) ; } param projectId param stringId param languageId param translationId param limit param offset listTranslationVotes ( projectId , stringId ? , languageId ? , translationId ? , limit ? , offset ? ) ; listTranslationVotes ( projectId , stringIdOrRequest ? , languageId ? , translationId ? , limit ? , offset ? ) { let url = `${ this . url }/projects/${ projectId }/votes` ; let request ; if ( stringIdOrRequest && typeof stringIdOrRequest === 'object' ) { request = stringIdOrRequest ; } else { request = { stringId : stringIdOrRequest , languageId , translationId , limit , offset } ; } url = this . addQueryParam ( url , 'stringId' , request . stringId ) ; url = this . addQueryParam ( url , 'languageId' , request . languageId ) ; url = this . addQueryParam ( url , 'translationId' , request . translationId ) ; return this . getList ( url , request . limit , request . offset ) ; } param projectId param request addVote ( projectId , request ) { const url = `${ this . url }/projects/${ projectId }/votes` ; return this . post ( url , request , this . defaultConfig ( ) ) ; } param projectId param voteId voteInfo ( projectId , voteId ) { const url = `${ this . url }/projects/${ projectId }/votes/${ voteId }` ; return this . get ( url , this . defaultConfig ( ) ) ; } param projectId param voteId cancelVote ( projectId , voteId ) { const url = `${ this . url }/projects/${ projectId }/votes/${ voteId }` ; return this . delete ( url , this . defaultConfig ( ) ) ; } } export namespace StringTranslationsModel { export interface ListTranslationApprovalsRequest { stringId ? : number ; languageId ? : string ; translationId ? : number ; limit ? : number ; offset ? : number ; fileId ? : number ; } export interface Approval { id : number ; user : User ; translationId : number ; stringId : number ; languageId : string ; workflowStepId : number ; createdAt : string ; } export interface AddApprovalRequest { translationId : number ; } export interface StringTranslation { id : number ; text : string ; pluralCategoryName : string ; user : User ; rating : number ; createdAt : string ; } export interface ListLanguageTranslationsRequest { stringIds ? : string ; fileId ? : number ; limit ? : number ; offset ? : number ; labelIds ? : string ; denormalizePlaceholders ? : BooleanInt ; croql ? : string ; } export interface PlainLanguageTranslation { stringId : number ; contentType : string ; translationId : number ; text : string ; user : User ; createdAt : string ; } export interface PluralLanguageTranslation { stringId : number ; contentType : string ; plurals : Plural [ ] ; } export interface IcuLanguageTranslation { stringId : number ; contentType : string ; translationId : number ; text : string ; user : User ; createdAt : string ; } export interface Plural { translationId : number ; text : string ; pluralForm : string ; user : User ; createdAt : string ; } export interface AddStringTranslationRequest { stringId : number ; languageId : string ; text : string ; pluralCategoryName ? : string ; } export interface ListTranslationVotesRequest { stringId ? : number ; languageId ? : string ; translationId ? : number ; limit ? : number ; offset ? : number ; } export interface Vote { id : number ; user : User ; translationId : number ; votedAt : string ; mark : Mark ; } export interface AddVoteRequest { mark : Mark ; translationId : number ; } export interface User { id : number ; username : string ; fullName : string ; avatarUrl : string ; } export enum Mark { UP = 'up' , DOWN = 'down' } }