34 lines
647 B
JavaScript
34 lines
647 B
JavaScript
const _request = require('request');
|
|
|
|
class SourceModel {
|
|
constructor() {
|
|
this.name = "";
|
|
}
|
|
|
|
getName() {
|
|
return this.name;
|
|
}
|
|
|
|
request(options) {
|
|
return new Promise((resolve, reject) => {
|
|
_request(options, function(error, response, body) {
|
|
if (!error && response.statusCode === 200) {
|
|
resolve(body);
|
|
} else {
|
|
console.log(error);
|
|
reject(error);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
async search(keywords) {
|
|
return [
|
|
|
|
];
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
SourceModel
|
|
} |