@inrupt/solid-client-access-grants / resource

Module: resource#

Functions#

getFile#

getFile(resourceUrl, accessGrant, options?): Promise<Blob & WithResourceInfo & {}>

Retrieve a File from a Solid Pod using an Access Grant to prove the caller is authorized to access the target resource.

See

@inrupt/solid-client’s getFile

Since

0.4.0

Parameters#

Name

Type

Description

resourceUrl

string

The URL of the target resource.

accessGrant

VerifiableCredential

The Access Grant VC proving the caller is authorized.

options?

FetchOptions

Optional properties to customise the request behaviour.

Returns#

Promise<Blob & WithResourceInfo & {}>

A promise that resolves to a File if successful, and that rejects otherwise.

Defined in#

src/resource/file.ts:46


getSolidDataset#

getSolidDataset(datasetUrl, accessGrant, options?): Promise<Readonly<{}> & WithResourceInfo & {}>

Retrieve a Dataset from a Solid Pod using an Access Grant to prove the caller is authorized to access the target dataset.

See

@inrupt/solid-client’s getSolidDataset

Since

0.4.0

Parameters#

Name

Type

Description

datasetUrl

string

The URL of the target dataset.

accessGrant

VerifiableCredential

The Access Grant VC proving the caller is authorized.

options?

FetchOptions

Optional properties to customise the request behaviour.

Returns#

Promise<Readonly<{}> & WithResourceInfo & {}>

A promise that resolves to a SolidDataset if successful, and that rejects otherwise.

Defined in#

src/resource/getSolidDataset.ts:44


overwriteFile#

overwriteFile(resourceUrl, file, accessGrant, options?): Promise<Object>

Overwrites the file using an Access Grant to prove the caller is authorized to write to the given resource URL.

Note

This function does not support saving a file if the file does not yet exist, unlike its @inrupt/solid-client counterpart. To save a new file in a container, you should use saveFileInContainer instead.

See

@inrupt/solid-client’s overwriteFile

Since

1.1.0

Parameters#

Name

Type

Description

resourceUrl

string

The URL where the file is located.

file

File | Buffer

The file to be written.

accessGrant

VerifiableCredential

The Access Grant VC proving the caller is authorized.

options?

FetchOptions & { contentType?: string }

Optional properties to customise the request behaviour, or override the Content-Type of the file.

Returns#

Promise<Object>

A promise that resolves to a File if successful, and that rejects otherwise.

Defined in#

src/resource/file.ts:89


saveFileInContainer#

saveFileInContainer(containerUrl, file, accessGrant, options?): Promise<Object>

Saves a file in the given container URL using an Access Grant to prove the caller is authorized to save a file in the given container.

See

@inrupt/solid-client’s saveFileInContainer

Since

1.1.0

Parameters#

Name

Type

Description

containerUrl

string

The container URL where the file is to be saved.

file

File | Buffer

The file to be written.

accessGrant

VerifiableCredential

The Access Grant VC proving the caller is authorized.

options?

FetchOptions & { contentType?: string ; slug?: string }

Optional properties to customise the request behaviour, or override the Content-Type of the file.

Returns#

Promise<Object>

A promise that resolves to a File if successful, and that rejects otherwise.

Defined in#

src/resource/file.ts:133


saveSolidDatasetAt#

saveSolidDatasetAt<Dataset>(datasetUrl, solidDataset, accessGrant, options?): Promise<Dataset & WithResourceInfo & {} & Readonly<{}> & {}>

Saves a Dataset in a Solid Pod using an Access Grant to prove the caller is authorized to write or append to the dataset at the given dataset URL.

Note

This function does not support saving a dataset if the dataset does not yet exist, unlike its @inrupt/solid-client counterpart.

See

@inrupt/solid-client’s saveSolidDatasetAt

Since

0.4.0

Type parameters#

Name

Type

Dataset

extends Readonly<{}>

Parameters#

Name

Type

Description

datasetUrl

string

The URL of the dataset to save.

solidDataset

Dataset

-

accessGrant

VerifiableCredential

The Access Grant VC proving the caller is authorized.

options?

FetchOptions

Optional properties to customise the request behaviour.

Returns#

Promise<Dataset & WithResourceInfo & {} & Readonly<{}> & {}>

A promise that resolves to a SolidDataset if successful, and that rejects otherwise.

Defined in#

src/resource/saveSolidDatasetAt.ts:50