trender-client
Version:
Official Trender client API
57 lines (56 loc) • 2.46 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const RequestEmitter_1 = tslib_1.__importDefault(require("../utils/RequestEmitter"));
class FollowManager extends RequestEmitter_1.default {
constructor(params) {
super(params);
}
delete(target_id) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const request = yield this.deleteRequest(`/users/${target_id}/follows`);
const response = request;
return response;
});
}
create(target_id) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const request = yield this.postRequest(`/users/${target_id}/follows`, {});
const response = request;
return response;
});
}
accept(follow_id) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const request = yield this.putRequest(`/follows/accept`, {
follow_id: follow_id
});
const response = request;
return response;
});
}
unacceptedList() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const request = yield this.getRequest("/users/me/follows");
const response = request;
return response;
});
}
follows(nickname, options) {
var _a, _b;
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const request = yield this.getRequest(`/users/${nickname}/follows?skip=${(_a = options === null || options === void 0 ? void 0 : options.skip) !== null && _a !== void 0 ? _a : 0}&limit=${(_b = options === null || options === void 0 ? void 0 : options.limit) !== null && _b !== void 0 ? _b : 30}`);
const response = request;
return response;
});
}
followers(nickname, options) {
var _a, _b;
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const request = yield this.getRequest(`/users/${nickname}/followers?skip=${(_a = options === null || options === void 0 ? void 0 : options.skip) !== null && _a !== void 0 ? _a : 0}&limit=${(_b = options === null || options === void 0 ? void 0 : options.limit) !== null && _b !== void 0 ? _b : 30}`);
const response = request;
return response;
});
}
}
exports.default = FollowManager;