import { CrowdinApi , PatchRequest , ResponseList , ResponseObject } from '../core' ; export class StringComments extends CrowdinApi { listStringComments ( projectId , request ? ) ; param projectId param stringId param type param targetLanguageId param issueType param issueStatus listStringComments ( projectId , stringId ? , type ? , targetLanguageId ? , issueType ? , issueStatus ? ) ; listStringComments ( projectId , stringIdOrRequest ? , type ? , targetLanguageId ? , issueType ? , issueStatus ? ) { let url = `${ this . url }/projects/${ projectId }/comments` ; let request ; if ( stringIdOrRequest && typeof stringIdOrRequest === 'object' ) { request = stringIdOrRequest ; } else { request = { stringId : stringIdOrRequest , type , targetLanguageId , issueStatus , issueType } ; } url = this . addQueryParam ( url , 'stringId' , request . stringId ) ; url = this . addQueryParam ( url , 'type' , request . type ) ; url = this . addQueryParam ( url , 'targetLanguageId' , request . targetLanguageId ) ; url = this . addQueryParam ( url , 'issueType' , request . issueType ) ; url = this . addQueryParam ( url , 'issueStatus' , request . issueStatus ) ; return this . getList ( url , request . limit , request . offset ) ; } param projectId param request addStringComment ( projectId , request ) { const url = `${ this . url }/projects/${ projectId }/comments` ; return this . post ( url , request , this . defaultConfig ( ) ) ; } param projectId param stringCommentId getStringComment ( projectId , stringCommentId ) { const url = `${ this . url }/projects/${ projectId }/comments/${ stringCommentId }` ; return this . get ( url , this . defaultConfig ( ) ) ; } param projectId param stringCommentId deleteStringComment ( projectId , stringCommentId ) { const url = `${ this . url }/projects/${ projectId }/comments/${ stringCommentId }` ; return this . delete ( url , this . defaultConfig ( ) ) ; } param projectId param stringCommentId param request editStringComment ( projectId , stringCommentId , request ) { const url = `${ this . url }/projects/${ projectId }/comments/${ stringCommentId }` ; return this . patch ( url , request , this . defaultConfig ( ) ) ; } } export namespace StringCommentsModel { export interface ListStringCommentsRequest { stringId ? : number ; limit ? : number ; offset ? : number ; type ? : Type ; targetLanguageId ? : string ; issueType ? : IssueType ; issueStatus ? : IssueStatus ; } export interface StringComment { id : number ; text : string ; userId : number ; stringId : number ; user : User ; string : StringModel ; languageId : string ; type : Type ; issueType : IssueType ; issueStatus : IssueStatus ; resolverId : number ; resolver : User ; resolvedAt : string ; createdAt : string ; } export interface User { id : number ; username : string ; fullName : string ; avatarUrl : string ; } export interface StringModel { id : number ; text : string ; type : string ; hasPlurals : boolean ; isIcu : boolean ; context : string ; fileId : number ; } export interface AddStringCommentRequest { stringId : number ; text : string ; targetLanguageId : string ; type : Type ; issueType ? : IssueType ; } export enum Type { COMMENT = 'comment' , ISSUE = 'issue' } export enum IssueType { GENERAL_QUESTION = 'general_question' , TRANSLATION_MISTAKE = 'translation_mistake' , CONTEXT_REQUEST = 'context_request' , SOURCE_MISTAKE = 'source_mistake' } export enum IssueStatus { UNRESOLVED = 'unresolved' , RESOLVED = 'resolved' } }