Skip to content

Commit 7d85f78

Browse files
🩹 [Patch]: Added placeholder functions (#3)
## Description - Added placeholder functions ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [ ] 🪲 [Fix] - [x] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [Feature] - [ ] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
1 parent b38fd2d commit 7d85f78

File tree

3 files changed

+74
-1
lines changed

3 files changed

+74
-1
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
function Update-PSGalleryResourceListing {
2+
<#
3+
.SYNOPSIS
4+
Updates the listing status of a module on the PowerShell Gallery.
5+
6+
.EXAMPLE
7+
Update-PSGalleryResourceListing -Name 'MyModule' -Version '1.0.0' -Listed $true -APIKey 'myapikey'
8+
#>
9+
[CmdletBinding(SupportsShouldProcess)]
10+
param (
11+
# Name of the module.
12+
[Parameter(Mandatory)]
13+
[string] $Name,
14+
15+
# Version of the module.
16+
[Parameter(Mandatory)]
17+
[string] $Version,
18+
19+
# Whether the module is listed on the PowerShell Gallery.
20+
[Parameter(Mandatory)]
21+
[bool] $Listed,
22+
23+
# API key for the PowerShell Gallery.
24+
[Parameter(Mandatory)]
25+
[string] $APIKey
26+
)
27+
28+
$uri = "https://www.powershellgallery.com/packages/$Name/$Version/UpdateListed"
29+
30+
$body = @{
31+
__RequestVerificationToken = $APIKey
32+
Version = $Version
33+
Listed = $Listed
34+
}
35+
36+
if ($PSCmdlet.ShouldProcess("module [$Name]", 'Update listing status')) {
37+
Invoke-RestMethod -Uri $uri -Method Post -Body $body
38+
}
39+
}

src/PowerShellGallery/public/Get-PSGalleryAPI.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
[CmdletBinding()]
77
param()
88

9-
Invoke-RestMethod -Method Get -Uri https://www.powershellgallery.com/api/v2/ -ContentType 'application/json'
9+
Invoke-RestMethod -Method Get -Uri 'https://www.powershellgallery.com/api/v2/' -ContentType 'application/json'
1010
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
function Get-PSGalleryResource {
2+
<#
3+
.SYNOPSIS
4+
Get a resource from the PowerShell Gallery.
5+
6+
.DESCRIPTION
7+
Long description
8+
9+
.EXAMPLE
10+
Get-PSGalleryResource -Name 'MyModule' -Version '1.0.0'
11+
12+
.NOTES
13+
General notes
14+
#>
15+
16+
[CmdletBinding()]
17+
param (
18+
# Name of the module.
19+
[Parameter(Mandatory)]
20+
[string] $Name,
21+
22+
# The API key for the PowerShell Gallery.
23+
[Parameter(Mandatory)]
24+
[string] $APIKey
25+
)
26+
27+
$uri = "https://www.powershellgallery.com/packages/$Name"
28+
29+
$body = @{
30+
__RequestVerificationToken = $APIKey
31+
}
32+
33+
Invoke-RestMethod -Uri $uri -Method Get -Body $body
34+
}

0 commit comments

Comments
 (0)