circles_rpc/methods/
avatar.rs1use crate::client::RpcClient;
2use crate::error::Result;
3use circles_types::{Address, AvatarInfo, Profile};
4
5#[derive(Clone, Debug)]
9pub struct AvatarMethods {
10 client: RpcClient,
11}
12
13impl AvatarMethods {
14 pub fn new(client: RpcClient) -> Self {
16 Self { client }
17 }
18
19 pub async fn get_avatar_info(&self, address: Address) -> Result<AvatarInfo> {
21 self.client.call("circles_getAvatarInfo", (address,)).await
22 }
23
24 pub async fn get_avatar_info_batch(&self, addresses: Vec<Address>) -> Result<Vec<AvatarInfo>> {
26 self.client
27 .call("circles_getAvatarInfoBatch", (addresses,))
28 .await
29 }
30
31 pub async fn get_profile_cid(&self, address: Address) -> Result<String> {
33 self.client.call("circles_getProfileCid", (address,)).await
34 }
35
36 pub async fn get_profile_cid_batch(&self, addresses: Vec<Address>) -> Result<Vec<String>> {
38 self.client
39 .call("circles_getProfileCidBatch", (addresses,))
40 .await
41 }
42
43 pub async fn get_profile_by_cid(&self, cid: String) -> Result<Profile> {
45 self.client.call("circles_getProfileByCid", (cid,)).await
46 }
47
48 pub async fn get_profile_by_cid_batch(&self, cids: Vec<String>) -> Result<Vec<Profile>> {
50 self.client
51 .call("circles_getProfileByCidBatch", (cids,))
52 .await
53 }
54
55 pub async fn get_profile_by_address(&self, address: Address) -> Result<Profile> {
57 self.client
58 .call("circles_getProfileByAddress", (address,))
59 .await
60 }
61
62 pub async fn get_profile_by_address_batch(
64 &self,
65 addresses: Vec<Address>,
66 ) -> Result<Vec<Profile>> {
67 self.client
68 .call("circles_getProfileByAddressBatch", (addresses,))
69 .await
70 }
71}