Skip to content

Commit

Permalink
Added: getDatasetLocks docs
Browse files Browse the repository at this point in the history
  • Loading branch information
GPortas committed Jan 31, 2024
1 parent 291b4a0 commit c1039f1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
35 changes: 31 additions & 4 deletions docs/useCases.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ The different use cases currently available in the package are classified below,
- [Datasets](#Datasets)
- [Datasets read use cases](#datasets-read-use-cases)
- [Get a Dataset](#get-a-dataset)
- [Get Citation Text from a Dataset](#get-citation-text-from-a-dataset)
- [List all Datasets](#list-all-datasets)
- [Get Dataset Citation Text](#get-dataset-citation-text)
- [Get Dataset Locks](#get-dataset-locks)
- [List All Datasets](#list-all-datasets)
- [Files](#Files)
- [Metadata Blocks](#metadata-blocks)
- [Users](#Users)
Expand Down Expand Up @@ -53,7 +54,7 @@ The `datasetVersionId` parameter can correspond to a numeric version identifier,

There is a third optional parameter called `includeDeaccessioned`, which indicates whether to consider deaccessioned versions or not in the dataset search. If not set, the default value is `false`.

#### Get Citation Text from a Dataset
#### Get Dataset Citation Text

Returns the Dataset citation text.

Expand All @@ -64,7 +65,7 @@ import { getDatasetCitation } from '@iqss/dataverse-client-javascript'

/* ... */

const datasetId = 'doi:10.77777/FK2/AAAAAA';
const datasetId = 2;
const datasetVersionId = '1.0';

getDatasetCitation
Expand All @@ -80,6 +81,32 @@ getDatasetCitation

There is a third optional parameter called `includeDeaccessioned`, which indicates whether to consider deaccessioned versions or not in the dataset search. If not set, the default value is `false`.

#### Get Dataset Locks

Returns a [DatasetLock](../src/datasets/domain/models/DatasetLock.ts) array of all locks present in a Dataset.

##### Example call:

````typescript
import { getDatasetLocks } from '@iqss/dataverse-client-javascript'

/* ... */

const datasetId = 'doi:10.77777/FK2/AAAAAA';

getDatasetLocks
.execute(datasetId)
.then((datasetLocks: DatasetLock[]) => {
/* ... */
});

/* ... */
````

*See [use case](../src/datasets/domain/useCases/GetDatasetLocks.ts) definition*.

The `datasetId` parameter can be a string, for persistent identifiers, or a number, for numeric identifiers.

#### List All Datasets

Returns an instance of [DatasetPreviewSubset](../src/datasets/domain/models/DatasetPreviewSubset.ts) that contains reduced information for each dataset that the calling user can access in the installation.
Expand Down
6 changes: 6 additions & 0 deletions src/datasets/domain/useCases/GetDatasetLocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ export class GetDatasetLocks implements UseCase<DatasetLock[]> {
this.datasetsRepository = datasetsRepository;
}

/**
* Returns all locks present in a Dataset.
*
* @param {number | string} [datasetId] - The dataset identifier, which can be a string (for persistent identifiers), or a number (for numeric identifiers).
* @returns {Promise<DatasetLock[]>}
*/
async execute(datasetId: number | string): Promise<DatasetLock[]> {
return await this.datasetsRepository.getDatasetLocks(datasetId);
}
Expand Down

0 comments on commit c1039f1

Please sign in to comment.