You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
520 B
34 lines
520 B
const {query} = require("../client")
|
|
|
|
class Tag {
|
|
/**
|
|
* @param {string} kind
|
|
* @param {string} name
|
|
*/
|
|
constructor(kind, name) {
|
|
this.kind = kind
|
|
this.name = name
|
|
}
|
|
}
|
|
|
|
const tagApi = {
|
|
/**
|
|
* Call `tags` query
|
|
*
|
|
* @returns {Promise<Tag[]>}
|
|
*/
|
|
list() {
|
|
return query(`
|
|
query Tags {
|
|
tags {
|
|
kind
|
|
name
|
|
}
|
|
}
|
|
`, {}).then(({tags}) => {
|
|
return tags.map(d => new Tag(d.kind, d.name))
|
|
})
|
|
},
|
|
}
|
|
|
|
module.exports = {Tag, tagApi}
|