UNPKG

typerinth

Version:

A TypeScript library for interacting with the Modrinth API.

29 lines (28 loc) 984 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Route_1 = require("../Route"); const errors_1 = require("../../errors"); class GetPayoutHistoryRoute extends Route_1.Route { userId; constructor(baseUrl, ua, cacheManager, authorization, userId) { super(baseUrl, ua, cacheManager, authorization); this.userId = userId; } getCacheKey() { return `user_payout_history:${this.userId}`; } getUrl() { console.log(Route_1.Route.addPathSegment(this.baseUrl, `/user/${this.userId}/payouts`)); return Route_1.Route.addPathSegment(this.baseUrl, `/user/${this.userId}/payouts`); } parseData(data, status) { if (status === 404) { throw new errors_1.UserNotFoundError('User not found'); } if (data.error) { throw new errors_1.ApiError(data.error, data.description); } return data; } } exports.default = GetPayoutHistoryRoute;