All files / codegen/models UpdateSubscriptionArgs.ts

75.98% Statements 155/204
100% Branches 0/0
0% Functions 0/3
75.98% Lines 155/204

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 203 204 205 2061x 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 {
    CreditPlanInputArgs,
    CreditPlanInputArgsFromJSON,
    CreditPlanInputArgsFromJSONTyped,
    CreditPlanInputArgsToJSON,
} from './CreditPlanInputArgs';
import {
    DiscountInputArgs,
    DiscountInputArgsFromJSON,
    DiscountInputArgsFromJSONTyped,
    DiscountInputArgsToJSON,
} from './DiscountInputArgs';
import {
    FeatureInputArgs,
    FeatureInputArgsFromJSON,
    FeatureInputArgsFromJSONTyped,
    FeatureInputArgsToJSON,
} from './FeatureInputArgs';
import {
    LimitInputArgs,
    LimitInputArgsFromJSON,
    LimitInputArgsFromJSONTyped,
    LimitInputArgsToJSON,
} from './LimitInputArgs';
import {
    SubscriptionAddOnInput,
    SubscriptionAddOnInputFromJSON,
    SubscriptionAddOnInputFromJSONTyped,
    SubscriptionAddOnInputToJSON,
} from './SubscriptionAddOnInput';
import {
    TrialInputArgs,
    TrialInputArgsFromJSON,
    TrialInputArgsFromJSONTyped,
    TrialInputArgsToJSON,
} from './TrialInputArgs';
 
/**
 * 
 * @export
 * @interface UpdateSubscriptionArgs
 */
export interface UpdateSubscriptionArgs {
    /**
     * Boolean that indicates whether to update the subscription at the end of the billing cycle. If 'true' and either of `effective_at` or `at_cycle_start` are set, will return an error.
     * @type {boolean}
     * @memberof UpdateSubscriptionArgs
     */
    atCycleEnd?: boolean;
    /**
     * 
     * @type {string}
     * @memberof UpdateSubscriptionArgs
     */
    couponOverrideName?: string;
    /**
     * DEPRECATED - use discounts field
     * @type {DiscountInputArgs}
     * @memberof UpdateSubscriptionArgs
     */
    discountOverride?: DiscountInputArgs | null;
    /**
     * 
     * @type {Array<DiscountInputArgs>}
     * @memberof UpdateSubscriptionArgs
     */
    discounts?: Array<DiscountInputArgs>;
    /**
     * Boolean that indicates whether to update the subscription at the start of the billing cycle. If 'true' and either of `effective_at` or `at_cycle_end` are set, will return an error.
     * @type {boolean}
     * @memberof UpdateSubscriptionArgs
     */
    atCycleStart?: boolean;
    /**
     * The UUID of the specific price plan version to subscribe customer to. Either provide price plan UUID or name/tag but not both.
     * @type {string}
     * @memberof UpdateSubscriptionArgs
     */
    pricePlanUuid?: string;
    /**
     * 
     * @type {Array<FeatureInputArgs>}
     * @memberof UpdateSubscriptionArgs
     */
    featuresOverride?: Array<FeatureInputArgs> | null;
    /**
     * 
     * @type {Array<SubscriptionAddOnInput>}
     * @memberof UpdateSubscriptionArgs
     */
    addOns?: Array<SubscriptionAddOnInput> | null;
    /**
     * The tag of the specific price plan version for the given price_plan_name. Should only be set if identifying price plan by name.
     * @type {string}
     * @memberof UpdateSubscriptionArgs
     */
    pricePlanTag?: string;
    /**
     * 
     * @type {Array<LimitInputArgs>}
     * @memberof UpdateSubscriptionArgs
     */
    limitsOverride?: Array<LimitInputArgs> | null;
    /**
     * The name of the price plan to subscribe customer to. Either provide price plan UUID or name/tag but not both.
     * @type {string}
     * @memberof UpdateSubscriptionArgs
     */
    pricePlanName?: string;
    /**
     * 
     * @type {TrialInputArgs}
     * @memberof UpdateSubscriptionArgs
     */
    trialOverride?: TrialInputArgs | null;
    /**
     * Whether to align this subscripton's billing cycles to calendar boundaries (e.g., begining of every month). If the subscripiton is effective as of the middle of the month, the first cycle will be prorated appropriately.
     * @type {boolean}
     * @memberof UpdateSubscriptionArgs
     */
    alignToCalendar?: boolean;
    /**
     * 
     * @type {Date}
     * @memberof UpdateSubscriptionArgs
     */
    effectiveAt?: Date;
    /**
     * Credit plan associated with this subscription.
     * @type {CreditPlanInputArgs}
     * @memberof UpdateSubscriptionArgs
     */
    creditPlan?: CreditPlanInputArgs | null;
}
 
export function UpdateSubscriptionArgsFromJSON(json: any): UpdateSubscriptionArgs {
    return UpdateSubscriptionArgsFromJSONTyped(json, false);
}
 
export function UpdateSubscriptionArgsFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpdateSubscriptionArgs {
    if ((json === undefined) || (json === null)) {
        return json;
    }
    return {
        
        'atCycleEnd': !exists(json, 'at_cycle_end') ? undefined : json['at_cycle_end'],
        'couponOverrideName': !exists(json, 'coupon_override_name') ? undefined : json['coupon_override_name'],
        'discountOverride': !exists(json, 'discount_override') ? undefined : DiscountInputArgsFromJSON(json['discount_override']),
        'discounts': !exists(json, 'discounts') ? undefined : ((json['discounts'] as Array<any>).map(DiscountInputArgsFromJSON)),
        'atCycleStart': !exists(json, 'at_cycle_start') ? undefined : json['at_cycle_start'],
        'pricePlanUuid': !exists(json, 'price_plan_uuid') ? undefined : json['price_plan_uuid'],
        'featuresOverride': !exists(json, 'features_override') ? undefined : (json['features_override'] === null ? null : (json['features_override'] as Array<any>).map(FeatureInputArgsFromJSON)),
        'addOns': !exists(json, 'add_ons') ? undefined : (json['add_ons'] === null ? null : (json['add_ons'] as Array<any>).map(SubscriptionAddOnInputFromJSON)),
        'pricePlanTag': !exists(json, 'price_plan_tag') ? undefined : json['price_plan_tag'],
        'limitsOverride': !exists(json, 'limits_override') ? undefined : (json['limits_override'] === null ? null : (json['limits_override'] as Array<any>).map(LimitInputArgsFromJSON)),
        'pricePlanName': !exists(json, 'price_plan_name') ? undefined : json['price_plan_name'],
        'trialOverride': !exists(json, 'trial_override') ? undefined : TrialInputArgsFromJSON(json['trial_override']),
        'alignToCalendar': !exists(json, 'align_to_calendar') ? undefined : json['align_to_calendar'],
        'effectiveAt': !exists(json, 'effective_at') ? undefined : (new Date(json['effective_at'])),
        'creditPlan': !exists(json, 'credit_plan') ? undefined : CreditPlanInputArgsFromJSON(json['credit_plan']),
    };
}
 
export function UpdateSubscriptionArgsToJSON(value?: UpdateSubscriptionArgs | null): any {
    if (value === undefined) {
        return undefined;
    }
    if (value === null) {
        return null;
    }
    return {
        
        'at_cycle_end': value.atCycleEnd,
        'coupon_override_name': value.couponOverrideName,
        'discount_override': DiscountInputArgsToJSON(value.discountOverride),
        'discounts': value.discounts === undefined ? undefined : ((value.discounts as Array<any>).map(DiscountInputArgsToJSON)),
        'at_cycle_start': value.atCycleStart,
        'price_plan_uuid': value.pricePlanUuid,
        'features_override': value.featuresOverride === undefined ? undefined : (value.featuresOverride === null ? null : (value.featuresOverride as Array<any>).map(FeatureInputArgsToJSON)),
        'add_ons': value.addOns === undefined ? undefined : (value.addOns === null ? null : (value.addOns as Array<any>).map(SubscriptionAddOnInputToJSON)),
        'price_plan_tag': value.pricePlanTag,
        'limits_override': value.limitsOverride === undefined ? undefined : (value.limitsOverride === null ? null : (value.limitsOverride as Array<any>).map(LimitInputArgsToJSON)),
        'price_plan_name': value.pricePlanName,
        'trial_override': TrialInputArgsToJSON(value.trialOverride),
        'align_to_calendar': value.alignToCalendar,
        'effective_at': value.effectiveAt === undefined ? undefined : (value.effectiveAt.toISOString()),
        'credit_plan': CreditPlanInputArgsToJSON(value.creditPlan),
    };
}