@getopenpay/client
Version:
OpenPay API TypeScript SDK
98 lines (97 loc) • 4.41 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.instanceOfPromotionCodeExternal = instanceOfPromotionCodeExternal;
exports.PromotionCodeExternalFromJSON = PromotionCodeExternalFromJSON;
exports.PromotionCodeExternalFromJSONTyped = PromotionCodeExternalFromJSONTyped;
exports.PromotionCodeExternalToJSON = PromotionCodeExternalToJSON;
exports.PromotionCodeExternalToJSONTyped = PromotionCodeExternalToJSONTyped;
const PromoRestrictions_1 = require("./PromoRestrictions");
const CouponExternal_1 = require("./CouponExternal");
const ObjectName_1 = require("./ObjectName");
/**
* Check if a given object implements the PromotionCodeExternal interface.
*/
function instanceOfPromotionCodeExternal(value) {
if (!('code' in value) || value['code'] === undefined)
return false;
if (!('coupon' in value) || value['coupon'] === undefined)
return false;
if (!('couponId' in value) || value['couponId'] === undefined)
return false;
if (!('createdAt' in value) || value['createdAt'] === undefined)
return false;
if (!('id' in value) || value['id'] === undefined)
return false;
if (!('isActive' in value) || value['isActive'] === undefined)
return false;
if (!('restrictions' in value) || value['restrictions'] === undefined)
return false;
if (!('updatedAt' in value) || value['updatedAt'] === undefined)
return false;
return true;
}
function PromotionCodeExternalFromJSON(json) {
return PromotionCodeExternalFromJSONTyped(json, false);
}
function PromotionCodeExternalFromJSONTyped(json, ignoreDiscriminator) {
if (json == null) {
return json;
}
return {
'code': json['code'],
'coupon': (0, CouponExternal_1.CouponExternalFromJSON)(json['coupon']),
'couponId': json['coupon_id'],
'createdAt': (new Date(json['created_at'])),
'customerIds': json['customer_ids'] == null ? undefined : json['customer_ids'],
'expiresAt': json['expires_at'] == null ? undefined : (new Date(json['expires_at'])),
'id': json['id'],
'isActive': json['is_active'],
'isDeleted': json['is_deleted'] == null ? undefined : json['is_deleted'],
'maxRedemptions': json['max_redemptions'] == null ? undefined : json['max_redemptions'],
'maxRedemptionsPerCustomer': json['max_redemptions_per_customer'] == null ? undefined : json['max_redemptions_per_customer'],
'metadata': json['metadata'] == null ? undefined : json['metadata'],
'object': json['object'] == null ? undefined : (0, ObjectName_1.ObjectNameFromJSON)(json['object']),
'restrictions': (0, PromoRestrictions_1.PromoRestrictionsFromJSON)(json['restrictions']),
'timesRedeemed': json['times_redeemed'] == null ? undefined : json['times_redeemed'],
'updatedAt': (new Date(json['updated_at'])),
};
}
function PromotionCodeExternalToJSON(json) {
return PromotionCodeExternalToJSONTyped(json, false);
}
function PromotionCodeExternalToJSONTyped(value, ignoreDiscriminator = false) {
if (value == null) {
return value;
}
return {
'code': value['code'],
'coupon': (0, CouponExternal_1.CouponExternalToJSON)(value['coupon']),
'coupon_id': value['couponId'],
'created_at': ((value['createdAt']).toISOString()),
'customer_ids': value['customerIds'],
'expires_at': value['expiresAt'] == null ? undefined : (value['expiresAt'].toISOString()),
'id': value['id'],
'is_active': value['isActive'],
'is_deleted': value['isDeleted'],
'max_redemptions': value['maxRedemptions'],
'max_redemptions_per_customer': value['maxRedemptionsPerCustomer'],
'metadata': value['metadata'],
'object': (0, ObjectName_1.ObjectNameToJSON)(value['object']),
'restrictions': (0, PromoRestrictions_1.PromoRestrictionsToJSON)(value['restrictions']),
'times_redeemed': value['timesRedeemed'],
'updated_at': ((value['updatedAt']).toISOString()),
};
}