Skip to content

Commit

Permalink
breaking: Added content as a required parameter for RepositoryFiles
Browse files Browse the repository at this point in the history
breaking: Removed projectId from System Hooks API since it wasn't required
breaking: Removed dependency on FS. Now the Projects API takes in two arguments `projectId` and `content` as well as an option fileName argument
breaking: Changing everything to named exports for simplicity
breaking: Switching required initialization argument from 'url' to 'host'
breaking: Updated Approvals API support to match https://docs.gitlab.com/ee/api/merge_request_approvals.html
breaking: MergeRequest Pipelines require the mergeRequestId
breaking: NotificationSettings API edit function now takes one parameter, `options`
breaking: Changing the access level enum property from master to maintainer as per https://gitlab.com/gitlab-org/gitlab-ce/issues/42751
breaking: Notes now require a body argument instead of checking the options argument for a body parameter

fix: #227 (#227) Fixing array syntax thanks to Lukas Eipert (https://github.com/leipert) (f9bc34d (f9bc34d))
fix: Fixing Todos support. If todoId was not passed, an undefined value would be introduced into the url (cbeef18 (cbeef18))
fix: ResourceAwardEmojis API wasn't properly filtering based on awardId (70f4315 (70f4315))
fix: Removed xhr library in favour of ky, and switched request for got for a smaller package size and retry functionality

feat: Adding the ability to add sudo to specific requests (780244f (780244f))

chore: Adding editorconfig file
chore: Removing some overrides from the tslint
chore: Removing unused dependencies
chore: Adding prettier as a dev dependency

docs: Removing xml request docs
docs: Updating imports to be named imports
  • Loading branch information
jdalrymple committed Dec 11, 2018
1 parent 6981399 commit fe74d99
Show file tree
Hide file tree
Showing 120 changed files with 3,351 additions and 2,373 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf

# editorconfig-tools is unable to ignore longs strings or urls
max_line_length = null
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
npm-debug.log
dist
coverage
.rpt2_cache
5 changes: 5 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
printWidth: 100
singleQuote: true
trailingComma: all
tabWidth: 2
useTabs: false
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
- stage: release
node_js: 10.0.0
script:
- npm run semantic-release
- npm run release
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@

# [5.0.0-rc.1](https://github.com/jdalrymple/node-gitlab/compare/4.2.0...5.0.0) (2018-11-07)

### Breaking
* Added content as a required parameter for RepositoryFiles
* Removed projectId from System Hooks API since it wasn't required
* Removed dependency on FS. Now the Projects API takes in two arguments `projectId` and `content` as well as an option fileName argument
* Changing everything to named exports for simplicity
* Switching required initialization argument from 'url' to 'host'
* Updated Approvals API support to match https://docs.gitlab.com/ee/api/merge_request_approvals.html
* MergeRequest Pipelines require the mergeRequestId
* NotificationSettings API edit function now takes one parameter, `options`
* Changing the access level enum property from master to maintainer as per https://gitlab.com/gitlab-org/gitlab-ce/issues/42751
* Notes now require a body argument instead of checking the options argument for a body parameter

## Bug Fixes
* #227 (https://github.com/jdalrymple/node-gitlab/issues/227) Fixing array syntax thanks to Lukas Eipert (https://github.com/leipert) (f9bc34d (https://github.com/jdalrymple/node-gitlab/commit/f9bc34d))
* Fixing Todos support. If todoId was not passed, an undefined value would be introduced into the url (cbeef18 (https://github.com/jdalrymple/node-gitlab/commit/cbeef18))
* ResourceAwardEmojis API wasn't properly filtering based on awardId (70f4315 (https://github.com/jdalrymple/node-gitlab/commit/70f4315))
* Removed xhr library in favour of ky, and switched request for got for a smaller package size and retry functionality

## Features
* Adding the ability to add sudo to specific requests (780244f (https://github.com/jdalrymple/node-gitlab/commit/780244f))

## Documentation
* Removing xml request docs
* Updating imports to be named imports

## [4.2.7](https://github.com/jdalrymple/node-gitlab/compare/4.2.6...4.2.7) (2018-11-26)


Expand Down
72 changes: 33 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
[![Coverage](https://img.shields.io/codecov/c/github/jdalrymple/node-gitlab/master.svg)](https://codecov.io/gh/jdalrymple/node-gitlab)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![Code Style: Prettier](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)
[![Install Size](https://packagephobia.now.sh/badge?p=gitlab)](https://packagephobia.now.sh/result?p=gitlab)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/jdalrymple/node-gitlab/blob/master/LICENSE.md)

# node-gitlab
Expand Down Expand Up @@ -139,22 +141,22 @@ Instantiate the library using a basic token created in your [Gitlab Profile](htt

```javascript
// ES6 (>=node 8.0.0)
import Gitlab from 'gitlab';
import { Gitlab } from 'gitlab';

// ES5, assuming Promise and Object.assign are available
const Gitlab = require('gitlab/dist/es5').default
// ES5, assuming native or polyfilled Promise is available
const Gitlab = require('gitlab')


// Instantiating
const api = new Gitlab({
url: 'http://example.com', // Defaults to http://gitlab.com
host: 'http://example.com', // Defaults to http://gitlab.com
token: 'abcdefghij123456' // Can be created in your profile.
})

// Or, use a OAuth token instead!

const api = new Gitlab({
url: 'http://example.com', // Defaults to http://gitlab.com
host: 'http://example.com', // Defaults to http://gitlab.com
oauthToken: 'abcdefghij123456'
})

Expand All @@ -168,7 +170,7 @@ Sometimes you don't want to import and instantiate the whole Gitlab API, perhaps
import { Projects } from 'gitlab';

const service = new Projects({
url: 'http://example.com', // Defaults to http://gitlab.com
host: 'http://example.com', // Defaults to http://gitlab.com
token: 'abcdefghij123456' // Can be created in your profile.
})

Expand All @@ -183,7 +185,7 @@ It can be annoying to have to import all the API's pertaining to a specific reso
import { ProjectsBundle } from 'gitlab';

const services = new ProjectsBundle({
url: 'http://example.com', // Defaults to http://gitlab.com
host: 'http://example.com', // Defaults to http://gitlab.com
token: 'abcdefghij123456' // Can be created in your profile.
})

Expand Down Expand Up @@ -266,32 +268,16 @@ EpicNotes
EpicDiscussions
```

### Using XMLHttpRequest
This package uses the [Request](https://github.com/request/request) library by default, which is built into Node. However, if your code is running in a browser, you can get better built-in resolution of proxies and self-signed certificates by using the browser's XMLHttpRequest implementation instead:

```javascript
import Gitlab from 'gitlab';

const api = new Gitlab({
url: 'http://example.com', // Defaults to http://gitlab.com
token: 'abcdefghij123456', // Can be created in your profile.

useXMLHttpRequest: true // Use the browser's XMLHttpRequest instead of Node's Request library
})
```

**WARNING:** Currently this option does not support the `multipart/form-data` content type, and therefore the endpoint for [uploading a file to a project](https://docs.gitlab.com/ee/api/projects.html#upload-a-file) will not work correctly. All other endpoints should work exactly as expected.

### Examples
Once you have your library instantiated, you can utilize many of the API's functionality:

Using the await/async method

```javascript
import Gitlab from 'gitlab';
import { Gitlab } from 'gitlab';

const api = new Gitlab({
url: 'http://example.com', // Defaults to http://gitlab.com
host: 'http://example.com', // Defaults to http://gitlab.com
token: 'abcdefghij123456' // Can be created in your profile.
});

Expand All @@ -312,10 +298,10 @@ General rule about all the function parameters:
ie.

```javascript
import Gitlab from 'gitlab';
import { Gitlab } from 'gitlab';

const api = new Gitlab({
url: 'http://example.com', // Defaults to http://gitlab.com
host: 'http://example.com', // Defaults to http://gitlab.com
token: 'abcdefghij123456' // Can be created in your profile.
});

Expand All @@ -329,10 +315,10 @@ api.Projects.create(projectId, {
For any .all() function on a resource, it will return all the items from Gitlab. This can be troublesome if there are many items, as the request it self can take a while to be fulfilled. As such, a maxPages option can be passed to limit the scope of the all function.

```javascript
import Gitlab from 'gitlab';
import { Gitlab } from 'gitlab';

const api = new Gitlab({
url: 'http://example.com', // Defaults to http://gitlab.com
host: 'http://example.com', // Defaults to http://gitlab.com
token: 'abcdefghij123456' // Can be created in your profile.
});

Expand All @@ -343,10 +329,10 @@ let projects = await api.Projects.all({ maxPages:2 });
You can also use this in conjunction to the perPage argument which would override the default of 30 per page set by Gitlab:

```javascript
import Gitlab from 'gitlab';
import { Gitlab } from 'gitlab';

const api = new Gitlab({
url: 'http://example.com', // Defaults to http://gitlab.com
host: 'http://example.com', // Defaults to http://gitlab.com
token: 'abcdefghij123456' // Can be created in your profile.
});

Expand All @@ -359,7 +345,11 @@ Additionally, if you would like to get back the pagination information, to know

```javascript
...
let { data, pagination } = await api.Projects.all({ perPage:40, maxPages:2, showPagination: true });
const { data, pagination } = await api.Projects.all({
perPage:40,
maxPages:2,
showPagination: true
});
...
```

Expand Down Expand Up @@ -420,19 +410,15 @@ And then inside whatever project you are using `node-gitlab` in you change your

```json
"dependencies": {
...
"node-gitlab": "2.1.0"
...
"gitlab": "5.0.0"
}
```

to this

```json
"dependencies": {
...
"node-gitlab": "<path-to-your-clone>"
...
"gitlab": "<path-to-your-clone>"
}
```

Expand Down Expand Up @@ -499,7 +485,8 @@ This started off as a fork from [node-gitlab](https://github.com/node-gitlab/nod
- [Pavel Birukov](https://github.com/r00ger)
- [Sharma-Rajat](https://github.com/Sharma-Rajat)
- [Joseph Petersen](https://github.com/casz)
- [Igor Katsuba](https://github.com/Defenderbass)
- [Igor Katsuba](https://github.com/IKatsuba)
- [Giuseppe Angri](https://github.com/giuseppeangri)
- [Michael Townsend](https://github.com/Continuities)
- [bodtx](https://github.com/bodtx)
- [Artem](https://github.com/arthot)
Expand All @@ -509,6 +496,13 @@ This started off as a fork from [node-gitlab](https://github.com/node-gitlab/nod
- [Norm MacLennan](https://github.com/maclennann)
- [jnovick](https://github.com/jnovick)
- [Fabian Aussems](https://github.com/mozinator)
- [jennparise](https://github.com/jennparise)
- [Michael Matzka](https://github.com/mimaidms)
- [CraigAllardyce](https://github.com/CraigAllardyce)
- [Bruno Guimarães](https://github.com/brunobastosg)
- [Louis Cherel](https://github.com/Musinux)
- [Lukas Eipert](https://github.com/leipert)
- [Maximilian Krauß](https://github.com/maximilian-krauss)

## License

Expand Down
Loading

0 comments on commit fe74d99

Please sign in to comment.