@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:125


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

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.

Since

1.7.0

Defined in#

src/resource/resource.ts:229


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

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.

Since

1.7.0

Defined in#

src/resource/resource.ts:210


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

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.

Since

0.6.0

Defined in#

src/resource/resource.ts:159


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

string

URL to fetch Resource metadata from.

options?

Object

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

options.fetch?

(input: RequestInfo | URL, init?: RequestInit) => Promise<Response>

MDN Reference

options.ignoreAuthenticationErrors?

boolean

-

Returns#

Promise<WithServerResourceInfo>

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

Since

0.4.0

Defined in#

src/resource/resource.ts:54


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:133

getSourceUrl(resource): string | null

Parameters#

Name

Type

resource

Resource

Returns#

string | null

Defined in#

src/resource/resource.ts:134


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:102


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

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.

Since

0.6.0

Defined in#

src/resource/resource.ts:186


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:117