summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/api/routes/scenarios.js
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-web/opendc-web-ui/src/api/routes/scenarios.js')
-rw-r--r--opendc-web/opendc-web-ui/src/api/routes/scenarios.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/opendc-web/opendc-web-ui/src/api/routes/scenarios.js b/opendc-web/opendc-web-ui/src/api/routes/scenarios.js
new file mode 100644
index 00000000..ab2e8b86
--- /dev/null
+++ b/opendc-web/opendc-web-ui/src/api/routes/scenarios.js
@@ -0,0 +1,42 @@
+import { deleteById, getById } from './util'
+import { sendRequest } from '../index'
+
+export function addScenario(portfolioId, scenario) {
+ return sendRequest({
+ path: '/portfolios/{portfolioId}/scenarios',
+ method: 'POST',
+ parameters: {
+ body: {
+ scenario,
+ },
+ path: {
+ portfolioId,
+ },
+ query: {},
+ },
+ })
+}
+
+export function getScenario(scenarioId) {
+ return getById('/scenarios/{scenarioId}', { scenarioId })
+}
+
+export function updateScenario(scenarioId, scenario) {
+ return sendRequest({
+ path: '/scenarios/{projectId}',
+ method: 'POST',
+ parameters: {
+ body: {
+ scenario,
+ },
+ path: {
+ scenarioId,
+ },
+ query: {},
+ },
+ })
+}
+
+export function deleteScenario(scenarioId) {
+ return deleteById('/scenarios/{scenarioId}', { scenarioId })
+}