@crowdin/crowdin-api-client
Advanced tools
Comparing version 1.8.5 to 1.8.6
@@ -1,2 +0,2 @@ | ||
import { CrowdinApi, ResponseList, ResponseObject, PatchRequest, DownloadLink } from '../core'; | ||
import { CrowdinApi, DownloadLink, PatchRequest, ResponseList, ResponseObject } from '../core'; | ||
export declare class SourceFiles extends CrowdinApi { | ||
@@ -60,2 +60,3 @@ /** | ||
editDirectory(projectId: number, directoryId: number, request: PatchRequest[]): Promise<ResponseObject<SourceFilesModel.Directory>>; | ||
listProjectFiles(projectId: number, request: SourceFilesModel.ListProjectFilesRequest): Promise<ResponseList<SourceFilesModel.File>>; | ||
/** | ||
@@ -68,4 +69,5 @@ * | ||
* @param offset starting offset in the collection (default 0) | ||
* @param recursion use to list files recursively | ||
*/ | ||
listProjectFiles(projectId: number, branchId?: number, directoryId?: number, limit?: number, offset?: number): Promise<ResponseList<SourceFilesModel.File>>; | ||
listProjectFiles(projectId: number, branchId?: number, directoryId?: number, limit?: number, offset?: number, recursion?: any): Promise<ResponseList<SourceFilesModel.File>>; | ||
/** | ||
@@ -159,2 +161,9 @@ * @param projectId project identifier | ||
} | ||
interface ListProjectFilesRequest { | ||
branchId?: number; | ||
directoryId?: number; | ||
limit?: number; | ||
offset?: number; | ||
recursion?: any; | ||
} | ||
interface File { | ||
@@ -161,0 +170,0 @@ id: number; |
@@ -99,16 +99,16 @@ "use strict"; | ||
} | ||
/** | ||
* | ||
* @param projectId project identifier | ||
* @param branchId list branch files (Note! You can either list files for the specified branch (branchId) in the same request) | ||
* @param directoryId list directory files (Note! You can either list files for the specified directory (directoryId) in the same request) | ||
* @param limit maximum number of items to retrieve (default 25) | ||
* @param offset starting offset in the collection (default 0) | ||
*/ | ||
listProjectFiles(projectId, branchId, directoryId, limit, offset) { | ||
listProjectFiles(projectId, branchIdOrRequest, directoryId, limit, offset, recursion) { | ||
let url = `${this.url}/projects/${projectId}/files`; | ||
url = this.addQueryParam(url, 'branchId', branchId); | ||
url = this.addQueryParam(url, 'directoryId', directoryId); | ||
url = this.addQueryParam(url, 'limit', limit); | ||
url = this.addQueryParam(url, 'offset', offset); | ||
let request; | ||
if (branchIdOrRequest && typeof branchIdOrRequest === 'object') { | ||
request = branchIdOrRequest; | ||
} | ||
else { | ||
request = { branchId: branchIdOrRequest, directoryId, limit, offset, recursion }; | ||
} | ||
url = this.addQueryParam(url, 'branchId', request.branchId); | ||
url = this.addQueryParam(url, 'directoryId', request.directoryId); | ||
url = this.addQueryParam(url, 'limit', request.limit); | ||
url = this.addQueryParam(url, 'offset', request.offset); | ||
url = this.addQueryParam(url, 'recursion', request.recursion); | ||
return this.get(url, this.defaultConfig()); | ||
@@ -115,0 +115,0 @@ } |
{ | ||
"name": "@crowdin/crowdin-api-client", | ||
"version": "1.8.5", | ||
"version": "1.8.6", | ||
"description": "JavaScript library for Crowdin API v2.", | ||
@@ -5,0 +5,0 @@ "main": "out/index.js", |
183526
4578