@getopenpay/client
Version:
OpenPay API TypeScript SDK
114 lines (113 loc) • 5.02 kB
JavaScript
;
/* tslint:disable */
/* eslint-disable */
/**
* OpenPay API
* super charge your subscription management.
*
* The version of the OpenAPI document: 1.2.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.instanceOfCouponExternal = instanceOfCouponExternal;
exports.CouponExternalFromJSON = CouponExternalFromJSON;
exports.CouponExternalFromJSONTyped = CouponExternalFromJSONTyped;
exports.CouponExternalToJSON = CouponExternalToJSON;
exports.CouponExternalToJSONTyped = CouponExternalToJSONTyped;
const CouponDuration_1 = require("./CouponDuration");
const CurrencyEnum_1 = require("./CurrencyEnum");
const ObjectName_1 = require("./ObjectName");
/**
* Check if a given object implements the CouponExternal interface.
*/
function instanceOfCouponExternal(value) {
if (!('amountAtomOff' in value) || value['amountAtomOff'] === undefined)
return false;
if (!('createdAt' in value) || value['createdAt'] === undefined)
return false;
if (!('duration' in value) || value['duration'] === undefined)
return false;
if (!('durationInMonths' in value) || value['durationInMonths'] === undefined)
return false;
if (!('id' in value) || value['id'] === undefined)
return false;
if (!('isActive' in value) || value['isActive'] === undefined)
return false;
if (!('maxRedemptions' in value) || value['maxRedemptions'] === undefined)
return false;
if (!('name' in value) || value['name'] === undefined)
return false;
if (!('percentOff' in value) || value['percentOff'] === undefined)
return false;
if (!('redeemBy' in value) || value['redeemBy'] === undefined)
return false;
if (!('timesRedeemed' in value) || value['timesRedeemed'] === undefined)
return false;
if (!('updatedAt' in value) || value['updatedAt'] === undefined)
return false;
return true;
}
function CouponExternalFromJSON(json) {
return CouponExternalFromJSONTyped(json, false);
}
function CouponExternalFromJSONTyped(json, ignoreDiscriminator) {
if (json == null) {
return json;
}
return {
'amountAtomOff': json['amount_atom_off'],
'createdAt': (new Date(json['created_at'])),
'currency': json['currency'] == null ? undefined : (0, CurrencyEnum_1.CurrencyEnumFromJSON)(json['currency']),
'duration': (0, CouponDuration_1.CouponDurationFromJSON)(json['duration']),
'durationInMonths': json['duration_in_months'],
'id': json['id'],
'isActive': json['is_active'],
'isDeleted': json['is_deleted'] == null ? undefined : json['is_deleted'],
'maxRedemptions': json['max_redemptions'],
'metadata': json['metadata'] == null ? undefined : json['metadata'],
'name': json['name'],
'object': json['object'] == null ? undefined : (0, ObjectName_1.ObjectNameFromJSON)(json['object']),
'percentOff': json['percent_off'],
'productFamilies': json['product_families'] == null ? undefined : json['product_families'],
'products': json['products'] == null ? undefined : json['products'],
'promotionCodes': json['promotion_codes'] == null ? undefined : json['promotion_codes'],
'redeemBy': (json['redeem_by'] == null ? null : new Date(json['redeem_by'])),
'timesRedeemed': json['times_redeemed'],
'trialDaysOff': json['trial_days_off'] == null ? undefined : json['trial_days_off'],
'updatedAt': (new Date(json['updated_at'])),
};
}
function CouponExternalToJSON(json) {
return CouponExternalToJSONTyped(json, false);
}
function CouponExternalToJSONTyped(value, ignoreDiscriminator = false) {
if (value == null) {
return value;
}
return {
'amount_atom_off': value['amountAtomOff'],
'created_at': ((value['createdAt']).toISOString()),
'currency': (0, CurrencyEnum_1.CurrencyEnumToJSON)(value['currency']),
'duration': (0, CouponDuration_1.CouponDurationToJSON)(value['duration']),
'duration_in_months': value['durationInMonths'],
'id': value['id'],
'is_active': value['isActive'],
'is_deleted': value['isDeleted'],
'max_redemptions': value['maxRedemptions'],
'metadata': value['metadata'],
'name': value['name'],
'object': (0, ObjectName_1.ObjectNameToJSON)(value['object']),
'percent_off': value['percentOff'],
'product_families': value['productFamilies'],
'products': value['products'],
'promotion_codes': value['promotionCodes'],
'redeem_by': (value['redeemBy'] == null ? null : value['redeemBy'].toISOString()),
'times_redeemed': value['timesRedeemed'],
'trial_days_off': value['trialDaysOff'],
'updated_at': ((value['updatedAt']).toISOString()),
};
}