From b091c47db808f4099e034a77adc67b5c8f1b42b5 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Fri, 24 Jan 2025 03:56:06 +0000 Subject: [PATCH 1/4] feat: WebSocket Parameter Sets ( Fixes #73, Fixes #74, Fixes #76 ) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9f2d4e2..1ff022d 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ To stop watching a websocket, simply stop the background job. ~~~powershell # Create a WebSocket job that connects to a WebSocket and outputs the results. -Get-WebSocket -WebSocketUri "wss://localhost:9669/" +Get-WebSocket -SocketUrl "wss://localhost:9669/" ~~~ #### Get-WebSocket Example 2 From 75172ec4f3c4d03c7dab57b2b45eea727aa344a4 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Fri, 24 Jan 2025 03:56:14 +0000 Subject: [PATCH 2/4] feat: WebSocket Parameter Sets ( Fixes #73, Fixes #74, Fixes #76 ) --- docs/Get-WebSocket.md | 77 ++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/docs/Get-WebSocket.md b/docs/Get-WebSocket.md index e9b5c3f..7de7e2e 100644 --- a/docs/Get-WebSocket.md +++ b/docs/Get-WebSocket.md @@ -20,7 +20,7 @@ If the `-Watch` parameter is provided, will output a continous stream of objects Create a WebSocket job that connects to a WebSocket and outputs the results. ```PowerShell -Get-WebSocket -WebSocketUri "wss://localhost:9669/" +Get-WebSocket -SocketUrl "wss://localhost:9669/" ``` Get is the default verb, so we can just say WebSocket. `-Watch` will output a continous stream of objects from the websocket. @@ -146,20 +146,20 @@ $somePosts | --- ### Parameters -#### **WebSocketUri** +#### **SocketUrl** The WebSocket Uri. -|Type |Required|Position|PipelineInput |Aliases | -|-------|--------|--------|---------------------|----------------------------| -|`[Uri]`|false |1 |true (ByPropertyName)|Url
Uri
WebSocketUrl| +|Type |Required|Position|PipelineInput |Aliases | +|-------|--------|--------|---------------------|---------------------------------------------| +|`[Uri]`|false |1 |true (ByPropertyName)|Url
Uri
WebSocketUri
WebSocketUrl| #### **RootUrl** One or more root urls. If these are provided, a WebSocket server will be created with these listener prefixes. -|Type |Required|Position|PipelineInput |Aliases | -|------------|--------|--------|---------------------|---------------------------------------------------------------------------------------------------| -|`[String[]]`|false |2 |true (ByPropertyName)|HostHeader
Host
CNAME
ServerURL
ListenerPrefix
ListenerPrefixes
ListenerUrl| +|Type |Required|Position|PipelineInput |Aliases | +|------------|--------|--------|---------------------|-------------------------------------------------------------------------------------| +|`[String[]]`|true |1 |true (ByPropertyName)|HostHeader
Host
CNAME
ListenerPrefix
ListenerPrefixes
ListenerUrl| #### **Route** A route table for all requests. @@ -179,9 +179,9 @@ This will be displayed when visiting the root url. #### **PaletteName** The name of the palette to use. This will include the [4bitcss](https://4bitcss.com) stylesheet. -|Type |Required|Position|PipelineInput|Aliases | -|----------|--------|--------|-------------|----------------------------------------| -|`[String]`|false |named |false |Palette
ColorScheme
ColorPalette| +|Type |Required|Position|PipelineInput |Aliases | +|----------|--------|--------|---------------------|----------------------------------------| +|`[String]`|false |named |true (ByPropertyName)|Palette
ColorScheme
ColorPalette| #### **GoogleFont** The [Google Font](https://fonts.google.com/) name. @@ -214,11 +214,11 @@ A javascript import map. This allows you to import javascript modules. #### **QueryParameter** A collection of query parameters. -These will be appended onto the `-WebSocketUri`. +These will be appended onto the `-SocketUrl`. -|Type |Required|Position|PipelineInput| -|---------------|--------|--------|-------------| -|`[IDictionary]`|false |named |false | +|Type |Required|Position|PipelineInput | +|---------------|--------|--------|---------------------| +|`[IDictionary]`|false |named |true (ByPropertyName)| #### **Handler** A ScriptBlock that will handle the output of the WebSocket. @@ -322,9 +322,9 @@ If set, will force a new job to be created, rather than reusing an existing job. #### **SubProtocol** The subprotocol used by the websocket. If not provided, this will default to `json`. -|Type |Required|Position|PipelineInput| -|----------|--------|--------|-------------| -|`[String]`|false |named |false | +|Type |Required|Position|PipelineInput | +|----------|--------|--------|---------------------| +|`[String]`|false |named |true (ByPropertyName)| #### **Filter** One or more filters to apply to the output of the WebSocket. @@ -333,18 +333,18 @@ If they are strings or regexes, they will be applied to the raw text. If they are scriptblocks, they will be applied to the deserialized JSON. These filters will be run within the WebSocket job. -|Type |Required|Position|PipelineInput| -|--------------|--------|--------|-------------| -|`[PSObject[]]`|false |named |false | +|Type |Required|Position|PipelineInput | +|--------------|--------|--------|---------------------| +|`[PSObject[]]`|false |named |true (ByPropertyName)| #### **WatchFor** If set, will watch the output of a WebSocket job for one or more conditions. The conditions are the keys of the dictionary, and can be a regex, a string, or a scriptblock. The values of the dictionary are what will happen when a match is found. -|Type |Required|Position|PipelineInput|Aliases | -|---------------|--------|--------|-------------|----------------------| -|`[IDictionary]`|false |named |false |WhereFor
Wherefore| +|Type |Required|Position|PipelineInput |Aliases | +|---------------|--------|--------|---------------------|----------------------| +|`[IDictionary]`|false |named |true (ByPropertyName)|WhereFor
Wherefore| #### **TimeOut** The timeout for the WebSocket connection. If this is provided, after the timeout elapsed, the WebSocket will be closed. @@ -357,9 +357,9 @@ The timeout for the WebSocket connection. If this is provided, after the timeou If provided, will decorate the objects outputted from a websocket job. This will only decorate objects converted from JSON. -|Type |Required|Position|PipelineInput|Aliases | -|------------|--------|--------|-------------|---------------------------------------| -|`[String[]]`|false |named |false |PSTypeNames
Decorate
Decoration| +|Type |Required|Position|PipelineInput |Aliases | +|------------|--------|--------|---------------------|---------------------------------------| +|`[String[]]`|false |named |true (ByPropertyName)|PSTypeNames
Decorate
Decoration| #### **Maximum** The maximum number of messages to receive before closing the WebSocket. @@ -379,25 +379,25 @@ The throttle limit used when creating background jobs. The maximum time to wait for a connection to be established. By default, this is 7 seconds. -|Type |Required|Position|PipelineInput| -|------------|--------|--------|-------------| -|`[TimeSpan]`|false |named |false | +|Type |Required|Position|PipelineInput | +|------------|--------|--------|---------------------| +|`[TimeSpan]`|false |named |true (ByPropertyName)| #### **Runspace** The Runspace where the handler should run. Runspaces allow you to limit the scope of the handler. -|Type |Required|Position|PipelineInput| -|------------|--------|--------|-------------| -|`[Runspace]`|false |named |false | +|Type |Required|Position|PipelineInput | +|------------|--------|--------|---------------------| +|`[Runspace]`|false |named |true (ByPropertyName)| #### **RunspacePool** The RunspacePool where the handler should run. RunspacePools allow you to limit the scope of the handler to a pool of runspaces. -|Type |Required|Position|PipelineInput|Aliases| -|----------------|--------|--------|-------------|-------| -|`[RunspacePool]`|false |named |false |Pool | +|Type |Required|Position|PipelineInput |Aliases| +|----------------|--------|--------|---------------------|-------| +|`[RunspacePool]`|false |named |true (ByPropertyName)|Pool | #### **IncludeTotalCount** @@ -421,5 +421,8 @@ RunspacePools allow you to limit the scope of the handler to a pool of runspaces ### Syntax ```PowerShell -Get-WebSocket [[-WebSocketUri] ] [[-RootUrl] ] [-Route ] [-HTML ] [-PaletteName ] [-GoogleFont ] [-CodeFont ] [-JavaScript ] [-ImportMap ] [-QueryParameter ] [-Handler ] [-Variable ] [-Name ] [-InitializationScript ] [-BufferSize ] [-Broadcast ] [-OnConnect ] [-OnError ] [-OnOutput ] [-OnWarning ] [-Watch] [-RawText] [-Binary] [-Force] [-SubProtocol ] [-Filter ] [-WatchFor ] [-TimeOut ] [-PSTypeName ] [-Maximum ] [-ThrottleLimit ] [-ConnectionTimeout ] [-Runspace ] [-RunspacePool ] [-IncludeTotalCount] [-Skip ] [-First ] [] +Get-WebSocket [[-SocketUrl] ] [-QueryParameter ] [-Variable ] [-Name ] [-InitializationScript ] [-BufferSize ] [-Broadcast ] [-OnConnect ] [-OnError ] [-OnOutput ] [-OnWarning ] [-Watch] [-RawText] [-Binary] [-Force] [-SubProtocol ] [-Filter ] [-WatchFor ] [-TimeOut ] [-PSTypeName ] [-Maximum ] [-ThrottleLimit ] [-ConnectionTimeout ] [-Runspace ] [-RunspacePool ] [-IncludeTotalCount] [-Skip ] [-First ] [] +``` +```PowerShell +Get-WebSocket [-RootUrl] [-Route ] [-HTML ] [-PaletteName ] [-GoogleFont ] [-CodeFont ] [-JavaScript ] [-ImportMap ] [-Handler ] [-Variable ] [-Name ] [-InitializationScript ] [-BufferSize ] [-Broadcast ] [-Force] [-TimeOut ] [-Maximum ] [-ThrottleLimit ] [-IncludeTotalCount] [-Skip ] [-First ] [] ``` From 3dbaeccc346a5932c4e00761a46f2190b9c05130 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Fri, 24 Jan 2025 03:56:14 +0000 Subject: [PATCH 3/4] feat: WebSocket Parameter Sets ( Fixes #73, Fixes #74, Fixes #76 ) --- docs/_data/Help/Get-WebSocket.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_data/Help/Get-WebSocket.json b/docs/_data/Help/Get-WebSocket.json index b24a853..c6b964e 100644 --- a/docs/_data/Help/Get-WebSocket.json +++ b/docs/_data/Help/Get-WebSocket.json @@ -33,7 +33,7 @@ { "Title": "EXAMPLE 1", "Markdown": "Create a WebSocket job that connects to a WebSocket and outputs the results.", - "Code": "Get-WebSocket -WebSocketUri \"wss://localhost:9669/\"" + "Code": "Get-WebSocket -SocketUrl \"wss://localhost:9669/\"" }, { "Title": "EXAMPLE 2", From 10bd595a52ce78a0800ac01179c0d7c522159b12 Mon Sep 17 00:00:00 2001 From: StartAutomating Date: Fri, 24 Jan 2025 03:56:15 +0000 Subject: [PATCH 4/4] feat: WebSocket Parameter Sets ( Fixes #73, Fixes #74, Fixes #76 ) --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 7c727fb..811d474 100644 --- a/docs/README.md +++ b/docs/README.md @@ -46,7 +46,7 @@ To stop watching a websocket, simply stop the background job. ~~~powershell # Create a WebSocket job that connects to a WebSocket and outputs the results. -Get-WebSocket -WebSocketUri "wss://localhost:9669/" +Get-WebSocket -SocketUrl "wss://localhost:9669/" ~~~ #### Get-WebSocket Example 2