Esempio n. 1
0
function fetchApplications(team) {
    return request
            .get(`${Services.kio.url}${Services.kio.root}` + (team ? `?team_id=${team}` : ''))
            .accept('json')
            .oauth(Provider, RequestConfig)
            .exec(saveRoute)
            .then(res => res.body);
}
Esempio n. 2
0
function fetchViolationTypes() {
    return request
            .get(`${FULLSTOP_BASE_URL}/violation-types`)
            .accept('json')
            .oauth(Provider, RequestConfig)
            .exec(saveRoute)
            .then(res => res.body);
}
Esempio n. 3
0
function fetchViolation(violationId) {
    return request
            .get(`${FULLSTOP_BASE_URL}/violations/${violationId}`)
            .accept('json')
            .oauth(Provider, RequestConfig)
            .exec(saveRoute)
            .then(res => res.body)
            .catch(e => {
                e.violationId = violationId;
                throw e;
            });
}
Esempio n. 4
0
 fetchOAuthConfig(applicationId) {
     return request
                 .get(`${Services.mint.url}${Services.mint.root}/${applicationId}`)
                 .accept('json')
                 .oauth(Provider, RequestConfig)
                 .exec(saveRoute)
                 .then(res => [applicationId, res.body])
                 .catch(e => {
                     e.id = applicationId;
                     throw e;
                 });
 }
Esempio n. 5
0
 fetchApi(id) {
     return request
             .get(`${Services.twintip.url}${Services.twintip.root}/${id}`)
             .accept('json')
             .oauth(Provider, RequestConfig)
             .exec(saveRoute)
             .then(res => res.body)
             .catch(err => {
                 err.id = id;
                 throw err;
             });
 }
Esempio n. 6
0
function fetchLatestApplicationVersions(team) {
    return request
            .get(ENV_DEVELOPMENT ? `http://localhost:8080/latestVersions/${team}` : `/latestVersions/${team}`)
            .accept('json')
            .oauth(Provider, RequestConfig)
            .exec(saveRoute)
            .then(res => res.body)
            .catch(err => {
                err.team = team;
                throw err;
            });
}
Esempio n. 7
0
function fetchApplicationVersions(id) {
    return request
            .get(`${Services.kio.url}${Services.kio.root}/${id}/versions`)
            .accept('json')
            .oauth(Provider, RequestConfig)
            .exec(saveRoute)
            .then(res => res.body)
            .catch(err => {
                err.id = id;
                throw err;
            });
}
Esempio n. 8
0
function fetchOwnTotal(accounts) {
    return request
            .get(`${FULLSTOP_BASE_URL}/violations`)
            .accept('json')
            .query({
                accounts: accounts && accounts.join(','),
                from: new Date(0).toISOString(),
                checked: false
            })
            .oauth(Provider, RequestConfig)
            .exec(saveRoute)
            .then(res => res.body.total_elements);
}
Esempio n. 9
0
function fetchApprovals(applicationId, versionId) {
    return request
            .get(`${Services.kio.url}${Services.kio.root}/${applicationId}/versions/${versionId}/approvals`)
            .accept('json')
            .oauth(Provider, RequestConfig)
            .exec(saveRoute)
            .then(res => [applicationId, versionId, res.body])
            .catch(err => {
                err.applicationId = applicationId;
                err.versionId = versionId;
                throw err;
            });
}
Esempio n. 10
0
function fetchViolationCountIn(account, params) {
    return request
            .get(`${FULLSTOP_BASE_URL}/violation-count/${account}`)
            .query({
                to: (params.to || new Date()).toISOString(),
                from: params.from ? params.from.toISOString() : '',
                resolved: params.showResolved && !params.showUnresolved ?
                            true :
                            !params.showResolved && params.showUnresolved ?
                                false :
                                undefined
            })
            .accept('json')
            .oauth(Provider, RequestConfig)
            .exec(saveRoute)
            .then(res => [account, res.body]);
}
Esempio n. 11
0
function fetchViolationCount(params) {
    return request
            .get(`${FULLSTOP_BASE_URL}/violation-count`)
            .query({
                accounts: params.accounts && params.accounts.join(','),
                to: params.to ? params.to.toISOString() : (new Date()).toISOString(),
                from: params.from ? params.from.toISOString() : '',
                resolved: params.showResolved && !params.showUnresolved ?
                            true :
                            !params.showResolved && params.showUnresolved ?
                                false :
                                undefined
            })
            .accept('json')
            .oauth(Provider, RequestConfig)
            .exec(saveRoute)
            .then(res => res.body);
}
Esempio n. 12
0
function fetchApprovalTypes(applicationId) {
    return request
            .get(`${Services.kio.url}${Services.kio.root}/${applicationId}/approvals`)
            .accept('json')
            .oauth(Provider, RequestConfig)
            .exec(saveRoute)
            .then(res => [
                applicationId,
                // specification, test, deploy and code change always have to be there
                (res.body.concat(['SPECIFICATION', 'TEST', 'DEPLOY', 'CODE_CHANGE']))
                    .filter((i, idx, arr) => arr.lastIndexOf(i) === idx)
                    .sort()
            ])
            .catch(err => {
                err.applicationId = applicationId;
                throw err;
            });
}
Esempio n. 13
0
function fetchViolations(params) {
    return request
            .get(`${FULLSTOP_BASE_URL}/violations`)
            .accept('json')
            .query({
                accounts: params.accounts && params.accounts.join(','),
                size: params.size || 10,
                from: params.from ? params.from.toISOString() : '',
                to: (params.to || new Date()).toISOString(),
                page: params.page || 0,
                type: params.type || undefined,
                priority: typeof params.priority !== 'undefined' ? params.priority : undefined,
                sort: (params.sortBy || 'created') + (params.sortAsc ? ',asc' : ',desc'),
                whitelisted: params.showWhitelisted || false,
                checked: params.showResolved && !params.showUnresolved ?
                            true :
                            !params.showResolved && params.showUnresolved ?
                                false :
                                undefined
            })
            .oauth(Provider, RequestConfig)
            .exec(saveRoute)
            .then(res => [res.body, res.body.content]);
}
Esempio n. 14
0
 login() {
     request
         .get('does.not.matter')
         .oauth(Provider, RequestConfig)
         .requestAccessToken(saveRoute);
 }