Skip to content

Commit 8cca3b5

Browse files
committed
Merge branch 'develop'
2 parents 6931f1d + bcca9ad commit 8cca3b5

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "stoufa06/php-garmin-connect-api",
33
"description": "PHP library to connect and use garmin wellness api",
44
"type": "library",
5-
"version": "1.4",
5+
"version": "1.5",
66
"require": {
77
"league/oauth1-client": "*"
88
},

src/GarminApi.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,28 @@ public function getManuallyActivitySummary(TokenCredentials $tokenCredentials, a
173173
return $response->getBody()->getContents();
174174
}
175175

176+
public function getActivityDetailsSummary(TokenCredentials $tokenCredentials, array $params)
177+
{
178+
$client = $this->createHttpClient();
179+
$query = http_build_query($params);
180+
$query = 'activityDetails?'.$query;
181+
$headers = $this->getHeaders($tokenCredentials, 'GET', self::USER_API_URL . $query);
182+
183+
try {
184+
$response = $client->get(self::USER_API_URL . $query, [
185+
'headers' => $headers,
186+
]);
187+
} catch (BadResponseException $e) {
188+
$response = $e->getResponse();
189+
$body = $response->getBody();
190+
$statusCode = $response->getStatusCode();
191+
throw new \Exception(
192+
"Received error [$body] with status code [$statusCode] when retrieving manually activity summary."
193+
);
194+
}
195+
return $response->getBody()->getContents();
196+
}
197+
176198
public function backfill(TokenCredentials $tokenCredentials, string $uri, array $params) {
177199
$client = $this->createHttpClient();
178200
$query = http_build_query($params);

0 commit comments

Comments
 (0)