diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index b970415..177a392 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -5,6 +5,7 @@ # API - [AddonScript API](api/README.md) + - [File repository](api/features/files.md) # Schema diff --git a/docs/api/README.md b/docs/api/README.md index 9f42918..0705aed 100755 --- a/docs/api/README.md +++ b/docs/api/README.md @@ -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 \ No newline at end of file diff --git a/docs/api/features/files.md b/docs/api/features/files.md new file mode 100644 index 0000000..da4433b --- /dev/null +++ b/docs/api/features/files.md @@ -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": {} + } +} +``` \ No newline at end of file diff --git a/docs/schema/file.md b/docs/schema/file.md index f55ae19..1075ed4 100644 --- a/docs/schema/file.md +++ b/docs/schema/file.md @@ -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`. diff --git a/docs/schema/repository.md b/docs/schema/repository.md index f76384a..ed17840 100644 --- a/docs/schema/repository.md +++ b/docs/schema/repository.md @@ -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. \ No newline at end of file