#include #include #include using namespace atpp::lexicons; int main(int argc, char* argv[]) { try { const char* pds = std::getenv("BSKY_PDS"); atpp::Client client(pds ? pds : "https://bsky.social"); const char* handle = std::getenv("BSKY_HANDLE"); const char* password = std::getenv("BSKY_PASSWORD"); if (handle && password) { if (!client.login(handle, password)) { std::cerr << "Login failed." << std::endl; return 1; } } else { std::cerr << "Handle or password not set." << std::endl; return 1; } app::bsky::feed::post::Main record; record.text = "Hello from AT++"; if (argc > 1) { record.text = ""; for (int i = 1; i < argc; ++i) { if (i > 1) record.text += " "; record.text += argv[i]; } } auto facets = atpp::richtext::detectFacets(record.text, [&](const std::string& h) -> std::optional { try { auto r = client.resolveHandle(h); if (r) return r->did; } catch (...) {} return std::nullopt; }); record.facets = facets; auto res = client.post(record); if (res) { std::cout << nlohmann::json(res).dump(2) << std::endl; } else { std::cout << "Post failed." << std::endl; } } catch (const std::exception& e) { std::cerr << "Error: " << e.what() << std::endl; return 1; } return 0; }