diff --git a/CHANGELOG.md b/CHANGELOG.md index 5efbe54..953212f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - New method `Art4\Wegliphant\Client::authenticate()` to set your API key for authorized API requests. +- New method `Art4\Wegliphant\Client::listOwnNotices()` to list all notices for the authorized user. - New class `Art4\Wegliphant\Exception\UnexpectedResponseException` that will be thrown if an error happens while processing the response. ### Changed diff --git a/README.md b/README.md index 909bb1c..7f94be2 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,69 @@ You can find your API key [here](https://www.weg.li/user/edit). $client->authenticate($apiKey); ``` +### List all own notices + +```php +$notices = $client->listOwnNotices(); + +// $notices contains: +[ + [...], + [ + 'token' => '8843d7f92416211de9ebb963ff4ce281', + 'status' => 'shared', + 'street' => 'Musterstraße 123', + 'city' => 'Berlin', + 'zip' => '12305', + 'latitude' => 52.5170365, + 'longitude' => 13.3888599, + 'registration' => 'EX AM 713', + 'color' => 'white', + 'brand' => 'Car brand', + 'charge' => [ + 'tbnr' => '141312', + 'description' => 'Sie parkten im absoluten Haltverbot (Zeichen 283).', + 'fine' => '25.0', + 'bkat' => '§ 41 Abs. 1 iVm Anlage 2, § 49 StVO; § 24 Abs. 1, 3 Nr. 5 StVG; 52 BKat', + 'penalty' => null, + 'fap' => null, + 'points' => 0, + 'valid_from' => '2021-11-09T00:00:00.000+01:00', + 'valid_to' => null, + 'implementation' => null, + 'classification' => 5, + 'variant_table_id' => 741017, + 'rule_id' => 39, + 'table_id' => null, + 'required_refinements' => '00000000000000000000000000000000', + 'number_required_refinements' => 0, + 'max_fine' => '0.0', + 'created_at' => '2023-09-18T15:30:43.312+02:00', + 'updated_at' => '2023-09-18T15:30:43.312+02:00', + ], + 'tbnr' => '141312', + 'start_date' => '2023-11-12T11:31:00.000+01:00', + 'end_date' => '2023-11-12T11:36:00.000+01:00', + 'note' => 'Some user notes', + 'photos' => [ + [ + 'filename' => 'IMG_20231124_113156.jpg', + 'url' => 'https://example.com/storage/IMG_20231124_113156.jpg', + ], + ], + 'created_at' => '2023-11-12T11:33:29.423+01:00', + 'updated_at' => '2023-11-12T11:49:24.383+01:00', + 'sent_at' => '2023-11-12T11:49:24.378+01:00', + 'vehicle_empty' => true, + 'hazard_lights' => false, + 'expired_tuv' => false, + 'expired_eco' => false, + 'over_2_8_tons' => false, + ], + [...], +], +``` + ### List all districts ```php diff --git a/tests/Unit/Client/ListOwnNoticesTest.php b/tests/Unit/Client/ListOwnNoticesTest.php index 7ca53c1..03580ed 100644 --- a/tests/Unit/Client/ListOwnNoticesTest.php +++ b/tests/Unit/Client/ListOwnNoticesTest.php @@ -22,7 +22,7 @@ public function testListOwnNoticesReturnsArray(): void { $expected = [ [ - 'token' => '7a473465c3cbbc6c90781b5e798966ce', + 'token' => '8843d7f92416211de9ebb963ff4ce281', 'status' => 'shared', 'street' => 'Musterstraße 123', 'city' => 'Berlin', @@ -59,8 +59,8 @@ public function testListOwnNoticesReturnsArray(): void 'note' => 'Some user notes', 'photos' => [ [ - 'filename' => 'IMG_20231124_113156.jpg', - 'url' => 'https://example.com/storage/IMG_20231124_113156.jpg', + 'filename' => 'IMG_20231112_113156.jpg', + 'url' => 'https://example.com/storage/IMG_20231112_113156.jpg', ], ], 'created_at' => '2023-11-12T11:33:29.423+01:00',