@cranberry-money/shared-services
Version:
Platform-agnostic API services with pure functions and dependency injection. Includes auth, portfolios, assets, countries, sectors, and more.
24 lines • 1.23 kB
JavaScript
import { PORTFOLIO_ENDPOINTS } from '@cranberry-money/shared-constants';
export const getPortfolios = (apiClient) => {
return apiClient.get(PORTFOLIO_ENDPOINTS.BASE);
};
export const createPortfolio = (apiClient, data) => {
return apiClient.post(PORTFOLIO_ENDPOINTS.BASE, data);
};
export const updatePortfolio = (apiClient, uuid, data) => {
return apiClient.patch(`${PORTFOLIO_ENDPOINTS.BASE}${uuid}/`, data);
};
export const deletePortfolio = (apiClient, uuid) => {
return apiClient.delete(`${PORTFOLIO_ENDPOINTS.BASE}${uuid}/`);
};
export const getPortfolioByUuid = (apiClient, uuid) => {
return apiClient.get(`${PORTFOLIO_ENDPOINTS.BASE}${uuid}/`);
};
export const getPortfolioSnapshots = (apiClient, portfolioUuid, params) => apiClient.get(`${PORTFOLIO_ENDPOINTS.BASE}${portfolioUuid}/snapshots/`, { params });
export const addWalletToPortfolio = (apiClient, portfolioUuid, walletUuid) => apiClient.post(`${PORTFOLIO_ENDPOINTS.BASE}${portfolioUuid}/add-wallet/`, {
walletUuid,
});
export const removeWalletFromPortfolio = (apiClient, portfolioUuid, walletUuid) => apiClient.post(`${PORTFOLIO_ENDPOINTS.BASE}${portfolioUuid}/remove-wallet/`, {
walletUuid,
});
//# sourceMappingURL=portfolios.js.map