-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.c
67 lines (52 loc) · 1.96 KB
/
example.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <jansson.h>
#include "bluesky.h"
int
main(int argc, char **argv)
{
char *bksy_app_password = getenv("BSKY_APP_PASSWORD");
int ret = bs_client_init("bdowns328.bsky.social", bksy_app_password, NULL);
if (ret > 0) {
fprintf(stderr, "failed to login to bluesky\n");
return 1;
}
// bs_client_response_t *res = bs_client_profile_get("bdowns328.bsky.social");
// printf("%s\n", res->resp);
// json_t *root;
// json_error_t error;
// root = json_loads(res->resp, 0, &error);
// const char *did = {0};
// json_unpack(root, "{s:s}", "did", &did);
// printf("%s\n", did);
// json_decref(root);
// bs_client_response_free(res);
// bs_client_response_t *res = bs_timeline_get(NULL);
// printf("%s\n", res->resp);
// bs_client_response_free(res);
// bs_client_response_t *res = bs_profile_preferences();
// printf("%s\n", res->resp);
// bs_client_response_free(res);
// const char *msg = "{\"$type\": \"app.bsky.feed.post\",
// \"text\": \"Another post from libbluesky #c library!\",
// \"createdAt\": \"2024-12-19T22:47:30.0000Z\"}";
// bs_client_response_t *res = bs_client_post(msg);
// printf("%s\n", res->resp);
// bs_client_response_free(res);
// bs_client_response_t *res = bs_client_follows_get(
// "bdowns328.bsky.social", NULL);
// printf("%s ", res->resp);
// printf("%d\n", res->err_code);
// bs_client_response_free(res);
// bs_client_response_t *res = bs_client_followers_get(
// "bdowns328.bsky.social", NULL);
// printf("%s ", res->resp);
// bs_client_response_free(res);
bs_client_response_t *res = bs_author_feed_get(
"did:plc:d2pmhxz4ud7z3zwc5rejgl53", NULL);
printf("%s\n", res->resp);
bs_client_response_free(res);
bs_client_free();
return 0;
}