@@ -3,7 +3,7 @@ import { toUrlSearchParams } from '../lib/to-url-search-params.js'
33import type { PinAPI , PinLsResult } from './index.js'
44import type { HTTPRPCClient } from '../lib/core.js'
55
6- function toPin ( type : string , cid : string , metadata : Record < string , string > ) : PinLsResult {
6+ function toPin ( type : string , cid : string , metadata : Record < string , string > , name : string ) : PinLsResult {
77 const pin : PinLsResult = {
88 type,
99 cid : CID . parse ( cid )
@@ -12,6 +12,9 @@ function toPin (type: string, cid: string, metadata: Record<string, string>): Pi
1212 if ( metadata != null ) {
1313 pin . metadata = metadata
1414 }
15+ if ( name != null ) {
16+ pin . name = name
17+ }
1518
1619 return pin
1720}
@@ -37,12 +40,12 @@ export function createLs (client: HTTPRPCClient): PinAPI['ls'] {
3740 for await ( const pin of res . ndjson ( ) ) {
3841 if ( pin . Keys != null ) { // non-streaming response
3942 for ( const cid of Object . keys ( pin . Keys ) ) {
40- yield toPin ( pin . Keys [ cid ] . Type , cid , pin . Keys [ cid ] . Metadata )
43+ yield toPin ( pin . Keys [ cid ] . Type , cid , pin . Keys [ cid ] . Metadata , pin . Keys [ cid ] . Name )
4144 }
4245 return
4346 }
4447
45- yield toPin ( pin . Type , pin . Cid , pin . Metadata )
48+ yield toPin ( pin . Type , pin . Cid , pin . Metadata , pin . Keys [ cid ] . Name )
4649 }
4750 }
4851}
0 commit comments