1
0
Fork
You've already forked atproto-cpp
0
  • C++ 89.4%
  • CMake 10.6%
2025年07月14日 15:41:51 +07:00
.github/workflows Update cmake-test.yml 2024年11月02日 23:28:14 +01:00
examples feat: validate images. add post embeds example 2025年07月14日 15:34:28 +07:00
external submodules 2024年11月02日 22:00:50 +00:00
include feat: validate images. add post embeds example 2025年07月14日 15:34:28 +07:00
src feat: validate images. add post embeds example 2025年07月14日 15:34:28 +07:00
tests test: refer to the client properly 2025年07月14日 15:41:51 +07:00
.gitignore Add .gitignore 2024年11月10日 22:59:38 +01:00
.gitmodules submodules 2024年11月02日 22:00:50 +00:00
CMakeLists.txt feat: validate images. add post embeds example 2025年07月14日 15:34:28 +07:00
LICENSE Create LICENSE 2024年11月02日 22:56:46 +01:00
README.md docs: fix incorrect scopes in README's examples 2025年07月14日 15:39:18 +07:00

atproto-cpp

CMake Builder

The BlueSky atproto-cpp library provides a C++ interface for interacting with the BlueSky social networking service. This library includes functions to handle user authentication, post creation, feed retrieval, and more.

Features

  • User authentication and session management
  • Post creation and feed retrieval
  • Helper functions for JSON manipulation and URL encoding

Installation

To use the BlueSky HPP library, include the header files in your project and link against the required dependencies.

#include "bluesky_client.hpp"

Usage

Initialization

To initialize the BlueskyClient, provide the server address:

Bluesky::Client client("bsky.social");

Authentication

To log in to the BlueSky service, use the login function:

bool success = client.login("your_identifier", "your_password");
if (success) {
 std::cout << "Logged in successfully!" << std::endl;
} else {
 std::cerr << "Login failed!" << std::endl;
}

Creating a Post

To create a new post, use the createPost function:

Bluesky::Client::Error error = client.createPost("Hello, BlueSky!");
if (error == Bluesky::Client::Error_None) {
 std::cout << "Post created successfully!" << std::endl;
} else {
 std::cerr << "Failed to create post!" << std::endl;
}

Retrieving Feed Posts

To retrieve posts from a feed, use the getFeedPosts function:

Bluesky::Client::PostsResult result = client.getFeedPosts("feed_uri", 10);
if (result.error == Bluesky::Client::Error_None) {
 for (const auto& post : result.posts) {
 std::cout << "Post: " << post.text << std::endl;
 }
} else {
 std::cerr << "Failed to retrieve feed posts!" << std::endl;
}

Retrieving Author Posts

To retrieve posts from a specific author, use the getAuthorPosts function:

Bluesky::Client::PostsResult result = client.getAuthorPosts("author_id", 10);
if (result.error == Bluesky::Client::Error_None) {
 for (const auto& post : result.posts) {
 std::cout << "Author Post: " << post.text << std::endl;
 }
} else {
 std::cerr << "Failed to retrieve author posts!" << std::endl;
}

Additional Functions

  • getUnreadCount(): Retrieves the count of unread notifications.
  • filterText(const std::string& str): Filters special characters from a text string.
  • splitIntoWords(const std::string& str): Splits a string into individual words.
  • urlEncode(const std::string& str): Encodes a string for use in URLs.
  • createJsonString(const std::map<std::string, std::string>& data): Creates a JSON string from a map of key-value pairs.

Status

  • Prototype, Untested

Credits

Contains portions of bluesky_esphom and postbluesky