@getopenpay/client
Version:
OpenPay API TypeScript SDK
112 lines (111 loc) • 6.34 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.instanceOfCreatePriceRequest = instanceOfCreatePriceRequest;
exports.CreatePriceRequestFromJSON = CreatePriceRequestFromJSON;
exports.CreatePriceRequestFromJSONTyped = CreatePriceRequestFromJSONTyped;
exports.CreatePriceRequestToJSON = CreatePriceRequestToJSON;
exports.CreatePriceRequestToJSONTyped = CreatePriceRequestToJSONTyped;
const PriceTypeEnum_1 = require("./PriceTypeEnum");
const UsageAggMethodEnum_1 = require("./UsageAggMethodEnum");
const CalendarIntervalEnum_1 = require("./CalendarIntervalEnum");
const PriceTierParams_1 = require("./PriceTierParams");
const UsageTypeEnum_1 = require("./UsageTypeEnum");
const CurrencyEnum_1 = require("./CurrencyEnum");
const PricingModel_1 = require("./PricingModel");
/**
* Check if a given object implements the CreatePriceRequest interface.
*/
function instanceOfCreatePriceRequest(value) {
if (!('isActive' in value) || value['isActive'] === undefined)
return false;
if (!('priceType' in value) || value['priceType'] === undefined)
return false;
if (!('pricingModel' in value) || value['pricingModel'] === undefined)
return false;
if (!('productId' in value) || value['productId'] === undefined)
return false;
return true;
}
function CreatePriceRequestFromJSON(json) {
return CreatePriceRequestFromJSONTyped(json, false);
}
function CreatePriceRequestFromJSONTyped(json, ignoreDiscriminator) {
if (json == null) {
return json;
}
return {
'aggregateUsage': json['aggregate_usage'] == null ? undefined : (0, UsageAggMethodEnum_1.UsageAggMethodEnumFromJSON)(json['aggregate_usage']),
'billingInterval': json['billing_interval'] == null ? undefined : (0, CalendarIntervalEnum_1.CalendarIntervalEnumFromJSON)(json['billing_interval']),
'billingIntervalCount': json['billing_interval_count'] == null ? undefined : json['billing_interval_count'],
'canOnlyBePurchasedWith': json['can_only_be_purchased_with'] == null ? undefined : json['can_only_be_purchased_with'],
'contractAutoRenew': json['contract_auto_renew'] == null ? undefined : json['contract_auto_renew'],
'contractTermMultiple': json['contract_term_multiple'] == null ? undefined : json['contract_term_multiple'],
'currency': json['currency'] == null ? undefined : (0, CurrencyEnum_1.CurrencyEnumFromJSON)(json['currency']),
'customFields': json['custom_fields'] == null ? undefined : json['custom_fields'],
'defaultNetD': json['default_net_d'] == null ? undefined : json['default_net_d'],
'internalDescription': json['internal_description'] == null ? undefined : json['internal_description'],
'isActive': json['is_active'],
'isDefault': json['is_default'] == null ? undefined : json['is_default'],
'isExclusive': json['is_exclusive'] == null ? undefined : json['is_exclusive'],
'listedExclusivelyForCustomers': json['listed_exclusively_for_customers'] == null ? undefined : json['listed_exclusively_for_customers'],
'meta': json['meta'] == null ? undefined : json['meta'],
'meterId': json['meter_id'] == null ? undefined : json['meter_id'],
'name': json['name'] == null ? undefined : json['name'],
'priceTiers': json['price_tiers'] == null ? undefined : (json['price_tiers'].map(PriceTierParams_1.PriceTierParamsFromJSON)),
'priceType': (0, PriceTypeEnum_1.PriceTypeEnumFromJSON)(json['price_type']),
'pricingModel': (0, PricingModel_1.PricingModelFromJSON)(json['pricing_model']),
'productId': json['product_id'],
'transformQuantityDivideBy': json['transform_quantity_divide_by'] == null ? undefined : json['transform_quantity_divide_by'],
'trialPeriodDays': json['trial_period_days'] == null ? undefined : json['trial_period_days'],
'unitAmountAtom': json['unit_amount_atom'] == null ? undefined : json['unit_amount_atom'],
'usageType': json['usage_type'] == null ? undefined : (0, UsageTypeEnum_1.UsageTypeEnumFromJSON)(json['usage_type']),
};
}
function CreatePriceRequestToJSON(json) {
return CreatePriceRequestToJSONTyped(json, false);
}
function CreatePriceRequestToJSONTyped(value, ignoreDiscriminator = false) {
if (value == null) {
return value;
}
return {
'aggregate_usage': (0, UsageAggMethodEnum_1.UsageAggMethodEnumToJSON)(value['aggregateUsage']),
'billing_interval': (0, CalendarIntervalEnum_1.CalendarIntervalEnumToJSON)(value['billingInterval']),
'billing_interval_count': value['billingIntervalCount'],
'can_only_be_purchased_with': value['canOnlyBePurchasedWith'],
'contract_auto_renew': value['contractAutoRenew'],
'contract_term_multiple': value['contractTermMultiple'],
'currency': (0, CurrencyEnum_1.CurrencyEnumToJSON)(value['currency']),
'custom_fields': value['customFields'],
'default_net_d': value['defaultNetD'],
'internal_description': value['internalDescription'],
'is_active': value['isActive'],
'is_default': value['isDefault'],
'is_exclusive': value['isExclusive'],
'listed_exclusively_for_customers': value['listedExclusivelyForCustomers'],
'meta': value['meta'],
'meter_id': value['meterId'],
'name': value['name'],
'price_tiers': value['priceTiers'] == null ? undefined : (value['priceTiers'].map(PriceTierParams_1.PriceTierParamsToJSON)),
'price_type': (0, PriceTypeEnum_1.PriceTypeEnumToJSON)(value['priceType']),
'pricing_model': (0, PricingModel_1.PricingModelToJSON)(value['pricingModel']),
'product_id': value['productId'],
'transform_quantity_divide_by': value['transformQuantityDivideBy'],
'trial_period_days': value['trialPeriodDays'],
'unit_amount_atom': value['unitAmountAtom'],
'usage_type': (0, UsageTypeEnum_1.UsageTypeEnumToJSON)(value['usageType']),
};
}