This repository has been archived by the owner on Jan 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3de8ae9
commit adb5d59
Showing
4 changed files
with
186 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
New-UDPage -Name "REST-APIs" -Endpoint { | ||
|
||
$OnlineVersion = 'https://github.com/ironmansoftware/universal-dashboard/blob/master/src/poshud/pages/rest-apis.ps1' | ||
|
||
New-UDElement -Tag div -Attributes @{ style = @{ paddingLeft = "20px" }} -Content { | ||
New-UDRow -Columns { | ||
New-UDColumn -Size 12 -Content { | ||
New-UDHeading -Size 3 -Text "REST APIs" | ||
} | ||
} | ||
|
||
New-UDRow -Columns { | ||
New-UDButton -Icon github -Text "Edit on GitHub" -OnClick ( | ||
New-UDEndpoint -Endpoint { | ||
Invoke-UDRedirect -Url $ArgumentList[0] -OpenInNewWindow | ||
} -ArgumentList $OnlineVersion | ||
) -BackgroundColor 'white' -FontColor 'black' | ||
} | ||
|
||
New-UDRow -Columns { | ||
New-UDColumn -Size 12 -Content { | ||
New-UDHeading -Size 5 -Text "You can define REST APIs to allow herrogenous systems to interact with PowerShell over HTTP." | ||
} | ||
} | ||
|
||
New-UDElement -tag 'hr' | ||
|
||
New-UDRow -Columns { | ||
New-UDColumn -Size 12 -Content { | ||
New-UDHeading -Size 4 -Text "Examples" | ||
} | ||
} | ||
|
||
New-UDRow -Columns { | ||
New-UDColumn -Size 12 -Content { | ||
New-UDRestApiExample -Name "Return Data" -Description "Creates a basic GET endpoint that returns data." -Code "New-UDEndpoint -Url '/data' -Endpoint { 'Hello, World!' } " -Invocation "Invoke-RestMethod http://localhost:10001/api/data" | ||
} | ||
} | ||
|
||
New-UDRow -Columns { | ||
New-UDColumn -Size 12 -Content { | ||
New-UDRestApiExample -Name "Filter Data" -Description "Filter data using route variables." -Code "New-UDEndpoint -Url '/data/:filter' -Endpoint { param(`$filter) @(1,2,3) | Where-Object { `$_ -eq `$filter } } " -Invocation "Invoke-RestMethod http://localhost:10001/api/data/1" | ||
} | ||
} | ||
|
||
New-UDRow -Columns { | ||
New-UDColumn -Size 12 -Content { | ||
New-UDRestApiExample -Name "Filter Data with query string parameters" -Description "Filter data using query string parameters." -Code "New-UDEndpoint -Url '/queryData' -Endpoint { param(`$filter) @(1,2,3) | Where-Object { `$_ -eq `$filter } } " -Invocation "Invoke-RestMethod http://localhost:10001/api/queryData?filter=1" | ||
} | ||
} | ||
|
||
|
||
New-UDRow -Columns { | ||
New-UDColumn -Size 12 -Content { | ||
New-UDRestApiExample -Name "Send Data to the Server" -Description "Sends data to the server via the body" -Code "New-UDEndpoint -Method POST -Url '/data' -Endpoint { param(`$Body) `$Body } " -Invocation "Invoke-RestMethod http://localhost:10001/api/data -Method POST -Body 'Echo'" | ||
} | ||
} | ||
|
||
New-UDRow -Columns { | ||
New-UDColumn -Size 12 -Content { | ||
New-UDRestApiExample -Name "Send Data via route variables" -Description "Uses route variables to send data to the endpoint on the server" -Code "New-UDEndpoint -Method POST -Url '/data/:variable' -Endpoint { param(`$variable) `$variable } " -Invocation "Invoke-RestMethod http://localhost:10001/api/data/echo -Method POST" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
New-UDPage -Name "Scheduled-Endpoints" -Endpoint { | ||
|
||
$OnlineVersion = 'https://github.com/ironmansoftware/universal-dashboard/blob/master/src/poshud/pages/scheduled-endpoints.ps1' | ||
|
||
New-UDElement -Tag div -Attributes @{ style = @{ paddingLeft = "20px" }} -Content { | ||
New-UDRow -Columns { | ||
New-UDColumn -Size 12 -Content { | ||
New-UDHeading -Size 3 -Text "Scheduled Endpoints" | ||
} | ||
} | ||
|
||
New-UDRow -Columns { | ||
New-UDButton -Icon github -Text "Edit on GitHub" -OnClick ( | ||
New-UDEndpoint -Endpoint { | ||
Invoke-UDRedirect -Url $ArgumentList[0] -OpenInNewWindow | ||
} -ArgumentList $OnlineVersion | ||
) -BackgroundColor 'white' -FontColor 'black' | ||
} | ||
|
||
New-UDRow -Columns { | ||
New-UDColumn -Size 12 -Content { | ||
New-UDHeading -Size 5 -Text "Scheduled endpoints allow you to schedule actions to be taken on an interval. This is similar to a task scheduler but can interact with features of Universal Dashboard." | ||
} | ||
} | ||
|
||
New-UDElement -tag 'hr' | ||
|
||
New-UDRow -Columns { | ||
New-UDColumn -Size 12 -Content { | ||
New-UDHeading -Size 4 -Text "Examples" | ||
} | ||
} | ||
|
||
New-UDRow -Columns { | ||
New-UDColumn -Size 12 -Content { | ||
New-UDRawExample -Title 'Scheduled every 10 minutes' -Description "Runs the scheduled endpoint every ten minutes." -Code "New-UDEndpoint -Schedule (New-UDEndpointSchedule -Every 10 -Minute) -Endpoint { `$Cache:Processes = Get-Process }" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters