diff options
author | Steru <jerrydream111@gmail.com> | 2024-08-02 16:07:15 +0200 |
---|---|---|
committer | Steru <jerrydream111@gmail.com> | 2024-08-02 16:07:15 +0200 |
commit | a767d83d81755710fc760a6d3dc040b4a379c16a (patch) | |
tree | 131b23f31e7b25f7106b2a51da99090985038891 /src/api/OlympicsAPI.h | |
parent | ab7280aa471346374520eca3ca8c50742e70510f (diff) |
Extracted API call in seperate class. Started class to handle data and filter (Sport).
Diffstat (limited to 'src/api/OlympicsAPI.h')
-rw-r--r-- | src/api/OlympicsAPI.h | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/src/api/OlympicsAPI.h b/src/api/OlympicsAPI.h new file mode 100644 index 0000000..8efaa26 --- /dev/null +++ b/src/api/OlympicsAPI.h @@ -0,0 +1,84 @@ + +#ifndef ITAT_CHALLANGE_OLYMPICS_OLYMPICSAPI_H +#define ITAT_CHALLANGE_OLYMPICS_OLYMPICSAPI_H + + +#define API_LINK "https://sph-s-api.olympics.com/summer/schedules/api/ENG/schedule/discipline/" + +#include <string> +#include <QJsonObject> + +using namespace std; + +/* + * TODO: + * Replace api request code snippet in main with: + * + OlympicsAPI api; + QJsonObject archery = api.getSportData(api.Archery); + qDebug() << "Competitor:" << archery["units"][0]["competitors"][0]["name"].toString(); + * + */ + +class OlympicsAPI { + +public: + + enum Disciplines { + AquaticsArtisticSwimming, + AquaticsDiving, + AquaticsMarathonSwimming, + AquaticsSwimming, + AquaticsWaterPolo, + Archery, + Athletics, + Badminton, + Basketball3v3, + Basketball, + Boxing, + Breaking, + CanoeingSprint, + CanoeingSlalom, + CyclingBMXFreestyle, + CyclingBMXRacing, + CyclingMaountainBike, + CyclingRoad, + CyclingTrack, + EquestrianDressage, + EquestrianEventing, + EquestrianJumping, + Fencing, + FieldHockey, + Football, + Golf, + GymnasticsArtistic, + GymnasticsRhythmic, + GymnasticsTrampoline, + HandballIndoor, + Judo, + ModernPentathlon, + Rowing, + Rugby7, + Sailing, + Shooting, + Skateboarding, + SportClimbing, + Surfing, + TableTennis, + Taekwondo, + Tennis, + Triathlon, + VolleyballBeach, + VolleyballIndoor, + Weightlifting, + WrestlingFreestyle, + WrestlingGrecoRoman + }; + + QJsonObject getSportData(Disciplines sport); + string getDisciplineShort(Disciplines sport); + +}; + + +#endif //ITAT_CHALLANGE_OLYMPICS_OLYMPICSAPI_H |