wallee
Version:
TypeScript/JavaScript client for wallee
57 lines (56 loc) • 3.38 kB
JavaScript
import { SubscriptionAffiliateFromJSON, SubscriptionAffiliateToJSON, } from './SubscriptionAffiliate';
import { SubscriberFromJSON, SubscriberToJSON, } from './Subscriber';
import { SubscriptionStateFromJSON, SubscriptionStateToJSON, } from './SubscriptionState';
import { TokenFromJSON, TokenToJSON, } from './Token';
import { SubscriptionProductVersionFromJSON, SubscriptionProductVersionToJSON, } from './SubscriptionProductVersion';
/**
* Check if a given object implements the Subscription interface.
*/
export function instanceOfSubscription(value) {
return true;
}
export function SubscriptionFromJSON(json) {
return SubscriptionFromJSONTyped(json, false);
}
export function SubscriptionFromJSONTyped(json, ignoreDiscriminator) {
if (json == null) {
return json;
}
return {
'subscriber': json['subscriber'] == null ? undefined : SubscriberFromJSON(json['subscriber']),
'plannedPurgeDate': json['plannedPurgeDate'] == null ? undefined : (new Date(json['plannedPurgeDate'])),
'terminatedBy': json['terminatedBy'] == null ? undefined : json['terminatedBy'],
'description': json['description'] == null ? undefined : json['description'],
'language': json['language'] == null ? undefined : json['language'],
'initializedOn': json['initializedOn'] == null ? undefined : (new Date(json['initializedOn'])),
'createdOn': json['createdOn'] == null ? undefined : (new Date(json['createdOn'])),
'version': json['version'] == null ? undefined : json['version'],
'token': json['token'] == null ? undefined : TokenFromJSON(json['token']),
'reference': json['reference'] == null ? undefined : json['reference'],
'terminatedOn': json['terminatedOn'] == null ? undefined : (new Date(json['terminatedOn'])),
'linkedSpaceId': json['linkedSpaceId'] == null ? undefined : json['linkedSpaceId'],
'activatedOn': json['activatedOn'] == null ? undefined : (new Date(json['activatedOn'])),
'terminatingOn': json['terminatingOn'] == null ? undefined : (new Date(json['terminatingOn'])),
'currentProductVersion': json['currentProductVersion'] == null ? undefined : SubscriptionProductVersionFromJSON(json['currentProductVersion']),
'plannedTerminationDate': json['plannedTerminationDate'] == null ? undefined : (new Date(json['plannedTerminationDate'])),
'id': json['id'] == null ? undefined : json['id'],
'state': json['state'] == null ? undefined : SubscriptionStateFromJSON(json['state']),
'affiliate': json['affiliate'] == null ? undefined : SubscriptionAffiliateFromJSON(json['affiliate']),
'terminationScheduledOn': json['terminationScheduledOn'] == null ? undefined : (new Date(json['terminationScheduledOn'])),
};
}
export function SubscriptionToJSON(json) {
return SubscriptionToJSONTyped(json, false);
}
export function SubscriptionToJSONTyped(value, ignoreDiscriminator = false) {
if (value == null) {
return value;
}
return {
'subscriber': SubscriberToJSON(value['subscriber']),
'token': TokenToJSON(value['token']),
'currentProductVersion': SubscriptionProductVersionToJSON(value['currentProductVersion']),
'state': SubscriptionStateToJSON(value['state']),
'affiliate': SubscriptionAffiliateToJSON(value['affiliate']),
};
}