@inrupt/solid-client / resource/resource
Module: resource/resource#
Classes#
Functions#
getContentType#
▸ getContentType(resource
): string
| null
Parameters#
Name |
Type |
Description |
---|---|---|
|
Resource for which to determine the Content Type. |
Returns#
string
| null
The Content Type, if known, or null if not known.
Defined in#
getEffectiveAccess#
▸ getEffectiveAccess(resource
): EffectiveAccess
Get what access the current user has to the given Resource.
This function can tell you what access the current user has for the given Resource, allowing you to e.g. determine that changes to it will be rejected before attempting to do so. Additionally, for servers adhering to the Web Access Control specification, it will tell you what access unauthenticated users have to the given Resource.
Parameters#
Name |
Type |
Description |
---|---|---|
|
A Resource fetched from a Solid Pod. |
Returns#
What access the current user and, if supported by the server, unauthenticated users have to the given Resource.
Since
1.7.0
Defined in#
getLinkedResourceUrlAll#
▸ getLinkedResourceUrlAll(resource
): LinkedResourceUrlAll
Get the URLs of Resources linked to the given Resource.
Solid servers can link Resources to each other. For example, in servers
implementing Web Access Control, Resources can have an Access Control List
Resource linked to it via the acl
relation.
Parameters#
Name |
Type |
Description |
---|---|---|
|
A Resource fetched from a Solid Pod. |
Returns#
The URLs of Resources linked to the given Resource, indexed by the key that links them.
Since
1.7.0
Defined in#
getPodOwner#
▸ getPodOwner(resource
): WebId
| null
Given a Resource that exposes information about the owner of the Pod it is in, returns the WebID of that owner.
Data about the owner of the Pod is exposed when the following conditions hold:
The Pod server supports exposing the Pod owner
The current user is allowed to see who the Pod owner is.
If one or more of those conditions are false, this function will return null
.
Parameters#
Name |
Type |
Description |
---|---|---|
|
A Resource that contains information about the owner of the Pod it is in. |
Returns#
WebId
| null
The WebID of the owner of the Pod the Resource is in, if provided, or null
if not.
Since
0.6.0
Defined in#
getResourceInfo#
▸ getResourceInfo(url
, options?
): Promise
<WithServerResourceInfo
>
Retrieve the information about a resource (e.g. access permissions) without fetching the resource itself.
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
URL to fetch Resource metadata from. |
|
|
Optional parameter |
|
( |
|
|
|
- |
Returns#
Promise
<WithServerResourceInfo
>
Promise resolving to the metadata describing the given Resource, or rejecting if fetching it failed.
Since
0.4.0
Defined in#
getSourceUrl#
▸ getSourceUrl(resource
): string
Parameters#
Name |
Type |
---|---|
|
Returns#
string
The URL from which the Resource has been fetched, or null if it is not known.
Defined in#
▸ getSourceUrl(resource
): string
| null
Parameters#
Name |
Type |
---|---|
|
Returns#
string
| null
Defined in#
isContainer#
▸ isContainer(resource
): boolean
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
Resource for which to check whether it is a Container. |
Returns#
boolean
Whether resource
is a Container.
Defined in#
isPodOwner#
▸ isPodOwner(webId
, resource
): boolean
| null
Given a WebID and a Resource that exposes information about the owner of the Pod it is in, returns whether the given WebID is the owner of the Pod.
Data about the owner of the Pod is exposed when the following conditions hold:
The Pod server supports exposing the Pod owner
The current user is allowed to see who the Pod owner is.
If one or more of those conditions are false, this function will return null
.
Parameters#
Name |
Type |
Description |
---|---|---|
|
|
The WebID of which to check whether it is the Pod Owner’s. |
|
A Resource that contains information about the owner of the Pod it is in. |
Returns#
boolean
| null
Whether the given WebID is the Pod Owner’s, if the Pod Owner is exposed, or null
if it is not exposed.
Since
0.6.0
Defined in#
isRawData#
▸ isRawData(resource
): boolean
This function will tell you whether a given Resource contains raw data, or a SolidDataset.
Parameters#
Name |
Type |
Description |
---|---|---|
|
Resource for which to check whether it contains raw data. |
Returns#
boolean
Whether resource
contains raw data.