File tree Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Original file line number Diff line number Diff line change 1+ function Get-SlackFile {
2+ [CmdletBinding ()]
3+ param (
4+ [Parameter (Mandatory = $true , Position = 0 )]
5+ [string ]$Token ,
6+ [Parameter (Mandatory = $true , Position = 1 )]
7+ [string ]$Uri ,
8+ [Parameter (Mandatory = $false , Position = 2 )]
9+ [string ]$OutFile
10+ )
11+
12+ begin {
13+ Write-Verbose " Cmdlet Get-SlackFile - Begin"
14+ }
15+
16+ process {
17+ Write-Verbose " Cmdlet Get-SlackFile - Process"
18+ $headers = Get-RequestHeader $Token
19+ if ($OutFile ) {
20+ Invoke-WebRequest - Method Get - Uri $Uri - Headers $headers - OutFile $OutFile
21+ }else {
22+ Invoke-WebRequest - Method Get - Uri $Uri - Headers $headers | Select-Object - ExpandProperty Content
23+ }
24+ }
25+
26+ end {
27+ Write-Verbose " Cmdlet Get-SlackFile - End"
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ function Get-FilesList {
2+ [CmdletBinding ()]
3+ param (
4+ [Parameter (Mandatory = $true , Position = 0 )]
5+ [string ]$Token ,
6+ [Parameter (Mandatory = $false , Position = 1 )]
7+ [string ]$ChannelId ,
8+ [Parameter (Mandatory = $false , Position = 2 )]
9+ [string ]$TsFrom ,
10+ [Parameter (Mandatory = $false , Position = 3 )]
11+ [string ]$TsTo ,
12+ [Parameter (Mandatory = $false , Position = 4 )]
13+ [int ]$Count = 1000 ,
14+ [Parameter (Mandatory = $false , Position = 5 )]
15+ [int ]$Page = 1
16+ )
17+
18+ begin {
19+ Write-Verbose " Cmdlet Get-FilesList - Begin"
20+ }
21+
22+ process {
23+ Write-Verbose " Cmdlet Get-FilesList - Process"
24+ $params = @ {
25+ ' channel' = $ChannelId ;
26+ ' count' = $Count ;
27+ ' ts_from' = $TsFrom
28+ ' ts_to' = $TsTo
29+ ' page' = $Page
30+ }
31+ Invoke-SlackAPI - Method ' files.list' - Token $Token - Parameters $params
32+ }
33+
34+ end {
35+ Write-Verbose " Cmdlet Get-FilesList - End"
36+ }
37+ }
You can’t perform that action at this time.
0 commit comments