Skip to content

Commit 2d01dc2

Browse files
committed
Documentation and renamed adverts endpoint to search.
1 parent 2ab134b commit 2d01dc2

File tree

6 files changed

+124
-41
lines changed

6 files changed

+124
-41
lines changed

src/Api/RetailMetrics.php

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Olsgreen\AutoTrader\Api\Builders\SearchRequestBuilder;
66

7-
class Adverts extends AbstractApi
7+
class Search extends AbstractApi
88
{
99
/**
1010
* $request = (new SearchRequestBuilder())

src/Api/Taxonomy.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,26 @@
44

55
class Taxonomy extends AbstractApi
66
{
7+
/**
8+
* Retrieve available vehicle types.
9+
*
10+
* @param string $advertiserId
11+
* @return array
12+
*/
713
public function types(string $advertiserId): array
814
{
915
return $this->_get('/service/stock-management/taxonomy/vehicleTypes', [
1016
'advertiserId' => $advertiserId
1117
]);
1218
}
1319

20+
/**
21+
* Retrieve a vehicles types available makes.
22+
*
23+
* @param string $advertiserId
24+
* @param string $vehicleType
25+
* @return array
26+
*/
1427
public function makes(string $advertiserId, string $vehicleType): array
1528
{
1629
return $this->_get(
@@ -19,6 +32,13 @@ public function makes(string $advertiserId, string $vehicleType): array
1932
);
2033
}
2134

35+
/**
36+
* Retrieve a makes available models.
37+
*
38+
* @param string $advertiserId
39+
* @param string $makeId
40+
* @return array
41+
*/
2242
public function models(string $advertiserId, string $makeId): array
2343
{
2444
return $this->_get(
@@ -27,6 +47,13 @@ public function models(string $advertiserId, string $makeId): array
2747
);
2848
}
2949

50+
/**
51+
* Retrieve a models available generations.
52+
*
53+
* @param string $advertiserId
54+
* @param string $modelId
55+
* @return array
56+
*/
3057
public function generations(string $advertiserId, string $modelId): array
3158
{
3259
return $this->_get(
@@ -35,6 +62,13 @@ public function generations(string $advertiserId, string $modelId): array
3562
);
3663
}
3764

65+
/**
66+
* Retrieve a generations available derivatives.
67+
*
68+
* @param string $advertiserId
69+
* @param string $generationId
70+
* @return array
71+
*/
3872
public function derivatives(string $advertiserId, string $generationId): array
3973
{
4074
return $this->_get(
@@ -43,6 +77,13 @@ public function derivatives(string $advertiserId, string $generationId): array
4377
);
4478
}
4579

80+
/**
81+
* Retrieve the technical data for a derivativeId.
82+
*
83+
* @param string $advertiserId
84+
* @param string $derivativeId
85+
* @return array
86+
*/
4687
public function technicalData(string $advertiserId, string $derivativeId): array
4788
{
4889
return $this->_get(
@@ -52,6 +93,14 @@ public function technicalData(string $advertiserId, string $derivativeId): array
5293
);
5394
}
5495

96+
/**
97+
* Retrieve the features for a derivativeId.
98+
*
99+
* @param string $advertiserId
100+
* @param string $derivativeId
101+
* @param string $effectiveDate
102+
* @return array
103+
*/
55104
public function features(string $advertiserId, string $derivativeId, string $effectiveDate): array
56105
{
57106
return $this->_get(
@@ -60,6 +109,14 @@ public function features(string $advertiserId, string $derivativeId, string $eff
60109
);
61110
}
62111

112+
/**
113+
* Retrieve manufacturer pricing data for a derivativeId.
114+
*
115+
* @param string $advertiserId
116+
* @param string $derivativeId
117+
* @param string|null $effectiveDate
118+
* @return array
119+
*/
63120
public function prices(string $advertiserId, string $derivativeId, string $effectiveDate = null)
64121
{
65122
$options = ['derivativeId' => $derivativeId, 'advertiserId' => $advertiserId];

src/Api/Valuations.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@
66

77
class Valuations extends AbstractApi
88
{
9-
/** *
9+
10+
/**
11+
* Retrieve a valuation.
12+
*
13+
* @param string $advertiserId
14+
* @param ValuationRequestBuilder $builder
15+
* @return array
16+
*
17+
* @example
1018
* $request = ValuationRequestBuilder::create();.
1119
*
1220
* $request->vehicle()

src/Api/VehicleMetrics.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,22 @@
66

77
class VehicleMetrics extends AbstractApi
88
{
9-
/** *
10-
* $request = MetricRequestBuilder::create();.
9+
/**
10+
* Lookup a vehicles metrics.
11+
*
12+
* @param string $advertiserId
13+
* @param MetricRequestBuilder $builder
14+
* @return array
15+
*
16+
* @example
17+
* $request = MetricRequestBuilder::create();
1118
*
1219
* $request->vehicle()
1320
* ->setDerivativeId('ABC123')
1421
* ->setFirstRegisteredDate('2020-11-01')
1522
* ->setOdometerReadingMiles(8000);
1623
*
17-
* $valuation = $api->vehicleMmetrics()->retrieve($request)
24+
* $valuation = $api->vehicleMetrics()->lookup(12345, $request)
1825
*/
1926
public function lookup(string $advertiserId, MetricRequestBuilder $builder)
2027
{

src/Client.php

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
namespace Olsgreen\AutoTrader;
44

5-
use Olsgreen\AutoTrader\Api\Adverts;
5+
use Olsgreen\AutoTrader\Api\Search;
66
use Olsgreen\AutoTrader\Api\Authentication;
7-
use Olsgreen\AutoTrader\Api\RetailMetrics;
87
use Olsgreen\AutoTrader\Api\Stock;
98
use Olsgreen\AutoTrader\Api\Taxonomy;
109
use Olsgreen\AutoTrader\Api\Valuations;
@@ -16,9 +15,10 @@ class Client extends AbstractClient
1615
use ManagesHttpAccessTokens;
1716

1817
/**
19-
* Set this clients options from array.
18+
* Set client options from array.
2019
*
2120
* @param array $options
21+
* @return AbstractClient
2222
*/
2323
protected function configureFromArray(array $options): AbstractClient
2424
{
@@ -37,43 +37,80 @@ protected function configureFromArray(array $options): AbstractClient
3737
return $this;
3838
}
3939

40-
public function adverts(): Adverts
41-
{
42-
return new Adverts($this);
43-
}
44-
40+
/**
41+
* Access Token Management.
42+
*
43+
* @see https://developers.autotrader.co.uk/api#authentication
44+
* @return Authentication
45+
*/
4546
public function authentication(): Authentication
4647
{
4748
return new Authentication($this);
4849
}
4950

51+
/**
52+
* Stock Endpoint.
53+
*
54+
* @see https://developers.autotrader.co.uk/api#stock-endpoint
55+
* @return Stock
56+
*/
5057
public function stock(): Stock
5158
{
5259
return new Stock($this);
5360
}
5461

62+
/**
63+
* Taxonomy Endpoint.
64+
*
65+
* @see https://developers.autotrader.co.uk/api#taxonomy-endpoint
66+
* @return Taxonomy
67+
*/
5568
public function taxonomy(): Taxonomy
5669
{
5770
return new Taxonomy($this);
5871
}
5972

73+
/**
74+
* Valuations Endpoint.
75+
*
76+
* @see https://developers.autotrader.co.uk/api#valuations-endpoint
77+
* @return Valuations
78+
*/
6079
public function valuations(): Valuations
6180
{
6281
return new Valuations($this);
6382
}
6483

84+
/**
85+
* Vehicles Endpoint
86+
*
87+
* @see https://developers.autotrader.co.uk/api#vehicles-endpoint
88+
* @return Vehicles
89+
*/
6590
public function vehicles(): Vehicles
6691
{
6792
return new Vehicles($this);
6893
}
6994

95+
/**
96+
* Vehicle Metrics Endpoint.
97+
*
98+
* @see https://developers.autotrader.co.uk/api#vehicle-metrics-endpoint
99+
* @return VehicleMetrics
100+
*/
70101
public function vehicleMetrics(): VehicleMetrics
71102
{
72103
return new VehicleMetrics($this);
73104
}
74105

75-
public function retailMetrics(): RetailMetrics
106+
/**
107+
* Search Endpoint
108+
*
109+
* @see https://developers.autotrader.co.uk/api#search-endpoint
110+
* @return Search
111+
*/
112+
public function adverts(): Search
76113
{
77-
return new RetailMetrics($this);
114+
return new Search($this);
78115
}
79116
}

0 commit comments

Comments
 (0)