Skip to content

Commit d0a3ee8

Browse files
author
James Brundage
committed
feat: Connect-Neocities ( Fixes #4 )
1 parent 07b407e commit d0a3ee8

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Commands/Connect-Neocities.ps1

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
function Connect-Neocities
2+
{
3+
<#
4+
.SYNOPSIS
5+
Connect to Neocities
6+
.DESCRIPTION
7+
Connect to Neocities using a credential object.
8+
9+
This will create a session that can be used to authenticate to the Neocities API.
10+
.LINK
11+
Get-Neocities
12+
#>
13+
param(
14+
# The Neocities credential
15+
[Parameter(ValueFromPipelineByPropertyName)]
16+
[Alias(
17+
'Credentials', # Plural aliases are nice
18+
'PSCredential', # so are parameters that match the type name.
19+
'NeocitiesCredential', # A contextual alias is a good idea, too.
20+
'NeocitiesCredentials' # And you may need to pluralize that contextual alias.
21+
)]
22+
[PSCredential]
23+
$Credential
24+
)
25+
26+
begin {
27+
$NeocitiesApi = "https://neocities.org/api"
28+
}
29+
30+
process {
31+
Invoke-RestMethod -Uri ($NeocitiesApi,'key' -join '/') -Credential $Credential -Authentication Basic
32+
}
33+
}

0 commit comments

Comments
 (0)