Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}Add the dependency
dependencies {
implementation 'com.github.FeryaFox:WakaTimeApiWrapper:1.1'
}Add the JitPack repository to your build file
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>Add the dependency
<dependency>
<groupId>com.github.FeryaFox</groupId>
<artifactId>WakaTimeApiWrapper</artifactId>
<version>1.1</version>
</dependency>ApiTokenAuth auth = new ApiTokenAuth("api_key");First you need to create an OAuth application https://wakatime.com/apps
Scanner sc = new Scanner(System.in);
AccessTokenAuth auth = new AccessTokenAuth(
"App ID",
"App Secret",
"Authorized Redirect URIs"
);
System.out.println(auth.getAuthorizationUrl());
auth.getAccessToken(sc.nextLine());You must copy the received link, follow it, log in and then enter the received code
Create Wrapper
WakaTimeWrapper wrapper = new WakaTimeWrapper(auth);Get All Time Since Today
System.out.println(wrapper.getAllTimeSinceToday("Your Project"));To get all available methods, go to the website https://wakatime.com/developers/