From 2cfe33f4a354442ab1907c26b17072955f720bcc Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 10 Oct 2023 13:51:38 -0400 Subject: [PATCH] populate vignette --- vignettes/Basic_Usage.Rmd | 133 +++++++++++++++++++++++++++++++++++++- 1 file changed, 130 insertions(+), 3 deletions(-) diff --git a/vignettes/Basic_Usage.Rmd b/vignettes/Basic_Usage.Rmd index 0f9b1ba..264b42c 100644 --- a/vignettes/Basic_Usage.Rmd +++ b/vignettes/Basic_Usage.Rmd @@ -27,23 +27,150 @@ As soon as the functionality is added by BlueSky, we will implement it here. ## Get profiles + follow graph ### Take an account + + ### Get description + +```{r} +get_user_info(actor = c("atpr.bsky.social")) +get_user_info(actor = c("benguinaudeau.bsky.social", "atpr.bsky.social")) +``` + +### Get all the skeets from one person + +```{r} +get_skeets_authored_by(actor = "benguinaudeau.bsky.social", parse = T) +``` + + ### Get all followers/follows + +```{r} +get_followers(actor = "benguinaudeau.bsky.social", limit = 200) %>% + glimpse + +get_follows(actor = "benguinaudeau.bsky.social", limit = 200) %>% + glimpse +``` + + ### Get description of all followers/follows +```{r} +follows <- get_follows(actor = "benguinaudeau.bsky.social", limit = 200) %>% + glimpse + +follows$handle %>% + split(ceiling(seq_along(.)/25)) %>% + map_dfr(~{ + get_user_info(actor = .x) + }) %>% + glimpse + +``` + ## Create a post +```{r} +post <- post_skeet(text = "Posting around") + +``` + +### Reply to a post + +```{r} +reply <- post_skeet(text = "Replying around", in_reply_to = post$uri) +``` + +### Delete a post + +```{r} +delete_skeet(post_url = reply$uri) +``` + ### support for media -## Get list of members in a feed +```{r} +## Not working +library(ggplot2) +ggplot(mpg, aes(displ, hwy, colour = class)) + + geom_point() +f1 <- ggsave(tempfile(pattern = "1", fileext = ".png")) + +lty <- c("solid", "dashed", "dotted", "dotdash", "longdash", "twodash") +linetypes <- data.frame( + y = seq_along(lty), + lty = lty +) +ggplot(linetypes, aes(0, y)) + + geom_segment(aes(xend = 5, yend = y, linetype = lty)) + + scale_linetype_identity() + + geom_text(aes(label = lty), hjust = 0, nudge_y = 0.2) + + scale_x_continuous(NULL, breaks = NULL) + + scale_y_reverse(NULL, breaks = NULL) + +f2 <- ggsave(tempfile(pattern = "2", fileext = ".png")) +post_thread(texts = c("This is the first plot on the ggplot2 website", + "This is the second plot on the ggplot2 website", + "And this is just text sent from the atr package by @jbgruber.bsky.social, @benguinaudeau.bsky.social and @favstats.bsky.social"), + images = c(f1, f2, ""), + image_alts = c("first ggplot2 plot", + "second ggplot2 plot", + "")) + +thread <- post_thread(c("Post 1", "Post 2", "Post 3")) +delete_post(thread$uri) +``` + +### (un)/Follow user + +```{r} +follow(actor = "benguinaudeau.bsky.social") +unfollow(actor = "benguinaudeau.bsky.social") +``` + + +## Feed analysis + +```{r} +feeds <- get_feeds_created_by(actor = "andrew.heiss.phd") %>% + glimpse + +rstat_feed <- feeds %>% + filter(displayName == "#rstats") + +rstat_posts <- get_feed(rstat_feed$uri, limit = 200) %>% + glimpse +``` + -### Get the list of people in the rstats feed ### Top poster from a specific feed ### Top popular poster from a specific feed ## Get likes from a post ### Most famous rstats post -### Like anlaysis + +```{r} + +``` + +### Like analysis + +```{r} +uri <- convert_http_to_at("https://bsky.app/profile/ryanlcooper.com/post/3kb42gayda52t") +# Not working for now +get_likes(uri) +``` + +### Repost analysis + +```{r} +uri <- convert_http_to_at("https://bsky.app/profile/ryanlcooper.com/post/3kb42gayda52t") +# Not working for now +get_reposts(post_url = uri) +``` + + ### Eventual temporal structure