-
Notifications
You must be signed in to change notification settings - Fork 10
Use Cases of Get and Delete a template #406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jp-tosca
merged 8 commits into
develop
from
398-use-cases-of-adding-and-deleting-a-new-template
Jan 15, 2026
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
243eda1
feat: restructure template
ChengShi-1 778f30c
feat: get and delete a single template by id
ChengShi-1 0d51b50
chore: sync the naming to template fron DatasetTemplate
ChengShi-1 0f7eab0
chore: a lint fix
ChengShi-1 5b57f4c
Naming Convention update
ChengShi-1 cbbff32
rename createDatasetTemplate to createTemplate, and clean GetTemplate…
ChengShi-1 31ac368
chore: use case clean
ChengShi-1 355ac27
Merge Conflict
ChengShi-1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,13 @@ The different use cases currently available in the package are classified below, | |
| - [Update Collection Featured Items](#update-collection-featured-items) | ||
| - [Delete Collection Featured Items](#delete-collection-featured-items) | ||
| - [Delete a Collection Featured Item](#delete-a-collection-featured-item) | ||
| - [Create a Dataset Template](#create-a-dataset-template) | ||
| - [Templates](#Templates) | ||
| - [Templates read use cases](#templates-read-use-cases) | ||
| - [Get a Template](#get-a-template) | ||
| - [Get Dataset Templates](#get-dataset-templates) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to update the useCase docs with the new function name |
||
| - [Templates write use cases](#templates-write-use-cases) | ||
| - [Create a Template](#create-a-template) | ||
| - [Delete a Template](#delete-a-template) | ||
| - [Datasets](#Datasets) | ||
| - [Datasets read use cases](#datasets-read-use-cases) | ||
| - [Get a Dataset](#get-a-dataset) | ||
|
|
@@ -40,7 +46,6 @@ The different use cases currently available in the package are classified below, | |
| - [Get Dataset Versions Summaries](#get-dataset-versions-summaries) | ||
| - [Get Dataset Linked Collections](#get-dataset-linked-collections) | ||
| - [Get Dataset Available Categories](#get-dataset-available-categories) | ||
| - [Get Dataset Templates](#get-dataset-templates) | ||
| - [Get Dataset Available Dataset Types](#get-dataset-available-dataset-types) | ||
| - [Get Dataset Available Dataset Type](#get-dataset-available-dataset-type) | ||
| - [Datasets write use cases](#datasets-write-use-cases) | ||
|
|
@@ -569,18 +574,60 @@ deleteCollectionFeaturedItem.execute(featuredItemId) | |
|
|
||
| _See [use case](../src/collections/domain/useCases/DeleteCollectionFeaturedItem.ts)_ definition. | ||
|
|
||
| #### Create a Dataset Template | ||
| ## Templates | ||
|
|
||
| ### Templates Read Use Cases | ||
|
|
||
| #### Get a Template | ||
|
|
||
| Creates a dataset template for a given Dataverse collection id or alias. | ||
| Returns a [Template](../src/templates/domain/models/Template.ts) by its template id. | ||
|
|
||
| ##### Example call: | ||
|
|
||
| ```typescript | ||
| import { createDatasetTemplate } from '@iqss/dataverse-client-javascript' | ||
| import { TemplateCreateDTO } from '@iqss/dataverse-client-javascript' | ||
| import { getTemplate } from '@iqss/dataverse-client-javascript' | ||
|
|
||
| const templateId = 12345 | ||
|
|
||
| getTemplate.execute(templateId).then((template: Template) => { | ||
| /* ... */ | ||
| }) | ||
| ``` | ||
|
|
||
| _See [use case](../src/templates/domain/useCases/GetTemplate.ts)_ definition. | ||
|
|
||
| #### Get Dataset Templates | ||
|
ChengShi-1 marked this conversation as resolved.
Outdated
|
||
|
|
||
| Returns a [Template](../src/templates/domain/models/Template.ts) array containing the templates of the requested collection, given the collection identifier or alias. | ||
|
|
||
| ##### Example call: | ||
|
|
||
| ```typescript | ||
| import { getDatasetTemplates } from '@iqss/dataverse-client-javascript' | ||
|
|
||
| const collectionIdOrAlias = 12345 | ||
|
|
||
| getDatasetTemplates.execute(collectionIdOrAlias).then((datasetTemplates: Template[]) => { | ||
| /* ... */ | ||
| }) | ||
| ``` | ||
|
|
||
| _See [use case](../src/templates/domain/useCases/GetDatasetTemplates.ts)_ definition. | ||
|
|
||
| ### Templates Write Use Cases | ||
|
|
||
| #### Create a Template | ||
|
|
||
| Creates a template for a given Dataverse collection id or alias. | ||
|
|
||
| ##### Example call: | ||
|
|
||
| ```typescript | ||
| import { createTemplate } from '@iqss/dataverse-client-javascript' | ||
| import { CreateDatasetTemplateDTO } from '@iqss/dataverse-client-javascript' | ||
|
|
||
| const collectionAlias = ':root' | ||
| const template: TemplateCreateDTO = { | ||
| const template: CreateDatasetTemplateDTO = { | ||
| name: 'Dataverse template', | ||
| isDefault: true, | ||
| fields: [ | ||
|
|
@@ -599,10 +646,26 @@ const template: TemplateCreateDTO = { | |
| instructions: [{ instructionField: 'author', instructionText: 'The author data' }] | ||
| } | ||
|
|
||
| await createDatasetTemplate.execute(template, collectionAlias) | ||
| await createTemplate.execute(template, collectionAlias) | ||
| ``` | ||
|
|
||
| _See [use case](../src/templates/domain/useCases/CreateTemplate.ts) implementation_. | ||
|
|
||
| #### Delete a Template | ||
|
|
||
| Deletes a template by its template id. | ||
|
|
||
| ##### Example call: | ||
|
|
||
| ```typescript | ||
| import { deleteTemplate } from '@iqss/dataverse-client-javascript' | ||
|
|
||
| const templateId = 12345 | ||
|
|
||
| await deleteTemplate.execute(templateId) | ||
| ``` | ||
|
|
||
| _See [use case](../src/collections/domain/useCases/CreateDatasetTemplate.ts) implementation_. | ||
| _See [use case](../src/templates/domain/useCases/DeleteTemplate.ts)_ definition. | ||
|
|
||
| ## Datasets | ||
|
|
||
|
|
@@ -1333,24 +1396,6 @@ _See [use case](../src/datasets/domain/useCases/GetDatasetAvailableCategories.ts | |
|
|
||
| The `datasetId` parameter is a number for numeric identifiers or string for persistent identifiers. | ||
|
|
||
| #### Get Dataset Templates | ||
|
|
||
| Returns a [DatasetTemplate](../src/datasets/domain/models/DatasetTemplate.ts) array containing the dataset templates of the requested collection, given the collection identifier or alias. | ||
|
|
||
| ##### Example call: | ||
|
|
||
| ```typescript | ||
| import { getDatasetTemplates } from '@iqss/dataverse-client-javascript' | ||
|
|
||
| const collectionIdOrAlias = 12345 | ||
|
|
||
| getDatasetTemplates.execute(collectionIdOrAlias).then((datasetTemplates: DatasetTemplate[]) => { | ||
| /* ... */ | ||
| }) | ||
| ``` | ||
|
|
||
| _See [use case](../src/datasets/domain/useCases/GetDatasetTemplates.ts)_ definition. | ||
|
|
||
| #### Add a Dataset Type | ||
|
|
||
| Adds a dataset types that can be used at dataset creation. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 0 additions & 57 deletions
57
src/datasets/infra/repositories/transformers/datasetTemplateTransformers.ts
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.