@inrupt/solid-client / thing/thing
Module: thing/thing¶
Type aliases¶
CreateThingLocalOptions¶
Ƭ CreateThingLocalOptions: { name?
: string }
Pass these options to createThing to initialise a new Thing whose URL will be determined when it is saved.
Type declaration:¶
Name |
Type |
Description |
---|---|---|
|
string |
The name that should be used for this Thing when constructing its URL. If not provided, a random one will be generated. |
Defined in: src/thing/thing.ts:243
CreateThingOptions¶
Ƭ CreateThingOptions: CreateThingLocalOptions | CreateThingPersistedOptions
The options you pass to createThing.
To specify the URL for the initialised Thing, pass CreateThingPersistedOptions.
To have the URL determined during the save, pass CreateThingLocalOptions.
Defined in: src/thing/thing.ts:262
CreateThingPersistedOptions¶
Ƭ CreateThingPersistedOptions: { url
: UrlString }
Pass these options to createThing to initialise a new Thing whose URL is already known.
Type declaration:¶
Name |
Type |
Description |
---|---|---|
|
The URL of the newly created Thing. |
Defined in: src/thing/thing.ts:252
Functions¶
asUrl¶
▸ asUrl(thing
: ThingLocal, baseUrl
: UrlString): UrlString
Get the URL to a given Thing.
Parameters:¶
Name |
Type |
Description |
---|---|---|
|
The Thing you want to obtain the URL from. |
|
|
If |
Returns: UrlString
Defined in: src/thing/thing.ts:318
▸ asUrl(thing
: ThingPersisted): UrlString
createThing¶
▸ createThing(options
: CreateThingPersistedOptions): ThingPersisted
Initialise a new Thing in memory with a given URL.
Parameters:¶
Name |
Type |
Description |
---|---|---|
|
See CreateThingPersistedOptions for how to specify the new Thing’s URL. |
Returns: ThingPersisted
Defined in: src/thing/thing.ts:270
▸ createThing(options?
: CreateThingLocalOptions): ThingLocal
Initialise a new Thing in memory.
Parameters:¶
Name |
Type |
Description |
---|---|---|
|
Optional parameters that affect the final URL of this Thing when saved. |
Returns: ThingLocal
Defined in: src/thing/thing.ts:278
▸ createThing(options?
: CreateThingOptions): Thing
getThing¶
▸ getThing(solidDataset
: SolidDataset, thingUrl
: UrlString | Url, options?
: GetThingOptions): ThingPersisted | null
Parameters:¶
Name |
Type |
---|---|
|
|
|
|
|
GetThingOptions |
Returns: ThingPersisted | null
Defined in: src/thing/thing.ts:64
▸ getThing(solidDataset
: SolidDataset, thingUrl
: LocalNode, options?
: GetThingOptions): ThingLocal | null
Parameters:¶
Name |
Type |
---|---|
|
|
|
LocalNode |
|
GetThingOptions |
Returns: ThingLocal | null
Defined in: src/thing/thing.ts:69
▸ getThing(solidDataset
: SolidDataset, thingUrl
: UrlString | Url | LocalNode, options?
: GetThingOptions): Thing | null
Parameters:¶
Name |
Type |
---|---|
|
|
|
|
|
GetThingOptions |
Returns: Thing | null
Defined in: src/thing/thing.ts:74
getThingAll¶
▸ getThingAll(solidDataset
: SolidDataset, options?
: GetThingOptions): Thing[]
Get all Things about which a SolidDataset contains Quads.
Parameters:¶
Name |
Type |
Default value |
Description |
---|---|---|---|
|
- |
The SolidDataset to extract the Things from. |
|
|
GetThingOptions |
… |
Not yet implemented. |
Returns: Thing[]
Defined in: src/thing/thing.ts:125
isThing¶
▸ isThing<X>(input
: X | Thing): input is Thing
since
0.2.0
Type parameters:¶
Name |
---|
|
Parameters:¶
Name |
Type |
Description |
---|---|---|
|
X | Thing |
An value that might be a Thing. |
Returns: input is Thing
Whether input
is a Thing.
Defined in: src/thing/thing.ts:304
isThingLocal¶
▸ isThingLocal(thing
: ThingPersisted | ThingLocal): thing is ThingLocal
Parameters:¶
Name |
Type |
Description |
---|---|---|
|
The Thing of which a URL might or might not be known. |
Returns: thing is ThingLocal
Whether thing
has no known URL yet.
Defined in: src/thing/thing.ts:375
removeThing¶
▸ removeThing<Dataset>(solidDataset
: Dataset, thing
: UrlString | Url | LocalNode | Thing): Dataset & WithChangeLog
Remove a Thing from a SolidDataset.
Type parameters:¶
Name |
Type |
---|---|
|
DatasetCore<Quad, Quad, Dataset> |
Parameters:¶
Name |
Type |
Description |
---|---|---|
|
Dataset |
The SolidDataset to remove a Thing from. |
|
The Thing to remove from |
Returns: Dataset & WithChangeLog
A new SolidDataset equal to the input SolidDataset, excluding the given Thing.
Defined in: src/thing/thing.ts:197
setThing¶
▸ setThing<Dataset>(solidDataset
: Dataset, thing
: Thing): Dataset & WithChangeLog
Insert a Thing into a SolidDataset, replacing previous instances of that Thing.
Type parameters:¶
Name |
Type |
---|---|
|
DatasetCore<Quad, Quad, Dataset> |
Parameters:¶
Name |
Type |
Description |
---|---|---|
|
Dataset |
The SolidDataset to insert a Thing into. |
|
The Thing to insert into the given SolidDataset. |
Returns: Dataset & WithChangeLog
A new SolidDataset equal to the given SolidDataset, but with the given Thing.
Defined in: src/thing/thing.ts:166
thingAsMarkdown¶
▸ thingAsMarkdown(thing
: Thing): string
Gets a human-readable representation of the given Thing to aid debugging.
Note that changes to the exact format of the return value are not considered a breaking change; it is intended to aid in debugging, not as a serialisation method that can be reliably parsed.
since
0.3.0
Parameters:¶
Name |
Type |
Description |
---|---|---|
|
The Thing to get a human-readable representation of. |
Returns: string
Defined in: src/thing/thing.ts:345