gionoa / formula1api Goto Github PK
View Code? Open in Web Editor NEWSwift Package for accessing Formula 1 data from the Ergast API
License: MIT License
Swift Package for accessing Formula 1 data from the Ergast API
License: MIT License
https://ergast.com/api/f1/2019/1/laps/1.json
required: season, round
Ergast REST API responses (example) provide limit
, offset,
& total
values for pagination. Add support for providing query items to specify a limit for each page.
Hi @gionoa, thanks for sharing this! I appreciate you setting this up, especially the models for Ergast responses.
I'm working against a self-hosted copy of the Ergast DB, and in your Readme under deploying and publishing, you recommended this nodejs repo. That repo works well for querying against my own db, but I wanted to point out that the url endpoints don't match up with those of the original Ergast API.
For example, getting drivers standings on Ergast:
https://ergast.com/api/f1/2008/driverStandings.json
Would have to be something like this in the node api:
http://localhost:5001/standings/drivers?year=2008
That being the case, I'd don't think think it would work as a drop in replacement to use your library against.
Are you using something else for your custom api? Or maybe I'm wrong and this library supports that url format?
Thanks again for sharing this.
Hello,
First of all, thank you for putting this together!
I added it to my project using Swift Package Manager and was able to use it to make calls to the Ergast API and print the resulting objects.
The problem is that the only object that is returned is the top-level one, and nothing else is accessible.
For example if I tried to get Circuit info for 2021, my code would be:
Formula1API.circuits(for: .year(2021)) { result in switch result { case .success(let circuits): print(circuits) case .failure(let error): print(error) } }
This works...BUT the "circuits" object can't be accessed (for example, I can't reach its "data" property because it is set to "internal" access-level only).
Unless I'm missing a step, this means I can't unpack the Circuits to get to an individual Circuit (or use the object in any other way).
I'd appreciate any help or guidance you can provide.
Thank you,
Marco
https://ergast.com/api/f1/2011/5/pitstops.json
required: season, round
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.