pub struct Farcaster {
pub account: Account,
pub registry: Registry,
}Expand description
The Farcaster type that holds the keys to the castle - so to speak :)
Fields§
§account: Account§registry: RegistryImplementations§
Source§impl Farcaster
impl Farcaster
Sourcepub async fn generate_bearer(
wallet: &Wallet<SigningKey>,
duration_secs: Option<i64>,
) -> Result<Bearer, Box<dyn Error>>
pub async fn generate_bearer( wallet: &Wallet<SigningKey>, duration_secs: Option<i64>, ) -> Result<Bearer, Box<dyn Error>>
§Best not to use this function directly
Instead, use the Account struct methods, such as from_mnemonic, and from_private_key, as that generates these automatically.
However, if you’d really like to use these, go ahead.
Source§impl Farcaster
impl Farcaster
Sourcepub async fn get_session_token(
bearer: &Bearer,
) -> Result<SecretToken, Box<dyn Error>>
pub async fn get_session_token( bearer: &Bearer, ) -> Result<SecretToken, Box<dyn Error>>
§Best not to use this function directly
Instead, use the Account struct methods, such as from_mnemonic, and from_private_key, as that generates these automatically.
However, if you’d really like to use these, go ahead.
Source§impl Farcaster
impl Farcaster
Sourcepub async fn revoke_session_token(
token: &SecretToken,
) -> Result<RevokedKeyRoot, Box<dyn Error>>
pub async fn revoke_session_token( token: &SecretToken, ) -> Result<RevokedKeyRoot, Box<dyn Error>>
Best not to use this function on its own, as the Account struct has a method that does this in a clean way
i.e. farcaster.account.revoke_auth_token().await?;
Source§impl Farcaster
impl Farcaster
Sourcepub async fn get_collections_by_fid(
&self,
fid: i64,
limit: Option<i64>,
cursor: Option<String>,
) -> Result<UserCollectionsRoot, Box<dyn Error>>
pub async fn get_collections_by_fid( &self, fid: i64, limit: Option<i64>, cursor: Option<String>, ) -> Result<UserCollectionsRoot, Box<dyn Error>>
Get all collections an FID owns
use farcaster_rs::{Account, Farcaster};
let account: Account = Account::from_mnemonic("mnemonic phrase", None).await?;
let farcaster: Farcaster = Farcaster::new("eth provider", account).await?;
// Returns all Farcaster collection owners of the ID specified
let collections = farcaster.get_collections_by_fid(5, None, None).await?;Sourcepub async fn get_collections_by_username(
&self,
username: &str,
limit: Option<i64>,
cursor: Option<String>,
) -> Result<UserCollectionsRoot, Box<dyn Error>>
pub async fn get_collections_by_username( &self, username: &str, limit: Option<i64>, cursor: Option<String>, ) -> Result<UserCollectionsRoot, Box<dyn Error>>
Get all collections a username owns
use farcaster_rs::{Account, Farcaster};
let account: Account = Account::from_mnemonic("mnemonic phrase", None).await?;
let farcaster: Farcaster = Farcaster::new("eth provider", account).await?;
// Returns all Farcaster collection owners of the ID specified
let collections = farcaster.get_collections_by_username("ace", None, None).await?;Sourcepub async fn get_collections_by_address(
&self,
address: &str,
limit: Option<i64>,
cursor: Option<String>,
) -> Result<UserCollectionsRoot, Box<dyn Error>>
pub async fn get_collections_by_address( &self, address: &str, limit: Option<i64>, cursor: Option<String>, ) -> Result<UserCollectionsRoot, Box<dyn Error>>
Get all collections an address owns
use farcaster_rs::{Account, Farcaster};
let account: Account = Account::from_mnemonic("mnemonic phrase", None).await?;
let farcaster: Farcaster = Farcaster::new("eth provider", account).await?;
// Returns all Farcaster collection owners of the ID specified
let collections = farcaster.get_collections_by_address("0x000.....", None, None).await?;Source§impl Farcaster
impl Farcaster
Sourcepub async fn delete_cast_by_cast_hash(
&self,
cast_hash: &str,
) -> Result<DeletedCastRoot, Box<dyn Error>>
pub async fn delete_cast_by_cast_hash( &self, cast_hash: &str, ) -> Result<DeletedCastRoot, Box<dyn Error>>
Source§impl Farcaster
impl Farcaster
Sourcepub async fn get_casts_by_fid(
&self,
fid: i64,
limit: Option<i32>,
cursor: Option<&str>,
) -> Result<CastRoot, Box<dyn Error>>
pub async fn get_casts_by_fid( &self, fid: i64, limit: Option<i32>, cursor: Option<&str>, ) -> Result<CastRoot, Box<dyn Error>>
Sourcepub async fn get_casts_by_username(
&self,
username: &str,
limit: Option<i32>,
cursor: Option<&str>,
) -> Result<CastRoot, Box<dyn Error>>
pub async fn get_casts_by_username( &self, username: &str, limit: Option<i32>, cursor: Option<&str>, ) -> Result<CastRoot, Box<dyn Error>>
Source§impl Farcaster
impl Farcaster
Sourcepub async fn publish_cast(
&self,
content: &str,
reply_to_hash: Option<&str>,
reply_to_fid: Option<i64>,
) -> Result<PublishedCast, Box<dyn Error>>
pub async fn publish_cast( &self, content: &str, reply_to_hash: Option<&str>, reply_to_fid: Option<i64>, ) -> Result<PublishedCast, Box<dyn Error>>
Publish a cast to the protocol
use farcaster_rs::{Account, Farcaster};
let account: Account = Account::from_mnemonic("mnemonic phrase", None).await?;
let farcaster: Farcaster = Farcaster::new("eth provider", account).await?;
// Publish a cast.
// 1st Param: Content
// 2nd & 3rd Param: Parent Cast Hash & Parent User FID
// Used for replying to a cast
let cast = farcaster.publish_cast("cast content", Some("optional parent hash to reply to"), Some(0)).await?;Source§impl Farcaster
impl Farcaster
Sourcepub async fn follow_user_by_fid(
&self,
fid: i64,
) -> Result<FollowUserRoot, Box<dyn Error>>
pub async fn follow_user_by_fid( &self, fid: i64, ) -> Result<FollowUserRoot, Box<dyn Error>>
Sourcepub async fn follow_user_by_username(
&self,
username: &str,
) -> Result<FollowUserRoot, Box<dyn Error>>
pub async fn follow_user_by_username( &self, username: &str, ) -> Result<FollowUserRoot, Box<dyn Error>>
Sourcepub async fn follow_user_by_address(
&self,
address: &str,
) -> Result<FollowUserRoot, Box<dyn Error>>
pub async fn follow_user_by_address( &self, address: &str, ) -> Result<FollowUserRoot, Box<dyn Error>>
Source§impl Farcaster
impl Farcaster
pub async fn get_following_by_fid( &self, fid: i64, limit: Option<i64>, cursor: Option<&str>, ) -> Result<FollowersRoot, Box<dyn Error>>
pub async fn get_following_by_username( &self, username: &str, limit: Option<i64>, cursor: Option<&str>, ) -> Result<FollowersRoot, Box<dyn Error>>
pub async fn get_following_by_address( &self, address: &str, limit: Option<i64>, cursor: Option<&str>, ) -> Result<FollowersRoot, Box<dyn Error>>
Source§impl Farcaster
impl Farcaster
pub async fn get_followers_by_fid( &self, fid: i64, limit: Option<i32>, cursor: Option<&str>, ) -> Result<FollowersRoot, Box<dyn Error>>
pub async fn get_followers_by_username( &self, username: &str, limit: Option<i32>, cursor: Option<&str>, ) -> Result<FollowersRoot, Box<dyn Error>>
pub async fn get_followers_by_address( &self, address: &str, limit: Option<i32>, cursor: Option<&str>, ) -> Result<FollowersRoot, Box<dyn Error>>
Source§impl Farcaster
impl Farcaster
pub async fn unfollow_user_by_fid( &self, fid: i64, ) -> Result<UnfollowUserRoot, Box<dyn Error>>
pub async fn unfollow_user_by_username( &self, username: &str, ) -> Result<UnfollowUserRoot, Box<dyn Error>>
pub async fn unfollow_user_by_address( &self, address: &str, ) -> Result<UnfollowUserRoot, Box<dyn Error>>
Source§impl Farcaster
impl Farcaster
Sourcepub async fn get_notifications(
&self,
limit: Option<i64>,
cursor: Option<&str>,
) -> Result<NotificationsRoot, Box<dyn Error>>
pub async fn get_notifications( &self, limit: Option<i64>, cursor: Option<&str>, ) -> Result<NotificationsRoot, Box<dyn Error>>
Source§impl Farcaster
impl Farcaster
Sourcepub async fn delete_like_by_cast_hash(
&self,
cast_hash: &str,
) -> Result<DeletedLikeRoot, Box<dyn Error>>
pub async fn delete_like_by_cast_hash( &self, cast_hash: &str, ) -> Result<DeletedLikeRoot, Box<dyn Error>>
Source§impl Farcaster
impl Farcaster
Sourcepub async fn delete_recast_by_cast_hash(
&self,
cast_hash: &str,
) -> Result<DeletedRecastRoot, Box<dyn Error>>
pub async fn delete_recast_by_cast_hash( &self, cast_hash: &str, ) -> Result<DeletedRecastRoot, Box<dyn Error>>
Source§impl Farcaster
impl Farcaster
Source§impl Farcaster
impl Farcaster
Source§impl Farcaster
impl Farcaster
Sourcepub async fn like_cast_by_cast_hash(
&self,
cast_hash: &str,
) -> Result<LikedCastRoot, Box<dyn Error>>
pub async fn like_cast_by_cast_hash( &self, cast_hash: &str, ) -> Result<LikedCastRoot, Box<dyn Error>>
Source§impl Farcaster
impl Farcaster
Sourcepub async fn recast_by_cast_hash(
&self,
cast_hash: &str,
) -> Result<RecastedRoot, Box<dyn Error>>
pub async fn recast_by_cast_hash( &self, cast_hash: &str, ) -> Result<RecastedRoot, Box<dyn Error>>
Source§impl Farcaster
impl Farcaster
Sourcepub async fn get_custody_address_by_fid(
&self,
fid: i64,
) -> Result<CustodyAddressRoot, Box<dyn Error>>
pub async fn get_custody_address_by_fid( &self, fid: i64, ) -> Result<CustodyAddressRoot, Box<dyn Error>>
Get a custody address by FID
Sourcepub async fn get_custody_address_by_username(
&self,
username: &str,
) -> Result<CustodyAddressRoot, Box<dyn Error>>
pub async fn get_custody_address_by_username( &self, username: &str, ) -> Result<CustodyAddressRoot, Box<dyn Error>>
Get a custody address by FID
Sourcepub async fn get_custody_address_by_address(
&self,
address: &str,
) -> Result<CustodyAddressRoot, Box<dyn Error>>
pub async fn get_custody_address_by_address( &self, address: &str, ) -> Result<CustodyAddressRoot, Box<dyn Error>>
Get a custody address by FID
Source§impl Farcaster
impl Farcaster
Sourcepub async fn get_user_by_fid(
&self,
fid: u64,
) -> Result<UserInfo, Box<dyn Error>>
pub async fn get_user_by_fid( &self, fid: u64, ) -> Result<UserInfo, Box<dyn Error>>
Get information about a user via their Farcaster ID (more commonly shortened to FID throughout this codebase
Source§impl Farcaster
impl Farcaster
Sourcepub async fn get_verifications_by_fid(
&self,
fid: i64,
) -> Result<VerificationsRoot, Box<dyn Error>>
pub async fn get_verifications_by_fid( &self, fid: i64, ) -> Result<VerificationsRoot, Box<dyn Error>>
Get verifications of a user by their FID
Sourcepub async fn get_verifications_by_username(
&self,
username: &str,
) -> Result<VerificationsRoot, Box<dyn Error>>
pub async fn get_verifications_by_username( &self, username: &str, ) -> Result<VerificationsRoot, Box<dyn Error>>
Get verifications of a user by their username
Sourcepub async fn get_verifications_by_address(
&self,
address: &str,
) -> Result<VerificationsRoot, Box<dyn Error>>
pub async fn get_verifications_by_address( &self, address: &str, ) -> Result<VerificationsRoot, Box<dyn Error>>
Get verifications of a user by their address
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Farcaster
impl !RefUnwindSafe for Farcaster
impl !UnwindSafe for Farcaster
impl Send for Farcaster
impl Sync for Farcaster
impl Unpin for Farcaster
impl UnsafeUnpin for Farcaster
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more