A better Rust ATProto crate

Question: How to use the app-password credentials #9

closed
opened by aleeve.dev edited

Hi,

Thanks for the superslim crates! I'm getting errors trying to send GetActorLikes xrpcs requests and cant figure out what I'm doing wrong. Sorry if this is the wrong forum.

Here the snippet that doesn't work for me

// --- SETUP
let base = url::Url::parse("https://public.api.bsky.app")?;
let session = jacquard::client::credential_session::CredentialSession::new(
    Arc::new(MemorySessionStore::default()),
    Arc::new(BasicClient::default()),
);
session
    .login(
        CowStr::new_static("did:plc:***********"),
        CowStr::new_static("********"),
        None,
        None,
        None,
    )
    .await?;
let agent = Agent::from(session);

// Get profile works fine
let request = GetProfiles::new()
    .actors(vec![AtIdentifier::Did(did.parse()?)])
    .build();
let response = agent.xrpc(base.clone()).send(&request).await?;
info!("{:#?}", response.parse());


// This gives error
let request = GetActorLikes::new()
    .actor(AtIdentifier::Did(did.parse()?))
    .limit(1)
    .build();
let response = agent.xrpc(base).send(&request).await?;

I get the following error: Xrpc( Unknown( Object( Object( { "error": String( String( "InvalidRequest", ), ), "message": String( String( "Profile not found", ), ), }, ), ), ), ), )

This was just me missunderstanding the at-protocol, GetActorLikes only seems to work for the currently authenticated user. I can simply use listRecords to get what I want. Sorry for the confusion!

no worries! glad you figured it out.

sign up or login to add to the discussion
Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:klugggc44dmpomjkuzyahzjd/sh.tangled.repo.issue/3m35265goxc22