instagram-private-api
Version:
Instagram private API wrapper for full access to instagram
47 lines • 1.55 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const repository_1 = require("../core/repository");
const errors_1 = require("../errors");
class UserRepository extends repository_1.Repository {
async info(id) {
const { body } = await this.client.request.send({
url: `/api/v1/users/${id}/info/`,
});
return body.user;
}
async arlinkDownloadInfo() {
const { body } = await this.client.request.send({
url: `/api/v1/users/arlink_download_info/`,
qs: {
version_override: '2.0.2',
},
});
return body.user;
}
async search(username) {
const { body } = await this.client.request.send({
url: `/api/v1/users/search/`,
qs: {
timezone_offset: this.client.state.timezoneOffset,
q: username,
count: 30,
},
});
return body;
}
async searchExact(username) {
username = username.toLowerCase();
const result = await this.search(username);
const users = result.users;
const account = users.find(account => account.username === username);
if (!account)
throw new errors_1.IgExactUserNotFoundError();
return account;
}
async getIdByUsername(username) {
const user = await this.searchExact(username);
return user.pk;
}
}
exports.UserRepository = UserRepository;
//# sourceMappingURL=user.repository.js.map
;