AppVeyor REST API client generated from the unofficial Swagger definition in Java. The primary purpose of this project is to serve as a demonstration and test of the Swagger definition using the Java language. It is also suitable for use as a library to access the AppVeyor API from languages which run on the JVM. Users should be aware that the generated classes are a bit clunky and the API is likely to change frequently as a result of updates to swagger-codegen or the REST API.
import name.kevinlocke.appveyor.ApiClient;
import name.kevinlocke.appveyor.ApiException;
import name.kevinlocke.appveyor.api.ProjectApi;
import name.kevinlocke.appveyor.model.Build;
public class AppveyorApiExample {
public static void main(String[] args) {
ApiClient apiClient = new ApiClient();
apiClient.setApiKeyPrefix("Bearer");
// API Token from https://ci.appveyor.com/api-token
apiClient.setApiKey(apiToken);
ProjectApi projectApi = new ProjectApi(apiClient);
try {
Build build =
// Account name and slug from AppVeyor project URL
projectApi.getProjectLastBuild(accountName, projectSlug)
.getBuild();
System.out.println("Last build status: " + build.getStatus());
} catch (ApiException e) {
System.err.println("Error getting last build: " + e.getMessage());
}
}
}
To use this project as a dependency with Maven,
add the following dependency to your project's pom.xml
:
<dependency>
<groupId>name.kevinlocke.appveyor</groupId>
<artifactId>appveyor-swagger</artifactId>
<version>0.1.0</version>
</dependency>
To use this project as a dependency with sbt
add the following dependency to your project's build.sbt
:
libraryDependencies += "name.kevinlocke.appveyor" % "appveyor-swagger" % "0.1.0"
To use this project as a dependency with Gradle,
add the following dependency to your project's build.gradle
:
compile "name.kevinlocke.appveyor:appveyor-swagger:0.1.0"
To use this project as a dependency of another build system, a JAR can be created by running the following commands:
git clone --branch v0.1.0 https://github.com/kevinoid/appveyor-swagger-java.git
cd appveyor-swagger-java
mvn package
The generated JAR file will be at target/appveyor-swagger-0.1.0.jar
.
The project documentation includes Javadoc and Swagger-generated endpoint and model documentation. There is also Swagger API Documentation.
Running the tests defined in this project requires an AppVeyor account. The
API Token must be set in the environment
variable $APPVEYOR_API_TOKEN
when running the tests. This can be
accomplished as follows:
APPVEYOR_API_TOKEN=deadbeef mvn test
This library is available under the terms of the MIT License.