@inrupt/solid-client / thing/build

Module: thing/build

Table of contents

Type aliases

Functions

Type aliases

ThingBuilder

Ƭ ThingBuilder<T>: Object

A Fluent interface to build a Thing.

Add, replace or remove property values using consecutive calls to .add*(), .set*() and .remove*(), then finally generate a Thing with the given properties using .build().

since 1.9.0

Type parameters

Name

Type

T

extends Thing

Type declaration

Name

Type

addBoolean

Adder<boolean, T>

addDate

Adder<Date, T>

addDatetime

Adder<Date, T>

addDecimal

Adder<number, T>

addInteger

Adder<number, T>

addIri

Adder<Url | UrlString | Thing, T>

addLiteral

(property: Parameters<typeof addLiteral>[1], value: Parameters<typeof addLiteral>[2]) => ThingBuilder<T>

addNamedNode

(property: Parameters<typeof addNamedNode>[1], value: Parameters<typeof addNamedNode>[2]) => ThingBuilder<T>

addStringNoLocale

Adder<string, T>

addStringWithLocale

(property: Parameters<typeof addStringWithLocale>[1], value: Parameters<typeof addStringWithLocale>[2], locale: Parameters<typeof addStringWithLocale>[3]) => ThingBuilder<T>

addTerm

(property: Parameters<typeof addTerm>[1], value: Parameters<typeof addTerm>[2]) => ThingBuilder<T>

addTime

Adder<Time, T>

addUrl

Adder<Url | UrlString | Thing, T>

build

() => T

removeAll

(property: Parameters<typeof removeLiteral>[1]) => ThingBuilder<T>

removeBoolean

Remover<boolean, T>

removeDate

Remover<Date, T>

removeDatetime

Remover<Date, T>

removeDecimal

Remover<number, T>

removeInteger

Remover<number, T>

removeIri

Remover<Url | UrlString | Thing, T>

removeLiteral

(property: Parameters<typeof removeLiteral>[1], value: Parameters<typeof removeLiteral>[2]) => ThingBuilder<T>

removeNamedNode

(property: Parameters<typeof removeNamedNode>[1], value: Parameters<typeof removeNamedNode>[2]) => ThingBuilder<T>

removeStringNoLocale

Remover<string, T>

removeStringWithLocale

(property: Parameters<typeof removeStringWithLocale>[1], value: Parameters<typeof removeStringWithLocale>[2], locale: Parameters<typeof removeStringWithLocale>[3]) => ThingBuilder<T>

removeTime

Remover<Time, T>

removeUrl

Remover<Url | UrlString | Thing, T>

setBoolean

Setter<boolean, T>

setDate

Setter<Date, T>

setDatetime

Setter<Date, T>

setDecimal

Setter<number, T>

setInteger

Setter<number, T>

setIri

Setter<Url | UrlString | Thing, T>

setLiteral

(property: Parameters<typeof setLiteral>[1], value: Parameters<typeof setLiteral>[2]) => ThingBuilder<T>

setNamedNode

(property: Parameters<typeof setNamedNode>[1], value: Parameters<typeof setNamedNode>[2]) => ThingBuilder<T>

setStringNoLocale

Setter<string, T>

setStringWithLocale

(property: Parameters<typeof setStringWithLocale>[1], value: Parameters<typeof setStringWithLocale>[2], locale: Parameters<typeof setStringWithLocale>[3]) => ThingBuilder<T>

setTerm

(property: Parameters<typeof setTerm>[1], value: Parameters<typeof setTerm>[2]) => ThingBuilder<T>

setTime

Setter<Time, T>

setUrl

Setter<Url | UrlString | Thing, T>

Functions

buildThing

buildThing(init): ThingBuilder<ThingLocal>

Modify a Thing, setting multiple properties in a single expresssion.

For example, you can initialise several properties of a given Thing as follows:

const me = buildThing(createThing({ name: "profile-vincent" }))
  .addUrl(rdf.type, schema.Person)
  .addStringNoLocale(schema.givenName, "Vincent")
  .build();

Take note of the final call to .build() to obtain the actual Thing.

since 1.9.0

Parameters

Name

Type

Description

init

ThingLocal

A Thing to modify.

Returns

ThingBuilder<ThingLocal>

a ThingBuilder, a Fluent API that allows you to set multiple properties in a single expression.

Defined in

src/thing/build.ts:204

buildThing(init): ThingBuilder<ThingPersisted>

Modify a Thing, setting multiple properties in a single expresssion.

For example, you can initialise several properties of a given Thing as follows:

const me = buildThing(createThing({ url: "https://example.pod/profile#vincent" }))
  .addUrl(rdf.type, schema.Person)
  .addStringNoLocale(schema.givenName, "Vincent")
  .build();

Take note of the final call to .build() to obtain the actual Thing.

since 1.9.0

Parameters

Name

Type

Description

init

ThingPersisted

A Thing to modify.

Returns

ThingBuilder<ThingPersisted>

a ThingBuilder, a Fluent API that allows you to set multiple properties in a single expression.

Defined in

src/thing/build.ts:221

buildThing(init): ThingBuilder<ThingLocal>

Create a Thing, setting multiple properties in a single expresssion.

For example, you can create a new Thing and initialise several properties as follows:

const me = buildThing({ name: "profile-vincent" })
  .addUrl(rdf.type, schema.Person)
  .addStringNoLocale(schema.givenName, "Vincent")
  .build();

Take note of the final call to .build() to obtain the actual Thing.

since 1.9.0

Parameters

Name

Type

Description

init

CreateThingLocalOptions

Options used to initialise a new Thing.

Returns

ThingBuilder<ThingLocal>

a ThingBuilder, a Fluent API that allows you to set multiple properties in a single expression.

Defined in

src/thing/build.ts:238

buildThing(init): ThingBuilder<ThingPersisted>

Create a Thing, setting multiple properties in a single expresssion.

For example, you can create a new Thing and initialise several properties as follows:

const me = buildThing({ url: "https://example.pod/profile#vincent" })
  .addUrl(rdf.type, schema.Person)
  .addStringNoLocale(schema.givenName, "Vincent")
  .build();

Take note of the final call to .build() to obtain the actual Thing.

since 1.9.0

Parameters

Name

Type

Description

init

CreateThingPersistedOptions

Optionally pass an existing Thing to modify the properties of. If left empty, buildThing will initialise a new Thing.

Returns

ThingBuilder<ThingPersisted>

a ThingBuilder, a Fluent API that allows you to set multiple properties in a single expression.

Defined in

src/thing/build.ts:257

buildThing(): ThingBuilder<ThingLocal>

Create a Thing, setting multiple properties in a single expresssion.

For example, you can create a new Thing and initialise several properties as follows:

const me = buildThing()
  .addUrl(rdf.type, schema.Person)
  .addStringNoLocale(schema.givenName, "Vincent")
  .build();

Take note of the final call to .build() to obtain the actual Thing.

since 1.9.0

Returns

ThingBuilder<ThingLocal>

a ThingBuilder, a Fluent API that allows you to set multiple properties in a single expression.