UNPKG

@crowdin/crowdin-api-client

Version:
117 lines (116 loc) 4.79 kB
import { CrowdinApi, PaginationOptions, PatchRequest, ResponseList, ResponseObject } from '../core'; /** * Use API to list, add, get, edit or delete string comments. */ export declare class StringComments extends CrowdinApi { /** * @param projectId project identifier * @param options optional parameters for the requesr * @see https://developer.crowdin.com/api/v2/#operation/api.projects.comments.getMany */ listStringComments(projectId: number, options?: StringCommentsModel.ListStringCommentsOptions): Promise<ResponseList<StringCommentsModel.StringComment>>; /** * @param projectId project identifier * @param stringId string identifier * @param type defines string comment type * @param targetLanguageId defines target language id. It can be one target language id or a list of comma-separated ones * @param issueType defines issue type. It can be one issue type or a list of comma-separated ones * @param issueStatus defines issue resolution status * @deprecated optional parameters should be passed through an object * @see https://developer.crowdin.com/api/v2/#operation/api.projects.comments.getMany */ listStringComments(projectId: number, stringId?: number, type?: StringCommentsModel.Type, targetLanguageId?: string, issueType?: StringCommentsModel.IssueType, issueStatus?: StringCommentsModel.IssueStatus): Promise<ResponseList<StringCommentsModel.StringComment>>; /** * @param projectId project identifier * @param request request body * @see https://developer.crowdin.com/api/v2/#operation/api.projects.comments.post */ addStringComment(projectId: number, request: StringCommentsModel.AddStringCommentRequest): Promise<ResponseObject<StringCommentsModel.StringComment>>; /** * @param projectId project identifier * @param stringCommentId string comment identifier * @see https://developer.crowdin.com/api/v2/#operation/api.projects.comments.get */ getStringComment(projectId: number, stringCommentId: number): Promise<ResponseObject<StringCommentsModel.StringComment>>; /** * @param projectId project identifier * @param stringCommentId string comment identifier * @see https://developer.crowdin.com/api/v2/#operation/api.projects.comments.delete */ deleteStringComment(projectId: number, stringCommentId: number): Promise<void>; /** * @param projectId project identifier * @param stringCommentId string comment identifier * @param request request body * @see https://developer.crowdin.com/api/v2/#operation/api.projects.comments.patch */ editStringComment(projectId: number, stringCommentId: number, request: PatchRequest[]): Promise<ResponseObject<StringCommentsModel.StringComment>>; /** * @param projectId project identifier * @param request request body * @see https://developer.crowdin.com/api/v2/#operation/api.projects.comments.batchPatch */ stringCommentBatchOperations(projectId: number, request: PatchRequest[]): Promise<ResponseList<StringCommentsModel.StringComment>>; } export declare namespace StringCommentsModel { interface ListStringCommentsOptions extends PaginationOptions { stringId?: number; type?: Type; targetLanguageId?: string; issueType?: IssueType; issueStatus?: IssueStatus; orderBy?: string; } interface StringComment { id: number; isShared?: boolean; text: string; userId: number; stringId: number; user: User; string: StringModel; projectId: number; languageId: string; type: Type; issueType: IssueType; issueStatus: IssueStatus; resolverId: number; senderOrganization: { id: number; domain: string; }; resolverOrganization: { id: number; domain: string; }; resolver: User; resolvedAt: string; createdAt: string; } interface User { id: number; username: string; fullName: string; avatarUrl: string; } interface StringModel { id: number; text: string; type: string; hasPlurals: boolean; isIcu: boolean; context: string; fileId: number; } interface AddStringCommentRequest { stringId: number; text: string; targetLanguageId: string; type: Type; isShared?: boolean; issueType?: IssueType; } type Type = 'comment' | 'issue'; type IssueType = 'general_question' | 'translation_mistake' | 'context_request' | 'source_mistake'; type IssueStatus = 'unresolved' | 'resolved'; }