From bc5f286af8f675bc01ad206f110f46d876e22159 Mon Sep 17 00:00:00 2001 From: dehnel Date: Tue, 9 Jan 2018 21:10:19 -0600 Subject: [PATCH 1/4] Added project-repository-files docs page --- docs/project-repository-files.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 docs/project-repository-files.md diff --git a/docs/project-repository-files.md b/docs/project-repository-files.md new file mode 100644 index 000000000..cff8ce502 --- /dev/null +++ b/docs/project-repository-files.md @@ -0,0 +1,14 @@ +## Project Repository Files + +* [Get a file](#get-a-file) + +### Get a file + +Get file from repository + +```javascript +// From a project ID +let file = GitlabAPI.projects.repository.files.show(projectId, encodeURIComponent( filePath ), branch ); +``` +Parameters: [Get file from repository](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/repository_files.md#get-file-from-repository) + From 2b2be721e0f2e1a1bd74092e00e60c8c26d52686 Mon Sep 17 00:00:00 2001 From: dehnel Date: Wed, 10 Jan 2018 08:42:34 -0600 Subject: [PATCH 2/4] adjusted repository files to use the parse util for filepath values --- src/Models/ProjectRepositoryFiles.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Models/ProjectRepositoryFiles.js b/src/Models/ProjectRepositoryFiles.js index ac79903fc..ed1203dcb 100644 --- a/src/Models/ProjectRepositoryFiles.js +++ b/src/Models/ProjectRepositoryFiles.js @@ -5,31 +5,31 @@ class ProjectRepositoryFiles extends BaseModel { create(projectId, filePath, branch, options = {}) { const pId = parse(projectId); - return this.post(`projects/${pId}/repository/files/${filePath}`, Object.assign({ branch }, options)); + return this.post(`projects/${pId}/repository/files/${parse(filePath)}`, Object.assign({ branch }, options)); } edit(projectId, filePath, branch, options = {}) { const pId = parse(projectId); - return this.put(`projects/${pId}/repository/files/${filePath}`, Object.assign({ branch }, options)); + return this.put(`projects/${pId}/repository/files/${parse(filePath)}`, Object.assign({ branch }, options)); } remove(projectId, filePath, branch, options = {}) { const pId = parse(projectId); - return this.delete(`projects/${pId}/repository/files/${filePath}`, Object.assign({ branch }, options)); + return this.delete(`projects/${pId}/repository/files/${parse(filePath)}`, Object.assign({ branch }, options)); } show(projectId, filePath, ref) { const pId = parse(projectId); - return this.get(`projects/${pId}/repository/files/${filePath}`, { ref }); + return this.get(`projects/${pId}/repository/files/${parse(filePath)}`, { ref }); } showRaw(projectId, filePath, ref) { const pId = parse(projectId); - return this.get(`projects/${pId}/repository/files/${filePath}/raw`, { ref }); + return this.get(`projects/${pId}/repository/files/${parse(filePath)}/raw`, { ref }); } } From db6198ccc49b6414a04317fc3e2f562c2e6ec50d Mon Sep 17 00:00:00 2001 From: dehnel Date: Wed, 10 Jan 2018 08:42:59 -0600 Subject: [PATCH 3/4] Added Development section to the readme --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index e57418c6e..816459862 100644 --- a/README.md +++ b/README.md @@ -312,3 +312,33 @@ inferred from the file path - Initial release - TODO: Tests, Examples +## Development + +To get this running locally rather than from your `node_modules` folder: + +```bash +$ git clone https://github.com/jdalrymple/node-gitlab-api.git +$ cd node-gitlab-api +$ npm install +$ npm build +``` + +And then inside whatever project you are using `node-gitlab-api` in you change your references to use that repo. In your package.json of that upstream project change: + +```json + "dependencies": { + ... + "node-gitlab-api": "2.1.0" + ... + } +``` + +to this + +```json + "dependencies": { + ... + "node-gitlab-api": "" + ... + } +``` \ No newline at end of file From 6893bdb4c58e2f02088e361ab9e0be8aab7bf1a0 Mon Sep 17 00:00:00 2001 From: dehnel Date: Wed, 10 Jan 2018 08:43:36 -0600 Subject: [PATCH 4/4] removed encodeURIComponent from project repository files docs --- docs/project-repository-files.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/project-repository-files.md b/docs/project-repository-files.md index cff8ce502..6ca8d5ebb 100644 --- a/docs/project-repository-files.md +++ b/docs/project-repository-files.md @@ -8,7 +8,7 @@ Get file from repository ```javascript // From a project ID -let file = GitlabAPI.projects.repository.files.show(projectId, encodeURIComponent( filePath ), branch ); +let file = GitlabAPI.projects.repository.files.show(projectId, filePath, branch ); ``` Parameters: [Get file from repository](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/repository_files.md#get-file-from-repository)