Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": "<path-to-your-clone>"
...
}
```
14 changes: 14 additions & 0 deletions docs/project-repository-files.md
Original file line number Diff line number Diff line change
@@ -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, filePath, branch );
```
Parameters: [Get file from repository](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/repository_files.md#get-file-from-repository)

10 changes: 5 additions & 5 deletions src/Models/ProjectRepositoryFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
}

Expand Down