Merge pull request 'Remove Maven repositories from spec' (#17) from tilera/addonscript-spec:maven into master

Reviewed-on: addonscript/addonscript-spec#17
This commit is contained in:
Timo Ley 2022-08-30 14:12:37 +00:00
commit f14ec070d4
5 changed files with 65 additions and 34 deletions

View File

@ -5,6 +5,7 @@
# API
- [AddonScript API](api/README.md)
- [File repository](api/features/files.md)
# Schema

View File

@ -71,4 +71,5 @@ be in a namespace-like format (reversed domain name).
These API features are part of the AddonScript specification itself:
- `files`: [File repository](./features/files.md)
- To be added

View File

@ -0,0 +1,57 @@
# File Repository
## Endpoints
### `GET {base URL}/v1/files/:namespace/:addon/:version/:qualifier`
This endpoint can be used to retrieve information about a specific file.
If the instance don't know this file, it must respond with status code 404.
#### Path variables:
- `namespace`: The [canonical namespace](../../concepts/namespaces.md#canonical-namespaces)
of the addon to which the file belongs to
- `addon`: The addon ID of the addon to which the file belongs to
- `version`: The addon version to which the file belongs to
- `qualifier`: The qualifier of the file
#### Example response:
```json
{
"links": ["https://example.com/file.jar"],
"filename?": "file.jar",
"hashes": {
"sha1": "somesha1checksum"
},
"meta": {
"additional": {}
}
}
```
### `GET {base URL}/v1/files/:algorithm/:hash`
This endpoint can be used to retrieve information about a file from the hash value of the file.
If the instance can't find the file by the hash or does not know the specified hash algorithm,
it must respond with status code 404.
#### Path variables:
- `algorithm`: The hash algorithm of the hash
- `hash`: The hash value of the file
#### Example response:
```json
{
"links": ["https://example.com/file.jar"],
"filename?": "file.jar",
"hashes": {
"sha1": "somesha1checksum"
},
"meta": {
"additional": {}
}
}
```

View File

@ -2,10 +2,9 @@
```json
{
"id": "modfile",
"qualifier": "modfile",
"link": ["https://example.com/mymod.jar", "./mymod.jar"],
"flags": [],
"maven": {},
"install": [],
"hashes": {
"sha1": "somesha1checksum"
@ -15,11 +14,12 @@
## Required properties
### id
### qualifier
This is the ID of the file.
This is the qualifier of this file.
It should be written in the `kebab-case` format, meaning lowercase only and using `-` instead of spaces.
The file ID has to be unique to this addon version.
The qualifier has to be unique to this addon version. The namespace, addon ID, version and qualifier
can together be used to uniquely identify a file.
### link
@ -51,19 +51,3 @@ value is the checksum.
Supported hash algorithms:
- `sha1`
### maven
```json
{
"group": "com.example",
"artifact": "mymod",
"version": "1.0",
"qualifier": ""
}
```
Each file has a unique Maven specifier, consisting of a group ID, an artifact ID, a version, a file type and an optional qualifier.
By default, the group ID is equal to the addon namespace, the artifact ID to the addon ID, the version to the addon version and
the qualifier to file ID. Those values can be overwritten in this object. If the qualifier is set to an empty string, it will be
removed from the Maven specifier. The file type is always equal to the file type of the `link`. If the group ID, addon ID and version
all have their default values and the qualifier is an emptry string, the file type may not be `json`.

View File

@ -3,7 +3,6 @@
```json
{
"id": "asrepo",
"type": "api",
"url": "https://api.addonscript.net"
}
```
@ -14,17 +13,6 @@
This is the ID of the repository. It has to be unique to the AddonScript file.
### type
This is the type of the repository. Possible values are `addonscript` or `maven`.
A repository of the type `addonscript` is an instance of the [AddonScript API](../api).
AddonScript will use the basic endpoints of that instance to retrieve available versions
of a specific addon, as well as the [addon JSON](./addon.md) for a specific version of an
addon.
### url
This is the base URL of an [AddonScript API](../api) instance, if the repository
type is `addonscript`, or the base URL of a Maven Repository, if the repository
type is `maven`.
This is the base URL of an [AddonScript API](../api) instance.