mirror of
https://github.com/jdalrymple/gitbeaker.git
synced 2026-01-18 15:55:30 +00:00
Renamed Namespace to Bundle
Added Todos support Cleaned up Tags Moved createTodo to Todos API
This commit is contained in:
parent
07c0809365
commit
f7cbe2293e
22
README.md
22
README.md
@ -83,8 +83,9 @@ Tags
|
||||
Triggers
|
||||
|
||||
// General
|
||||
SystemHooks
|
||||
Events
|
||||
SystemHooks
|
||||
Todos
|
||||
|
||||
```
|
||||
### Import
|
||||
@ -130,15 +131,15 @@ const service = new Projects({
|
||||
|
||||
```
|
||||
|
||||
#### Namespace Imports
|
||||
#### Bundle Imports
|
||||
|
||||
It can be annoying to have to import all the API's pertaining to a specific resource. For example, the Projects resource is composed of many API's, Projects, Issues, Labels, MergeRequests, etc. For convience, there is a Namespace export for importing and instantiating all these related API's at once.
|
||||
It can be annoying to have to import all the API's pertaining to a specific resource. For example, the Projects resource is composed of many API's, Projects, Issues, Labels, MergeRequests, etc. For convience, there is a Bundle export for importing and instantiating all these related API's at once.
|
||||
|
||||
|
||||
```javascript
|
||||
import { ProjectsNamespace } from 'node-gitlab-api';
|
||||
import { ProjectsBundle } from 'node-gitlab-api';
|
||||
|
||||
const services = new ProjectsNamespace({
|
||||
const services = new ProjectsBundle({
|
||||
url: 'http://example.com', // Defaults to http://gitlab.com
|
||||
token: 'abcdefghij123456' //Can be created in your profile.
|
||||
})
|
||||
@ -149,8 +150,8 @@ etc..
|
||||
|
||||
```
|
||||
|
||||
Currently there are three Namespaces:
|
||||
1. ProjectsNamespace which includes:
|
||||
Currently there are three Bundles:
|
||||
1. ProjectsBundle which includes:
|
||||
```
|
||||
Branches,
|
||||
Commits,
|
||||
@ -179,7 +180,7 @@ Tags,
|
||||
Triggers
|
||||
```
|
||||
|
||||
2. UsersNamespace which includes:
|
||||
2. UsersBundle which includes:
|
||||
```
|
||||
Users,
|
||||
UserEmails,
|
||||
@ -188,7 +189,7 @@ UserKeys,
|
||||
UserGPGKeys
|
||||
```
|
||||
|
||||
3. GroupsNamespace which includes:
|
||||
3. GroupsBundle which includes:
|
||||
```
|
||||
Groups,
|
||||
GroupAccessRequests,
|
||||
@ -324,6 +325,7 @@ This started off as a fork from [node-gitlab](https://github.com/node-gitlab/nod
|
||||
- Added support for Merge Request Approvals #49
|
||||
- Fixed problem with .all() functions where only the some of the results were being returned
|
||||
- Added full support for Enviroments
|
||||
- Added support for Todos
|
||||
|
||||
### Breaking Changes between 2.2.6 and 3.0.0
|
||||
- Instantiation of the API must use the new operator consistently. See usage above.
|
||||
@ -334,7 +336,7 @@ ProjectRepository -> Repositories, Tags, Commits, Branches and RepositoryFiles
|
||||
Users -> Users, UserKeys, UserGPGKeys, UserCustomAttributes, UserVariables
|
||||
|
||||
```
|
||||
|
||||
- Moved createTodo function from MergeRequests API to Todos API
|
||||
- Many services have been renamed:
|
||||
```
|
||||
ProjectProtectedBranches -> ProtectedBranches
|
||||
|
||||
@ -15,7 +15,7 @@ const {
|
||||
GroupVariables,
|
||||
} = APIServices;
|
||||
|
||||
export const GroupNamespace = init({
|
||||
export const GroupsBundle = init({
|
||||
Groups,
|
||||
GroupAccessRequests,
|
||||
GroupCustomAttributes,
|
||||
@ -28,7 +28,7 @@ export const GroupNamespace = init({
|
||||
// Users
|
||||
const { Users, UserEmails, UserImpersonationTokens, UserKeys, UserGPGKeys } = APIServices;
|
||||
|
||||
export const UserNamespace = init({
|
||||
export const UsersBundle = init({
|
||||
Users,
|
||||
UserEmails,
|
||||
UserImpersonationTokens,
|
||||
@ -65,7 +65,7 @@ const {
|
||||
Triggers,
|
||||
} = APIServices;
|
||||
|
||||
export const ProjectNamespace = init({
|
||||
export const ProjectsBundle = init({
|
||||
Branches,
|
||||
Commits,
|
||||
DeployKeys,
|
||||
|
||||
@ -69,12 +69,6 @@ class MergeRequests extends BaseService {
|
||||
});
|
||||
}
|
||||
|
||||
createTodo(projectId, mergerequestId) {
|
||||
const [pId, mId] = [projectId, mergerequestId].map(encodeURIComponent);
|
||||
|
||||
return RequestHelper.post(this, `projects/${pId}/merge_requests/${mId}/todo`);
|
||||
}
|
||||
|
||||
edit(projectId, mergerequestId, options) {
|
||||
const [pId, mId] = [projectId, mergerequestId].map(encodeURIComponent);
|
||||
|
||||
|
||||
@ -14,21 +14,15 @@ class Tags extends BaseService {
|
||||
}
|
||||
|
||||
remove(projectId, tagName) {
|
||||
const pId = encodeURIComponent(projectId);
|
||||
const [pId, tId] = [projectId, tagName].map(encodeURIComponent);
|
||||
|
||||
return RequestHelper.delete(
|
||||
this,
|
||||
`projects/${pId}/repository/tags/${encodeURI(tagName)}`,
|
||||
);
|
||||
return RequestHelper.delete(this, `projects/${pId}/repository/tags/${tId}`);
|
||||
}
|
||||
|
||||
show(projectId, tagName) {
|
||||
const pId = encodeURIComponent(projectId);
|
||||
const [pId, tId] = [projectId, tagName].map(encodeURIComponent);
|
||||
|
||||
return RequestHelper.get(
|
||||
this,
|
||||
`projects/${pId}/repository/tags/${encodeURI(tagName)}`,
|
||||
);
|
||||
return RequestHelper.get(this, `projects/${pId}/repository/tags/${tId}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
21
src/services/Todos.js
Normal file
21
src/services/Todos.js
Normal file
@ -0,0 +1,21 @@
|
||||
import { BaseService, RequestHelper } from '../infrastructure';
|
||||
|
||||
class Todos extends BaseService {
|
||||
all(options) {
|
||||
return RequestHelper.get(this, 'todos, options);
|
||||
}
|
||||
|
||||
create(projectId, mergerequestId) {
|
||||
const [pId, mId] = [projectId, mergerequestId].map(encodeURIComponent);
|
||||
|
||||
return RequestHelper.post(this, `projects/${pId}/merge_requests/${mId}/todo`);
|
||||
}
|
||||
|
||||
done({ todoId } = {}) {
|
||||
const tId = encodeURIComponent(todoId);
|
||||
|
||||
return RequestHelper.delete(this,`todos/${tId}/mark_as_done`);
|
||||
}
|
||||
}
|
||||
|
||||
export default Todos;
|
||||
@ -39,6 +39,7 @@ export RepositoryFiles from './RepositoryFiles';
|
||||
export Runners from './Runners';
|
||||
export Services from './Services';
|
||||
export Tags from './Tags';
|
||||
export Todos from '/Todos';
|
||||
export Triggers from './Triggers';
|
||||
|
||||
// General
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user