diff --git a/src/registry/RegistryClient.ts b/src/registry/RegistryClient.ts index 00fc72f..8705118 100644 --- a/src/registry/RegistryClient.ts +++ b/src/registry/RegistryClient.ts @@ -214,6 +214,26 @@ export class RegistryClient extends HTTPClient { .catch(RegistryClient.catch404); } + /** + * Retrieves the versions associated with the specified hashes. + * + * @param hashes SHA-512 hashes of the files, encoded as a hex strings. + * @throws {@link RegistryClient.RegistryError} If the request fails. + * @throws {@link !TypeError} If fetching fails. + */ + public async getVersionsByHashes(hashes: string[]): Promise { + return this.fetch(["version_files"], { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + hashes, + algorithm: "sha512", + }), + }).then(res => res.json()); + } + /** * Retrieves the versions associated with the specified version IDs. *