File tree Expand file tree Collapse file tree 3 files changed +67
-0
lines changed
Raindrop.API/Public/Backup Expand file tree Collapse file tree 3 files changed +67
-0
lines changed Original file line number Diff line number Diff line change 1+ function Get-RaindropBackup {
2+ param (
3+ [Parameter (Mandatory )]
4+ [string ] $ApiToken
5+ )
6+
7+ $url = " $Global :RaindropBaseUrl /backups"
8+ $headers = Get-RaindropAuthHeader - ApiToken $ApiToken
9+
10+ try {
11+ $response = Invoke-RestMethod - Uri $url - Headers $headers - Method Get
12+ return $response.items
13+ }
14+ catch {
15+ Write-Error " Failed to retrieve projects: $_ "
16+ }
17+ }
Original file line number Diff line number Diff line change 1+ function New-RaindropBackup {
2+ param (
3+ [Parameter (Mandatory )]
4+ [string ] $ApiToken
5+ )
6+
7+ $url = " $Global :RaindropBaseUrl /backup"
8+ $headers = Get-RaindropAuthHeader - ApiToken $ApiToken
9+
10+ try {
11+ $response = Invoke-RestMethod - Uri $url - Headers $headers - Method Get
12+ Write-Host $response.message
13+ return $response.result
14+ }
15+ catch {
16+ Write-Error " Failed to retrieve projects: $_ "
17+ }
18+ }
Original file line number Diff line number Diff line change 1+ function Save-RaindropBackup {
2+ param (
3+ [Parameter (Mandatory )]
4+ [string ] $ApiToken ,
5+
6+ [Parameter (Mandatory = $true )]
7+ [string ] $id = 0 ,
8+
9+ [Parameter (Mandatory = $true )]
10+ [ValidateSet (" csv" , " html" )]
11+ [string ] $format ,
12+
13+ [Parameter (Mandatory = $false )]
14+ [string ] $OutFile
15+ )
16+
17+ $url = " $Global :RaindropBaseUrl /backup/$id .$format "
18+ $headers = Get-RaindropAuthHeader - ApiToken $ApiToken
19+
20+ try {
21+ if ([string ]::IsNullOrEmpty($OutFile )) {
22+ $response = Invoke-RestMethod - Uri $url - Headers $headers - Method Get
23+ return $response
24+ }
25+ else {
26+ Invoke-WebRequest - Uri $url - Headers $headers - Method Get - OutFile $OutFile
27+ }
28+ }
29+ catch {
30+ Write-Error " Failed to retrieve projects: $_ "
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments