Skip to content

A Java Client for VocaDB API (auto-generated by OpenAPI and auto-fixed by my VocaDB OpenAPI Java Client Autofixer)

License

Notifications You must be signed in to change notification settings

VocaDB/vocadb-openapi-client-java

Repository files navigation

Auto-generated VocaDB OpenAPI Java Client

A sample VocaDB API Java Client that is auto-generated by OpenAPI and is auto-fixed by my VocaDB OpenAPI Java Client Autofixer

The original README file coming from this auto-generated client is in README Original.md

This client is generated by:

docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate \
  --api-package mikufan.cx.vocadbapiclient.api \
  --model-package mikufan.cx.vocadbapiclient.model \
  --invoker-package mikufan.cx.vocadbapiclient.client \
  -i /local/openapi.json \
  --group-id mikufan.cx \
  --artifact-id vocadb-api-client \
  --artifact-version 1.0.0 \
  --minimal-update \
  -g java  \
    -p java8=true \
    -p dateLibrary=java8-localdatetime \
    -p useRuntimeException=true \
    -p useJakartaEe=true \
    -p openApiNullable=false \
    -p serializationLibrary=jackson \
    -p licenseName=WTFPL \
    -p licenseUrl=http://www.wtfpl.net/ \
  --library resttemplate \
  -o /local/sample-unfixed-client

How to import

Refer to jitpack to see how to import

How to use

Please read VocaDB API Usage Rules before using this API client.

Refer to the generated documentation for how to use this client

Notes

  • Highly recommended to set your custom User-Agent in ApiClient for VocaDB to identity you
  • This client probably won't work well for any non-GET requests. Base on VocaDB document, you need to set some custom header to be able to use it. This probably can be done by tunning the RestTemplate instance inside ApiClient
  • Take a look of your client, understand the structure
    • api directory is where you use to call the VocaDB Rest API
    • ApiClient is the core class
  • By default, the base URL is always http://localhost, change it to https://vocadb.net by calling setBaseurl() on ApiClient class
    • for Java 11 native HTTP client, use setHostname("vocadb.net") and setScheme("https") (Java 11 native HTTP client doesn't have setBaseurl()). If you don't do setScheme("https"), you need to manually add builder.followRedirects(Redirect.NORMAL)
  • Because VocaDB and UtaiteDB use the same codebase, you could probably change the base URL to https://utaitedb.net to make your client an UtaiteDB Api Client.
    • be aware that some artist types are a bit different between VocaDB and UtaiteDB, as ycanardeau said
    • if having problems on UtaiteDB, you can always grab the swagger.json file from UtaiteDB API page and regernate your client just for UtaiteDB
  • Test cases are all @Ignored when generated by OpenAPI. To run some of them, explicitly remove the @Ignored and run it at your own risk (e.g. IP banned by VocaDB)