wot-thing-description-types
Version:
Official Typescript definition type for W3C Thing Description
538 lines (535 loc) • 14.9 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 `ThingDescription`'s JSON-Schema
* via the `definition` "title".
*/
export type Title = string;
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "type_declaration".
*/
export type TypeDeclaration = string | string[];
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "description".
*/
export type Description = string;
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "form_element_property".
*/
export type FormElementProperty = FormElementBase;
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "anyUri".
*/
export type AnyUri = string;
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "subprotocol".
*/
export type Subprotocol = string;
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "security".
*/
export type Security = [string, ...string[]] | string;
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "scopes".
*/
export type Scopes = string[] | string;
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "additionalResponsesDefinition".
*/
export type AdditionalResponsesDefinition = {
contentType?: string;
schema?: string;
success?: boolean;
[]: unknown;
}[];
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "dataSchema-type".
*/
export type DataSchemaType = "boolean" | "integer" | "number" | "string" | "object" | "array" | "null";
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "multipleOfDefinition".
*/
export type MultipleOfDefinition = number;
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "form_element_action".
*/
export type FormElementAction = FormElementBase;
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "form_element_event".
*/
export type FormElementEvent = FormElementBase;
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "link_element".
*/
export type LinkElement = BaseLinkElement & {
[]: unknown;
};
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "bcp47_string".
*/
export type Bcp47String = string;
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "icon_link_element".
*/
export type IconLinkElement = BaseLinkElement & {
rel: "icon";
sizes?: string;
[]: unknown;
};
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "form_element_root".
*/
export type FormElementRoot = FormElementBase;
/**
* This interface was referenced by `ThingDescription`'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 `ThingDescription`'s JSON-Schema
* via the `definition` "comboSecurityScheme".
*/
export type ComboSecurityScheme =
| {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme: "combo";
oneOf: [string, string, ...string[]];
[]: unknown;
}
| {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme: "combo";
allOf: [string, string, ...string[]];
[]: unknown;
};
/**
* This interface was referenced by `ThingDescription`'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 `ThingDescription`'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 `ThingDescription`'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 `ThingDescription`'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 `ThingDescription`'s JSON-Schema
* via the `definition` "form".
*/
export type Form = FormElementProperty | FormElementAction | FormElementEvent | FormElementRoot;
/**
* JSON Schema for validating TD instances against the TD information model. TD instances can be with or without terms that have default values
*/
export interface ThingDescription {
id?: string;
title: Title;
titles?: Titles;
properties?: {
[]: PropertyElement;
};
actions?: {
[]: ActionElement;
};
events?: {
[]: EventElement;
};
description?: Description;
descriptions?: Descriptions;
version?: {
instance: string;
[]: unknown;
};
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"?: TypeDeclaration;
"@context": ThingContext;
[]: unknown;
}
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "titles".
*/
export interface Titles {
[]: string;
}
/**
* This interface was referenced by `ThingDescription`'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;
writeOnly?: boolean;
readOnly?: boolean;
oneOf?: DataSchema[];
unit?: string;
enum?: [unknown, ...unknown[]];
format?: string;
const?: unknown;
default?: unknown;
type?: DataSchemaType;
items?: DataSchema | DataSchema[];
maxItems?: number;
minItems?: number;
minimum?: number;
maximum?: number;
exclusiveMinimum?: number;
exclusiveMaximum?: number;
minLength?: number;
maxLength?: number;
multipleOf?: MultipleOfDefinition;
properties?: {
[]: DataSchema;
};
required?: string[];
[]: unknown;
}
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "descriptions".
*/
export interface Descriptions {
[]: string;
}
/**
* This interface was referenced by `ThingDescription`'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 `ThingDescription`'s JSON-Schema
* via the `definition` "expectedResponse".
*/
export interface ExpectedResponse {
contentType: string;
[]: unknown;
}
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "dataSchema".
*/
export interface DataSchema {
"@type"?: TypeDeclaration;
description?: Description;
title?: Title;
descriptions?: Descriptions;
titles?: Titles;
writeOnly?: boolean;
readOnly?: boolean;
oneOf?: DataSchema[];
unit?: string;
enum?: [unknown, ...unknown[]];
format?: string;
const?: unknown;
default?: unknown;
contentEncoding?: string;
contentMediaType?: string;
type?: DataSchemaType;
items?: DataSchema | DataSchema[];
maxItems?: number;
minItems?: number;
minimum?: number;
maximum?: number;
exclusiveMinimum?: number;
exclusiveMaximum?: number;
minLength?: number;
maxLength?: number;
multipleOf?: MultipleOfDefinition;
properties?: {
[]: DataSchema;
};
required?: string[];
[]: unknown;
}
/**
* This interface was referenced by `ThingDescription`'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;
idempotent?: boolean;
synchronous?: boolean;
[]: unknown;
}
/**
* This interface was referenced by `ThingDescription`'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;
[]: unknown;
}
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "base_link_element".
*/
export interface BaseLinkElement {
href: AnyUri;
type?: string;
rel?: string;
anchor?: AnyUri;
hreflang?: Bcp47String | Bcp47String[];
[]: unknown;
}
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "noSecurityScheme".
*/
export interface NoSecurityScheme {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme: "nosec";
[]: unknown;
}
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "autoSecurityScheme".
*/
export interface AutoSecurityScheme {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme: "auto";
[]: unknown;
}
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "basicSecurityScheme".
*/
export interface BasicSecurityScheme {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme: "basic";
in?: "header" | "query" | "body" | "cookie" | "auto";
name?: string;
[]: unknown;
}
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "digestSecurityScheme".
*/
export interface DigestSecurityScheme {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme: "digest";
qop?: "auth" | "auth-int";
in?: "header" | "query" | "body" | "cookie" | "auto";
name?: string;
[]: unknown;
}
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "apiKeySecurityScheme".
*/
export interface ApiKeySecurityScheme {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme: "apikey";
in?: "header" | "query" | "body" | "cookie" | "uri" | "auto";
name?: string;
[]: unknown;
}
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "bearerSecurityScheme".
*/
export interface BearerSecurityScheme {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme: "bearer";
authorization?: AnyUri;
alg?: string;
format?: string;
in?: "header" | "query" | "body" | "cookie" | "auto";
name?: string;
[]: unknown;
}
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "pskSecurityScheme".
*/
export interface PskSecurityScheme {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme: "psk";
identity?: string;
[]: unknown;
}
/**
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "oAuth2SecurityScheme".
*/
export interface OAuth2SecurityScheme {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme: "oauth2";
authorization?: AnyUri;
token?: AnyUri;
refresh?: AnyUri;
scopes?: string[] | string;
flow?: string | ("code" | "client");
[]: unknown;
}
/**
* Applies to additional SecuritySchemes not defined in the WoT TD specification.
*
* This interface was referenced by `ThingDescription`'s JSON-Schema
* via the `definition` "additionalSecurityScheme".
*/
export interface AdditionalSecurityScheme {
"@type"?: TypeDeclaration;
description?: Description;
descriptions?: Descriptions;
proxy?: AnyUri;
scheme: string;
[]: unknown;
}