File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed
Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ function com.atproto.repo.listRecords {
2+ [CmdletBinding (SupportsPaging )]
3+ [Alias (' at.records' )]
4+ param (
5+ [Parameter (ValueFromPipelineByPropertyName )]
6+ [string ]
7+ $did = " did:plc:hlchta7bwmobyum375ltycg5" ,
8+
9+ [Parameter (ValueFromPipelineByPropertyName )]
10+ [Alias (' $type' )]
11+ [string ]
12+ $Collection = " app.bsky.feed.post" ,
13+
14+ [string ]
15+ $Cursor ,
16+
17+ [int ]
18+ $Limit = 100
19+ )
20+
21+ process {
22+ $total = [long ]0
23+ $skipped = [long ]0
24+ :AtSync do {
25+ $xrpcUrl = " https://bsky.social/xrpc/com.atproto.repo.listRecords?repo=$did &collection=$collection &cursor=$Cursor &limit=$Limit "
26+ $results = Invoke-RestMethod $xrpcUrl
27+ if ($results -and $results.cursor ) {
28+ $Cursor = $results.cursor
29+ }
30+ foreach ($record in $results.records ) {
31+ if ($PSCmdlet.PagingParameters.Skip -and
32+ $skipped -lt $PSCmdlet.PagingParameters.Skip
33+ ) {
34+ $skipped ++
35+ continue
36+ }
37+
38+ $record.pstypenames.insert (0 , $collection )
39+ $record
40+ $total ++
41+
42+ if ($PSCmdlet.PagingParameters.First -and
43+ $total -ge $PSCmdlet.PagingParameters.First ) {
44+ break AtSync
45+ }
46+ }
47+ } while ($results -and $results.cursor )
48+ }
49+
50+
51+ }
You can’t perform that action at this time.
0 commit comments