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

Feature Request: Handling PDS resoultion for getRecord #1689

Open
lukehmcc opened this issue Aug 26, 2024 · 0 comments
Open

Feature Request: Handling PDS resoultion for getRecord #1689

lukehmcc opened this issue Aug 26, 2024 · 0 comments
Assignees
Labels
feat A label indicating that this issue is a new feature. help wanted Extra attention is needed untriaged A label Indicating this Issue has not yet been initiated.

Comments

@lukehmcc
Copy link

lukehmcc commented Aug 26, 2024

Proposal

Currently with the atproto.repo.getRecord endpoint, the service is hard coded to your PDS (set by the ServiceContext in the repo service). This is a problem because this means that with this library you can only fetch content records from your own user's PDS. Content records are a valuable way to share information between users, and only being able to fetch from your own PDS is limiting. I propose that getRecord should dynamically resolve the PDS based on the DID fed to it.

Currently code that does this looks something like:

// Have to swap out the service to the other user's pds
final plcClient = PLC();
final didDoc = await plcClient.findDocument(
  did: covalent2.session!.did,
);
final pds = Uri.parse(didDoc.data.service.first.serviceEndpoint).host;

final response = await xrpc.query<String>(
  xrpc.NSID.create('atproto.com', 'repo.getRecord'),
  service: pds, // This represents the service URL (pds).
  parameters: {
    'repo': covalent2.session!.did,
    'collection': 'app.vup.chat.test',
    'rkey': 'default',
  },
);
if (response.status.equalsByCode(200)) {
  print(jsonDecode(response.data)["value"]["text"]);
} else {
  print("error fetching content record");
}

Risks

It would add more complexity.

@lukehmcc lukehmcc added feat A label indicating that this issue is a new feature. help wanted Extra attention is needed untriaged A label Indicating this Issue has not yet been initiated. labels Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat A label indicating that this issue is a new feature. help wanted Extra attention is needed untriaged A label Indicating this Issue has not yet been initiated.
Projects
None yet
Development

No branches or pull requests

2 participants