gitbeaker/src/services/NotificationSettings.ts
Daniel Rose da1a8f6a63 fix: Make package Typescript-conformant
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.
2019-06-12 15:06:00 +02:00

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;