Skip to content

Commit

Permalink
feat: Add documentations for vehicle endpoints.
Browse files Browse the repository at this point in the history
  • Loading branch information
3m1n3nc3 committed Jan 6, 2025
1 parent c52ab36 commit 10d8398
Show file tree
Hide file tree
Showing 132 changed files with 2,508 additions and 367 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Naija Places API
# Toneflix Places API

[![Test & Lint](https://github.com/toneflix/naija-places/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/toneflix/naija-places/actions/workflows/run-tests.yml)
[![codecov](https://codecov.io/gh/toneflix/naija-places/graph/badge.svg?token=2O7aFulQ9P)](https://codecov.io/gh/toneflix/naija-places)
Expand All @@ -11,7 +11,7 @@ One api to rule them all, query all states, Local government areas, Wards, Polli

### Apply API Key

You can get an API key by creating an account on [Naija Places API Portal]([)](https://naija-places.toneflix.com.ng/portal/home).
You can get an API key by creating an account on [Toneflix Places API Portal]([)](https://naija-places.toneflix.com.ng/portal/home).
Once you have generated your API keys you can add it to every request to the API via the `X-Api-Key` header

#### Example
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Vehicles/VehicleYearController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function index(Request $request)
fn($q) => $q->where('year_to', '<=', $request->max)
);

if ($request->boolean('distinct')) {
if (!$request->boolean('sick')) {
$list = $query
->where('year_from', '!=', '')
->select(['vehicle_years.id', 'year_from as name'])
Expand Down Expand Up @@ -69,7 +69,7 @@ public function countryIndex(Request $request, VehicleCountry $country)
fn($q) => $q->where('year_to', '<=', $request->max)
);

if ($request->boolean('distinct')) {
if (!$request->boolean('sick')) {
$list = $query
->where('year_from', '!=', '')
->select(['vehicle_years.id', 'year_from as name'])
Expand Down
5 changes: 3 additions & 2 deletions app/Http/Middleware/ApiAccessMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ public function handle(Request $request, Closure $next): Response

// Get the current url from the request
$url = str($request->url());
$localhost = str(parse_url($request->header('referer'), PHP_URL_HOST))->is('localhost');

/**
* Check if the request originates from the same domain as the API
*/
if ($url->contains(parse_url($request->header('origin'), PHP_URL_HOST))) {
if ($url->contains(parse_url($request->header('origin'), PHP_URL_HOST)) || $localhost) {
return $next($request);
}

Expand Down Expand Up @@ -94,4 +95,4 @@ public function handle(Request $request, Closure $next): Response

return $response;
}
}
}
8 changes: 4 additions & 4 deletions public/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>404 | Naija Places API</title>
<title>404 | Toneflix Places API</title>

<meta name="generator" content="VitePress v1.3.2">
<link rel="preload stylesheet" href="/doc-assets/style.Ce8rQZmn.css" as="style">
<link rel="preload stylesheet" href="/doc-assets/style.EL1P2gZo.css" as="style">

<script type="module" src="/doc-assets/app.BawrLXbg.js"></script>
<script type="module" src="/doc-assets/app.FSZg1qt4.js"></script>
<link rel="preload" href="/doc-assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
<link rel="icon" href="/docs/logo.png">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/remixicon/4.2.0/remixicon.css" integrity="sha512-OQDNdI5rpnZ0BRhhJc+btbbtnxaj+LdQFeh0V9/igiEPDiWE2fG+ZsXl0JEH+bjXKPJ3zcXqNyP4/F/NegVdZg==" crossorigin="anonymous" referrerpolicy="no-referrer">
Expand All @@ -22,7 +22,7 @@
</head>
<body>
<div id="app"></div>
<script>window.__VP_HASH_MAP__=JSON.parse("{\"api-documentation.md\":\"DzxVoDyK\",\"demo.md\":\"BBTE3TPV\",\"docs_cities.md\":\"B_TDpMsr\",\"docs_lgas.md\":\"D_Oq99on\",\"docs_states.md\":\"BgSjhXoD\",\"docs_units.md\":\"Erptsw1S\",\"docs_wards.md\":\"DTN5Wn8V\",\"docs_world_cities.md\":\"DNPoPX15\",\"docs_world_countries.md\":\"DHkTE4bG\",\"docs_world_demo.md\":\"Bj7DnLov\",\"docs_world_regions.md\":\"DPiyiTIE\",\"docs_world_states.md\":\"DiFhghcr\",\"docs_world_subregions.md\":\"NJf3oLz3\",\"get-started.md\":\"BQGHuiZD\",\"index.md\":\"BWS66eGG\",\"portal_api-keys.md\":\"DS6G-Tqt\",\"portal_home.md\":\"DYKmET3o\",\"portal_login.md\":\"DAZOwmxC\",\"portal_register.md\":\"KiZo59gW\",\"portal_reset-password.md\":\"yGhkt2eh\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"Naija Places API\",\"description\":\"One api to rule them all, query all states, Local government areas, Wards, Polling Units and Towns in Nigeria + all world regions, countries, states and cities.\",\"base\":\"/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"logo\":\"/docs/logo.png\",\"nav\":[{\"text\":\"Home\",\"link\":\"/\"},{\"text\":\"Demo\",\"link\":\"/demo\"},{\"text\":\"Portal\",\"link\":\"/portal/home\"}],\"sidebar\":[{\"text\":\"Usage\",\"items\":[{\"text\":\"Api Documentation\",\"link\":\"/api-documentation\"},{\"text\":\"States\",\"link\":\"/docs/states\"},{\"text\":\"LGAs\",\"link\":\"/docs/lgas\"},{\"text\":\"Wards\",\"link\":\"/docs/wards\"},{\"text\":\"Polling Units\",\"link\":\"/docs/units\"},{\"text\":\"Towns and Cities\",\"link\":\"/docs/cities\"},{\"text\":\"World Regions\",\"link\":\"/docs/world/regions\"},{\"text\":\"World Subregions\",\"link\":\"/docs/world/subregions\"},{\"text\":\"World Countries\",\"link\":\"/docs/world/countries\"},{\"text\":\"World States\",\"link\":\"/docs/world/states\"},{\"text\":\"World Cities\",\"link\":\"/docs/world/cities\"}]}],\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/toneflix/naija-places\"}],\"footer\":{\"message\":\"Released under the MIT License.\",\"copyright\":\"Copyright © 2025 Toneflix\"},\"lastUpdated\":{\"text\":\"Last updated\",\"formatOptions\":{\"dateStyle\":\"full\",\"timeStyle\":\"medium\"}}},\"locales\":{},\"scrollOffset\":134,\"cleanUrls\":true}");</script>
<script>window.__VP_HASH_MAP__=JSON.parse("{\"api-documentation.md\":\"D2s_N2G_\",\"demo.md\":\"D99vP8Nb\",\"docs_cars.md\":\"Ckb2hpOW\",\"docs_cars_countries.md\":\"CGTWMGp8\",\"docs_cars_demo.md\":\"DuSCi_vk\",\"docs_cars_derivatives.md\":\"D9ZOdPDC\",\"docs_cars_engines.md\":\"CSjUdmvi\",\"docs_cars_manufacturers.md\":\"rzCHWYco\",\"docs_cars_mileages.md\":\"oeOxT-JV\",\"docs_cars_models.md\":\"DYOmkxOr\",\"docs_cars_vehicles.md\":\"D_06LCoc\",\"docs_cars_years.md\":\"5cCNRZ0y\",\"docs_cities.md\":\"B9-ZOAxY\",\"docs_lgas.md\":\"Taan7sev\",\"docs_states.md\":\"LUXpUf_G\",\"docs_units.md\":\"CfN56dAK\",\"docs_wards.md\":\"CKCWMPXq\",\"docs_world_cities.md\":\"DfemAqOv\",\"docs_world_countries.md\":\"Du5jXSJK\",\"docs_world_demo.md\":\"KxBMlcPq\",\"docs_world_regions.md\":\"Dol5TwHY\",\"docs_world_states.md\":\"BHxRHhxm\",\"docs_world_subregions.md\":\"BhcZJo4T\",\"get-started.md\":\"UyRU3NQH\",\"index.md\":\"3lLRA69S\",\"portal_api-keys.md\":\"BpIhLm6a\",\"portal_home.md\":\"YnzIn0tO\",\"portal_login.md\":\"Dt8S5zUo\",\"portal_register.md\":\"BAHkw1ZR\",\"portal_reset-password.md\":\"DePf6j4I\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"Toneflix Places API\",\"description\":\"One api to rule them all, query all states, Local government areas, Wards, Polling Units and Towns in Nigeria + all world regions, countries, states and cities.\",\"base\":\"/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"logo\":\"/docs/logo.png\",\"nav\":[{\"text\":\"Home\",\"link\":\"/\"},{\"text\":\"Demo\",\"link\":\"/demo\"},{\"text\":\"Portal\",\"link\":\"/portal/home\"}],\"sidebar\":[{\"text\":\"Usage\",\"items\":[{\"text\":\"Api Documentation\",\"link\":\"/api-documentation\"}]},{\"text\":\"Naija Geolocation\",\"items\":[{\"text\":\"States\",\"link\":\"/docs/states\"},{\"text\":\"LGAs\",\"link\":\"/docs/lgas\"},{\"text\":\"Wards\",\"link\":\"/docs/wards\"},{\"text\":\"Polling Units\",\"link\":\"/docs/units\"},{\"text\":\"Towns and Cities\",\"link\":\"/docs/cities\"}]},{\"text\":\"World Geolocation\",\"items\":[{\"text\":\"Regions\",\"link\":\"/docs/world/regions\"},{\"text\":\"Subregions\",\"link\":\"/docs/world/subregions\"},{\"text\":\"Countries\",\"link\":\"/docs/world/countries\"},{\"text\":\"States\",\"link\":\"/docs/world/states\"},{\"text\":\"Cities\",\"link\":\"/docs/world/cities\"}]},{\"text\":\"Car API\",\"link\":\"/docs/cars\",\"items\":[{\"text\":\"Countries/Origins\",\"link\":\"/docs/cars/countries\"},{\"text\":\"Make Years\",\"link\":\"/docs/cars/years\"},{\"text\":\"Manufacturers\",\"link\":\"/docs/cars/manufacturers\"},{\"text\":\"Vehicles\",\"link\":\"/docs/cars/vehicles\"},{\"text\":\"Derivatives\",\"link\":\"/docs/cars/derivatives\"},{\"text\":\"Mileages\",\"link\":\"/docs/cars/mileages\"},{\"text\":\"Engines\",\"link\":\"/docs/cars/engines\"},{\"text\":\"Models\",\"link\":\"/docs/cars/models\"}]}],\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/toneflix/naija-places\"}],\"footer\":{\"message\":\"Released under the MIT License.\",\"copyright\":\"Copyright © 2025 Toneflix\"},\"lastUpdated\":{\"text\":\"Last updated\",\"formatOptions\":{\"dateStyle\":\"full\",\"timeStyle\":\"medium\"}}},\"locales\":{},\"scrollOffset\":134,\"cleanUrls\":true}");</script>

</body>
</html>
16 changes: 8 additions & 8 deletions public/api-documentation.html

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions public/demo.html

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 10d8398

Please sign in to comment.