wot-thing-model-types
Version:
Official Typescript definition type for W3C Thing Model Description
576 lines (573 loc) • 16.7 kB
TypeScript
/* tslint:disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "title".
*/
export type Title = string;
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "type_declaration".
*/
export type TypeDeclaration = string | string[];
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "description".
*/
export type Description = string;
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "form_element_property".
*/
export type FormElementProperty = FormElementBase;
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "anyUri".
*/
export type AnyUri = string;
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "subprotocol".
*/
export type Subprotocol = string;
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "security".
*/
export type Security = string[] | string;
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "scopes".
*/
export type Scopes = string[] | string;
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "additionalResponsesDefinition".
*/
export type AdditionalResponsesDefinition = {
contentType?: string;
schema?: string;
success?: boolean;
[ ]: unknown;
}[];
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "placeholder-pattern".
*/
export type PlaceholderPattern = string;
export type DataSchemaType =
| ("boolean" | "integer" | "number" | "string" | "object" | "array" | "null")
| PlaceholderPattern;
export type DataSchemaType1 = string;
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "multipleOfDefinition".
*/
export type MultipleOfDefinition = number | PlaceholderPattern;
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "tm_ref".
*/
export type TmRef = string;
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "form_element_action".
*/
export type FormElementAction = FormElementBase;
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "form_element_event".
*/
export type FormElementEvent = FormElementBase;
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "link_element".
*/
export type LinkElement = BaseLinkElement & {
[ ]: unknown;
};
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "bcp47_string".
*/
export type Bcp47String = string;
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "icon_link_element".
*/
export type IconLinkElement = BaseLinkElement & {
rel: "icon";
sizes?: string;
[ ]: unknown;
};
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "form_element_root".
*/
export type FormElementRoot = FormElementBase;
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "securityScheme".
*/
export type SecurityScheme =
| NoSecurityScheme
| AutoSecurityScheme
| ComboSecurityScheme
| BasicSecurityScheme
| DigestSecurityScheme
| ApiKeySecurityScheme
| BearerSecurityScheme
| PskSecurityScheme
| OAuth2SecurityScheme
| AdditionalSecurityScheme;
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "comboSecurityScheme".
*/
export type ComboSecurityScheme =
| {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme?: ("combo" | PlaceholderPattern) & string;
oneOf?: [string, string, ...string[]];
"tm:ref"?: TmRef;
[ ]: unknown;
}
| {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme?: ("combo" | PlaceholderPattern) & string;
allOf?: [string, string, ...string[]];
"tm:ref"?: TmRef;
[ ]: unknown;
};
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "tm_type_declaration".
*/
export type TmTypeDeclaration = "tm:ThingModel" | string[];
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "thing-context".
*/
export type ThingContext =
| []
| [
ThingContextTdUriV11,
...(
| AnyUri
| {
[ ]: string;
}
)[]
]
| "https://www.w3.org/2022/wot/td/v1.1"
| [
ThingContextTdUriV1,
ThingContextTdUriV11,
...(
| AnyUri
| {
[ ]: string;
}
)[]
]
| [
ThingContextTdUriV1,
...(
| AnyUri
| {
[ ]: string;
}
)[]
]
| "https://www.w3.org/2019/wot/td/v1";
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "thing-context-td-uri-v1.1".
*/
export type ThingContextTdUriV11 = "https://www.w3.org/2022/wot/td/v1.1";
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "thing-context-td-uri-v1".
*/
export type ThingContextTdUriV1 = "https://www.w3.org/2019/wot/td/v1";
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "tm_optional".
*/
export type TmOptional = (string & {
[ ]: unknown;
})[];
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "thing-context-td-uri-temp".
*/
export type ThingContextTdUriTemp = "http://www.w3.org/ns/td";
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "form".
*/
export type Form = FormElementProperty | FormElementAction | FormElementEvent | FormElementRoot;
/**
* JSON Schema for validating Thing Models. This is automatically generated from the WoT TD Schema.
*/
export interface ThingModel {
id?: string;
title?: Title;
titles?: Titles;
properties?: {
[ ]: PropertyElement;
};
actions?: {
[ ]: ActionElement;
};
events?: {
[ ]: EventElement;
};
description?: Description;
descriptions?: Descriptions;
version?:
| {
model?: string;
[ ]: unknown;
}
| PlaceholderPattern;
links?: (LinkElement | IconLinkElement)[];
forms?: [FormElementRoot, ...FormElementRoot[]];
base?: AnyUri;
securityDefinitions?: {
[ ]: SecurityScheme;
};
schemaDefinitions?: {
[ ]: DataSchema;
};
support?: AnyUri;
created?: string;
modified?: string;
profile?: AnyUri | [AnyUri, ...AnyUri[]];
security?: string | [string, ...string[]];
uriVariables?: {
[ ]: DataSchema;
};
"@type": TmTypeDeclaration;
"@context": ThingContext;
"tm:optional"?: TmOptional;
[ ]: unknown;
}
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "titles".
*/
export interface Titles {
[ ]: string;
}
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "property_element".
*/
export interface PropertyElement {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
title?: Title;
titles?: Titles;
forms?: [FormElementProperty, ...FormElementProperty[]];
uriVariables?: {
[ ]: DataSchema;
};
observable?: boolean | PlaceholderPattern;
writeOnly?: boolean | PlaceholderPattern;
readOnly?: boolean | PlaceholderPattern;
oneOf?: DataSchema[];
unit?: string;
enum?: [unknown, ...unknown[]] | PlaceholderPattern;
format?: string;
const?: unknown;
default?: unknown;
type?: DataSchemaType & DataSchemaType1;
items?: DataSchema | DataSchema[];
maxItems?: number | PlaceholderPattern;
minItems?: number | PlaceholderPattern;
minimum?: number | PlaceholderPattern;
maximum?: number | PlaceholderPattern;
exclusiveMinimum?: number;
exclusiveMaximum?: number;
minLength?: number | PlaceholderPattern;
maxLength?: number | PlaceholderPattern;
multipleOf?: MultipleOfDefinition;
properties?: {
[ ]: DataSchema;
};
required?: string[] | PlaceholderPattern;
"tm:ref"?: TmRef;
[ ]: unknown;
}
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "descriptions".
*/
export interface Descriptions {
[ ]: string;
}
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "form_element_base".
*/
export interface FormElementBase {
op?: string | string[];
href?: AnyUri;
contentType?: string;
contentCoding?: string;
subprotocol?: Subprotocol;
security?: Security;
scopes?: Scopes;
response?: ExpectedResponse;
additionalResponses?: AdditionalResponsesDefinition;
[ ]: unknown;
}
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "expectedResponse".
*/
export interface ExpectedResponse {
contentType?: string;
[ ]: unknown;
}
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "dataSchema".
*/
export interface DataSchema {
"@type"?: TypeDeclaration;
description?: Description;
title?: Title;
descriptions?: Descriptions;
titles?: Titles;
writeOnly?: boolean | PlaceholderPattern;
readOnly?: boolean | PlaceholderPattern;
oneOf?: DataSchema[];
unit?: string;
enum?: [unknown, ...unknown[]] | PlaceholderPattern;
format?: string;
const?: unknown;
default?: unknown;
contentEncoding?: string;
contentMediaType?: string;
type?: DataSchemaType & DataSchemaType1;
items?: DataSchema | DataSchema[];
maxItems?: number | PlaceholderPattern;
minItems?: number | PlaceholderPattern;
minimum?: number | PlaceholderPattern;
maximum?: number | PlaceholderPattern;
exclusiveMinimum?: number;
exclusiveMaximum?: number;
minLength?: number | PlaceholderPattern;
maxLength?: number | PlaceholderPattern;
multipleOf?: MultipleOfDefinition;
properties?: {
[ ]: DataSchema;
};
required?: string[] | PlaceholderPattern;
"tm:ref"?: TmRef;
[ ]: unknown;
}
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "action_element".
*/
export interface ActionElement {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
title?: Title;
titles?: Titles;
forms?: [FormElementAction, ...FormElementAction[]];
uriVariables?: {
[ ]: DataSchema;
};
input?: DataSchema;
output?: DataSchema;
safe?: boolean | PlaceholderPattern;
idempotent?: boolean | PlaceholderPattern;
synchronous?: boolean | PlaceholderPattern;
"tm:ref"?: TmRef;
[ ]: unknown;
}
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "event_element".
*/
export interface EventElement {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
title?: Title;
titles?: Titles;
forms?: [FormElementEvent, ...FormElementEvent[]];
uriVariables?: {
[ ]: DataSchema;
};
subscription?: DataSchema;
data?: DataSchema;
dataResponse?: DataSchema;
cancellation?: DataSchema;
"tm:ref"?: TmRef;
[ ]: unknown;
}
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "base_link_element".
*/
export interface BaseLinkElement {
href?: AnyUri;
type?: string;
rel?: string;
anchor?: AnyUri;
hreflang?: Bcp47String | Bcp47String[];
instanceName?: string;
[ ]: unknown;
}
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "noSecurityScheme".
*/
export interface NoSecurityScheme {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme?: ("nosec" | PlaceholderPattern) & string;
"tm:ref"?: TmRef;
[ ]: unknown;
}
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "autoSecurityScheme".
*/
export interface AutoSecurityScheme {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme?: ("auto" | PlaceholderPattern) & string;
[ ]: unknown;
}
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "basicSecurityScheme".
*/
export interface BasicSecurityScheme {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme?: ("basic" | PlaceholderPattern) & string;
in?: (("header" | "query" | "body" | "cookie" | "auto") | PlaceholderPattern) & string;
name?: string;
"tm:ref"?: TmRef;
[ ]: unknown;
}
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "digestSecurityScheme".
*/
export interface DigestSecurityScheme {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme?: ("digest" | PlaceholderPattern) & string;
qop?: (("auth" | "auth-int") | PlaceholderPattern) & string;
in?: (("header" | "query" | "body" | "cookie" | "auto") | PlaceholderPattern) & string;
name?: string;
"tm:ref"?: TmRef;
[ ]: unknown;
}
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "apiKeySecurityScheme".
*/
export interface ApiKeySecurityScheme {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme?: ("apikey" | PlaceholderPattern) & string;
in?: (("header" | "query" | "body" | "cookie" | "uri" | "auto") | PlaceholderPattern) & string;
name?: string;
"tm:ref"?: TmRef;
[ ]: unknown;
}
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "bearerSecurityScheme".
*/
export interface BearerSecurityScheme {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme?: ("bearer" | PlaceholderPattern) & string;
authorization?: AnyUri;
alg?: string;
format?: string;
in?: (("header" | "query" | "body" | "cookie" | "auto") | PlaceholderPattern) & string;
name?: string;
"tm:ref"?: TmRef;
[ ]: unknown;
}
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "pskSecurityScheme".
*/
export interface PskSecurityScheme {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme?: ("psk" | PlaceholderPattern) & string;
identity?: string;
"tm:ref"?: TmRef;
[ ]: unknown;
}
/**
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "oAuth2SecurityScheme".
*/
export interface OAuth2SecurityScheme {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme?: ("oauth2" | PlaceholderPattern) & string;
authorization?: AnyUri;
token?: AnyUri;
refresh?: AnyUri;
scopes?: string[] | string;
flow?: string | ((("code" | "client") | PlaceholderPattern) & string);
"tm:ref"?: TmRef;
[ ]: unknown;
}
/**
* Applies to additional SecuritySchemes not defined in the WoT TD specification.
*
* This interface was referenced by `ThingModel`'s JSON-Schema
* via the `definition` "additionalSecurityScheme".
*/
export interface AdditionalSecurityScheme {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme?: string;
[ ]: unknown;
}