@inrupt/solid-client / resource/resource

Module: resource/resource#

Classes#

Functions#

getContentType#

getContentType(resource): string | null

Parameters#

Name

Type

Description

resource

WithResourceInfo

Resource for which to determine the Content Type.

Returns#

string | null

The Content Type, if known, or null if not known.

Defined in#

src/resource/resource.ts:133


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.

Since

1.7.0

Parameters#

Name

Type

Description

resource

WithServerResourceInfo

A Resource fetched from a Solid Pod.

Returns#

EffectiveAccess

What access the current user and, if supported by the server, unauthenticated users have to the given Resource.

Defined in#

src/resource/resource.ts:237


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.

Since

1.7.0

Parameters#

Name

Type

Description

resource

WithServerResourceInfo

A Resource fetched from a Solid Pod.

Returns#

LinkedResourceUrlAll

The URLs of Resources linked to the given Resource, indexed by the key that links them.

Defined in#

src/resource/resource.ts:218


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.

Since

0.6.0

Parameters#

Name

Type

Description

resource

WithServerResourceInfo

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.

Defined in#

src/resource/resource.ts:167


getResourceInfo#

getResourceInfo(url, options?): Promise<WithServerResourceInfo>

Retrieve the information about a resource (e.g. access permissions) without fetching the resource itself.

Since

0.4.0

Parameters#

Name

Type

Description

url

string

URL to fetch Resource metadata from.

options

Partial<{ fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response> & (input: RequestInfo | URL, init?: RequestInit) => Promise<Response> } & { ignoreAuthenticationErrors: boolean }>

Optional parameter options.fetch: An alternative fetch function to make the HTTP request, compatible with the browser-native fetch API.

Returns#

Promise<WithServerResourceInfo>

Promise resolving to the metadata describing the given Resource, or rejecting if fetching it failed.

Defined in#

src/resource/resource.ts:58


getSourceIri#

getSourceIri(resource): string

Parameters#

Name

Type

resource

WithResourceInfo

Returns#

string

The URL from which the Resource has been fetched, or null if it is not known.

Defined in#

src/resource/resource.ts:141

getSourceIri(resource): string | null

Alias of getSourceUrl for those who prefer to use IRI terminology.

Parameters#

Name

Type

resource

Resource

Returns#

string | null

Defined in#

src/resource/resource.ts:142


getSourceUrl#

getSourceUrl(resource): string

Parameters#

Name

Type

resource

WithResourceInfo

Returns#

string

The URL from which the Resource has been fetched, or null if it is not known.

Defined in#

src/resource/resource.ts:141

getSourceUrl(resource): string | null

Parameters#

Name

Type

resource

Resource

Returns#

string | null

Defined in#

src/resource/resource.ts:142


isContainer#

isContainer(resource): boolean

Parameters#

Name

Type

Description

resource

string | Url | WithResourceInfo

Resource for which to check whether it is a Container.

Returns#

boolean

Whether resource is a Container.

Defined in#

src/resource/resource.ts:110


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.

Since

0.6.0

Parameters#

Name

Type

Description

webId

string

The WebID of which to check whether it is the Pod Owner’s.

resource

WithServerResourceInfo

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.

Defined in#

src/resource/resource.ts:194


isRawData#

isRawData(resource): boolean

This function will tell you whether a given Resource contains raw data, or a SolidDataset.

Parameters#

Name

Type

Description

resource

WithResourceInfo

Resource for which to check whether it contains raw data.

Returns#

boolean

Whether resource contains raw data.

Defined in#

src/resource/resource.ts:125