@inrupt/solid-client

Globals / “resource/resource”

Module: “resource/resource”

Functions

getContentType

getContentType(resource: WithResourceInfo): string | null

Defined in src/resource/resource.ts:135

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.


getPodOwner

getPodOwner(resource: WithServerResourceInfo): WebId | null

Defined in src/resource/resource.ts:169

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.


getResourceInfo

getResourceInfo(url: UrlString, options?: Partial<typeof internal_defaultFetchOptions>): Promise<WithServerResourceInfo>

Defined in src/resource/resource.ts:56

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

since 0.4.0

Parameters:

Name

Type

Default value

Description

url

UrlString

-

URL to fetch Resource metadata from.

options

Partial<typeof internal_defaultFetchOptions>

internal_defaultFetchOptions

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.


getResourceInfoWithAcl

getResourceInfoWithAcl(url: UrlString, options?: Partial<typeof internal_defaultFetchOptions>): Promise<WithServerResourceInfo & WithAcl>

Defined in src/resource/resource.ts:97

Experimental: fetch a Resource’s metadata and its associated Access Control List.

This is an experimental function that fetches both a Resource’s metadata, the linked ACL Resource (if available), and the ACL that applies to it if the linked ACL Resource is not available (if accessible). This can result in many HTTP requests being executed, in lieu of the Solid spec mandating servers to provide this info in a single request.

If the Resource’s linked ACL Resource could not be fetched (because it does not exist, or because the authenticated user does not have access to it), acl.resourceAcl will be null. If the applicable Container’s ACL is not accessible to the authenticated user, acl.fallbackAcl will be null.

Parameters:

Name

Type

Default value

Description

url

UrlString

-

URL of the SolidDataset to fetch.

options

Partial<typeof internal_defaultFetchOptions>

internal_defaultFetchOptions

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

Returns: Promise<WithServerResourceInfo & WithAcl>

A Resource’s metadata and the ACLs that apply to the Resource, if available to the authenticated user.


getSourceUrl

getSourceUrl(resource: WithResourceInfo): string

Defined in src/resource/resource.ts:143

Parameters:

Name

Type

resource

WithResourceInfo

Returns: string

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

getSourceUrl(resource: Resource): string | null

Defined in src/resource/resource.ts:144

Parameters:

Name

Type

resource

Resource

Returns: string | null


isContainer

isContainer(resource: Url | UrlString | WithResourceInfo): boolean

Defined in src/resource/resource.ts:112

Parameters:

Name

Type

Description

resource

Url | UrlString | WithResourceInfo

Resource for which to check whether it is a Container.

Returns: boolean

Whether resource is a Container.


isPodOwner

isPodOwner(webId: WebId, resource: WithServerResourceInfo): boolean | null

Defined in src/resource/resource.ts:196

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

WebId

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.


isRawData

isRawData(resource: WithResourceInfo): boolean

Defined in src/resource/resource.ts:127

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.