{"id":16379042,"url":"https://github.com/derklaro/java-spiget-client","last_synced_at":"2025-07-25T04:39:25.559Z","repository":{"id":41709544,"uuid":"448683357","full_name":"derklaro/java-spiget-client","owner":"derklaro","description":"A java library to interact with the spiget.org api","archived":false,"fork":false,"pushed_at":"2025-07-04T15:57:05.000Z","size":290,"stargazers_count":2,"open_issues_count":11,"forks_count":0,"subscribers_count":1,"default_branch":"v2","last_synced_at":"2025-07-06T21:43:40.786Z","etag":null,"topics":["api","java-client","spiget"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/derklaro.png","metadata":{"files":{"readme":".github/README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-01-16T21:58:58.000Z","updated_at":"2025-02-08T14:26:14.000Z","dependencies_parsed_at":"2024-01-24T19:37:45.817Z","dependency_job_id":"d5430b4e-7898-4b8e-915b-ec7e5ac7535a","html_url":"https://github.com/derklaro/java-spiget-client","commit_stats":{"total_commits":33,"total_committers":2,"mean_commits":16.5,"dds":"0.48484848484848486","last_synced_commit":"9495407bd30992aa023df4c980c774e0360cf5db"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/derklaro/java-spiget-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derklaro%2Fjava-spiget-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derklaro%2Fjava-spiget-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derklaro%2Fjava-spiget-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derklaro%2Fjava-spiget-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/derklaro","download_url":"https://codeload.github.com/derklaro/java-spiget-client/tar.gz/refs/heads/v2","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derklaro%2Fjava-spiget-client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265002417,"owners_count":23696075,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","java-client","spiget"],"created_at":"2024-10-11T03:47:18.611Z","updated_at":"2025-07-12T13:33:33.050Z","avatar_url":"https://github.com/derklaro.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spiget Java Client\n\n![Build](https://github.com/derklaro/java-spiget-client/actions/workflows/build.yml/badge.svg)\n![MIT License](https://img.shields.io/badge/license-MIT-blue)\n![Release Version](https://img.shields.io/maven-central/v/dev.derklaro.spiget/core)\n\n### Dependencies\n\nThe spiget java client is available in the maven central repository.\n\n```xml\n\n\u003cdependencies\u003e\n  \u003cdependency\u003e\n    \u003cgroupId\u003edev.derklaro.spiget\u003c/groupId\u003e\n    \u003cartifactId\u003e{component}\u003c/artifactId\u003e\n    \u003cversion\u003e{release}\u003c/version\u003e\n  \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\n```gradle\nimplementation group: 'dev.derklaro.spiget', name: '{component}', version: '{version}'\n```\n\n### Dev Builds\n\nDev Builds are published to sonatype, use the following repository to access them:\n\n```xml\n\n\u003crepositories\u003e\n  \u003crepository\u003e\n    \u003cid\u003esonatype-snapshots\u003c/id\u003e\n    \u003curl\u003ehttps://s01.oss.sonatype.org/content/repositories/snapshots/\u003c/url\u003e\n  \u003c/repository\u003e\n\u003c/repositories\u003e\n```\n\n### Components\n\nThe library has 5 main components, 3 are required to run it. You need the core to get access to all request and response\ntypes, one http implementation to send a request and one json-mapper to en- / decode the request/response data:\n\n- `core`: contains all request and response models, the main api to use\n- `http-java8`: contains the java 8 (`HttpUrlConnection`) based http client implementation.\n- `http-java11`: contains the java 11 (`HttpClient`) based http client implementation\n- `http-httpclient5`: contains the apache client5 based http implementation\n- `mapper-gson`: contains a json mapper based on gson to en- / decode data\n- `mapper-jackson`: contains a json mapper based on jackson to en- / decode data\n- `tests`: contains all tests, no use for a user\n\n### External dependencies\n\nPlease note that no component shadows any dependency by default. Your library is required to define the following \ndependencies if you use the given component:\n\n| Component        | Required dependencies                           | Required Version |\n|------------------|-------------------------------------------------|------------------|\n| core             | no dependencies required                        | Java \u003e= 8        |\n| http-java8       | no dependencies required                        | Java \u003e= 8        |\n| http-java11      | no dependencies required                        | Java \u003e= 11       |\n| http-httpclient5 | `org.apache.httpcomponents.client5:httpclient5` | 5.X              |\n| mapper-gson      | `com.google.code.gson:gson`                     | 2.X              |\n| mapper-jackson   | `com.fasterxml.jackson.core:jackson-databind`   | 2.X              |\n\n### How to send a request\n\n*This example uses the Java 11 client and the gson mapper, but it's the same thing for all other clients/mappers.*\n\nA request will always be sent to the spiget base url `https://api.spiget.org/v2/`. Each request (and the possible fields\nof it) described in the spiget documentation (https://spiget.org/documentation) has a wrapper representation:\n\n```java\npackage dev.derklaro.spiget.example;\n\nimport dev.derklaro.spiget.SpigetClient;\nimport dev.derklaro.spiget.SpigetClientConfig;\nimport dev.derklaro.spiget.http.java11.Java11SpigetClient;\nimport dev.derklaro.spiget.mapper.gson.GsonMapper;\nimport dev.derklaro.spiget.model.Category;\nimport dev.derklaro.spiget.request.category.CategoryList;\nimport dev.derklaro.spiget.request.resource.ResourceDownload;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.UncheckedIOException;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport java.time.Duration;\nimport java.util.Set;\nimport java.util.concurrent.CompletableFuture;\n\npublic final class SpigetRequester {\n\n  private final SpigetClient client;\n\n  public SpigetRequester() {\n    // creates a new spiget client which uses the gson mapper and the connect timeout is set to 30 seconds.\n    // You can configure the request timeout and the user agent as well.\n    SpigetClientConfig config = SpigetClientConfig.create(GsonMapper.INSTANCE).connectTimeout(Duration.ofSeconds(30));\n    this.client = new Java11SpigetClient(config);\n  }\n\n  public Set\u003cCategory\u003e listCategories() {\n    // sends the request and waits for the result to become available\n    // this will rethrow any exception if one occurs\n    return CategoryList.create(this.client).size(5).exec().join();\n  }\n\n  public void listAndPrintCategories() {\n    // recommended way to use the api\n    // make use of the method given by CompletableFuture\n    CategoryList.create(this.client).size(5).exec().whenComplete((result, exception) -\u003e {\n      if (exception != null) {\n        System.err.println(\"Unable to fetch because \" + exception.getMessage());\n      } else {\n        result.forEach(category -\u003e System.out.println(category.name()));\n      }\n    });\n  }\n\n  public CompletableFuture\u003cVoid\u003e downloadFile() {\n    // a file download requires you to close the stream\n    // any other request which returns a model will do this for you\n    return ResourceDownload.create(this.client).resourceId(2).exec().thenAccept(stream -\u003e {\n      try (InputStream inputStream = stream) {\n        // copies the stream to the given file path\n        Files.copy(inputStream, Paths.get(\"target.jar\"));\n      } catch (IOException exception) {\n        // let the caller of the method deal with the exception\n        throw new UncheckedIOException(exception);\n      }\n    });\n  }\n}\n```\n\n### Compiling from source\n\nJust executing `./gradlew` or `gradlew.bat` will execute the full build lifecycle including all tests. For local changes\nand testing use `./gradlew publishToMavenLocal` to publish all artifacts into the local maven repository.\n\nFirst time example:\n\n```\ngit clone https://github.com/derklaro/java-spiget-client.git\ncd java-spiget-client/\n./gradlew\n```\n\n### Contributions\n\nOpen source lives from contributions so feel free to contribute! Before opening a pull request, please make sure that\nall tests are still passing and checkstyle prints no warnings during compile. Please include a test case if necessary.\n\nBreaking changes are only accepted if they are caused by spiget (e.g. spiget removed a query field).\n\n### License\n\nThis project is licensed under the terms of the [MIT License](../license.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderklaro%2Fjava-spiget-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fderklaro%2Fjava-spiget-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderklaro%2Fjava-spiget-client/lists"}