From d4fa2b1372498c7240682076099a5a613b6ab442 Mon Sep 17 00:00:00 2001 From: Dmitry Kovalev Date: Sun, 23 Jun 2024 22:08:00 +0300 Subject: [PATCH] feature/geolocation: GEO location support has been implemented --- src/Facades/DaDataAddress.php | 1 + src/Http/Router.php | 8 +++++ src/Methods/Address/GeoLocateMethod.php | 47 +++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 src/Methods/Address/GeoLocateMethod.php diff --git a/src/Facades/DaDataAddress.php b/src/Facades/DaDataAddress.php index faacd62..d71882e 100644 --- a/src/Facades/DaDataAddress.php +++ b/src/Facades/DaDataAddress.php @@ -6,6 +6,7 @@ /** * @method static suggest(string[] $array) + * @method static geoLocate(string[] $array) */ class DaDataAddress extends Facade { diff --git a/src/Http/Router.php b/src/Http/Router.php index 457787d..5a58b71 100644 --- a/src/Http/Router.php +++ b/src/Http/Router.php @@ -132,4 +132,12 @@ public static function cleanAddress(): string return 'clean/address'; } + /** + * @return string + */ + public static function geoLocateAddress(): string + { + return 'rs/geolocate/address'; + } + } diff --git a/src/Methods/Address/GeoLocateMethod.php b/src/Methods/Address/GeoLocateMethod.php new file mode 100644 index 0000000..3965e82 --- /dev/null +++ b/src/Methods/Address/GeoLocateMethod.php @@ -0,0 +1,47 @@ + 'float', + 'lon' => 'float', + 'count' => 'integer', + 'radius_meters' => 'integer', + 'language' => 'string', + ]; + + /** + * @param Client $client + * + */ + public function __construct(Client &$client) + { + $this->entryPoint = Router::geoLocateAddress(); + + parent::__construct($client); + } +}