From 442149334844d53f8512407a25c48dd51ace33e0 Mon Sep 17 00:00:00 2001 From: FabioSaitta Date: Sat, 15 May 2021 18:48:56 +0200 Subject: [PATCH] Update GarminConnect.php --- src/dawguk/GarminConnect.php | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/dawguk/GarminConnect.php b/src/dawguk/GarminConnect.php index d40853d..55aef1b 100755 --- a/src/dawguk/GarminConnect.php +++ b/src/dawguk/GarminConnect.php @@ -587,5 +587,58 @@ public function getSleepData() $objResponse = json_decode($strResponse, true); return $objResponse; } + /** + * Retrieves VoMax data + * + * @param string $strFrom + * @param string $strUntil + * @throws GarminConnect\exceptions\UnexpectedResponseCodeException + * @throws Exception + * @return array + */ + public function getVoMax($strFrom = '2019-01-01', $strUntil = '2021-12-31') + { + + + $strResponse = $this->objConnector->get( + 'https://connect.garmin.com/modern/proxy/metrics-service/metrics/maxmet/daily/'.$strFrom."/".$strUntil, + NULL, + true + ); + + if ($this->objConnector->getLastResponseCode() != 200) { + throw new UnexpectedResponseCodeException($this->objConnector->getLastResponseCode()); + } + $objResponse = json_decode($strResponse, true); + return $objResponse; + } + /** + * Retrieves TrainingStatus data + * + * @param string $strFrom + * @param string $strUntil + * @param string $user + * @throws GarminConnect\exceptions\UnexpectedResponseCodeException + * @throws Exception + * @return array + */ + public function getTrainingStatus($strFrom = '2019-01-01', $strUntil = '2021-12-31',$user) + { + $arrParams = array( + 'fromCalendarDate' => $strFrom, + 'toCalendarDate' => $strUntil + ); + $strResponse = $this->objConnector->get( + 'https://connect.garmin.com/modern/proxy/metrics-service/metrics/trainingstatus/weekly/'.$user, + $arrParams, + true + ); + + if ($this->objConnector->getLastResponseCode() != 200) { + throw new UnexpectedResponseCodeException($this->objConnector->getLastResponseCode()); + } + $objResponse = json_decode($strResponse, true); + return $objResponse; + } }