Skip to content

Commit

Permalink
Update APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
lewmilburn committed Jun 9, 2024
1 parent 765c6d3 commit 91b40a9
Show file tree
Hide file tree
Showing 7 changed files with 182 additions and 28 deletions.
5 changes: 3 additions & 2 deletions Writerside/LewMCWiki.tree
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@
<toc-element topic="SimplyAesthetic.md"/>
</toc-element>
<toc-element topic="Other.md">
<toc-element topic="LewMC-Services.md">
<toc-element topic="APIs.md"/>
<toc-element topic="LewMC-Services.md" accepts-web-file-names-ref="2de42906">
<toc-element topic="Download-Counter-API.md"/>
<toc-element topic="Version-API.md"/>
</toc-element>
</toc-element>
</instance-profile>
68 changes: 68 additions & 0 deletions Writerside/openapi/download-counter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
openapi: 3.0.0
info:
title: LewMC Download Counter API
description: Counts downloads for LewMC resources.
version: 1.0.0
servers:
- url: https://service.lewmc.net

paths:
/latest-version:
get:
summary: Get download count
parameters:
- name: resource
in: path
required: true
description: The resource to get the latest download count for.
schema:
type: string
format: string
minimum: 1
example: galactica
responses:
'200': # status code
description: Fetch the latest download count
content:
application/json:
schema:
type: object
properties:
status:
type: integer
description: HTTP status code
example: 200
data:
type: object
properties:
spigot:
type: integer
description: The latest download statistic from Spigot
example: 2000
modrinth:
type: integer
description: The latest download statistic from Modrinth
example: 1000
hangar:
type: integer
description: The latest download statistic from Hangar
example: 1000
curseforge:
type: integer
description: The latest download statistic from CurseForge
example: 5000
total:
type: integer
description: The total latest download statistic across all sources
example: 9000
'404':
description: Unable to find resource
content:
application/json:
schema:
type: object
properties:
status:
type: integer
format: int64
example: 404
65 changes: 65 additions & 0 deletions Writerside/openapi/service-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
openapi: 3.0.0
info:
title: LewMC Version API
description: Collects version information for LewMC resources.
version: 1.0.0
servers:
- url: https://service.lewmc.net

paths:
/latest-version:
get:
summary: Get latest version
parameters:
- name: resource
in: path
required: true
description: The resource to get the latest version for.
schema:
type: string
format: string
minimum: 1
example: galactica
responses:
'200': # status code
description: Fetch the latest version
content:
application/json:
schema:
type: object
properties:
status:
type: integer
description: HTTP status code
example: 200
data:
type: object
properties:
version:
type: string
description: The latest version of the resource
example: "1.11.1"
minecraft:
type: string
description: The Minecraft version compatible with the resource
example: "1.12.2"
modloader:
type: string
description: The modloader version compatible with the resource
example: "Forge 14.23.5.2858"
released:
type: string
format: date
description: The release date of the latest version
example: "2023-10-17"
'404':
description: Unable to find resource
content:
application/json:
schema:
type: object
properties:
status:
type: integer
format: int64
example: 404
4 changes: 4 additions & 0 deletions Writerside/redirection-rules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@
<description>Created after removal of "Miscellaneous" from LewMC Wiki</description>
<accepts>Miscellaneous.html</accepts>
</rule>
<rule id="2de42906">
<description>Created after removal of "APIs" from LewMC Wiki</description>
<accepts>APIs.html</accepts>
</rule>
</rules>
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
# APIs
# Download Counter API

## Version API
Get information about the latest version of a resource.

https://service.lewmc.net/latest-version?resource=[RESOURCE]

You can also get a simple format by adding &format=simpleversion to the end.

Example (Full): https://service.lewmc.net/download-counter?resource=essence

Example (Simple): https://service.lewmc.net/download-counter?resource=essence&format=simpleversion

## Download Counter API
> Base URL: https://service.lewmc.net
Get the number of downloads for a resource.

https://service.lewmc.net/download-counter?resource=[RESOURCE]

Adding &format=true to the URL formats the number counts as strings with commas for values over 1,000.

Resources: 'galactica', 'lews-jurassic-pack', 'lews-client-pack', 'simplyaesthetic', 'essence', 'kryptonite', 'all'
<api-doc openapi-path="../openapi/download-counter.yml"></api-doc>

## Resources

| Resource | Description | Version API | Download Counter API |
|---------------------|---------------------------------------------|-------------|----------------------|
| galactica | The Galactica Modpack |||
Expand All @@ -35,12 +23,4 @@ Resources: 'galactica', 'lews-jurassic-pack', 'lews-client-pack', 'simplyaesthet
| kryptonite-snapshot | The Kryptonite Plugin's snapshot/git branch |||
The essence-snapshot and kryptonite-snapshot download counts are bundled with release variants in essence and kryptonite resources.

Downloads from LewMC's legacy download system are not supported.

## Privacy

The API does not collect any information about you, our hosting provider may collect some data for security purposes, we do not have access to this. We can see how many people have used an endpoint via our hosting provider's dashboard, but we can not see who accessed it.

There are no rate limits, please be respectful and use the API appropriately so we do not have to implement this.

For terms and legal stuff visit [service.lewmc.net](https://service.lewmc.net).
Downloads from LewMC's legacy download system are not supported.
13 changes: 11 additions & 2 deletions Writerside/topics/LewMC-Services.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,14 @@

LewMC runs a number of web-based services that can allow you to interact with our work via an API.

## Services
[APIs](APIs.md)
## API
- [Download Counter API](Download-Counter-API.md)
- [Version API](Version-API.md)

### Privacy

The API does not collect any information about you, our hosting provider may collect some data for security purposes, we do not have access to this. We can see how many people have used an endpoint via our hosting provider's dashboard, but we can not see who accessed it.

There are no rate limits, please be respectful and use the API appropriately so we do not have to implement this.

For terms and legal stuff visit [service.lewmc.net](https://service.lewmc.net).
27 changes: 27 additions & 0 deletions Writerside/topics/Version-API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Version API

> Base URL: https://service.lewmc.net
Get information about the latest version of a resource.

https://service.lewmc.net/latest-version?resource=[RESOURCE]

You can also get a simple format by adding &format=simpleversion to the end.

Example (Full): https://service.lewmc.net/download-counter?resource=essence

Example (Simple): https://service.lewmc.net/download-counter?resource=essence&format=simpleversion

<api-doc openapi-path="../openapi/service-version.yml"></api-doc>

## Resources
| Resource | Description | Version API | Download Counter API |
|---------------------|---------------------------------------------|-------------|----------------------|
| galactica | The Galactica Modpack |||
| lewsjurassicpack | The Lew's Jurassic Pack Modpack |||
| lewsclientpack | The Lew's Client Pack Modpack |||
| simplyaesthetic | The SimplyAesthetic Modpack |||
| essence | The Essence Plugin |||
| essence-snapshot | The Essence Plugin's snapshot/git branch |||
| kryptonite | The Kryptonite Plugin |||
| kryptonite-snapshot | The Kryptonite Plugin's snapshot/git branch |||

0 comments on commit 91b40a9

Please sign in to comment.