From 2523effff8c064ef5b5c9362774acef4609fe4ec Mon Sep 17 00:00:00 2001 From: thanhtr Date: Thu, 16 Apr 2020 15:59:14 +0300 Subject: [PATCH] Clean up and convert ts files --- maas-schemas-ts/src/core/components/state.ts | 55 ++++++ .../subscriptions/subscription-intent.ts | 186 ++++++++++++++++++ .../subscriptions-intents-create/request.ts | 86 ++++++++ .../subscriptions-intents-create/response.ts | 72 +++++++ .../subscriptions-intents-list/request.ts | 88 +++++++++ .../subscriptions-intents-list/response.ts | 69 +++++++ .../subscriptions-intents-retrieve/request.ts | 85 ++++++++ .../response.ts | 69 +++++++ .../request.ts | 97 +++++++++ .../response.ts | 69 +++++++ maas-schemas-ts/translation.log | 18 ++ .../subscriptions/subscription-intent.json | 6 +- .../response.json | 2 +- .../subscriptions-intents-list/response.json | 2 +- .../response.json | 2 +- .../response.json | 2 +- 16 files changed, 901 insertions(+), 7 deletions(-) create mode 100644 maas-schemas-ts/src/maas-backend/subscriptions/subscription-intent.ts create mode 100644 maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-create/request.ts create mode 100644 maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-create/response.ts create mode 100644 maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-list/request.ts create mode 100644 maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-list/response.ts create mode 100644 maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-retrieve/request.ts create mode 100644 maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-retrieve/response.ts create mode 100644 maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-update-state/request.ts create mode 100644 maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-update-state/response.ts diff --git a/maas-schemas-ts/src/core/components/state.ts b/maas-schemas-ts/src/core/components/state.ts index 852bd562d..4a93a17b9 100644 --- a/maas-schemas-ts/src/core/components/state.ts +++ b/maas-schemas-ts/src/core/components/state.ts @@ -157,6 +157,61 @@ export interface ItineraryStateBrand { readonly ItineraryState: unique symbol; } +// SubscriptionIntentState +// The life-cycle state of an subscription intent +export type SubscriptionIntentState = t.Branded< + string & + ( + | 'START' + | 'DETAILS' + | 'CUSTOMISATION' + | 'PAYMENT' + | 'AUTH' + | 'VERIFICATION' + | 'CANCELLED' + | 'CANCELLED_WITH_ERRORS' + | 'FINISHED' + ), + SubscriptionIntentStateBrand +>; +export const SubscriptionIntentState = t.brand( + t.intersection([ + t.string, + t.union([ + t.literal('START'), + t.literal('DETAILS'), + t.literal('CUSTOMISATION'), + t.literal('PAYMENT'), + t.literal('AUTH'), + t.literal('VERIFICATION'), + t.literal('CANCELLED'), + t.literal('CANCELLED_WITH_ERRORS'), + t.literal('FINISHED'), + ]), + ]), + ( + x, + ): x is t.Branded< + string & + ( + | 'START' + | 'DETAILS' + | 'CUSTOMISATION' + | 'PAYMENT' + | 'AUTH' + | 'VERIFICATION' + | 'CANCELLED' + | 'CANCELLED_WITH_ERRORS' + | 'FINISHED' + ), + SubscriptionIntentStateBrand + > => true, + 'SubscriptionIntentState', +); +export interface SubscriptionIntentStateBrand { + readonly SubscriptionIntentState: unique symbol; +} + // State // The default export. More information at the top. export type State = t.Branded; diff --git a/maas-schemas-ts/src/maas-backend/subscriptions/subscription-intent.ts b/maas-schemas-ts/src/maas-backend/subscriptions/subscription-intent.ts new file mode 100644 index 000000000..1a4a6a705 --- /dev/null +++ b/maas-schemas-ts/src/maas-backend/subscriptions/subscription-intent.ts @@ -0,0 +1,186 @@ +/* + +undefined +MaaS subscription intent schema + +!!! AUTO GENERATED BY CONVERT.TS REFRAIN FROM MANUAL EDITING !!! + +*/ + +import * as t from 'io-ts'; +import * as State_ from 'maas-schemas-ts/core/components/state'; +import * as Units_ from 'maas-schemas-ts/core/components/units'; +import * as StateLog_ from 'maas-schemas-ts/core/components/state-log'; + +type Defined = + | Record + | Array + | string + | boolean + | number + | null; +const Defined = t.union([ + t.UnknownRecord, + t.UnknownArray, + t.string, + t.boolean, + t.number, + t.null, +]); + +export const schemaId = + 'http://maasglobal.com/maas-backend/subscriptions/subscription-intent.json'; + +// ItemId +// The purpose of this remains a mystery +export type ItemId = t.Branded; +export const ItemId = t.brand( + t.string, + (x): x is t.Branded => + (typeof x !== 'string' || x.length >= 1) && + (typeof x !== 'string' || x.length <= 255), + 'ItemId', +); +export interface ItemIdBrand { + readonly ItemId: unique symbol; +} + +// SubscriptionIntentCreate +// The purpose of this remains a mystery +export type SubscriptionIntentCreate = t.Branded< + { + planId?: ItemId; + planAddons?: Array; + state?: State_.SubscriptionIntentState; + startTime?: Units_.Time; + } & { + planId: Defined; + planAddons: Defined; + }, + SubscriptionIntentCreateBrand +>; +export const SubscriptionIntentCreate = t.brand( + t.intersection([ + t.partial({ + planId: ItemId, + planAddons: t.array(ItemId), + state: State_.SubscriptionIntentState, + startTime: Units_.Time, + }), + t.type({ + planId: Defined, + planAddons: Defined, + }), + ]), + ( + x, + ): x is t.Branded< + { + planId?: ItemId; + planAddons?: Array; + state?: State_.SubscriptionIntentState; + startTime?: Units_.Time; + } & { + planId: Defined; + planAddons: Defined; + }, + SubscriptionIntentCreateBrand + > => true, + 'SubscriptionIntentCreate', +); +export interface SubscriptionIntentCreateBrand { + readonly SubscriptionIntentCreate: unique symbol; +} + +// SubscriptionIntentBase +// The purpose of this remains a mystery +export type SubscriptionIntentBase = t.Branded< + { + id?: Units_.Uuid; + identityId?: Units_.IdentityId; + subscriptionId?: Units_.IdentityId; + nextPlanId?: ItemId; + nextPlanAddons?: Array; + prevPlanId?: ItemId; + prevPlanAddons?: Array; + startTime?: Units_.Time; + state?: State_.SubscriptionIntentState; + stateLog?: StateLog_.StateLog; + created?: Units_.Time; + modified?: Units_.Time; + } & { + identityId: Defined; + subscriptionId: Defined; + nextPlanId: Defined; + nextPlanAddons: Defined; + }, + SubscriptionIntentBaseBrand +>; +export const SubscriptionIntentBase = t.brand( + t.intersection([ + t.partial({ + id: Units_.Uuid, + identityId: Units_.IdentityId, + subscriptionId: Units_.IdentityId, + nextPlanId: ItemId, + nextPlanAddons: t.array(ItemId), + prevPlanId: ItemId, + prevPlanAddons: t.array(ItemId), + startTime: Units_.Time, + state: State_.SubscriptionIntentState, + stateLog: StateLog_.StateLog, + created: Units_.Time, + modified: Units_.Time, + }), + t.type({ + identityId: Defined, + subscriptionId: Defined, + nextPlanId: Defined, + nextPlanAddons: Defined, + }), + ]), + ( + x, + ): x is t.Branded< + { + id?: Units_.Uuid; + identityId?: Units_.IdentityId; + subscriptionId?: Units_.IdentityId; + nextPlanId?: ItemId; + nextPlanAddons?: Array; + prevPlanId?: ItemId; + prevPlanAddons?: Array; + startTime?: Units_.Time; + state?: State_.SubscriptionIntentState; + stateLog?: StateLog_.StateLog; + created?: Units_.Time; + modified?: Units_.Time; + } & { + identityId: Defined; + subscriptionId: Defined; + nextPlanId: Defined; + nextPlanAddons: Defined; + }, + SubscriptionIntentBaseBrand + > => true, + 'SubscriptionIntentBase', +); +export interface SubscriptionIntentBaseBrand { + readonly SubscriptionIntentBase: unique symbol; +} + +// SubscriptionIntent +// The default export. More information at the top. +export type SubscriptionIntent = t.Branded; +export const SubscriptionIntent = t.brand( + t.unknown, + (x): x is t.Branded => true, + 'SubscriptionIntent', +); +export interface SubscriptionIntentBrand { + readonly SubscriptionIntent: unique symbol; +} + +export default SubscriptionIntent; + +// Success diff --git a/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-create/request.ts b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-create/request.ts new file mode 100644 index 000000000..0110e5e10 --- /dev/null +++ b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-create/request.ts @@ -0,0 +1,86 @@ +/* + +undefined +Request schema for subscriptions-intents-create + +!!! AUTO GENERATED BY CONVERT.TS REFRAIN FROM MANUAL EDITING !!! + +*/ + +import * as t from 'io-ts'; +import * as Units_ from 'maas-schemas-ts/core/components/units'; +import * as SubscriptionIntent_ from 'maas-schemas-ts/maas-backend/subscriptions/subscription-intent'; +import * as ApiCommon_ from 'maas-schemas-ts/core/components/api-common'; + +type Defined = + | Record + | Array + | string + | boolean + | number + | null; +const Defined = t.union([ + t.UnknownRecord, + t.UnknownArray, + t.string, + t.boolean, + t.number, + t.null, +]); + +export const schemaId = + 'http://maasglobal.com/maas-backend/subscriptions/subscriptions-intents-create/request.json'; + +// Request +// The default export. More information at the top. +export type Request = t.Branded< + { + customerId?: Units_.IdentityId; + userId?: Units_.IdentityId; + payload?: SubscriptionIntent_.SubscriptionIntentCreate; + headers?: ApiCommon_.Headers; + } & { + customerId: Defined; + userId: Defined; + payload: Defined; + }, + RequestBrand +>; +export const Request = t.brand( + t.intersection([ + t.partial({ + customerId: Units_.IdentityId, + userId: Units_.IdentityId, + payload: SubscriptionIntent_.SubscriptionIntentCreate, + headers: ApiCommon_.Headers, + }), + t.type({ + customerId: Defined, + userId: Defined, + payload: Defined, + }), + ]), + ( + x, + ): x is t.Branded< + { + customerId?: Units_.IdentityId; + userId?: Units_.IdentityId; + payload?: SubscriptionIntent_.SubscriptionIntentCreate; + headers?: ApiCommon_.Headers; + } & { + customerId: Defined; + userId: Defined; + payload: Defined; + }, + RequestBrand + > => true, + 'Request', +); +export interface RequestBrand { + readonly Request: unique symbol; +} + +export default Request; + +// Success diff --git a/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-create/response.ts b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-create/response.ts new file mode 100644 index 000000000..e3d36cab2 --- /dev/null +++ b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-create/response.ts @@ -0,0 +1,72 @@ +/* + +undefined +Response schema for subscriptions-intents-create + +!!! AUTO GENERATED BY CONVERT.TS REFRAIN FROM MANUAL EDITING !!! + +*/ + +import * as t from 'io-ts'; +import * as SubscriptionIntent_ from 'maas-schemas-ts/maas-backend/subscriptions/subscription-intent'; + +type Defined = + | Record + | Array + | string + | boolean + | number + | null; +const Defined = t.union([ + t.UnknownRecord, + t.UnknownArray, + t.string, + t.boolean, + t.number, + t.null, +]); + +export const schemaId = + 'http://maasglobal.com/maas-backend/subscriptions/subscriptions-intents-create/response.json'; + +// Response +// The default export. More information at the top. +export type Response = t.Branded< + { + subscriptionIntent?: SubscriptionIntent_.SubscriptionIntentBase; + debug?: {}; + } & { + subscriptionIntent: Defined; + }, + ResponseBrand +>; +export const Response = t.brand( + t.intersection([ + t.partial({ + subscriptionIntent: SubscriptionIntent_.SubscriptionIntentBase, + debug: t.type({}), + }), + t.type({ + subscriptionIntent: Defined, + }), + ]), + ( + x, + ): x is t.Branded< + { + subscriptionIntent?: SubscriptionIntent_.SubscriptionIntentBase; + debug?: {}; + } & { + subscriptionIntent: Defined; + }, + ResponseBrand + > => true, + 'Response', +); +export interface ResponseBrand { + readonly Response: unique symbol; +} + +export default Response; + +// Success diff --git a/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-list/request.ts b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-list/request.ts new file mode 100644 index 000000000..2015472aa --- /dev/null +++ b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-list/request.ts @@ -0,0 +1,88 @@ +/* + +undefined +Request schema for subscriptions-intents-list + +!!! AUTO GENERATED BY CONVERT.TS REFRAIN FROM MANUAL EDITING !!! + +*/ + +import * as t from 'io-ts'; +import * as Units_ from 'maas-schemas-ts/core/components/units'; +import * as ApiCommon_ from 'maas-schemas-ts/core/components/api-common'; + +type Defined = + | Record + | Array + | string + | boolean + | number + | null; +const Defined = t.union([ + t.UnknownRecord, + t.UnknownArray, + t.string, + t.boolean, + t.number, + t.null, +]); + +export const schemaId = + 'http://maasglobal.com/maas-backend/subscriptions/subscriptions-intents-list/request.json'; + +// Request +// The default export. More information at the top. +export type Request = t.Branded< + { + customerId?: Units_.IdentityId; + userId?: Units_.IdentityId; + payload?: { + states?: string; + }; + headers?: ApiCommon_.Headers; + } & { + customerId: Defined; + userId: Defined; + }, + RequestBrand +>; +export const Request = t.brand( + t.intersection([ + t.partial({ + customerId: Units_.IdentityId, + userId: Units_.IdentityId, + payload: t.partial({ + states: t.string, + }), + headers: ApiCommon_.Headers, + }), + t.type({ + customerId: Defined, + userId: Defined, + }), + ]), + ( + x, + ): x is t.Branded< + { + customerId?: Units_.IdentityId; + userId?: Units_.IdentityId; + payload?: { + states?: string; + }; + headers?: ApiCommon_.Headers; + } & { + customerId: Defined; + userId: Defined; + }, + RequestBrand + > => true, + 'Request', +); +export interface RequestBrand { + readonly Request: unique symbol; +} + +export default Request; + +// Success diff --git a/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-list/response.ts b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-list/response.ts new file mode 100644 index 000000000..d25c29b24 --- /dev/null +++ b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-list/response.ts @@ -0,0 +1,69 @@ +/* + +undefined +Response schema for subscriptions-intents-create + +!!! AUTO GENERATED BY CONVERT.TS REFRAIN FROM MANUAL EDITING !!! + +*/ + +import * as t from 'io-ts'; +import * as SubscriptionIntent_ from 'maas-schemas-ts/maas-backend/subscriptions/subscription-intent'; + +type Defined = + | Record + | Array + | string + | boolean + | number + | null; +const Defined = t.union([ + t.UnknownRecord, + t.UnknownArray, + t.string, + t.boolean, + t.number, + t.null, +]); + +export const schemaId = + 'http://maasglobal.com/maas-backend/subscriptions/subscriptions-intents-list/response.json'; + +// Response +// The default export. More information at the top. +export type Response = t.Branded< + { + subscriptionIntents?: Array; + } & { + subscriptionIntents: Defined; + }, + ResponseBrand +>; +export const Response = t.brand( + t.intersection([ + t.partial({ + subscriptionIntents: t.array(SubscriptionIntent_.SubscriptionIntentBase), + }), + t.type({ + subscriptionIntents: Defined, + }), + ]), + ( + x, + ): x is t.Branded< + { + subscriptionIntents?: Array; + } & { + subscriptionIntents: Defined; + }, + ResponseBrand + > => true, + 'Response', +); +export interface ResponseBrand { + readonly Response: unique symbol; +} + +export default Response; + +// Success diff --git a/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-retrieve/request.ts b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-retrieve/request.ts new file mode 100644 index 000000000..3cd2b3d10 --- /dev/null +++ b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-retrieve/request.ts @@ -0,0 +1,85 @@ +/* + +undefined +Request schema for subscriptions-intents-retrieve + +!!! AUTO GENERATED BY CONVERT.TS REFRAIN FROM MANUAL EDITING !!! + +*/ + +import * as t from 'io-ts'; +import * as Units_ from 'maas-schemas-ts/core/components/units'; +import * as ApiCommon_ from 'maas-schemas-ts/core/components/api-common'; + +type Defined = + | Record + | Array + | string + | boolean + | number + | null; +const Defined = t.union([ + t.UnknownRecord, + t.UnknownArray, + t.string, + t.boolean, + t.number, + t.null, +]); + +export const schemaId = + 'http://maasglobal.com/maas-backend/subscriptions/subscriptions-intents-retrieve/request.json'; + +// Request +// The default export. More information at the top. +export type Request = t.Branded< + { + customerId?: Units_.IdentityId; + userId?: Units_.IdentityId; + subscriptionIntentId?: Units_.Uuid; + headers?: ApiCommon_.Headers; + } & { + customerId: Defined; + userId: Defined; + subscriptionIntentId: Defined; + }, + RequestBrand +>; +export const Request = t.brand( + t.intersection([ + t.partial({ + customerId: Units_.IdentityId, + userId: Units_.IdentityId, + subscriptionIntentId: Units_.Uuid, + headers: ApiCommon_.Headers, + }), + t.type({ + customerId: Defined, + userId: Defined, + subscriptionIntentId: Defined, + }), + ]), + ( + x, + ): x is t.Branded< + { + customerId?: Units_.IdentityId; + userId?: Units_.IdentityId; + subscriptionIntentId?: Units_.Uuid; + headers?: ApiCommon_.Headers; + } & { + customerId: Defined; + userId: Defined; + subscriptionIntentId: Defined; + }, + RequestBrand + > => true, + 'Request', +); +export interface RequestBrand { + readonly Request: unique symbol; +} + +export default Request; + +// Success diff --git a/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-retrieve/response.ts b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-retrieve/response.ts new file mode 100644 index 000000000..01d478086 --- /dev/null +++ b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-retrieve/response.ts @@ -0,0 +1,69 @@ +/* + +undefined +Response schema for subscriptions-intents-create + +!!! AUTO GENERATED BY CONVERT.TS REFRAIN FROM MANUAL EDITING !!! + +*/ + +import * as t from 'io-ts'; +import * as SubscriptionIntent_ from 'maas-schemas-ts/maas-backend/subscriptions/subscription-intent'; + +type Defined = + | Record + | Array + | string + | boolean + | number + | null; +const Defined = t.union([ + t.UnknownRecord, + t.UnknownArray, + t.string, + t.boolean, + t.number, + t.null, +]); + +export const schemaId = + 'http://maasglobal.com/maas-backend/subscriptions/subscriptions-intents-retrieve/response.json'; + +// Response +// The default export. More information at the top. +export type Response = t.Branded< + { + subscriptionIntent?: SubscriptionIntent_.SubscriptionIntentBase; + } & { + subscriptionIntent: Defined; + }, + ResponseBrand +>; +export const Response = t.brand( + t.intersection([ + t.partial({ + subscriptionIntent: SubscriptionIntent_.SubscriptionIntentBase, + }), + t.type({ + subscriptionIntent: Defined, + }), + ]), + ( + x, + ): x is t.Branded< + { + subscriptionIntent?: SubscriptionIntent_.SubscriptionIntentBase; + } & { + subscriptionIntent: Defined; + }, + ResponseBrand + > => true, + 'Response', +); +export interface ResponseBrand { + readonly Response: unique symbol; +} + +export default Response; + +// Success diff --git a/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-update-state/request.ts b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-update-state/request.ts new file mode 100644 index 000000000..d5a932afa --- /dev/null +++ b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-update-state/request.ts @@ -0,0 +1,97 @@ +/* + +undefined +Request schema for subscriptions-intents-update-state + +!!! AUTO GENERATED BY CONVERT.TS REFRAIN FROM MANUAL EDITING !!! + +*/ + +import * as t from 'io-ts'; +import * as Units_ from 'maas-schemas-ts/core/components/units'; +import * as ApiCommon_ from 'maas-schemas-ts/core/components/api-common'; + +type Defined = + | Record + | Array + | string + | boolean + | number + | null; +const Defined = t.union([ + t.UnknownRecord, + t.UnknownArray, + t.string, + t.boolean, + t.number, + t.null, +]); + +export const schemaId = + 'http://maasglobal.com/maas-backend/subscriptions/subscriptions-intents-update-state/request.json'; + +// Request +// The default export. More information at the top. +export type Request = t.Branded< + { + customerId?: Units_.IdentityId; + userId?: Units_.IdentityId; + subscriptionIntentId?: Units_.Uuid; + payload?: { + state?: string; + }; + headers?: ApiCommon_.Headers; + } & { + customerId: Defined; + userId: Defined; + subscriptionIntentId: Defined; + payload: Defined; + }, + RequestBrand +>; +export const Request = t.brand( + t.intersection([ + t.partial({ + customerId: Units_.IdentityId, + userId: Units_.IdentityId, + subscriptionIntentId: Units_.Uuid, + payload: t.partial({ + state: t.string, + }), + headers: ApiCommon_.Headers, + }), + t.type({ + customerId: Defined, + userId: Defined, + subscriptionIntentId: Defined, + payload: Defined, + }), + ]), + ( + x, + ): x is t.Branded< + { + customerId?: Units_.IdentityId; + userId?: Units_.IdentityId; + subscriptionIntentId?: Units_.Uuid; + payload?: { + state?: string; + }; + headers?: ApiCommon_.Headers; + } & { + customerId: Defined; + userId: Defined; + subscriptionIntentId: Defined; + payload: Defined; + }, + RequestBrand + > => true, + 'Request', +); +export interface RequestBrand { + readonly Request: unique symbol; +} + +export default Request; + +// Success diff --git a/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-update-state/response.ts b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-update-state/response.ts new file mode 100644 index 000000000..53d04d5b6 --- /dev/null +++ b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-update-state/response.ts @@ -0,0 +1,69 @@ +/* + +undefined +Response schema for subscriptions-intents-create + +!!! AUTO GENERATED BY CONVERT.TS REFRAIN FROM MANUAL EDITING !!! + +*/ + +import * as t from 'io-ts'; +import * as SubscriptionIntent_ from 'maas-schemas-ts/maas-backend/subscriptions/subscription-intent'; + +type Defined = + | Record + | Array + | string + | boolean + | number + | null; +const Defined = t.union([ + t.UnknownRecord, + t.UnknownArray, + t.string, + t.boolean, + t.number, + t.null, +]); + +export const schemaId = + 'http://maasglobal.com/maas-backend/subscriptions/subscriptions-intents-update-state/response.json'; + +// Response +// The default export. More information at the top. +export type Response = t.Branded< + { + subscriptionIntent?: SubscriptionIntent_.SubscriptionIntentBase; + } & { + subscriptionIntent: Defined; + }, + ResponseBrand +>; +export const Response = t.brand( + t.intersection([ + t.partial({ + subscriptionIntent: SubscriptionIntent_.SubscriptionIntentBase, + }), + t.type({ + subscriptionIntent: Defined, + }), + ]), + ( + x, + ): x is t.Branded< + { + subscriptionIntent?: SubscriptionIntent_.SubscriptionIntentBase; + } & { + subscriptionIntent: Defined; + }, + ResponseBrand + > => true, + 'Response', +); +export interface ResponseBrand { + readonly Response: unique symbol; +} + +export default Response; + +// Success diff --git a/maas-schemas-ts/translation.log b/maas-schemas-ts/translation.log index 642d601cd..e700f4225 100644 --- a/maas-schemas-ts/translation.log +++ b/maas-schemas-ts/translation.log @@ -1650,6 +1650,18 @@ WARNING: minItems field not supported outside top-level definitions in ./maas-backend/subscriptions/subscriptionOption.json INFO: missing description in ./maas-backend/subscriptions/subscriptionOption.json +INFO: primitive type "string" used outside top-level definitions + in ./maas-backend/subscriptions/subscriptions-intents-list/request.json +WARNING: minLength field not supported outside top-level definitions + in ./maas-backend/subscriptions/subscriptions-intents-list/request.json +WARNING: maxLength field not supported outside top-level definitions + in ./maas-backend/subscriptions/subscriptions-intents-list/request.json +INFO: primitive type "string" used outside top-level definitions + in ./maas-backend/subscriptions/subscriptions-intents-update-state/request.json +WARNING: minLength field not supported outside top-level definitions + in ./maas-backend/subscriptions/subscriptions-intents-update-state/request.json +WARNING: maxLength field not supported outside top-level definitions + in ./maas-backend/subscriptions/subscriptions-intents-update-state/request.json INFO: primitive type "string" used outside top-level definitions in ./maas-backend/subscriptions/subscriptions-options/request.json WARNING: minLength field not supported outside top-level definitions @@ -1658,6 +1670,12 @@ WARNING: maxLength field not supported outside top-level definitions in ./maas-backend/subscriptions/subscriptions-options/request.json WARNING: default field not supported outside top-level definitions in ./maas-backend/subscriptions/subscriptions-retrieve/request.json +INFO: missing description + in ./maas-backend/subscriptions/subscription-intent.json +INFO: missing description + in ./maas-backend/subscriptions/subscription-intent.json +INFO: missing description + in ./maas-backend/subscriptions/subscription-intent.json INFO: primitive type "string" used outside top-level definitions in ./maas-backend/vehicle/vehicle-alert/request.json WARNING: minLength field not supported outside top-level definitions diff --git a/maas-schemas/schemas/maas-backend/subscriptions/subscription-intent.json b/maas-schemas/schemas/maas-backend/subscriptions/subscription-intent.json index 63af394fb..0462165cc 100644 --- a/maas-schemas/schemas/maas-backend/subscriptions/subscription-intent.json +++ b/maas-schemas/schemas/maas-backend/subscriptions/subscription-intent.json @@ -19,9 +19,9 @@ }, "startTime": { "$ref": "http://maasglobal.com/core/components/units.json#/definitions/time" - }, - "required": ["planId", "planAddons"] - } + } + }, + "required": ["planId", "planAddons"] }, "subscriptionIntentBase": { "type": "object", diff --git a/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-create/response.json b/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-create/response.json index 92e454a9a..c62aa4ee6 100644 --- a/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-create/response.json +++ b/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-create/response.json @@ -4,7 +4,7 @@ "type": "object", "properties": { "subscriptionIntent": { - "$ref": "http://maasglobal.com/maas-backend/subscriptions/subscription.json#/definitions/subscriptionIntentBase" + "$ref": "http://maasglobal.com/maas-backend/subscriptions/subscription-intent.json#/definitions/subscriptionIntentBase" }, "debug": { "type": "object", diff --git a/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-list/response.json b/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-list/response.json index 39e7cd218..8f13bce3d 100644 --- a/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-list/response.json +++ b/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-list/response.json @@ -6,7 +6,7 @@ "subscriptionIntents": { "type": "array", "items": { - "$ref": "http://maasglobal.com/maas-backend/subscriptions/subscription.json#/definitions/subscriptionIntentBase" + "$ref": "http://maasglobal.com/maas-backend/subscriptions/subscription-intent.json#/definitions/subscriptionIntentBase" } } }, diff --git a/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-retrieve/response.json b/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-retrieve/response.json index 3fdf5ef63..f26e87e8f 100644 --- a/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-retrieve/response.json +++ b/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-retrieve/response.json @@ -4,7 +4,7 @@ "type": "object", "properties": { "subscriptionIntent": { - "$ref": "http://maasglobal.com/maas-backend/subscriptions/subscription.json#/definitions/subscriptionIntentBase" + "$ref": "http://maasglobal.com/maas-backend/subscriptions/subscription-intent.json#/definitions/subscriptionIntentBase" } }, "required": ["subscriptionIntent"], diff --git a/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-update-state/response.json b/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-update-state/response.json index 209d344f4..6efab9718 100644 --- a/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-update-state/response.json +++ b/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-update-state/response.json @@ -4,7 +4,7 @@ "type": "object", "properties": { "subscriptionIntent": { - "$ref": "http://maasglobal.com/maas-backend/subscriptions/subscription.json#/definitions/subscriptionIntentBase" + "$ref": "http://maasglobal.com/maas-backend/subscriptions/subscription-intent.json#/definitions/subscriptionIntentBase" } }, "required": ["subscriptionIntent"],