Skip to content

Class: DataModel<ModelTypes, ModelAliases>

datamodel.DataModel

import { DataModel } from '@glazed/datamodel'

Type parameters

Name Type
ModelTypes extends ModelTypeAliases
ModelAliases extends ModelTypesToAliases<ModelTypes>ModelTypesToAliases<ModelTypes>

Constructors

constructor

new DataModel<ModelTypes, ModelAliases>(__namedParameters)

Type parameters

Name Type
ModelTypes extends ModelTypeAliases<Record<string, any>, Record<string, string>, Record<string, string>>
ModelAliases extends ModelTypesToAliases<ModelTypes>ModelTypesToAliases<ModelTypes>

Parameters

Name Type
__namedParameters DataModelParams<ModelAliases>

Accessors

ceramic

get ceramic(): CeramicApi

Returns

CeramicApi

Methods

createTile

createTile<Alias, ContentType>(schemaAlias, content, __namedParameters?): Promise<TileDocument<ContentType>>

Type parameters

Name Type
Alias extends string | number | symbol
ContentType ModelTypes["schemas"][Alias]

Parameters

Name Type
schemaAlias Alias
content ContentType
__namedParameters CreateOptions

Returns

Promise<TileDocument<ContentType>>


getDefinitionID

getDefinitionID<Alias>(alias): null | string

Type parameters

Name Type
Alias extends string | number | symbol

Parameters

Name Type
alias Alias

Returns

null | string


getSchemaURL

getSchemaURL<Alias>(alias): null | string

Type parameters

Name Type
Alias extends string | number | symbol

Parameters

Name Type
alias Alias

Returns

null | string


getTileID

getTileID<Alias>(alias): null | string

Type parameters

Name Type
Alias extends string | number | symbol

Parameters

Name Type
alias Alias

Returns

null | string


loadTile

loadTile<Alias, ContentType>(alias): Promise<null | TileDocument<ContentType>>

Type parameters

Name Type
Alias extends string | number | symbol
ContentType ModelTypes["schemas"][ModelTypes["tiles"][Alias]]

Parameters

Name Type
alias Alias

Returns

Promise<null | TileDocument<ContentType>>