UNPKG

amazon-pay-async

Version:

API wrapper for Amazon Pay using promises and defining types

33 lines (32 loc) 1.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var AmazonResponse = /** @class */ (function () { function AmazonResponse(method, rawResponse, primaryKey, subKey) { this.method = method; this.rawResponse = rawResponse; this.primaryKey = primaryKey || this.method + "Response"; this.subKey = subKey || this.method + "Result"; } Object.defineProperty(AmazonResponse.prototype, "response", { get: function () { if (!this.rawResponse[this.primaryKey]) { return this.rawResponse; } var response = this.rawResponse[this.primaryKey]; var result = response[this.subKey]; if (response.ResponseMetadata) { Object.defineProperty(this, 'requestId', { enumerable: false, get: function () { return response.ResponseMetadata.RequestId; }, }); } return result; }, enumerable: true, configurable: true }); return AmazonResponse; }()); exports.AmazonResponse = AmazonResponse;