summaryrefslogtreecommitdiff
path: root/device.c
blob: f5b9942e2ad1eb55fde1b3f9ea89a82e8eefb3e8 (plain)
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
/* implements 11.9 Device Management 

GET /_matrix/client/r0/devices/{deviceId}
PUT /_matrix/client/r0/devices/{deviceId}
DELETE /_matrix/client/r0/devices/{deviceId}

*/

#include <stdio.h>
#include "session.h"
#include "util.h"
#include "curl_util.h"

void get_devices(matrix_session *sess)
{
	/* GET /_matrix/client/r0/devices */
	const char *u[] = { sess->url,
		"/_matrix/client/r0/devices?access_token=", sess->token , NULL };
	const char *requrl = alloc_build_string(u);
	json_object *resp;
	_curl_get(sess->curl, requrl, &resp);
	if (resp) {
		printf("%s\n", json_object_to_json_string(resp));
		/*
		const char *roomid = json_gets(resp, "room_id");
		if (roomid) {
			const char *r = copy_str(roomid);
			json_object_put(resp);
			return r;
		}
		*/
	}
	json_object_put(resp);
}