@space-runners/ablo-ts-sdk
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -14,3 +14,3 @@ "use strict"; | ||
this.axios = axios_1.default.create({ | ||
baseURL: options.baseUrl || 'https://api.ablo.com', | ||
baseURL: options.baseUrl || 'https://api.ablo.ai', | ||
headers: { | ||
@@ -17,0 +17,0 @@ 'x-api-key': apiKey, |
import { AxiosInstance } from 'axios'; | ||
import { IStyle } from './style.interface'; | ||
import { ICreateCustomStyleRequest } from './create-custom-style-request.interface'; | ||
export declare class StyleService { | ||
private readonly axios; | ||
private static ENTITY; | ||
private static CUSTOM; | ||
constructor(axios: AxiosInstance); | ||
/** | ||
* Kicks off the process of creating a custom style. | ||
* @param params - The parameters for creating a custom style. | ||
* @returns A Promise that resolves to the created style. | ||
*/ | ||
createCustomStyle: (params: ICreateCustomStyleRequest) => Promise<any>; | ||
/** | ||
* Retrieves all custom styles. | ||
* @returns A Promise that resolves to an array of styles. | ||
*/ | ||
getCustomStyles: () => Promise<IStyle[]>; | ||
/** | ||
* Retrieves all styles based on the provided template ID and pinned status. | ||
@@ -8,0 +22,0 @@ * @param templateId - Optional. The ID of the template to filter styles by. |
@@ -17,2 +17,23 @@ "use strict"; | ||
/** | ||
* Kicks off the process of creating a custom style. | ||
* @param params - The parameters for creating a custom style. | ||
* @returns A Promise that resolves to the created style. | ||
*/ | ||
this.createCustomStyle = (params) => __awaiter(this, void 0, void 0, function* () { | ||
const { data } = yield this.axios.post(`/${StyleService.ENTITY}`, params, { | ||
headers: { | ||
'Content-Type': 'multipart/form-data', | ||
}, | ||
}); | ||
return data; | ||
}); | ||
/** | ||
* Retrieves all custom styles. | ||
* @returns A Promise that resolves to an array of styles. | ||
*/ | ||
this.getCustomStyles = () => __awaiter(this, void 0, void 0, function* () { | ||
const { data } = yield this.axios.get(`/${StyleService.ENTITY}/${StyleService.CUSTOM}`); | ||
return data; | ||
}); | ||
/** | ||
* Retrieves all styles based on the provided template ID and pinned status. | ||
@@ -24,3 +45,3 @@ * @param templateId - Optional. The ID of the template to filter styles by. | ||
this.getAll = (templateId, isPinned) => __awaiter(this, void 0, void 0, function* () { | ||
const { data } = yield this.axios.get(`/styles${templateId ? `?templateId=${templateId}` : ''}${isPinned ? `&isPinned=${isPinned}` : ''}`); | ||
const { data } = yield this.axios.get(`/${StyleService.ENTITY}${templateId ? `?templateId=${templateId}` : ''}${isPinned ? `&isPinned=${isPinned}` : ''}`); | ||
return data; | ||
@@ -31,1 +52,3 @@ }); | ||
exports.StyleService = StyleService; | ||
StyleService.ENTITY = 'styles'; | ||
StyleService.CUSTOM = 'custom'; |
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "A TypeScript SDK for Ablo Services", | ||
@@ -9,0 +9,0 @@ "main": "lib/index.js", |
32982
50
680