@gitbeaker/rest 43.2.0 → 43.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -21
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
|
|
68
68
|
## Features
|
|
69
69
|
|
|
70
|
-
- **Complete** - All features of
|
|
70
|
+
- **Complete** - All features of GitLab's exposed APIs are covered up to version [16.5](https://docs.gitlab.com/16.5/ee/api/api_resources.html). See [here](./packages/core/README.md#supported-apis) for the full list.
|
|
71
71
|
- **Universal** - Works in all modern browsers, [Node.js](https://nodejs.org/), and [Deno](https://deno.land/).
|
|
72
72
|
- **Tested** - All libraries have > 80% test coverage.
|
|
73
73
|
- **Typed** - All libraries have extensive TypeScript declarations.
|
|
@@ -114,7 +114,7 @@ import { Gitlab } from '@gitbeaker/rest';
|
|
|
114
114
|
|
|
115
115
|
## API Client
|
|
116
116
|
|
|
117
|
-
Instantiate the library using a basic token created in your [
|
|
117
|
+
Instantiate the library using a basic token created in your [GitLab Profile](https://docs.gitlab.com/ce/user/profile/personal_access_tokens.html)
|
|
118
118
|
|
|
119
119
|
```javascript
|
|
120
120
|
const api = new Gitlab({
|
|
@@ -124,20 +124,21 @@ const api = new Gitlab({
|
|
|
124
124
|
|
|
125
125
|
Available instantiating options:
|
|
126
126
|
|
|
127
|
-
| Name | Optional | Default | Description
|
|
128
|
-
| -------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
129
|
-
| `host` | Yes | `https://gitlab.com` | Gitlab Instance Host URL
|
|
130
|
-
| `token` | Yes\* | N/A | Personal Token. Recommended (one of the three tokens are recommended)
|
|
131
|
-
| `oauthToken` | Yes\* | N/A | OAuth Token. Recommended (one of the three tokens are recommended)
|
|
132
|
-
| `jobToken` | Yes\* | N/A | CI Job Token. Recommended (one of the three tokens are recommended)
|
|
133
|
-
| `rejectUnauthorized` | Yes | `true` | Http Certificate setting, Only applies to non-browser releases and HTTPS hosts urls
|
|
134
|
-
| `sudo` | Yes | `false` | [Sudo](https://docs.gitlab.com/
|
|
135
|
-
| `camelize` | Yes | `false` | Camelizes all response body keys
|
|
136
|
-
| `requesterFn` | No | @gitbeaker/rest & @gitbeaker/cli : fetch-based, The @gitbeaker/core package **does not** have a default and thus must be set explicitly | Request Library Wrapper
|
|
137
|
-
| `queryTimeout` | Yes | `300000` | Query Timeout in ms
|
|
138
|
-
| `profileToken` | Yes | N/A | [Requests Profiles Token](https://docs.gitlab.com/
|
|
139
|
-
| `profileMode` | Yes | `execution` | [Requests Profiles Token](https://docs.gitlab.com/
|
|
140
|
-
| `rateLimits` | No | [DEFAULT_RATE_LIMITS](#rate-limits) | Global and endpoint specific adjustable rate limits
|
|
127
|
+
| Name | Optional | Default | Description |
|
|
128
|
+
| -------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
129
|
+
| `host` | Yes | `https://gitlab.com` | Gitlab Instance Host URL |
|
|
130
|
+
| `token` | Yes\* | N/A | Personal Token. Recommended (one of the three tokens are recommended) |
|
|
131
|
+
| `oauthToken` | Yes\* | N/A | OAuth Token. Recommended (one of the three tokens are recommended) |
|
|
132
|
+
| `jobToken` | Yes\* | N/A | CI Job Token. Recommended (one of the three tokens are recommended) |
|
|
133
|
+
| `rejectUnauthorized` | Yes | `true` | Http Certificate setting, Only applies to non-browser releases and HTTPS hosts urls |
|
|
134
|
+
| `sudo` | Yes | `false` | [Sudo](https://docs.gitlab.com/api/#sudo) query parameter |
|
|
135
|
+
| `camelize` | Yes | `false` | Camelizes all response body keys |
|
|
136
|
+
| `requesterFn` | No | @gitbeaker/rest & @gitbeaker/cli : fetch-based, The @gitbeaker/core package **does not** have a default and thus must be set explicitly | Request Library Wrapper |
|
|
137
|
+
| `queryTimeout` | Yes | `300000` | Query Timeout in ms |
|
|
138
|
+
| `profileToken` | Yes | N/A | [Requests Profiles Token](https://docs.gitlab.com/administration/monitoring/performance/request_profiling.html) |
|
|
139
|
+
| `profileMode` | Yes | `execution` | [Requests Profiles Token](https://docs.gitlab.com/administration/monitoring/performance/request_profiling.html) |
|
|
140
|
+
| `rateLimits` | No | [DEFAULT_RATE_LIMITS](#rate-limits) | Global and endpoint specific adjustable rate limits |
|
|
141
|
+
| `rateLimitDuration` | No | `60` | Timeout duration when rate limit is reached |
|
|
141
142
|
|
|
142
143
|
> \*One of these options should be supplied, as most API requests require authentication.
|
|
143
144
|
|
|
@@ -184,7 +185,7 @@ Available pagination options:
|
|
|
184
185
|
|
|
185
186
|
#### Offset Pagination
|
|
186
187
|
|
|
187
|
-
For any .all() function on a resource, it will return **all** the items from
|
|
188
|
+
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 itself can take a while to be fulfilled. As such, a maxPages option can be passed to limit the scope of the all function.
|
|
188
189
|
|
|
189
190
|
```javascript
|
|
190
191
|
import { Gitlab } from '@gitbeaker/rest';
|
|
@@ -236,11 +237,11 @@ paginationInfo: {
|
|
|
236
237
|
}
|
|
237
238
|
```
|
|
238
239
|
|
|
239
|
-
> Note: Supplying any pagination restrictions is call intensive. Some resources will require many requests which can put a significant load on the
|
|
240
|
+
> Note: Supplying any pagination restrictions is call intensive. Some resources will require many requests which can put a significant load on the GitLab Server. The general best practice would be setting the page request option to only return the first page if all results are not required.
|
|
240
241
|
|
|
241
242
|
#### Keyset Pagination
|
|
242
243
|
|
|
243
|
-
Similarly, support for [Keyset pagination](https://docs.gitlab.com/
|
|
244
|
+
Similarly, support for [Keyset pagination](https://docs.gitlab.com/api/#keyset-based-pagination) can be toggled on by passing a pagination parameter as a query option
|
|
244
245
|
|
|
245
246
|
```js
|
|
246
247
|
const { data } = await api.Projects.all({
|
|
@@ -252,7 +253,7 @@ const { data } = await api.Projects.all({
|
|
|
252
253
|
|
|
253
254
|
### Rate Limits
|
|
254
255
|
|
|
255
|
-
Rate limits are completely customizable, and are used to limit the request rate between consecutive API requests within the library. By default, all non-specified endpoints use a 3000 rps rate limit, while some endpoints have much smaller rates as dictated by the [
|
|
256
|
+
Rate limits are completely customizable, and are used to limit the request rate between consecutive API requests within the library. By default, all non-specified endpoints use a 3000 rps rate limit, while some endpoints have much smaller rates as dictated by the [GitLab Docs](https://docs.gitlab.com/security/rate_limits.html). See below for the default values:
|
|
256
257
|
|
|
257
258
|
```js
|
|
258
259
|
const DEFAULT_RATE_LIMITS = Object.freeze({
|
|
@@ -302,6 +303,8 @@ Rate limits can be overridden when instantiating a API wrapper. For ease of use,
|
|
|
302
303
|
1. The glob for the endpoint with the corresponding rate per second
|
|
303
304
|
2. The glob for the endpoint, with an object specifying the specific method for the endpoint and the corresponding rate limit
|
|
304
305
|
|
|
306
|
+
You can also override the `rateLimitDuration` default value of 60 seconds. This is how long a specific endpoint will be timed out for when its rate limit is reached.
|
|
307
|
+
|
|
305
308
|
```js
|
|
306
309
|
const api = new Gitlab({
|
|
307
310
|
token: 'token',
|
|
@@ -313,6 +316,7 @@ const api = new Gitlab({
|
|
|
313
316
|
limit: 300,
|
|
314
317
|
},
|
|
315
318
|
},
|
|
319
|
+
rateLimitDuration: 30,
|
|
316
320
|
});
|
|
317
321
|
```
|
|
318
322
|
|
|
@@ -379,7 +383,7 @@ const projectsAPI = new Projects({
|
|
|
379
383
|
});
|
|
380
384
|
|
|
381
385
|
projectsAPI.create({
|
|
382
|
-
//options defined in the
|
|
386
|
+
//options defined in the GitLab API documentation
|
|
383
387
|
});
|
|
384
388
|
```
|
|
385
389
|
|
|
@@ -515,6 +519,7 @@ projectsAPI.create({
|
|
|
515
519
|
<td align="center" valign="top" width="0.33%"><a href="https://note.itswhat.me/"><img src="https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/38807139?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="Bryan Lee"/></td>
|
|
516
520
|
<td align="center" valign="top" width="0.33%"><a href="https://github.com/zk-kb4"><img src="https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/42388953?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="Zack"/></td>
|
|
517
521
|
<td align="center" valign="top" width="0.33%"><a href="https://github.com/kayw-geek"><img src="https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/29700073?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="Kay W."/></td>
|
|
522
|
+
<td align="center" valign="top" width="0.33%"><a href="https://ffflorian.dev/"><img src="https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/5497598?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="Florian Imdahl"/></td>
|
|
518
523
|
</tr>
|
|
519
524
|
</p>
|
|
520
525
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitbeaker/rest",
|
|
3
|
-
"version": "43.
|
|
3
|
+
"version": "43.4.0",
|
|
4
4
|
"description": "Cross Platform implementation of the GitLab API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -54,14 +54,14 @@
|
|
|
54
54
|
"lint:fix": "yarn lint --fix"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@gitbeaker/core": "^43.
|
|
58
|
-
"@gitbeaker/requester-utils": "^43.
|
|
57
|
+
"@gitbeaker/core": "^43.4.0",
|
|
58
|
+
"@gitbeaker/requester-utils": "^43.4.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@playwright/test": "^1.54.
|
|
62
|
-
"@types/node": "^24.0
|
|
61
|
+
"@playwright/test": "^1.54.2",
|
|
62
|
+
"@types/node": "^24.2.0",
|
|
63
63
|
"tsup": "^8.5.0",
|
|
64
|
-
"typescript": "^5.
|
|
64
|
+
"typescript": "^5.9.2"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "dd8aa38674dba292815eb8cba325b08b2680936f"
|
|
67
67
|
}
|