@mft/moneyhub-api-client
Version:
Node.JS client for the Moneyhub API
52 lines • 1.89 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = ({ config, request }) => {
const { resourceServerUrl } = config;
return {
getCategories: async ({ userId, params = {} }, options) => request(`${resourceServerUrl}/categories`, {
searchParams: params,
cc: {
scope: "categories:read",
sub: userId,
},
options,
}),
getStandardCategories: async ({ params = {} }, options) => request(`${resourceServerUrl}/standard-categories`, {
searchParams: params,
options,
}),
getCategory: async ({ userId, categoryId, params = {} }, options) => request(`${resourceServerUrl}/categories/${categoryId}`, {
searchParams: params,
cc: {
scope: "categories:read",
sub: userId,
},
options,
}),
getCategoryGroups: async ({ userId, params = {} }, options) => request(`${resourceServerUrl}/category-groups`, {
searchParams: params,
cc: {
scope: "categories:read",
sub: userId,
},
options,
}),
getStandardCategoryGroups: async ({ params = {} }, options) => request(`${resourceServerUrl}/standard-category-groups`, {
searchParams: params,
options,
}),
createCustomCategory: async ({ userId, category: { group, name } }, options) => request(`${resourceServerUrl}/categories`, {
method: "POST",
cc: {
scope: "categories:read categories:write",
sub: userId,
},
body: {
group,
name,
},
options,
}),
};
};
//# sourceMappingURL=categories.js.map