Monorepo for Tangled tangled.org

friendlier repo counts #4677

Open pds.dad
Open opened by pds.dad

Currently there are 3 web calls to get a repo's star count if all you have is {handle}/{repo_name} on a Bobbin.

  1. Get the user's did from their handle
  2. Make a call to org.tangled.repo.getRepoByName to get the repo's subject
  3. Make a call to org.tangled.feed.countStars to get the star count, same for org.tangled.repo.countForks

As a user(npmx.dev) whose wanting to add an easier way to get tangled counts,

it would be nice if it was 1-2 calls. Like org.tangled.feed.countStars?identity={handle/did}&name={repo name} and get the subject. Same for owner on org.tangled.repo.getRepoByName, would be nice to be an identity?

This would make it easier to make these calls as simple as possible for consumers. I know on the backend it will still need to do the 3 web calls, but giving the cosumer a nicer API to call would be nice. Happy to do any of the work here to update these schemas! Or if there's another approach wanted.

We can make org.tangled.repo.getRepoByName to accept at-identifier format owner so it can be 2 calls, sounds reasonable and it's also what bsky APIs provide.

I'd probably avoid using owner+name pair for repo identity but I get the need. hmm we want to keep DID-based queries but having two slightly different xrpcs for all repo-related queries sounds bit too much...

Maybe we can just make repo input as at-uri type and allow either:

at://did:example:repo
at://did:example:repo/org.tangled.repo.manifest/self
at://did:example:owner/org.tangled.repo.declaration/slug
at://owner.tld/org.tangled.repo.declaration/slug

bit too verbose, but fits into one at-uri format. not sure tbh

owner becoming at-identifier works for me! Biggest thing was I was approaching it trying to think how to go to it from a web url like https://tangled.org/tangled.org/core to the count in a "I have no idea what atproto is, but I know tangled and like it, but how do I make an API call to get the stars?" context. But I think getRepoByName with something you can get from the repos web URL works too.

Sign up or Sign in to add to the discussion.