Skip to content

Commit eda563a

Browse files
committed
Updated README to include all endpoint methods
1 parent 3d8774a commit eda563a

File tree

3 files changed

+143
-18
lines changed

3 files changed

+143
-18
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
All notable changes to `laravel-vehapi` will be documented in this file
44

5-
## 1.0.0 - 201X-XX-XX
5+
## 1.0.0 - 2021-26-03
66

77
- initial release

README.md

Lines changed: 136 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
Vehicle Information API is an API system for retrieving vehicle information to include, vehicle year, make, model, trim, transmission, engine and logos for vehicle makes.
99
For more information on this service or to subscribe, please visit [Vehicle Information API](https://vehapi.com)
1010

11+
> NOTE: This package currently only works to retrieve vehicle data from our API, it will not work to retrieve ANY data from our MOTO API endpoints.
12+
> We will be adding that ability in a future release.
13+
1114
## Installation
1215

1316
You can install the package via composer:
@@ -59,11 +62,11 @@ $vehYears = json_encode(LaravelVehapi::getAllYears($sort));
5962
Let's get all the distinct years for all the makes available
6063
```php
6164
/**
62-
* @param $minYear - required
63-
* @param $maxYear - required
65+
* @param int $minYear - required
66+
* @param int $maxYear - required
6467
* @param string $sort - optional, defaults to 'asc'
6568
*/
66-
LaravelVehapi::getYearsRange($minYear, $maxYear, $sort = 'asc');
69+
LaravelVehapi::getYearsRange(int $minYear, int $maxYear, $sort = 'asc');
6770

6871
// Returns associative array
6972
$vehYears = LaravelVehapi::getYearsRange('2010', '2014', 'desc');
@@ -72,21 +75,146 @@ $vehYears = LaravelVehapi::getYearsRange('2010', '2014', 'desc');
7275
$vehYears = json_encode(LaravelVehapi::getYearsRange('2010', '2014', 'desc'));
7376
```
7477

75-
### Changelog
78+
Let's get all the distinct makes available
79+
```php
80+
/**
81+
* @param string $sort - optional, defaults to 'asc'
82+
*/
83+
LaravelVehapi::getAllMakes($sort = 'asc');
7684

77-
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
85+
// Returns associative array
86+
$vehMakes = LaravelVehapi::getAllMakes();
87+
88+
// Convert array to json format
89+
$vehMakes = json_encode(LaravelVehapi::getAllMakes());
90+
```
91+
92+
Let's get all the distinct makes available for a specific year
93+
```php
94+
/**
95+
* @param int $year - required
96+
* @param string $sort - optional, defaults to 'asc'
97+
*/
98+
LaravelVehapi::getMakesByYear($year, $sort = 'asc');
99+
100+
// Returns associative array
101+
$vehMakes = LaravelVehapi::getMakesByYear(2015);
102+
103+
// Convert array to json format
104+
$vehMakes = json_encode(LaravelVehapi::getMakesByYear(2015));
105+
```
106+
107+
Let's get all the distinct makes available for a specific year range
108+
```php
109+
/**
110+
* @param int $minYear - required
111+
* @param int $maxYear - required
112+
* @param string $sort - optional, defaults to 'asc'
113+
*/
114+
LaravelVehapi::getMakesByYearsRange($minYear, $maxYear, $sort = 'asc');
115+
116+
// Returns associative array
117+
$vehMakes = LaravelVehapi::getMakesByYear(2015);
118+
119+
// Convert array to json format
120+
$vehMakes = json_encode(LaravelVehapi::getMakesByYear(2015));
121+
```
122+
123+
Let's get all the models available for a specific make
124+
```php
125+
/**
126+
* @param string $make - required
127+
* @param string $sort - optional, defaults to 'asc'
128+
*/
129+
LaravelVehapi::getAllModelsByMake($make, $sort = 'asc');
130+
131+
// Returns associative array
132+
$vehModels = LaravelVehapi::getAllModelsByMake('Acura');
133+
134+
// Convert array to json format
135+
$vehModels = json_encode(LaravelVehapi::getAllModelsByMake('Acura'));
136+
```
137+
138+
Let's get all the models available for a specific year & make
139+
```php
140+
/**
141+
* @param int $year - required
142+
* @param string $make - required
143+
* @param string $sort - optional, defaults to 'asc'
144+
*/
145+
LaravelVehapi::getModelsByYearAndMake($year, $make, $sort = 'asc');
146+
147+
// Returns associative array
148+
$vehModels = LaravelVehapi::getModelsByYearAndMake(2015, 'Acura');
149+
150+
// Convert array to json format
151+
$vehModels = json_encode(LaravelVehapi::getModelsByYearAndMake(2015, 'Acura'));
152+
```
153+
154+
Let's get all the trims levels available for a specific year, make & model
155+
```php
156+
/**
157+
* @param int $year - required
158+
* @param string $make - required
159+
* @param string $model - required
160+
*/
161+
LaravelVehapi::getTrimsByYearMakeAndModel($year, $make, $model);
162+
163+
// Returns associative array
164+
$vehTrims = LaravelVehapi::getTrimsByYearMakeAndModel(2015, 'Acura', 'MDX');
165+
166+
// Convert array to json format
167+
$vehTrims = json_encode(LaravelVehapi::getTrimsByYearMakeAndModel(2015, 'Acura', 'MDX'));
168+
```
78169

79-
## Contributing
170+
Let's get all the transmissions available for a specific year, make, model & trim
171+
```php
172+
/**
173+
* @param int $year - required
174+
* @param string $make - required
175+
* @param string $model - required
176+
* @param string $trim - required
177+
*/
178+
LaravelVehapi::getTransmissionsByYearMakeModelAndTrim($year, $make, $model, $trim);
179+
180+
// Returns associative array
181+
$vehTransmissions = LaravelVehapi::getTransmissionsByYearMakeModelAndTrim(2015, 'Acura', 'MDX', 'FWD');
182+
183+
// Convert array to json format
184+
$vehTransmissions = json_encode(LaravelVehapi::getTransmissionsByYearMakeModelAndTrim(2015, 'Acura', 'MDX', 'FWD'));
185+
```
186+
187+
Let's get all the engines available for a specific year, make, model, trim & transmission
188+
```php
189+
/**
190+
* @param int $year - required
191+
* @param string $make - required
192+
* @param string $model - required
193+
* @param string $trim - required
194+
* @param string $transmission - required
195+
*/
196+
LaravelVehapi::getEnginesByYearMakeModelTrimAndTransmission($year, $make, $model, $trim, $transmission);
197+
198+
// Returns associative array
199+
$vehEngines = LaravelVehapi::getEnginesByYearMakeModelTrimAndTransmission(2015, 'Acura', 'MDX', 'FWD', '6-Speed Automatic');
200+
201+
// Convert array to json format
202+
$vehEngines = json_encode(LaravelVehapi::getEnginesByYearMakeModelTrimAndTransmission(2015, 'Acura', 'MDX', 'FWD', '6-Speed Automatic'));
203+
```
80204

81-
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
205+
### Changelog
206+
207+
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
82208

209+
### API Documentation
210+
For a complete list of available API endpoints, visit [API documentation](https://documenter.getpostman.com/view/185623/TVYM5c17)
83211
### Security
84212

85213
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
86214

87215
## Credits
88216

89-
- [RJ](https://github.com/codebyray)
217+
- [CodebyRay](https://github.com/codebyray)
90218
- [All Contributors](../../contributors)
91219

92220
## License

src/LaravelVehapi.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,11 @@ public function getModelsByYearAndMake(int $year, string $make, $sort = 'asc')
116116
* @param int $year
117117
* @param string $make
118118
* @param string $model
119-
* @param string $sort
120119
* @return mixed
121120
*/
122-
public function getTrimsByYearMakeAndModel(int $year, string $make, string $model, $sort = 'asc')
121+
public function getTrimsByYearMakeAndModel(int $year, string $make, string $model)
123122
{
124-
return json_decode(Http::withToken($this->vehApiToken)->get('https://vehapi.com/api/'.$this->vehApiVersion.'/car-lists/get/car/trims/'.$year.'/'.$make.'/'.$model.'/'.$sort), true);
123+
return json_decode(Http::withToken($this->vehApiToken)->get('https://vehapi.com/api/'.$this->vehApiVersion.'/car-lists/get/car/trims/'.$year.'/'.$make.'/'.$model), true);
125124
}
126125

127126
/**
@@ -131,12 +130,11 @@ public function getTrimsByYearMakeAndModel(int $year, string $make, string $mode
131130
* @param string $make
132131
* @param string $model
133132
* @param string $trim
134-
* @param string $sort
135133
* @return mixed
136134
*/
137-
public function getTransmissionsByYearMakeModelAndTrim(int $year, string $make, string $model, string $trim, $sort = 'asc')
135+
public function getTransmissionsByYearMakeModelAndTrim(int $year, string $make, string $model, string $trim)
138136
{
139-
return json_decode(Http::withToken($this->vehApiToken)->get('https://vehapi.com/api/'.$this->vehApiVersion.'/car-lists/get/car/transmissions/'.$year.'/'.$make.'/'.$model.'/'.$trim.'/'.$sort), true);
137+
return json_decode(Http::withToken($this->vehApiToken)->get('https://vehapi.com/api/'.$this->vehApiVersion.'/car-lists/get/car/transmissions/'.$year.'/'.$make.'/'.$model.'/'.$trim), true);
140138
}
141139

142140
/**
@@ -147,12 +145,11 @@ public function getTransmissionsByYearMakeModelAndTrim(int $year, string $make,
147145
* @param string $model
148146
* @param string $trim
149147
* @param string $transmission
150-
* @param string $sort
151148
* @return mixed
152149
*/
153-
public function getEnginesByYearMakeModelTrimAndTransmission(int $year, string $make, string $model, string $trim, string $transmission, $sort = 'asc')
150+
public function getEnginesByYearMakeModelTrimAndTransmission(int $year, string $make, string $model, string $trim, string $transmission)
154151
{
155-
return json_decode(Http::withToken($this->vehApiToken)->get('https://vehapi.com/api/'.$this->vehApiVersion.'/car-lists/get/car/engines/'.$year.'/'.$make.'/'.$model.'/'.$trim.'/'.$transmission.'/'.$sort), true);
152+
return json_decode(Http::withToken($this->vehApiToken)->get('https://vehapi.com/api/'.$this->vehApiVersion.'/car-lists/get/car/engines/'.$year.'/'.$make.'/'.$model.'/'.$trim.'/'.$transmission), true);
156153
}
157154

158155
/**

0 commit comments

Comments
 (0)