Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use own xrpc client #22

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Conversation

anbraten
Copy link
Contributor

@anbraten anbraten commented Nov 30, 2024

Tested how the lib could work. For now I've added a xrpc-client that takes a session (either password or later on oauth). The client can now be used by tsky to do api calls.

It would be use like this:

const session = new PasswordSession(TEST_ENDPOINT);
await session.login('did:from-alice', 'alice has a nice app password');
const tSky = new TSky(session);

Currently I got those two calls to work:

For the user's profile:

const profile = await tSky.profile(TEST_CREDENTIALS.alice.did);
console.log(profile);

To get the timeline of the user:

const paginator = tSky.feed.timeline({
  limit: 30,
});

await paginator.next(); // load the first page

console.log(paginator.values[0].feed); // print the feed array from the first page

Copy link

netlify bot commented Nov 30, 2024

Deploy Preview for tsky canceled.

Name Link
🔨 Latest commit 0acd74a
🔍 Latest deploy log https://app.netlify.com/sites/tsky/deploys/674b135a98f6e8000882bf6b

@anbraten
Copy link
Contributor Author

While baking on these changes I've noticed that we would need to replicate the quite well developed xrpc-client and session refreshing parts from atproto or atcute. Therefore it might be a good idea to for example use the atcute client underneath.

@anbraten anbraten mentioned this pull request Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant