All files / codegen/models Subscription.ts

77.11% Statements 155/201
100% Branches 0/0
0% Functions 0/3
77.11% Lines 155/201

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 2031x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x     1x 1x                                             1x 1x                                                
/* tslint:disable */
/* eslint-disable */
/**
 * Octane API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */
 
import { exists, mapValues } from '../runtime';
import {
    CreditPlan,
    CreditPlanFromJSON,
    CreditPlanFromJSONTyped,
    CreditPlanToJSON,
} from './CreditPlan';
import {
    Discount,
    DiscountFromJSON,
    DiscountFromJSONTyped,
    DiscountToJSON,
} from './Discount';
import {
    Feature,
    FeatureFromJSON,
    FeatureFromJSONTyped,
    FeatureToJSON,
} from './Feature';
import {
    Limit,
    LimitFromJSON,
    LimitFromJSONTyped,
    LimitToJSON,
} from './Limit';
import {
    PricePlan,
    PricePlanFromJSON,
    PricePlanFromJSONTyped,
    PricePlanToJSON,
} from './PricePlan';
import {
    Trial,
    TrialFromJSON,
    TrialFromJSONTyped,
    TrialToJSON,
} from './Trial';
 
/**
 * 
 * @export
 * @interface Subscription
 */
export interface Subscription {
    /**
     * 
     * @type {string}
     * @memberof Subscription
     */
    uuid: string;
    /**
     * Unique name identifier of a customer
     * @type {any}
     * @memberof Subscription
     */
    customerName: any | null;
    /**
     * Unique name indentifier of a price plan
     * @type {any}
     * @memberof Subscription
     */
    readonly pricePlanName: any | null;
    /**
     * External facing unique identifier of a price plan
     * @type {any}
     * @memberof Subscription
     */
    readonly pricePlanUuid: any | null;
    /**
     * Price plan associated with this subscription.
     * @type {PricePlan}
     * @memberof Subscription
     */
    pricePlan?: PricePlan | null;
    /**
     * Align billing cycles to a calendar unit if true. For example if the period is month, cycles will end on the first of every month.
     * @type {boolean}
     * @memberof Subscription
     */
    alignToCalendar?: boolean;
    /**
     * 
     * @type {Array<Discount>}
     * @memberof Subscription
     */
    discounts?: Array<Discount>;
    /**
     * 
     * @type {any}
     * @memberof Subscription
     */
    readonly addOns?: any | null;
    /**
     * Optional trial override for the associated subscription.
     * @type {Trial}
     * @memberof Subscription
     */
    trialOverride?: Trial | null;
    /**
     * Optional base price override for the associated subscription.
     * @type {number}
     * @memberof Subscription
     */
    basePriceOverride?: number | null;
    /**
     * 
     * @type {Array<Feature>}
     * @memberof Subscription
     */
    featuresOverride?: Array<Feature>;
    /**
     * 
     * @type {Array<Limit>}
     * @memberof Subscription
     */
    limitsOverride?: Array<Limit>;
    /**
     * ISO-8601 formatted timestamp that defines when the subscription should take effect. If this field is omitted, the subscription is effective upon creation.
     * @type {Date}
     * @memberof Subscription
     */
    effectiveAt?: Date;
    /**
     * ISO-8601 formatted timestamp that defines when the subscription will expire.
     * @type {Date}
     * @memberof Subscription
     */
    expiredAt?: Date | null;
    /**
     * Credit plan associated with this subscription.
     * @type {CreditPlan}
     * @memberof Subscription
     */
    creditPlan?: CreditPlan | null;
}
 
export function SubscriptionFromJSON(json: any): Subscription {
    return SubscriptionFromJSONTyped(json, false);
}
 
export function SubscriptionFromJSONTyped(json: any, ignoreDiscriminator: boolean): Subscription {
    if ((json === undefined) || (json === null)) {
        return json;
    }
    return {
        
        'uuid': json['uuid'],
        'customerName': json['customer_name'],
        'pricePlanName': json['price_plan_name'],
        'pricePlanUuid': json['price_plan_uuid'],
        'pricePlan': !exists(json, 'price_plan') ? undefined : PricePlanFromJSON(json['price_plan']),
        'alignToCalendar': !exists(json, 'align_to_calendar') ? undefined : json['align_to_calendar'],
        'discounts': !exists(json, 'discounts') ? undefined : ((json['discounts'] as Array<any>).map(DiscountFromJSON)),
        'addOns': !exists(json, 'add_ons') ? undefined : json['add_ons'],
        'trialOverride': !exists(json, 'trial_override') ? undefined : TrialFromJSON(json['trial_override']),
        'basePriceOverride': !exists(json, 'base_price_override') ? undefined : json['base_price_override'],
        'featuresOverride': !exists(json, 'features_override') ? undefined : ((json['features_override'] as Array<any>).map(FeatureFromJSON)),
        'limitsOverride': !exists(json, 'limits_override') ? undefined : ((json['limits_override'] as Array<any>).map(LimitFromJSON)),
        'effectiveAt': !exists(json, 'effective_at') ? undefined : (new Date(json['effective_at'])),
        'expiredAt': !exists(json, 'expired_at') ? undefined : (json['expired_at'] === null ? null : new Date(json['expired_at'])),
        'creditPlan': !exists(json, 'credit_plan') ? undefined : CreditPlanFromJSON(json['credit_plan']),
    };
}
 
export function SubscriptionToJSON(value?: Subscription | null): any {
    if (value === undefined) {
        return undefined;
    }
    if (value === null) {
        return null;
    }
    return {
        
        'uuid': value.uuid,
        'customer_name': value.customerName,
        'price_plan': PricePlanToJSON(value.pricePlan),
        'align_to_calendar': value.alignToCalendar,
        'discounts': value.discounts === undefined ? undefined : ((value.discounts as Array<any>).map(DiscountToJSON)),
        'trial_override': TrialToJSON(value.trialOverride),
        'base_price_override': value.basePriceOverride,
        'features_override': value.featuresOverride === undefined ? undefined : ((value.featuresOverride as Array<any>).map(FeatureToJSON)),
        'limits_override': value.limitsOverride === undefined ? undefined : ((value.limitsOverride as Array<any>).map(LimitToJSON)),
        'effective_at': value.effectiveAt === undefined ? undefined : (value.effectiveAt.toISOString()),
        'expired_at': value.expiredAt === undefined ? undefined : (value.expiredAt === null ? null : value.expiredAt.toISOString()),
        'credit_plan': CreditPlanToJSON(value.creditPlan),
    };
}