UNPKG

@getopenpay/client

Version:

OpenPay API TypeScript SDK

75 lines (74 loc) 3.38 kB
"use strict"; /* 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.instanceOfCreateCouponRequest = instanceOfCreateCouponRequest; exports.CreateCouponRequestFromJSON = CreateCouponRequestFromJSON; exports.CreateCouponRequestFromJSONTyped = CreateCouponRequestFromJSONTyped; exports.CreateCouponRequestToJSON = CreateCouponRequestToJSON; exports.CreateCouponRequestToJSONTyped = CreateCouponRequestToJSONTyped; const CouponDuration_1 = require("./CouponDuration"); const CurrencyEnum_1 = require("./CurrencyEnum"); /** * Check if a given object implements the CreateCouponRequest interface. */ function instanceOfCreateCouponRequest(value) { if (!('name' in value) || value['name'] === undefined) return false; return true; } function CreateCouponRequestFromJSON(json) { return CreateCouponRequestFromJSONTyped(json, false); } function CreateCouponRequestFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { 'amountAtomOff': json['amount_atom_off'] == null ? undefined : json['amount_atom_off'], 'currency': json['currency'] == null ? undefined : (0, CurrencyEnum_1.CurrencyEnumFromJSON)(json['currency']), 'duration': json['duration'] == null ? undefined : (0, CouponDuration_1.CouponDurationFromJSON)(json['duration']), 'durationInMonths': json['duration_in_months'] == null ? undefined : json['duration_in_months'], 'isActive': json['is_active'] == null ? undefined : json['is_active'], 'maxRedemptions': json['max_redemptions'] == null ? undefined : json['max_redemptions'], 'name': json['name'], 'percentOff': json['percent_off'] == null ? undefined : json['percent_off'], 'productFamilyIds': json['product_family_ids'] == null ? undefined : json['product_family_ids'], 'productIds': json['product_ids'] == null ? undefined : json['product_ids'], 'redeemBy': json['redeem_by'] == null ? undefined : (new Date(json['redeem_by'])), 'trialDaysOff': json['trial_days_off'] == null ? undefined : json['trial_days_off'], }; } function CreateCouponRequestToJSON(json) { return CreateCouponRequestToJSONTyped(json, false); } function CreateCouponRequestToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { 'amount_atom_off': value['amountAtomOff'], 'currency': (0, CurrencyEnum_1.CurrencyEnumToJSON)(value['currency']), 'duration': (0, CouponDuration_1.CouponDurationToJSON)(value['duration']), 'duration_in_months': value['durationInMonths'], 'is_active': value['isActive'], 'max_redemptions': value['maxRedemptions'], 'name': value['name'], 'percent_off': value['percentOff'], 'product_family_ids': value['productFamilyIds'], 'product_ids': value['productIds'], 'redeem_by': value['redeemBy'] == null ? undefined : (value['redeemBy'].toISOString()), 'trial_days_off': value['trialDaysOff'], }; }