building out asana client

This commit is contained in:
2020-06-05 17:31:05 -07:00
parent 999ca05d49
commit 3e414e62a8
5 changed files with 282 additions and 7 deletions

View File

@@ -49,6 +49,8 @@ size_t asana_write_callback(void *contents, size_t size, size_t nmemb,
Response *asana_fetch(char *path) {
char url[ASANA_URL_MAX_LENGTH];
snprintf(url, ASANA_URL_MAX_LENGTH, "https://app.asana.com/api/1.0/%s", path);
fprintf(stderr, "fetching %s\n", url);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, asana_auth_header);
@@ -62,6 +64,7 @@ Response *asana_fetch(char *path) {
CURLcode result;
result = curl_easy_perform(curl);
if (result == CURLE_OK) {
fprintf(stderr, "API Response:\n\n%s\n", response->body);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &(response->status));
} else {
response->status = 500;