trade360-nodejs-sdk
Version:
LSports Trade360 SDK for Node.js
62 lines • 2.65 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PackageDistributionHttpClient = void 0;
const _httpClient_1 = require("../../base-http-client");
const enums_1 = require("../enums");
const { STATUS_PREFIX_URL, START_PREFIX_URL, STOP_PREFIX_URL } = enums_1.DistributionRoutesPrefixUrl;
/**
* PackageDistributionHttpClient class is responsible for sending
* requests to the distribution API.
* It extends the BaseHttpClient class and contains the logic for
* sending requests to the distribution API.
* @param packageCredentials The package credentials for the API
* @param restApiBaseUrl The base URL of the customers API
* @param logger The logger instance
* @returns PackageDistributionHttpClient instance that is
* responsible for sending requests to the distribution API.
* @extends BaseHttpClient class for sending requests to the
* customers API.
* @implements IPackageDistributionHttpClient interface for
* sending requests to the distribution API.
* @see BaseHttpClient class for sending requests to the customers
* API.
* @see IPackageDistributionHttpClient interface for sending
* requests to the distribution API.
* @see IHttpServiceConfig interface for the configuration of the
* HTTP service.
* @see BaseEntity class for the base entity of the application.
* @see DistributionRoutesPrefixUrl for the prefix URLs of the
* distribution API.
* @see HttpResponsePayloadDto class for the response payload of
* the HTTP request.
* @see IPackageDistributionHttpClient interface for sending
* requests to the distribution API.
*/
class PackageDistributionHttpClient extends _httpClient_1.BaseHttpClient {
constructor({ packageCredentials, restApiBaseUrl, logger }) {
super({ restApiBaseUrl, packageCredentials, logger });
}
async getDistributionStatus(responseBodyType) {
this.logger.debug('run status request...');
return this.postRequest({
route: STATUS_PREFIX_URL,
responseBodyType: responseBodyType,
});
}
async startDistribution(responseBodyType) {
this.logger.debug('run start request...');
return this.postRequest({
route: START_PREFIX_URL,
responseBodyType: responseBodyType,
});
}
async stopDistribution(stopResponsePayloadDto) {
this.logger.debug('run stop request...');
return this.postRequest({
route: STOP_PREFIX_URL,
responseBodyType: stopResponsePayloadDto,
});
}
}
exports.PackageDistributionHttpClient = PackageDistributionHttpClient;
//# sourceMappingURL=distribution.service.js.map