From 30e93f762114279ed437d4a04ecb50a0cbcb6014 Mon Sep 17 00:00:00 2001 From: Timo Ley Date: Tue, 30 Aug 2022 16:11:03 +0200 Subject: [PATCH] Added file repository feature to API --- docs/SUMMARY.md | 1 + docs/api/README.md | 1 + docs/api/features/files.md | 57 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 docs/api/features/files.md 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