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: boost_toot() function #134

Closed
rempsyc opened this issue Jun 27, 2023 · 7 comments
Closed

Feature request: boost_toot() function #134

rempsyc opened this issue Jun 27, 2023 · 7 comments

Comments

@rempsyc
Copy link

rempsyc commented Jun 27, 2023

Hi, it would be nice if we could boost toots with the rtoot package, say with a boost_toot() function.

> library("rtoot")
> boost_toot()
Error in boost_toot() : could not find function "boost_toot"

Is there already a way to do this through an existing function?

@rempsyc
Copy link
Author

rempsyc commented Jun 27, 2023

From: https://docs.joinmastodon.org/methods/statuses/#boost

Boost a status
POST /api/v1/statuses/:id/reblog HTTP/1.1
Reshare a status on your own profile.

What I've tried:

library(rtoot)
post_id <- 110618427914578591
boost_endpoint <- paste0("api/v1/statuses/", post_id, "/reblog")
boost_endpoint
#> [1] "api/v1/statuses/110618427914578592/reblog"
boost_response <- rtoot(boost_endpoint, method = "POST")
#> Error: something went wrong. Status code: 404
boost_response <- rtoot(boost_endpoint, method = "HTTP/1.1")
#> Error: something went wrong. Status code: 404
404: Not found
Status does not exist or is private

{
  "error": "Record not found"
}

@rempsyc
Copy link
Author

rempsyc commented Jun 28, 2023

But trying the get_status() example I am getting the same error:

get_status(id = "109298295023649405")
#> Error: something went wrong. Status code: 404

get_reblogged_by(id = "109294719267373593")
#> Error: something went wrong. Status code: 404

get_favourited_by(id = "109294719267373593")
#> Error: something went wrong. Status code: 404

@schochastics
Copy link
Member

The example in get_status() seemed broken. I fixed that.
I also added post_status which works similar to post_user to favourite/reblog/bookmark statuses. So you can boost now :)

@rempsyc
Copy link
Author

rempsyc commented Jun 28, 2023

Wow, awesome, that was quick! 😮😃

@schochastics
Copy link
Member

You got me exactly on my monthly dev day 😉

@rempsyc
Copy link
Author

rempsyc commented Jun 30, 2023

Some more work for you, for next monthly dev day perhaps :P

library(rtoot)

# Works on same instance
post_id <- 110635249481533536
post_status(post_id)
#> successfully performed action on status

# Fails with no message on other instance
post_id <- 110618427914578591
post_status(post_id)

# Unused argument 'instance' like for `get_status()`
post_status(post_id, instance = "mastodon.world")
#> Error in post_status(post_id, instance = "mastodon.world"): unused argument (instance = "mastodon.world")

Created on 2023-06-30 with reprex v2.0.2

@chainsawriot
Copy link
Collaborator

Welcome to the Fediverse

mastodon/mastodon#7888

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants