UNPKG

typerinth

Version:

A TypeScript library for interacting with the Modrinth API.

28 lines (27 loc) 895 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Route_1 = require("../Route"); const errors_1 = require("../../errors"); class GetFollowedProjectsRoute extends Route_1.Route { userId; constructor(baseUrl, ua, cacheManager, authorization, userId) { super(baseUrl, ua, cacheManager, authorization); this.userId = userId; } getCacheKey() { return `user_follwed_projects:${this.userId}`; } getUrl() { return Route_1.Route.addPathSegment(this.baseUrl, `/user/${this.userId}/follows`); } 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 = GetFollowedProjectsRoute;