Passed
Push — master ( 5d9134...50ca29 )
by Christian
15:07 queued 01:56
created

BusinessEventsApiService.getBusinessEvents   A

Complexity

Conditions 2

Size

Total Lines 13
Code Lines 9

Duplication

Lines 13
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
eloc 9
dl 13
loc 13
rs 9.95
c 0
b 0
f 0
1 View Code Duplication
import ApiService from '../api.service';
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
2
3
/**
4
 * @class
5
 * @extends ApiService
6
 */
7
class BusinessEventsApiService extends ApiService {
8
    constructor(httpClient, loginService, apiEndpoint = 'business-events') {
9
        super(httpClient, loginService, apiEndpoint);
10
        this.name = 'businessEventService';
11
    }
12
13
    /**
14
     * Get all business events
15
     *
16
     * @param {Object} [additionalParams = {}]
17
     * @param {Object} [additionalHeaders = {}]
18
     * @returns {Promise<T>}
19
     */
20
    getBusinessEvents(additionalParams = {}, additionalHeaders = {}) {
21
        const params = additionalParams;
22
        const headers = this.getBasicHeaders(additionalHeaders);
23
24
        return this.httpClient
25
            .get('/_info/events.json', {
26
                params,
27
                headers
28
            })
29
            .then((response) => {
30
                return ApiService.handleResponse(response);
31
            });
32
    }
33
}
34
35
export default BusinessEventsApiService;
36