File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,25 @@ function Get-WebSocket {
84
84
{$args.commit.record.text -match '[\p{IsHighSurrogates}\p{IsLowSurrogates}]+'}={
85
85
$matches.0
86
86
}
87
- }
87
+ }
88
+ . EXAMPLE
89
+ # We can decorate a type returned from a WebSocket, allowing us to add additional properties.
90
+
91
+ # For example, let's add a `Tags` property to the `app.bsky.feed.post` type.
92
+ $typeName = 'app.bsky.feed.post'
93
+ Update-TypeData -TypeName $typeName -MemberName 'Tags' -MemberType ScriptProperty -Value {
94
+ @($this.commit.record.facets.features.tag)
95
+ } -Force
96
+
97
+ # Now, let's get 10kb posts ( this should not take too long )
98
+ $somePosts =
99
+ websocket "wss://jetstream2.us-west.bsky.network/subscribe?wantedCollections=$typeName" -PSTypeName $typeName -Maximum 10kb -Watch
100
+ $somePosts |
101
+ ? Tags |
102
+ Select -ExpandProperty Tags |
103
+ Group |
104
+ Sort Count -Descending |
105
+ Select -First 10
88
106
#>
89
107
[CmdletBinding (PositionalBinding = $false )]
90
108
[Alias (' WebSocket' )]
You can’t perform that action at this time.
0 commit comments