@translated/lara
Version:
Official Lara SDK for JavaScript and Node.js
34 lines (33 loc) • 973 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Styleguides = void 0;
const errors_1 = require("./errors");
class Styleguides {
constructor(client) {
this.client = client;
}
async list() {
return await this.client.get("/v2/styleguides");
}
async get(id) {
try {
return await this.client.get(`/v2/styleguides/${id}`);
}
catch (e) {
if (e instanceof errors_1.LaraApiError && e.statusCode === 404) {
return null;
}
throw e;
}
}
async create(name, content) {
return await this.client.post("/v2/styleguides", { name, content });
}
async update(id, name, content) {
return await this.client.put(`/v2/styleguides/${id}`, { name, content });
}
async delete(id) {
return await this.client.delete(`/v2/styleguides/${id}`);
}
}
exports.Styleguides = Styleguides;