libyadisk/tests/app.c

45 lines
1.1 KiB
C
Raw Normal View History

2023-11-27 09:03:47 +03:00
//
// Created by maxim on 27.11.23.
//
#include <yadisk.h>
2023-11-27 09:03:47 +03:00
#include <stdio.h>
2023-11-29 14:00:52 +03:00
int main()
{
2023-11-27 09:03:47 +03:00
char token[1024];
printf("Enter OAuth token: ");
fgets(token, sizeof(token), stdin);
2023-11-29 13:57:30 +03:00
yadisk_init();
2023-11-29 14:00:52 +03:00
yadisk_api_client* client = &(yadisk_api_client) {
.token = token
2023-11-27 09:03:47 +03:00
};
yadisk_disk_info yadisk_disk_info;
yadisk_get_disk(client, &yadisk_disk_info);
2023-11-29 13:57:30 +03:00
printf("Total disk size: %lu\n", yadisk_disk_info.total_space);
printf("Trash size: %lu\n", yadisk_disk_info.trash_size);
printf("Used space: %lu\n", yadisk_disk_info.used_space);
printf("Registration time: %s\n", yadisk_disk_info.reg_time);
printf("Is paid: %s\n", yadisk_disk_info.is_paid ? "Yes" : "No");
printf("=================\n");
yadisk_resource_info resource;
yadisk_get_disk_resources(client, "/", &resource);
printf("Path: %s\n", resource.path);
printf("Name: %s\n", resource.name);
printf("Type: %s\n", resource.type);
printf("Created: %s\n", resource.created);
printf("Modified: %s\n", resource.modified);
printf("ResourceID: %s\n", resource.resource_id);
yadisk_cleanup();
2023-11-27 09:03:47 +03:00
return 0;
2023-11-29 13:57:30 +03:00
}