| @@ 1-36 (lines=36) @@ | ||
| 1 | import ApiService from '../api.service'; |
|
| 2 | ||
| 3 | /** |
|
| 4 | * Gateway for the API end point "application" |
|
| 5 | * @class |
|
| 6 | * @extends ApiService |
|
| 7 | */ |
|
| 8 | class SalesChannelApiService extends ApiService { |
|
| 9 | constructor(httpClient, loginService, apiEndpoint = 'sales-channel') { |
|
| 10 | super(httpClient, loginService, apiEndpoint); |
|
| 11 | this.name = 'salesChannelService'; |
|
| 12 | } |
|
| 13 | ||
| 14 | /** |
|
| 15 | * Get the generated access key and secret access key from the API |
|
| 16 | * |
|
| 17 | * @param {Object} additionalParams |
|
| 18 | * @param {Object} additionalHeaders |
|
| 19 | * @returns {Promise<T>} |
|
| 20 | */ |
|
| 21 | generateKey(additionalParams = {}, additionalHeaders = {}) { |
|
| 22 | const params = additionalParams; |
|
| 23 | const headers = this.getBasicHeaders(additionalHeaders); |
|
| 24 | ||
| 25 | return this.httpClient |
|
| 26 | .get('/_action/access-key/sales-channel', { |
|
| 27 | params, |
|
| 28 | headers |
|
| 29 | }) |
|
| 30 | .then((response) => { |
|
| 31 | return ApiService.handleResponse(response); |
|
| 32 | }); |
|
| 33 | } |
|
| 34 | } |
|
| 35 | ||
| 36 | export default SalesChannelApiService; |
|
| 37 | ||
| @@ 1-35 (lines=35) @@ | ||
| 1 | import ApiService from '../api.service'; |
|
| 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 | ||