Skip to content

Commit 2fb51fa

Browse files
authored
Merge pull request #18 from IQSS/revert-17-feature/create_new_functions_to_allow_version_types
Revert "Create new functions to allow version types"
2 parents 53d1c70 + ec7353b commit 2fb51fa

5 files changed

Lines changed: 73 additions & 172 deletions

File tree

README.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,10 @@ const response = await client.getDataverseInformation('myDataverseAlias')
3232

3333
`public async getFileMetadata(fileId: string, draftVersion: boolean = false): Promise<AxiosResponse> {`
3434

35-
`public async getLatestPublishedDatasetInformation(datasetId: string): Promise<AxiosResponse> {`
36-
3735
`public async getLatestDatasetInformation(datasetId: string): Promise<AxiosResponse> {`
3836

39-
`public async getDraftDatasetInformation(datasetId: string): Promise<AxiosResponse> {`
40-
41-
`public async getLatestPublishedDatasetInformationFromDOI(doi: string): Promise<AxiosResponse> {`
42-
4337
`public async getLatestDatasetInformationFromDOI(doi: string): Promise<AxiosResponse> {`
4438

45-
`public async getDraftDatasetInformationFromDOI(doi: string): Promise<AxiosResponse> {`
46-
4739
`public async getDatasetVersions(datasetId: string): Promise<AxiosResponse> {`
4840

4941
```
@@ -53,8 +45,6 @@ Note: Version must be published, e.g.:
5345
http://demo.dataverse.org/api/datasets/389608/versions/1
5446
```
5547

56-
`public async getDatasetVersionFromDOI(doi: string, version: string): Promise<AxiosResponse> {`
57-
5848
`public async listDataverseRoleAssignments(dataverseAlias: string): Promise<AxiosResponse> {`
5949

6050
`public async getMetric(datasetId: string, metricType: DataverseMetricType, yearMonth?: string): Promise<AxiosResponse> {`

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "js-dataverse",
3-
"version": "1.0.30",
3+
"version": "1.0.29",
44
"description": "A Dataverse module for JavaScript/TypeScript",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",

src/@types/datasetVersionType.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/dataverseClient.ts

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { BasicDatasetInformation } from './@types/basicDataset'
77
import { DatasetUtil } from './utils/datasetUtil'
88
import request from 'request-promise'
99
import { DatasetVersionUpgradeType } from './@types/datasetVersionUpgradeType'
10-
import { DatasetVersionType } from './@types/datasetVersionType'
1110

1211
export class DataverseClient {
1312
private readonly host: string
@@ -64,28 +63,14 @@ export class DataverseClient {
6463
return this.getRequest(url)
6564
}
6665

67-
public async getLatestPublishedDatasetInformation(datasetId: string): Promise<AxiosResponse> {
68-
return this.getDatasetVersion(datasetId, DatasetVersionType.LATEST_PUBLISHED)
69-
}
70-
7166
public async getLatestDatasetInformation(datasetId: string): Promise<AxiosResponse> {
72-
return this.getDatasetVersion(datasetId, DatasetVersionType.LATEST)
73-
}
74-
75-
public async getDraftDatasetInformation(datasetId: string): Promise<AxiosResponse> {
76-
return this.getDatasetVersion(datasetId, DatasetVersionType.DRAFT)
77-
}
78-
79-
public async getLatestPublishedDatasetInformationFromDOI(doi: string): Promise<AxiosResponse> {
80-
return this.getDatasetVersionFromDOI(doi, DatasetVersionType.LATEST_PUBLISHED)
67+
const url = `${this.host}/api/datasets/${datasetId}`
68+
return this.getRequest(url)
8169
}
8270

8371
public async getLatestDatasetInformationFromDOI(doi: string): Promise<AxiosResponse> {
84-
return this.getDatasetVersionFromDOI(doi, DatasetVersionType.LATEST)
85-
}
86-
87-
public async getDraftDatasetInformationFromDOI(doi: string): Promise<AxiosResponse> {
88-
return this.getDatasetVersionFromDOI(doi, DatasetVersionType.DRAFT)
72+
const url = `${this.host}/api/datasets/:persistentId?persistentId=doi:${doi}`
73+
return this.getRequest(url)
8974
}
9075

9176
public async getDatasetVersions(datasetId: string): Promise<AxiosResponse> {
@@ -98,11 +83,6 @@ export class DataverseClient {
9883
return this.getRequest(url)
9984
}
10085

101-
public async getDatasetVersionFromDOI(doi: string, version: string): Promise<AxiosResponse> {
102-
const url = `${this.host}/api/datasets/:persistentId/versions/${version}?persistentId=doi:${doi}`
103-
return this.getRequest(url)
104-
}
105-
10686
public async getDatasetThumbnail(datasetId: string): Promise<AxiosResponse> {
10787
const url = `${this.host}/api/datasets/${datasetId}/thumbnail`
10888
return this.getRequest(url, {

0 commit comments

Comments
 (0)