diff --git a/maas-schemas-ts/package.json b/maas-schemas-ts/package.json index b7c24655d..34dc9f4aa 100644 --- a/maas-schemas-ts/package.json +++ b/maas-schemas-ts/package.json @@ -1,6 +1,6 @@ { "name": "maas-schemas-ts", - "version": "14.2.1", + "version": "14.3.0", "description": "TypeScript types and io-ts validators for maas-schemas", "main": "index.js", "files": [ diff --git a/maas-schemas-ts/src/core/components/state.ts b/maas-schemas-ts/src/core/components/state.ts index 7559fcd19..06a701062 100644 --- a/maas-schemas-ts/src/core/components/state.ts +++ b/maas-schemas-ts/src/core/components/state.ts @@ -158,6 +158,58 @@ 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' + | '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('VERIFICATION'), + t.literal('CANCELLED'), + t.literal('CANCELLED_WITH_ERRORS'), + t.literal('FINISHED'), + ]), + ]), + ( + x, + ): x is t.Branded< + string & + ( + | 'START' + | 'DETAILS' + | 'CUSTOMISATION' + | 'PAYMENT' + | '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..d50949c56 --- /dev/null +++ b/maas-schemas-ts/src/maas-backend/subscriptions/subscription-intent.ts @@ -0,0 +1,218 @@ +/* + +undefined +MaaS subscription intent schema + +!!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!! +See https://www.npmjs.com/package/io-ts-from-json-schema + +*/ + +import * as t from 'io-ts'; +import * as State_ from '../../core/components/state'; +import * as Units_ from '../../core/components/units'; +import * as StateLog_ from '../../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'; + +// PlanId +// The purpose of this remains a mystery +export type PlanId = t.Branded; +export const PlanId = t.brand( + t.string, + (x): x is t.Branded => + (typeof x !== 'string' || x.length >= 2) && + (typeof x !== 'string' || x.length <= 255), + 'PlanId', +); +export interface PlanIdBrand { + readonly PlanId: unique symbol; +} + +// AddonId +// The purpose of this remains a mystery +export type AddonId = t.Branded; +export const AddonId = t.brand( + t.string, + (x): x is t.Branded => + (typeof x !== 'string' || x.length >= 2) && + (typeof x !== 'string' || x.length <= 255), + 'AddonId', +); +export interface AddonIdBrand { + readonly AddonId: unique symbol; +} + +// CouponId +// The purpose of this remains a mystery +export type CouponId = t.Branded; +export const CouponId = t.brand( + t.string, + (x): x is t.Branded => + (typeof x !== 'string' || x.length >= 2) && + (typeof x !== 'string' || x.length <= 255), + 'CouponId', +); +export interface CouponIdBrand { + readonly CouponId: unique symbol; +} + +// SubscriptionIntentCreate +// The purpose of this remains a mystery +export type SubscriptionIntentCreate = t.Branded< + { + planId?: PlanId; + planAddons?: Array; + coupons?: Array; + state?: State_.SubscriptionIntentState; + } & { + planId: Defined; + planAddons: Defined; + }, + SubscriptionIntentCreateBrand +>; +export const SubscriptionIntentCreate = t.brand( + t.intersection([ + t.partial({ + planId: PlanId, + planAddons: t.array(AddonId), + coupons: t.array(CouponId), + state: State_.SubscriptionIntentState, + }), + t.type({ + planId: Defined, + planAddons: Defined, + }), + ]), + ( + x, + ): x is t.Branded< + { + planId?: PlanId; + planAddons?: Array; + coupons?: Array; + state?: State_.SubscriptionIntentState; + } & { + 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?: PlanId; + nextPlanAddons?: Array; + nextPlanCoupons?: Array; + prevPlanId?: PlanId; + prevPlanAddons?: Array; + state?: State_.SubscriptionIntentState; + stateLog?: StateLog_.StateLog; + created?: Units_.Time; + modified?: Units_.Time; + } & { + identityId: Defined; + subscriptionId: Defined; + nextPlanId: Defined; + nextPlanAddons: Defined; + nextPlanCoupons: Defined; + }, + SubscriptionIntentBaseBrand +>; +export const SubscriptionIntentBase = t.brand( + t.intersection([ + t.partial({ + id: Units_.Uuid, + identityId: Units_.IdentityId, + subscriptionId: Units_.IdentityId, + nextPlanId: PlanId, + nextPlanAddons: t.array(AddonId), + nextPlanCoupons: t.array(CouponId), + prevPlanId: PlanId, + prevPlanAddons: t.array(AddonId), + state: State_.SubscriptionIntentState, + stateLog: StateLog_.StateLog, + created: Units_.Time, + modified: Units_.Time, + }), + t.type({ + identityId: Defined, + subscriptionId: Defined, + nextPlanId: Defined, + nextPlanAddons: Defined, + nextPlanCoupons: Defined, + }), + ]), + ( + x, + ): x is t.Branded< + { + id?: Units_.Uuid; + identityId?: Units_.IdentityId; + subscriptionId?: Units_.IdentityId; + nextPlanId?: PlanId; + nextPlanAddons?: Array; + nextPlanCoupons?: Array; + prevPlanId?: PlanId; + prevPlanAddons?: Array; + state?: State_.SubscriptionIntentState; + stateLog?: StateLog_.StateLog; + created?: Units_.Time; + modified?: Units_.Time; + } & { + identityId: Defined; + subscriptionId: Defined; + nextPlanId: Defined; + nextPlanAddons: Defined; + nextPlanCoupons: 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..139039199 --- /dev/null +++ b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-create/request.ts @@ -0,0 +1,87 @@ +/* + +undefined +Request schema for subscriptions-intents-create + +!!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!! +See https://www.npmjs.com/package/io-ts-from-json-schema + +*/ + +import * as t from 'io-ts'; +import * as Units_ from '../../../core/components/units'; +import * as SubscriptionIntent_ from '../subscription-intent'; +import * as ApiCommon_ from '../../../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..0185c7ae7 --- /dev/null +++ b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-create/response.ts @@ -0,0 +1,73 @@ +/* + +undefined +Response schema for subscriptions-intents-create + +!!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!! +See https://www.npmjs.com/package/io-ts-from-json-schema + +*/ + +import * as t from 'io-ts'; +import * as SubscriptionIntent_ from '../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..412adb451 --- /dev/null +++ b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-list/request.ts @@ -0,0 +1,89 @@ +/* + +undefined +Request schema for subscriptions-intents-list + +!!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!! +See https://www.npmjs.com/package/io-ts-from-json-schema + +*/ + +import * as t from 'io-ts'; +import * as Units_ from '../../../core/components/units'; +import * as ApiCommon_ from '../../../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..a5ddcc82a --- /dev/null +++ b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-list/response.ts @@ -0,0 +1,70 @@ +/* + +undefined +Response schema for subscriptions-intents-list + +!!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!! +See https://www.npmjs.com/package/io-ts-from-json-schema + +*/ + +import * as t from 'io-ts'; +import * as SubscriptionIntent_ from '../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..c9ed2f028 --- /dev/null +++ b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-retrieve/request.ts @@ -0,0 +1,86 @@ +/* + +undefined +Request schema for subscriptions-intents-retrieve + +!!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!! +See https://www.npmjs.com/package/io-ts-from-json-schema + +*/ + +import * as t from 'io-ts'; +import * as Units_ from '../../../core/components/units'; +import * as ApiCommon_ from '../../../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..95d307406 --- /dev/null +++ b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-retrieve/response.ts @@ -0,0 +1,70 @@ +/* + +undefined +Response schema for subscriptions-intents-retrieve + +!!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!! +See https://www.npmjs.com/package/io-ts-from-json-schema + +*/ + +import * as t from 'io-ts'; +import * as SubscriptionIntent_ from '../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..62a46c7d5 --- /dev/null +++ b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-update-state/request.ts @@ -0,0 +1,99 @@ +/* + +undefined +Request schema for subscriptions-intents-update-state + +!!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!! +See https://www.npmjs.com/package/io-ts-from-json-schema + +*/ + +import * as t from 'io-ts'; +import * as Units_ from '../../../core/components/units'; +import * as State_ from '../../../core/components/state'; +import * as ApiCommon_ from '../../../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?: State_.SubscriptionIntentState; + }; + 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: State_.SubscriptionIntentState, + }), + 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?: State_.SubscriptionIntentState; + }; + 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..e7fe578b8 --- /dev/null +++ b/maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-update-state/response.ts @@ -0,0 +1,70 @@ +/* + +undefined +Response schema for subscriptions-intents-update-state + +!!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!! +See https://www.npmjs.com/package/io-ts-from-json-schema + +*/ + +import * as t from 'io-ts'; +import * as SubscriptionIntent_ from '../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 2c41899f1..640e9e25f 100644 --- a/maas-schemas-ts/translation.log +++ b/maas-schemas-ts/translation.log @@ -1652,6 +1652,12 @@ WARNING: minItems field not supported outside top-level definitions in ../maas-schemas/schemas/maas-backend/subscriptions/subscriptionOption.json INFO: missing description in ../maas-schemas/schemas/maas-backend/subscriptions/subscriptionOption.json +INFO: primitive type "string" used outside top-level definitions + in ../maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-list/request.json +WARNING: minLength field not supported outside top-level definitions + in ../maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-list/request.json +WARNING: maxLength field not supported outside top-level definitions + in ../maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-list/request.json INFO: primitive type "string" used outside top-level definitions in ../maas-schemas/schemas/maas-backend/subscriptions/subscriptions-options/request.json WARNING: minLength field not supported outside top-level definitions @@ -1660,6 +1666,16 @@ WARNING: maxLength field not supported outside top-level definitions in ../maas-schemas/schemas/maas-backend/subscriptions/subscriptions-options/request.json WARNING: default field not supported outside top-level definitions in ../maas-schemas/schemas/maas-backend/subscriptions/subscriptions-retrieve/request.json +INFO: missing description + in ../maas-schemas/schemas/maas-backend/subscriptions/subscription-intent.json +INFO: missing description + in ../maas-schemas/schemas/maas-backend/subscriptions/subscription-intent.json +INFO: missing description + in ../maas-schemas/schemas/maas-backend/subscriptions/subscription-intent.json +INFO: missing description + in ../maas-schemas/schemas/maas-backend/subscriptions/subscription-intent.json +INFO: missing description + in ../maas-schemas/schemas/maas-backend/subscriptions/subscription-intent.json INFO: primitive type "string" used outside top-level definitions in ../maas-schemas/schemas/maas-backend/vehicle/vehicle-alert/request.json WARNING: minLength field not supported outside top-level definitions diff --git a/maas-schemas/package.json b/maas-schemas/package.json index 5570dd70f..8c4a7e105 100644 --- a/maas-schemas/package.json +++ b/maas-schemas/package.json @@ -1,6 +1,6 @@ { "name": "maas-schemas", - "version": "14.2.1", + "version": "14.3.0", "description": "Schemas for MaaS infrastructure", "main": "index.js", "engine": { diff --git a/maas-schemas/schemas/core/components/state.json b/maas-schemas/schemas/core/components/state.json index 6b1b61605..e39f72796 100644 --- a/maas-schemas/schemas/core/components/state.json +++ b/maas-schemas/schemas/core/components/state.json @@ -30,6 +30,20 @@ "description": "The life-cycle state of an itinerary", "type": "string", "enum": ["START", "PLANNED", "PAID", "ACTIVATED", "CANCELLED", "CANCELLED_WITH_ERRORS", "FINISHED"] + }, + "subscriptionIntentState": { + "description": "The life-cycle state of an subscription intent", + "type": "string", + "enum": [ + "START", + "DETAILS", + "CUSTOMISATION", + "PAYMENT", + "VERIFICATION", + "CANCELLED", + "CANCELLED_WITH_ERRORS", + "FINISHED" + ] } } } diff --git a/maas-schemas/schemas/maas-backend/subscriptions/subscription-intent.json b/maas-schemas/schemas/maas-backend/subscriptions/subscription-intent.json new file mode 100644 index 000000000..6306abf58 --- /dev/null +++ b/maas-schemas/schemas/maas-backend/subscriptions/subscription-intent.json @@ -0,0 +1,97 @@ +{ + "$id": "http://maasglobal.com/maas-backend/subscriptions/subscription-intent.json", + "description": "MaaS subscription intent schema", + "definitions": { + "subscriptionIntentCreate": { + "type": "object", + "properties": { + "planId": { + "$ref": "#/definitions/planId" + }, + "planAddons": { + "type": "array", + "items": { + "$ref": "#/definitions/addonId" + } + }, + "coupons": { + "type": "array", + "items": { + "$ref": "#/definitions/couponId" + } + }, + "state": { + "$ref": "http://maasglobal.com/core/components/state.json#/definitions/subscriptionIntentState" + } + }, + "required": ["planId", "planAddons"] + }, + "subscriptionIntentBase": { + "type": "object", + "properties": { + "id": { + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/uuid" + }, + "identityId": { + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/identityId" + }, + "subscriptionId": { + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/identityId" + }, + "nextPlanId": { + "$ref": "#/definitions/planId" + }, + "nextPlanAddons": { + "type": "array", + "items": { + "$ref": "#/definitions/addonId" + } + }, + "nextPlanCoupons": { + "type": "array", + "items": { + "$ref": "#/definitions/couponId" + } + }, + "prevPlanId": { + "$ref": "#/definitions/planId" + }, + "prevPlanAddons": { + "type": "array", + "items": { + "$ref": "#/definitions/addonId" + } + }, + "state": { + "$ref": "http://maasglobal.com/core/components/state.json#/definitions/subscriptionIntentState" + }, + "stateLog": { + "$ref": "http://maasglobal.com/core/components/state-log.json" + }, + "created": { + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/time" + }, + "modified": { + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/time" + } + }, + "required": ["identityId", "subscriptionId", "nextPlanId", "nextPlanAddons", "nextPlanCoupons"], + "additionalProperties": false + }, + "addonId": { + "type": "string", + "minLength": 2, + "maxLength": 255 + }, + "planId": { + "type": "string", + "minLength": 2, + "maxLength": 255 + }, + "couponId": { + "type": "string", + "minLength": 2, + "maxLength": 255 + } + } +} diff --git a/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-create/request.json b/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-create/request.json new file mode 100644 index 000000000..402efc482 --- /dev/null +++ b/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-create/request.json @@ -0,0 +1,21 @@ +{ + "$id": "http://maasglobal.com/maas-backend/subscriptions/subscriptions-intents-create/request.json", + "description": "Request schema for subscriptions-intents-create", + "type": "object", + "properties": { + "customerId": { + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/identityId" + }, + "userId": { + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/identityId" + }, + "payload": { + "$ref": "http://maasglobal.com/maas-backend/subscriptions/subscription-intent.json#/definitions/subscriptionIntentCreate" + }, + "headers": { + "$ref": "http://maasglobal.com/core/components/api-common.json#/definitions/headers" + } + }, + "required": ["customerId", "userId", "payload"], + "additionalProperties": false +} 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 new file mode 100644 index 000000000..c62aa4ee6 --- /dev/null +++ b/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-create/response.json @@ -0,0 +1,16 @@ +{ + "$id": "http://maasglobal.com/maas-backend/subscriptions/subscriptions-intents-create/response.json", + "description": "Response schema for subscriptions-intents-create", + "type": "object", + "properties": { + "subscriptionIntent": { + "$ref": "http://maasglobal.com/maas-backend/subscriptions/subscription-intent.json#/definitions/subscriptionIntentBase" + }, + "debug": { + "type": "object", + "additionalProperties": true + } + }, + "required": ["subscriptionIntent"], + "additionalProperties": false +} diff --git a/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-list/request.json b/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-list/request.json new file mode 100644 index 000000000..98e8bee25 --- /dev/null +++ b/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-list/request.json @@ -0,0 +1,28 @@ +{ + "$id": "http://maasglobal.com/maas-backend/subscriptions/subscriptions-intents-list/request.json", + "description": "Request schema for subscriptions-intents-list", + "type": "object", + "properties": { + "customerId": { + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/identityId" + }, + "userId": { + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/identityId" + }, + "payload": { + "type": "object", + "properties": { + "states": { + "type": "string", + "minLength": 2, + "maxLength": 255 + } + } + }, + "headers": { + "$ref": "http://maasglobal.com/core/components/api-common.json#/definitions/headers" + } + }, + "required": ["customerId", "userId"], + "additionalProperties": false +} 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 new file mode 100644 index 000000000..ede695d0e --- /dev/null +++ b/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-list/response.json @@ -0,0 +1,15 @@ +{ + "$id": "http://maasglobal.com/maas-backend/subscriptions/subscriptions-intents-list/response.json", + "description": "Response schema for subscriptions-intents-list", + "type": "object", + "properties": { + "subscriptionIntents": { + "type": "array", + "items": { + "$ref": "http://maasglobal.com/maas-backend/subscriptions/subscription-intent.json#/definitions/subscriptionIntentBase" + } + } + }, + "required": ["subscriptionIntents"], + "additionalProperties": false +} diff --git a/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-retrieve/request.json b/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-retrieve/request.json new file mode 100644 index 000000000..ca5f76208 --- /dev/null +++ b/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-retrieve/request.json @@ -0,0 +1,21 @@ +{ + "$id": "http://maasglobal.com/maas-backend/subscriptions/subscriptions-intents-retrieve/request.json", + "description": "Request schema for subscriptions-intents-retrieve", + "type": "object", + "properties": { + "customerId": { + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/identityId" + }, + "userId": { + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/identityId" + }, + "subscriptionIntentId": { + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/uuid" + }, + "headers": { + "$ref": "http://maasglobal.com/core/components/api-common.json#/definitions/headers" + } + }, + "required": ["customerId", "userId", "subscriptionIntentId"], + "additionalProperties": false +} 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 new file mode 100644 index 000000000..fc2acdf78 --- /dev/null +++ b/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-retrieve/response.json @@ -0,0 +1,12 @@ +{ + "$id": "http://maasglobal.com/maas-backend/subscriptions/subscriptions-intents-retrieve/response.json", + "description": "Response schema for subscriptions-intents-retrieve", + "type": "object", + "properties": { + "subscriptionIntent": { + "$ref": "http://maasglobal.com/maas-backend/subscriptions/subscription-intent.json#/definitions/subscriptionIntentBase" + } + }, + "required": ["subscriptionIntent"], + "additionalProperties": false +} diff --git a/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-update-state/request.json b/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-update-state/request.json new file mode 100644 index 000000000..4ca4824bd --- /dev/null +++ b/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-update-state/request.json @@ -0,0 +1,29 @@ +{ + "$id": "http://maasglobal.com/maas-backend/subscriptions/subscriptions-intents-update-state/request.json", + "description": "Request schema for subscriptions-intents-update-state", + "type": "object", + "properties": { + "customerId": { + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/identityId" + }, + "userId": { + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/identityId" + }, + "subscriptionIntentId": { + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/uuid" + }, + "payload": { + "type": "object", + "properties": { + "state": { + "$ref": "http://maasglobal.com/core/components/state.json#/definitions/subscriptionIntentState" + } + } + }, + "headers": { + "$ref": "http://maasglobal.com/core/components/api-common.json#/definitions/headers" + } + }, + "required": ["customerId", "userId", "subscriptionIntentId", "payload"], + "additionalProperties": false +} 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 new file mode 100644 index 000000000..2be83a90e --- /dev/null +++ b/maas-schemas/schemas/maas-backend/subscriptions/subscriptions-intents-update-state/response.json @@ -0,0 +1,12 @@ +{ + "$id": "http://maasglobal.com/maas-backend/subscriptions/subscriptions-intents-update-state/response.json", + "description": "Response schema for subscriptions-intents-update-state", + "type": "object", + "properties": { + "subscriptionIntent": { + "$ref": "http://maasglobal.com/maas-backend/subscriptions/subscription-intent.json#/definitions/subscriptionIntentBase" + } + }, + "required": ["subscriptionIntent"], + "additionalProperties": false +}