@inrupt/solid-client / thing/build
Module: thing/build#
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 |
---|---|
|
extends |
Type declaration#
Name |
Type |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
( |
|
|
|
|
|
|
|
() => |
|
( |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
( |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
( |
|
|
|
|
|
Defined in#
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.
Parameters#
Name |
Type |
Description |
---|---|---|
|
A Thing to modify. |
Returns#
a [[ThingBuilder]], a Fluent API that allows you to set multiple properties in a single expression.
Since
1.9.0
Defined in#
▸ 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.
Parameters#
Name |
Type |
Description |
---|---|---|
|
A Thing to modify. |
Returns#
a [[ThingBuilder]], a Fluent API that allows you to set multiple properties in a single expression.
Since
1.9.0
Defined in#
▸ 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.
Parameters#
Name |
Type |
Description |
---|---|---|
|
Options used to initialise a new Thing. |
Returns#
a [[ThingBuilder]], a Fluent API that allows you to set multiple properties in a single expression.
Since
1.9.0
Defined in#
▸ 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.
Parameters#
Name |
Type |
Description |
---|---|---|
|
Optionally pass an existing [[Thing]] to modify the properties of. If left empty, |
Returns#
a [[ThingBuilder]], a Fluent API that allows you to set multiple properties in a single expression.
Since
1.9.0
Defined in#
▸ 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.
Returns#
a [[ThingBuilder]], a Fluent API that allows you to set multiple properties in a single expression.
Since
1.9.0