-
Notifications
You must be signed in to change notification settings - Fork 1
SpigetAPI Class
Table of contents:
- Constructor
- API Instance
- Methods
agent_name: Is the name of User Agent used to request API.
const api = new SpigetAPI("example");It is an instance of the SpigetAPI class that contains all the methods needed to interact with the spiget Rest API.
This method request a list of authors.
options (optional): Its a Basic Paginated Request
const auhors = await api.getAuthors();[
{
"id":1,
"name":"Author Example",
"icon": {
"data":"base64string",
"url":"http://url/to/the/image",
"hash":"sadsfsfsf",
"info":"161615616516"
}
}
]This method request an author.
id: It is an author id number.
const auhor = await api.getAuthor(1);{
"id":1,
"name":"Author Example",
"icon": {
"data":"base64string",
"url":"http://url/to/the/image",
"hash":"sadsfsfsf",
"info":"161615616516"
}
}This method request a list of categories.
options (optional): Its a Basic Paginated Request
const categories = await api.getCategories();[
{
"id":1,
"title":"Example Category"
}
]This method request a category.
id: Its an category id number.
const category = await api.getCategory(1);{
"id":1,
"title":"Example Category"
}This method request a list of resources that you can filter by what's newest, whether it's free or not, and what version the resource is for.
options (optional): Its a Resource Request
const resources = await api.getResources();[
{
"id": 0,
"name": "string",
"tag": "string",
"contributors": "string",
"likes": 0,
"file": {
"type": "string",
"size": 0,
"sizeUnit": "string",
"url": "string",
"externalUrl": "string"
},
"testedVersions": [
"string"
],
"links": {},
"rating": {
"count": 0,
"average": 0
},
"releaseDate": 0,
"updateDate": 0,
"downloads": 0,
"external": true,
"icon": {
"url": "string",
"data": "string"
},
"premium": true,
"price": 0,
"currency": "string",
"author": {
"id": 0
},
"category": {
"id": 0
},
"version": {
"id": 0,
"uuid": "string"
},
"reviews": [
{
"id": 0
}
],
"versions": [
{
"id": 0
}
],
"updates": [
{
"id": 0
}
],
"sourceCodeLink": "string",
"donationLink": "string"
}
]This method request a resource.
id: Its an resource id number.
const resource = await api.getResource(0);{
"id": 0,
"name": "string",
"tag": "string",
"contributors": "string",
"likes": 0,
"file": {
"type": "string",
"size": 0,
"sizeUnit": "string",
"url": "string",
"externalUrl": "string"
},
"testedVersions": [
"string"
],
"links": {},
"rating": {
"count": 0,
"average": 0
},
"releaseDate": 0,
"updateDate": 0,
"downloads": 0,
"external": true,
"icon": {
"url": "string",
"data": "string"
},
"premium": true,
"price": 0,
"currency": "string",
"author": {
"id": 0
},
"category": {
"id": 0
},
"version": {
"id": 0,
"uuid": "string"
},
"reviews": [
{
"id": 0
}
],
"versions": [
{
"id": 0
}
],
"updates": [
{
"id": 0
}
],
"sourceCodeLink": "string",
"donationLink": "string"
}This method its used to search in SpigetAPI.
entity: Must be author or resource.
options: Is a Search Request Config
const search = await api.search("author", {
query: "luck",
field: "name"
});{
"id": 0,
"name": "string",
"icon": {
"url":"string",
"data": "base64enconded",
"hash": "4sdafasfas",
"info": "614561654"
}
}