mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-08 06:22:53 +00:00
fix: remove undocumented default params
This commit is contained in:
29
src/api.ts
29
src/api.ts
@@ -301,29 +301,28 @@ export class Api {
|
|||||||
*
|
*
|
||||||
* @param options Options to get issues
|
* @param options Options to get issues
|
||||||
*/
|
*/
|
||||||
public getIssues(options?: ApiGetIssuesOptions): Promise<Issue[]> {
|
public getIssues(options: ApiGetIssuesOptions = {}): Promise<Issue[]> {
|
||||||
// set 'Meeting' as default milestone
|
|
||||||
const _options: ApiGetIssuesOptions = {
|
|
||||||
...{
|
|
||||||
milestone: 'Meeting',
|
|
||||||
},
|
|
||||||
...options,
|
|
||||||
};
|
|
||||||
|
|
||||||
// start to build request url
|
// start to build request url
|
||||||
let requestUrl = 'issues';
|
let requestUrl = 'issues';
|
||||||
|
|
||||||
|
// set initial divider for filter params
|
||||||
|
let divider = '?';
|
||||||
|
|
||||||
// request issues only for specific group, if group ID is set
|
// request issues only for specific group, if group ID is set
|
||||||
if (typeof _options.groupId === 'number') {
|
if (typeof options.groupId === 'number') {
|
||||||
requestUrl = 'groups/' + _options.groupId + '/' + requestUrl;
|
requestUrl = `groups/${options.groupId}/requestUrl`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add milestone to request url
|
if (typeof options.milestone === 'string') {
|
||||||
requestUrl += '?milestone=' + _options.milestone;
|
// add milestone to request url
|
||||||
|
requestUrl += `${divider}milestone=${options.milestone}`;
|
||||||
|
divider = '&';
|
||||||
|
}
|
||||||
|
|
||||||
// request issues only for specific state, if state is set
|
// request issues only for specific state, if state is set
|
||||||
if (typeof _options.state === 'string' && ['opened', 'closed'].indexOf(_options.state) >= 0) {
|
if (typeof options.state === 'string') {
|
||||||
requestUrl += '&state=' + _options.state;
|
requestUrl += `${divider}state=${options.state}`;
|
||||||
|
// divider = '&';
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.makeGitLabAPIRequest(requestUrl);
|
return this.makeGitLabAPIRequest(requestUrl);
|
||||||
|
|||||||
Reference in New Issue
Block a user