mirror of
https://github.com/jdalrymple/gitbeaker.git
synced 2026-01-25 16:04:01 +00:00
Remove the typings directory. Declare and use the types/interfaces in the various index.ts files. This will produce a package that can be used by Typescript without errors. Remove the typings directory. Declare and use the types/interfaces in the various index.ts files. This will produce a package that can be used by Typescript without errors.
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import {
|
|
BaseRequestOptions,
|
|
BaseService,
|
|
PaginatedRequestOptions,
|
|
RequestHelper,
|
|
} from '../infrastructure';
|
|
import { ProjectId, GroupId, NotificationSettingLevel } from '.';
|
|
|
|
class NotificationSettings extends BaseService {
|
|
all({
|
|
projectId,
|
|
groupId,
|
|
...options
|
|
}: ({ projectId: ProjectId } | { groupId: GroupId }) & PaginatedRequestOptions) {
|
|
let url = '';
|
|
|
|
if (projectId) {
|
|
url += `projects/${encodeURIComponent(projectId)}/`;
|
|
} else if (groupId) {
|
|
url += `groups/${encodeURIComponent(groupId)}/`;
|
|
}
|
|
|
|
return RequestHelper.get(this, `${url}notification_settings`, options);
|
|
}
|
|
|
|
edit({
|
|
projectId,
|
|
groupId,
|
|
...options
|
|
}: { level?: NotificationSettingLevel } & ({ projectId: ProjectId } | { groupId: GroupId }) &
|
|
BaseRequestOptions) {
|
|
let url = '';
|
|
|
|
if (projectId) {
|
|
url += `projects/${encodeURIComponent(projectId)}/`;
|
|
} else if (groupId) {
|
|
url += `groups/${encodeURIComponent(groupId)}/`;
|
|
}
|
|
|
|
return RequestHelper.put(this, `${url}notification_settings`, options);
|
|
}
|
|
}
|
|
|
|
export default NotificationSettings;
|