@@ -4,19 +4,12 @@ import type {
44 AppBskyActorGetProfiles ,
55 AppBskyActorSearchActors ,
66 AppBskyActorSearchActorsTypeahead ,
7+ AppBskyNS ,
78} from '@atproto/api' ;
8- import { AppBskyNS } from '@atproto/api' ;
99import { Paginator } from './Paginator' ;
10- import { SessionManager } from './session' ;
11- import { XrpcClient } from './xrpc' ;
1210
1311export class TSky {
14- xrpc : XrpcClient ;
15-
16- constructor ( { url, identifier, password } : { url : string ; identifier : string ; password : string } ) {
17- const session = new SessionManager ( url ) ;
18- this . xrpc = new XrpcClient ( session ) ;
19- }
12+ constructor ( private instance : AppBskyNS ) { }
2013
2114 /**
2215 * Get detailed profile view of an actor. Does not require auth, but contains relevant metadata with auth.
@@ -40,11 +33,18 @@ export class TSky {
4033 | AppBskyActorGetProfiles . CallOptions ,
4134 ) {
4235 if ( Array . isArray ( identifier ) ) {
43- const profiles = await Promise . all ( identifier . map ( i => this . profile ( i , options ) ) ) ;
44- return profiles ;
36+ const res = await this . instance . actor . getProfiles (
37+ { actors : identifier } ,
38+ options ,
39+ ) ;
40+
41+ return res . data . profiles ;
4542 }
4643
47- const res = await this . xrpc . request ( 'app.bsky.actor.getProfile' , 'GET' , { actor : identifier } ) ;
44+ const res = await this . instance . actor . getProfile (
45+ { actor : identifier [ 0 ] } ,
46+ options ,
47+ ) ;
4848
4949 return res . data ;
5050 }
0 commit comments