You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
url:'http://example.com', // Defaults to http://gitlab.com
142
-
token:'abcdefghij123456'//Can be created in your profile.
142
+
token:'abcdefghij123456'//Can be created in your profile.
143
143
})
144
144
145
145
// Or, use a OAuth token instead!
@@ -160,7 +160,7 @@ import { Projects } from 'node-gitlab-api';
160
160
161
161
constservice=newProjects({
162
162
url:'http://example.com', // Defaults to http://gitlab.com
163
-
token:'abcdefghij123456'//Can be created in your profile.
163
+
token:'abcdefghij123456'//Can be created in your profile.
164
164
})
165
165
166
166
```
@@ -175,7 +175,7 @@ import { ProjectsBundle } from 'node-gitlab-api';
175
175
176
176
constservices=newProjectsBundle({
177
177
url:'http://example.com', // Defaults to http://gitlab.com
178
-
token:'abcdefghij123456'//Can be created in your profile.
178
+
token:'abcdefghij123456'//Can be created in your profile.
179
179
})
180
180
181
181
services.Projects.all()
@@ -253,6 +253,22 @@ EpicNotes
253
253
EpicDiscussions
254
254
```
255
255
256
+
### Using XMLHttpRequest
257
+
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:
258
+
259
+
```javascript
260
+
importGitlabfrom'node-gitlab-api';
261
+
262
+
constapi=newGitlab({
263
+
url:'http://example.com', // Defaults to http://gitlab.com
264
+
token:'abcdefghij123456', // Can be created in your profile.
265
+
266
+
useXMLHttpRequest:true// Use the browser's XMLHttpRequest instead of Node's Request library
267
+
})
268
+
```
269
+
270
+
**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.
271
+
256
272
### Examples
257
273
Once you have your library instantiated, you can utilize many of the API's functionality:
258
274
@@ -263,7 +279,7 @@ import Gitlab from 'node-gitlab-api';
263
279
264
280
constapi=newGitlab({
265
281
url:'http://example.com', // Defaults to http://gitlab.com
266
-
token:'abcdefghij123456'//Can be created in your profile.
282
+
token:'abcdefghij123456'//Can be created in your profile.
267
283
});
268
284
269
285
// Listing users
@@ -280,14 +296,14 @@ General rule about all the function parameters:
280
296
- If its a required parameter, it is a named argument in the functions
281
297
- If its an optional parameter, it is defined in a options object following the named arguments
282
298
283
-
ie.
299
+
ie.
284
300
285
301
```javascript
286
302
importGitlabfrom'node-gitlab-api';
287
303
288
304
constapi=newGitlab({
289
305
url:'http://example.com', // Defaults to http://gitlab.com
290
-
token:'abcdefghij123456'//Can be created in your profile.
306
+
token:'abcdefghij123456'//Can be created in your profile.
291
307
});
292
308
293
309
api.Projects.create(projectId, {
@@ -305,7 +321,7 @@ import Gitlab from 'node-gitlab-api';
305
321
306
322
constapi=newGitlab({
307
323
url:'http://example.com', // Defaults to http://gitlab.com
308
-
token:'abcdefghij123456'//Can be created in your profile.
324
+
token:'abcdefghij123456'//Can be created in your profile.
309
325
});
310
326
311
327
let projects =awaitapi.Projects.all({maxPages:2});
@@ -319,7 +335,7 @@ import Gitlab from 'node-gitlab-api';
319
335
320
336
constapi=newGitlab({
321
337
url:'http://example.com', // Defaults to http://gitlab.com
322
-
token:'abcdefghij123456'//Can be created in your profile.
338
+
token:'abcdefghij123456'//Can be created in your profile.
323
339
});
324
340
325
341
let projects =awaitapi.Projects.all({maxPages:2, perPage:40});
@@ -328,7 +344,7 @@ let projects = await api.Projects.all({maxPages:2, perPage:40});
328
344
329
345
## Docs
330
346
331
-
Although there are the official docs for the API, there are some extra goodies offered by this package! After the 3.0.0 release, the next large project will be putting together proper documention for these goodies [#39]! Stay tuned!!
347
+
Although there are the official docs for the API, there are some extra goodies offered by this package! After the 3.0.0 release, the next large project will be putting together proper documention for these goodies [#39]! Stay tuned!!
332
348
333
349
## Tests
334
350
@@ -345,7 +361,7 @@ This started off as a fork from [node-gitlab](https://github.com/node-gitlab/nod
@@ -469,7 +485,7 @@ how to run locally via npm linking for Development testing thanks to [Adam Dehne
469
485
- Updating project docs for consistency
470
486
- Adding project unsharing to API. It was in the docs, but missing from the API
471
487
- Updating deprecated protected branches endpoint. Previously this was `projects.branches.protect` now its `projects.protectedBranches.protect`
472
-
- Added Owned Runners and Runner Jobs API
488
+
- Added Owned Runners and Runner Jobs API
473
489
474
490
### Breaking Changes between 1.3.3 and 2.1.0
475
491
- The `list` functions are no longer supported and have all been renamed to `all`
@@ -487,7 +503,7 @@ how to run locally via npm linking for Development testing thanks to [Adam Dehne
487
503
- Updating pagination changes into v2.0.1
488
504
- Removed unused labels endpoint since it already exists under projects.labels
489
505
- Added a mergeRequests class for the merge_requests endpoints
490
-
- Extended the ProjectMergeRequests class for additional functionality that was missing for project merge requests such as
506
+
- Extended the ProjectMergeRequests class for additional functionality that was missing for project merge requests such as
491
507
accepting merge requests, cancelling merges when the pipeline succeeds, listing issues that will close on merge, subscribing/unsubscribing to merges, creating todos, time spent and time estimates as well as time stats.
492
508
- Fixed the notes endpoints for ProjectMergeRequests. This can now be access via projects.mergeRequests.notes.[command here]
493
509
- Added comments endpoints to the ProjectRepositoryCommits class
@@ -497,7 +513,7 @@ accepting merge requests, cancelling merges when the pipeline succeeds, listing
0 commit comments