Skip to content

Commit

Permalink
+ added content exploration methods and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Sluzhivoy committed Apr 9, 2024
1 parent 3bd3764 commit f33d041
Show file tree
Hide file tree
Showing 8 changed files with 864 additions and 88 deletions.
9 changes: 3 additions & 6 deletions PSTableauREST/PSTableauREST.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'PSTableauREST.psm1'

# Version number of this module.
ModuleVersion = '0.6.4'
ModuleVersion = '0.6.5'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down Expand Up @@ -151,13 +151,10 @@ FunctionsToExport = @(
'Get-TableauDataAlert', 'New-TableauDataAlert', 'Set-TableauDataAlert', 'Remove-TableauDataAlert',
'Add-TableauDataAlertUser', 'Remove-TableauDataAlertUser',
'Get-TableauWebhook', 'New-TableauWebhook', 'Set-TableauWebhook', 'Remove-TableauWebhook',
'Test-TableauWebhook','Get-TableauSiteSettingsNotification','Set-TableauSiteSettingsNotification'
'Test-TableauWebhook','Get-TableauSiteSettingsNotification','Set-TableauSiteSettingsNotification',

### Content Exploration methods
# Get content Suggestions
# Get content search results
# Get batch content usage statistics
# Get usage statistics for content item
'Get-TableauContentSuggestion','Get-TableauContentSearch','Get-TableauContentUsage',

### Ask Data Lens methods - retired in API 3.22
### Metrics methods - retired in API 3.22
Expand Down
338 changes: 257 additions & 81 deletions PSTableauREST/PSTableauREST.psm1

Large diffs are not rendered by default.

144 changes: 144 additions & 0 deletions docs/Get-TableauContentSearch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# Get-TableauContentSearch

## SYNOPSIS
Get content search results

## SYNTAX

```
Get-TableauContentSearch [[-Terms] <String[]>] [[-Filter] <String[]>] [[-OrderBy] <String[]>] [-All]
[[-Limit] <Int32>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
```

## DESCRIPTION
Searches across all supported content types for objects relevant to the search expression specified in the querystring of the request URI.

## EXAMPLES

### EXAMPLE 1
```
$results = Get-TableauContentSearch -Terms sales -Filter type:eq:workbook -Limit 5
```

## PARAMETERS

### -Terms
(Optional) One or more terms the search uses as the basis for which items are relevant to return.
The items may be of any supported content type.
The relevance may be assessed based on any element of a given item.
If no terms are supplied, then results will be based filtering and page size limits.

```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Filter
(Optional) An expression to filter the response using one of the following parameters, or a combination of expressions separated by a comma:
- type, e.g.
type:eq:workbook, type:in:\[workbook,datasource\]
- ownerId, e.g.
ownerId:in:\[akhil,fred,alice\]
- modifiedTime, using eq, lte, gte, gt operators.
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -OrderBy
(Optional) The sorting method for items returned, based on the popularity of the item.
You can sort based on:
hitsTotal - The number of times a content item has been viewed since it was created.
hitsSmallSpanTotal The number of times viewed in the last month.
hitsMediumSpanTotal The number of times viewed in the last three months.
hitsLargeSpanTotal The number of times viewed in the last twelve months.
downstreamWorkbookCount The number workbooks in a given project.
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -All
(Switch) When this parameter is provided, the search results are iterated for all pages
(until the search is exhausted, that is when "next" pointer in the results is empty).
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```
### -Limit
(Optional) The number of search results to return.
The default is 10.
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: 10
Accept pipeline input: False
Accept wildcard characters: False
```
### -ProgressAction
{{ Fill ProgressAction Description }}
```yaml
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
## OUTPUTS
### System.Management.Automation.PSObject
## NOTES
## RELATED LINKS
[https://help.tableau.com/current/api/rest_api/en-us/REST/TAG/index.html#tag/Content-Exploration-Methods/operation/ContentExplorationService_getSearch](https://help.tableau.com/current/api/rest_api/en-us/REST/TAG/index.html#tag/Content-Exploration-Methods/operation/ContentExplorationService_getSearch)
116 changes: 116 additions & 0 deletions docs/Get-TableauContentSuggestion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Get-TableauContentSuggestion

## SYNOPSIS
Get content Suggestions

## SYNTAX

```
Get-TableauContentSuggestion [-Terms] <String> [[-Filter] <String[]>] [[-Luid] <String[]>] [[-Limit] <Int32>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
```

## DESCRIPTION
Returns a specified number of suggestions for auto-completion of user input as they type.
You can specify content types of suggestions and prioritize recently viewed content.

## EXAMPLES

### EXAMPLE 1
```
$results = Get-TableauContentSuggestion -Terms regional
```

## PARAMETERS

### -Terms
The term that is matched to find suggestions.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Filter
(Optional) A filter to restrict suggestions to specified content types, e.g.
type:eq:workbook
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Luid
(Optional) A comma separated list of luids that will be prioritized in scoring of content items matched to suggest.
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Limit
(Optional) The number of suggestions to return.
The default is 10.
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: 10
Accept pipeline input: False
Accept wildcard characters: False
```
### -ProgressAction
{{ Fill ProgressAction Description }}
```yaml
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
## OUTPUTS
### System.Management.Automation.PSObject
## NOTES
## RELATED LINKS
[https://help.tableau.com/current/api/rest_api/en-us/REST/TAG/index.html#tag/Content-Exploration-Methods/operation/ContentExploration_getSuggestions](https://help.tableau.com/current/api/rest_api/en-us/REST/TAG/index.html#tag/Content-Exploration-Methods/operation/ContentExploration_getSuggestions)
78 changes: 78 additions & 0 deletions docs/Get-TableauContentUsage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Get-TableauContentUsage

## SYNOPSIS
Get content usage statistics

## SYNTAX

```
Get-TableauContentUsage [-Content] <Hashtable[]> [-ProgressAction <ActionPreference>] [<CommonParameters>]
```

## DESCRIPTION
Gets usage statistics for one or multiple content items, specified by LUID and content type (workbook, datasource, flow).

## EXAMPLES

### EXAMPLE 1
```
$results = Get-TableauContentUsage -Content @{type='workbooks';luid=$id}
```

### EXAMPLE 2
```
$results = Get-TableauContentUsage -Content @{type='workbooks';luid=$wbid},@{type='datasources';luid=$dsid}
```

## PARAMETERS

### -Content
An array of hashtables, containing at least one item, each of those should have the following keys:
- type: workbook, datasource, flow
- luid: the LUID of the content

```yaml
Type: Hashtable[]
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -ProgressAction
{{ Fill ProgressAction Description }}
```yaml
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
## OUTPUTS
### System.Management.Automation.PSObject
## NOTES
If the Content parameter contains one element, the GET request is sent (GetUsageStats).
If the Content parameter contains more than one element, the POST request is sent (BatchGetUsage).
## RELATED LINKS
[https://help.tableau.com/current/api/rest_api/en-us/REST/TAG/index.html#tag/Content-Exploration-Methods/operation/UsageStatsService_GetUsageStats](https://help.tableau.com/current/api/rest_api/en-us/REST/TAG/index.html#tag/Content-Exploration-Methods/operation/UsageStatsService_GetUsageStats)
[https://help.tableau.com/current/api/rest_api/en-us/REST/TAG/index.html#tag/Content-Exploration-Methods/operation/UsageStatsService_BatchGetUsage](https://help.tableau.com/current/api/rest_api/en-us/REST/TAG/index.html#tag/Content-Exploration-Methods/operation/UsageStatsService_BatchGetUsage)
Loading

0 comments on commit f33d041

Please sign in to comment.