1
Fork 0
This repository has been archived on 2021-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
UOC_PP20211_PR/UOCContacts/include/api.h
2021-10-24 13:38:09 +02:00

45 lines
No EOL
1.2 KiB
C

#ifndef __UOCCONTACTS_API__H
#define __UOCCONTACTS_API__H
#include <stdbool.h>
#include "error.h"
#include "csv.h"
#include "contact.h"
#include "person.h"
// Type that stores all the application data
typedef struct _ApiData {
//////////////////////////////////
// Ex PR1 2:
/////////////////////////////////
tPopulation population;
tGeolocationData geolocationData;
} tApiData;
// Get the API version information
const char* api_version();
// Load data from a CSV file. If reset is true, remove previous data
tApiError api_loadData(tApiData* data, const char* filename, bool reset);
// Add a new entry
tApiError api_addDataEntry(tApiData* data, tCSVEntry entry);
// Free all used memory
tApiError api_freeData(tApiData* data);
// Initialize the data structure
tApiError api_initData(tApiData* data);
// Get person data
tApiError api_findPerson(tApiData* data, const char* document, tCSVEntry* person);
// Get all geolocation data for a given person
tApiError api_getPersonGeolocation(tApiData* data, const char* document, tCSVData* geodata);
// Remove a person
tApiError api_removePerson(tApiData* data, const char* document);
#endif // __UOCCONTACTS_API__H