mkraemer / garmin-connect-activity-uploader
There is no license information available for the latest version (v1.0.0) of this package.
v1.0.0
2015-03-22 21:58 UTC
Requires
Suggests
- mkraemer/garmin-connect-sso: Allows signing in into GarminConnect SSO
This package is not auto-updated.
Last update: 2024-12-21 18:14:30 UTC
README
This Activity Uploader provides a way to upload activity files into a GarminConnect account.
Usage
The following examples makes use of mkraemer/GarminConnectSSO to obtain the cookies to make authenticated calls agains the GarminConnect API:
use GuzzleHttp\Client as HttpClient; use MKraemer\GarminConnect\SSO\SSO as GarminConnectSSO; use MKraemer\GarminConnect\ActivityUploader\ActivityUploader as GarminConnectActivityUploader; $client = new HttpClient(); $sso = new GarminConnectSSO( $client, 'username', 'password' ); $cookieJar = $sso(); $activityUploader = new GarminConnectActivityUploader($client, $cookieJar); $fileInfo = new SplFileInfo('/path/to/garmin_device/Activities/2015-04-02.fit'); $result = $activityUploader($fileInfo); switch ($result) { case GarminConnectActivityUploader::RESULT_UPLOAD_SUCCESSFUL: echo sprintf('%s successfully uploaded', $fileInfo->getFilename()); break; case GarminConnectActivityUploader::RESULT_UPLOAD_DUPLICATE: echo sprintf('%s was already uploaded', $fileInfo->getFilename()); break; }