From ea690f0479cfbd378ddab59d96382007926c6bef Mon Sep 17 00:00:00 2001 From: Eden Kirin Date: Thu, 11 May 2023 19:54:23 +0200 Subject: [PATCH] Remove deprecated product functions --- javascript/fh_sdk.js | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/javascript/fh_sdk.js b/javascript/fh_sdk.js index 9034bca..0dd9ca6 100644 --- a/javascript/fh_sdk.js +++ b/javascript/fh_sdk.js @@ -138,47 +138,6 @@ class FairHopper { } return await r.json(); } - - async getProducts() { - const r = await fetch(this.formatUrl("/products"), { - headers: this.defaultHeaders, - }); - return await r.json(); - } - - async getProduct(productId) { - const r = await fetch(this.formatUrl(`/products/${productId}`), { - headers: this.defaultHeaders, - }); - switch (r.status) { - case 422: - throw new ValidationError(); - } - return await r.json(); - } - - async purchaseProduct(playerId, productId) { - const url = this.formatUrl(`/player/${playerId}/product/purchase`); - const postData = { - product_id: productId, - }; - const r = await fetch(url, { - method: "post", - headers: this.defaultHeaders, - body: JSON.stringify(postData), - }); - switch (r.status) { - case 403: - throw new PlayerInactiveError(); - case 404: - throw new PlayerNotFoundError(); - case 409: - throw new PositionError(); - case 422: - throw new ValidationError(); - } - return await r.json(); - } } module.exports = {