项目作者: kevinoid

项目描述 :
AppVeyor REST API Client (from Swagger, in Java)
高级语言: Java
项目地址: git://github.com/kevinoid/appveyor-swagger-java.git
创建时间: 2017-01-05T03:14:55Z
项目社区:https://github.com/kevinoid/appveyor-swagger-java

开源协议:Other

下载


AppVeyor REST API Client (from Swagger, in Java)

Build Status

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.

Introductory Example

  1. import name.kevinlocke.appveyor.ApiClient;
  2. import name.kevinlocke.appveyor.ApiException;
  3. import name.kevinlocke.appveyor.api.ProjectApi;
  4. import name.kevinlocke.appveyor.model.Build;
  5. public class AppveyorApiExample {
  6. public static void main(String[] args) {
  7. ApiClient apiClient = new ApiClient();
  8. apiClient.setApiKeyPrefix("Bearer");
  9. // API Token from https://ci.appveyor.com/api-token
  10. apiClient.setApiKey(apiToken);
  11. ProjectApi projectApi = new ProjectApi(apiClient);
  12. try {
  13. Build build =
  14. // Account name and slug from AppVeyor project URL
  15. projectApi.getProjectLastBuild(accountName, projectSlug)
  16. .getBuild();
  17. System.out.println("Last build status: " + build.getStatus());
  18. } catch (ApiException e) {
  19. System.err.println("Error getting last build: " + e.getMessage());
  20. }
  21. }
  22. }

Usage

Maven

To use this project as a dependency with Maven,
add the following dependency to your project’s pom.xml:

  1. <dependency>
  2. <groupId>name.kevinlocke.appveyor</groupId>
  3. <artifactId>appveyor-swagger</artifactId>
  4. <version>0.1.0</version>
  5. </dependency>

sbt

To use this project as a dependency with sbt
add the following dependency to your project’s build.sbt:

  1. libraryDependencies += "name.kevinlocke.appveyor" % "appveyor-swagger" % "0.1.0"

Gradle

To use this project as a dependency with Gradle,
add the following dependency to your project’s build.gradle:

  1. compile "name.kevinlocke.appveyor:appveyor-swagger:0.1.0"

Others

To use this project as a dependency of another build system, a
JAR
can be created by running the following commands:

  1. git clone --branch v0.1.0 https://github.com/kevinoid/appveyor-swagger-java.git
  2. cd appveyor-swagger-java
  3. mvn package

The generated JAR file will be at target/appveyor-swagger-0.1.0.jar.

Documentation

The project documentation
includes Javadoc
and Swagger-generated endpoint and model
documentation
.
There is also Swagger API
Documentation
.

Testing

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:

  1. APPVEYOR_API_TOKEN=deadbeef mvn test

License

This library is available under the terms of the
MIT License.