UNPKG

@getopenpay/client

Version:

OpenPay API TypeScript SDK

106 lines (105 loc) 4.8 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.instanceOfSubscriptionItemExternal = instanceOfSubscriptionItemExternal; exports.SubscriptionItemExternalFromJSON = SubscriptionItemExternalFromJSON; exports.SubscriptionItemExternalFromJSONTyped = SubscriptionItemExternalFromJSONTyped; exports.SubscriptionItemExternalToJSON = SubscriptionItemExternalToJSON; exports.SubscriptionItemExternalToJSONTyped = SubscriptionItemExternalToJSONTyped; const PriceExternal_1 = require("./PriceExternal"); const CurrencyEnum_1 = require("./CurrencyEnum"); const ObjectName_1 = require("./ObjectName"); /** * Check if a given object implements the SubscriptionItemExternal interface. */ function instanceOfSubscriptionItemExternal(value) { if (!('addAtPeriodEnd' in value) || value['addAtPeriodEnd'] === undefined) return false; if (!('createdAt' in value) || value['createdAt'] === undefined) return false; if (!('currency' in value) || value['currency'] === undefined) return false; if (!('deletedAt' in value) || value['deletedAt'] === undefined) return false; if (!('dropAtEnd' in value) || value['dropAtEnd'] === undefined) return false; if (!('id' in value) || value['id'] === undefined) return false; if (!('price' in value) || value['price'] === undefined) return false; if (!('priceId' in value) || value['priceId'] === undefined) return false; if (!('productId' in value) || value['productId'] === undefined) return false; if (!('quantity' in value) || value['quantity'] === undefined) return false; if (!('updatedAt' in value) || value['updatedAt'] === undefined) return false; return true; } function SubscriptionItemExternalFromJSON(json) { return SubscriptionItemExternalFromJSONTyped(json, false); } function SubscriptionItemExternalFromJSONTyped(json, ignoreDiscriminator) { if (json == null) { return json; } return { 'addAtPeriodEnd': json['add_at_period_end'], 'createdAt': (new Date(json['created_at'])), 'currency': (0, CurrencyEnum_1.CurrencyEnumFromJSON)(json['currency']), 'customFields': json['custom_fields'] == null ? undefined : json['custom_fields'], 'deletedAt': (json['deleted_at'] == null ? null : new Date(json['deleted_at'])), 'description': json['description'] == null ? undefined : json['description'], 'dropAtEnd': json['drop_at_end'], 'id': json['id'], 'isDeleted': json['is_deleted'] == null ? undefined : json['is_deleted'], 'object': json['object'] == null ? undefined : (0, ObjectName_1.ObjectNameFromJSON)(json['object']), 'pendingAttachmentToSubscriptionId': json['pending_attachment_to_subscription_id'] == null ? undefined : json['pending_attachment_to_subscription_id'], 'price': (0, PriceExternal_1.PriceExternalFromJSON)(json['price']), 'priceId': json['price_id'], 'productId': json['product_id'], 'quantity': json['quantity'], 'subscriptionId': json['subscription_id'] == null ? undefined : json['subscription_id'], 'updatedAt': (new Date(json['updated_at'])), }; } function SubscriptionItemExternalToJSON(json) { return SubscriptionItemExternalToJSONTyped(json, false); } function SubscriptionItemExternalToJSONTyped(value, ignoreDiscriminator = false) { if (value == null) { return value; } return { 'add_at_period_end': value['addAtPeriodEnd'], 'created_at': ((value['createdAt']).toISOString()), 'currency': (0, CurrencyEnum_1.CurrencyEnumToJSON)(value['currency']), 'custom_fields': value['customFields'], 'deleted_at': (value['deletedAt'] == null ? null : value['deletedAt'].toISOString()), 'description': value['description'], 'drop_at_end': value['dropAtEnd'], 'id': value['id'], 'is_deleted': value['isDeleted'], 'object': (0, ObjectName_1.ObjectNameToJSON)(value['object']), 'pending_attachment_to_subscription_id': value['pendingAttachmentToSubscriptionId'], 'price': (0, PriceExternal_1.PriceExternalToJSON)(value['price']), 'price_id': value['priceId'], 'product_id': value['productId'], 'quantity': value['quantity'], 'subscription_id': value['subscriptionId'], 'updated_at': ((value['updatedAt']).toISOString()), }; }