Libraries
Java
Author inventivetalent
Example Code
new SpigetClient().request("/resources").sorted().size(20).getSorted(Resource.class, (response, error) -> {
for(Resource resource : response) {
System.out.println(resource.getName());
}
});
PHP
Author GamePanel.io
Example Code
<?php
use GamePanelio\SpigetApi\Spiget;
$spiget = new Spiget("My_cool_user_agent/1.0");
$spiget->getResourceSearch(
'search_param',
[
/* ... additional parameters ... */
]
);
Java
Author CodedByYou
Example Code
PHP
Author Camouflage100
Example Code
PHP
Author Th3Shadowbroker
Example Code
<?php
require 'SpigetAPI.php';
use de\m4taiori\spiget4php\SpigetAPI as SpigetAPI;
//Yes you can use 'new' but getInstance() is a better way because you don't have to create a ton of instances.
$spiget = SpigetAPI::getInstance();
/*
* Some functions use optional arguments/parameters. Use null if you want to use the default value
* defined by the spiget-web-api.
*
* Nearly all functions in this lib throw SpigetExceptions if something's going horribly wrong or is just invalid. However
* if you want to receive nulls instead of exceptions you can disable exceptions by using setThrowExceptions()
* at any time.
*/
//Let's get a list of the categories
$categories = $spiget->getCategoryList();
//All results will be returned as PHP assoc.-array
var_dump($categories); //<-- Let's see the result as it is in PHP
Go Spiget
Author sunxyw
Example Code
package example
import (
"context"
"fmt"
"github.com/sunxyw/go-spiget/spiget"
)
func SearchResources() {
client := spiget.NewClient(nil)
opt := &spiget.ResourceSearchOptions{
Field: "name",
}
resources, _, err := client.Resources.Search(context.Background(), "PlaceholderAPI", opt)
if err != nil {
panic(err)
}
for _, resource := range resources {
fmt.Println(resource)
}
}
Node.js Spiget API
Author VeguiDev
Example Code
const SpigetAPI = require("spiget-api");
// or
import SpigetAPI from 'spiget-api';
let api = new SpigetAPI("Example Agent"); // Instance of Librery
api.getAuthors().then((authors) => {
console.log(authors); // In console: Author[]
});
spiget-js
Author Creeperkatze
Example Code
import SpigetClient from 'spiget-js';
const client = new SpigetClient({
userAgent: 'my-app/1.0',
});
const resource = await client.resources.get(9089);
const author = await client.resources.getAuthor(9089);
const { data: reviews } = await client.resources.getReviews(9089);
console.log(resource);
console.log(author);
console.log(reviews);
Submit your own Library/API
To submit your own Library, edit this file on GitHub or tweet @Inventivetalent and provide links to the source-code, a download and possibly an example :)