-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathlist.ts
27 lines (19 loc) · 942 Bytes
/
list.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { SfdxCommand } from '@salesforce/command';
import { WaveDataSetListResponse } from '../../../../shared/typeDefs';
export default class DatasetList extends SfdxCommand {
public static description = 'what analytics datasets are in my org?';
public static examples = ['sfdx shane:analytics:dataset:list'];
protected static flagsConfig = {};
protected static requiresUsername = true;
public async run(): Promise<any> {
// this.org is guaranteed because requiresUsername=true, as opposed to supportsUsername
const conn = this.org.getConnection();
const url = `${conn.baseUrl()}/wave/datasets`;
const results = ((await conn.request({
method: 'GET',
url
})) as unknown) as WaveDataSetListResponse;
this.ux.table(results.datasets, ['name', 'id', 'createdBy.name', 'datasetType', 'currentVersionId']);
return results.datasets;
}
}