Skip to content

Commit 62dd8f5

Browse files
committed
undo unrelated
1 parent 9cc36f8 commit 62dd8f5

4 files changed

Lines changed: 17 additions & 122 deletions

File tree

packages/core/src/index.test.ts

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,11 @@
11
import { describe, expect, it } from 'vitest';
2-
import { TSky } from './index';
3-
4-
const ALICE_DID = 'did:plc:jguhdmnjclquqf5lsvkyxqy3';
5-
const BOB_DID = 'did:plc:2ig7akkyfq256j42uxvc4g2h';
6-
7-
const env = process.env;
8-
const TEST_CREDENTIALS = {
9-
alice: {
10-
handle: 'tSky',
11-
did: ALICE_DID,
12-
appPassword: env.ALICE_APP_PASSWORD,
13-
},
14-
bob: {
15-
handle: 'tSky',
16-
did: BOB_DID,
17-
appPassword: env.BOB_APP_PASSWORD,
18-
},
19-
};
20-
const TEST_ENDPOINT = 'https://bsky.social';
212

223
describe('tSky', () => {
23-
const tSky = new TSky({
24-
url: TEST_ENDPOINT,
25-
identifier: TEST_CREDENTIALS.alice.did,
26-
password: TEST_CREDENTIALS.alice.appPassword,
27-
});
28-
29-
it('get Profile', async () => {
30-
const profile = await tSky.profile(ALICE_DID);
4+
it('profile', async () => {
5+
// TODO: use actual client
6+
const profile = {
7+
handle: 'alice.tsky.dev',
8+
};
319

3210
expect(profile).toBeDefined();
3311
expect(profile).toHaveProperty('handle', 'alice.tsky.dev');

packages/core/src/tsky/TSky.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,12 @@ import type {
44
AppBskyActorGetProfiles,
55
AppBskyActorSearchActors,
66
AppBskyActorSearchActorsTypeahead,
7+
AppBskyNS,
78
} from '@atproto/api';
8-
import { AppBskyNS } from '@atproto/api';
99
import { Paginator } from './Paginator';
10-
import { SessionManager } from './session';
11-
import { XrpcClient } from './xrpc';
1210

1311
export 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
}

packages/core/src/tsky/session.ts

Lines changed: 0 additions & 49 deletions
This file was deleted.

packages/core/src/tsky/xrpc.ts

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)