Skip to content

Commit

Permalink
Merge pull request #250 from h3poteto/feat/gotosocial/only_public
Browse files Browse the repository at this point in the history
Add only_public option to get_account_statuses for Gotosocial
  • Loading branch information
h3poteto authored Sep 30, 2024
2 parents 3518c1d + f81e5f0 commit 35c95df
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/detector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ mod tests {

#[tokio::test]
async fn test_detector_firefish() {
let sns = detector("https://calckey.world").await;
let sns = detector("https://cybre.club").await;

assert!(sns.is_ok());
assert_eq!(sns.unwrap(), SNS::Firefish);
Expand Down
3 changes: 3 additions & 0 deletions src/gotosocial/gotosocial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@ impl megalodon::Megalodon for Gotosocial {
if let Some(only_media) = options.only_media {
params.push(format!("only_media={}", only_media));
}
if let Some(only_public) = options.only_public {
params.push(format!("only_public={}", only_public));
}
}
let mut url = format!("/api/v1/accounts/{}/statuses", id);
if params.len() > 0 {
Expand Down
8 changes: 7 additions & 1 deletion src/megalodon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,11 @@ pub trait Megalodon {
async fn unpin_account(&self, id: String) -> Result<Response<entities::Relationship>, Error>;

/// Set a private note on the given account.
async fn set_account_note(&self, id: String, note: Option<String>) -> Result<Response<entities::Relationship>, Error>;
async fn set_account_note(
&self,
id: String,
note: Option<String>,
) -> Result<Response<entities::Relationship>, Error>;

/// Find out whether a given account is followed, blocked, muted, etc.
async fn get_relationships(
Expand Down Expand Up @@ -862,6 +866,8 @@ pub struct GetAccountStatusesInputOptions {
pub exclude_reblogs: Option<bool>,
/// Show only statuses with metia attached.
pub only_media: Option<bool>,
/// Show only public statuses.
pub only_public: Option<bool>,
}

/// Input options for [`Megalodon::get_account_favourites`].
Expand Down

0 comments on commit 35c95df

Please sign in to comment.