File size: 3,092 Bytes
de8e64f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
import axios from 'axios';
const API_URL = process.env.REACT_APP_API_URL || '/api';
// System
export const getSystemInfo = async () => {
const response = await axios.get(`${API_URL}/system/info`);
return response.data;
};
// Agents
export const getAgents = async () => {
const response = await axios.get(`${API_URL}/agents`);
return response.data;
};
export const getAgent = async (agentId) => {
const response = await axios.get(`${API_URL}/agents/${agentId}`);
return response.data;
};
// Collectives
export const getCollectives = async () => {
const response = await axios.get(`${API_URL}/collectives`);
return response.data;
};
export const getCollective = async (collectiveId) => {
const response = await axios.get(`${API_URL}/collectives/${collectiveId}`);
return response.data;
};
// Journal
export const getJournalEntries = async (params = {}) => {
const response = await axios.get(`${API_URL}/journal`, { params });
return response.data;
};
export const addJournalEntry = async (entry) => {
const response = await axios.post(`${API_URL}/journal`, entry);
return response.data;
};
// Portfolio
export const getPortfolioItems = async (params = {}) => {
const response = await axios.get(`${API_URL}/portfolio`, { params });
return response.data;
};
export const addPortfolioItem = async (item) => {
const response = await axios.post(`${API_URL}/portfolio`, item);
return response.data;
};
// Token Economy
export const getTokenBalances = async () => {
const response = await axios.get(`${API_URL}/token-economy/balances`);
return response.data;
};
export const getTokenTransactions = async (params = {}) => {
const response = await axios.get(`${API_URL}/token-economy/transactions`, { params });
return response.data;
};
export const transferTokens = async (transfer) => {
const response = await axios.post(`${API_URL}/token-economy/transfer`, transfer);
return response.data;
};
// Marketplace
export const getMarketplaceListings = async (params = {}) => {
const response = await axios.get(`${API_URL}/marketplace/listings`, { params });
return response.data;
};
export const createMarketplaceListing = async (listing) => {
const response = await axios.post(`${API_URL}/marketplace/listings`, listing);
return response.data;
};
export const purchaseListing = async (purchase) => {
const response = await axios.post(`${API_URL}/marketplace/purchase`, purchase);
return response.data;
};
// Virtual World
export const getVirtualWorldMap = async () => {
const response = await axios.get(`${API_URL}/virtual-world/map`);
return response.data;
};
export const moveAgent = async (move) => {
const response = await axios.post(`${API_URL}/virtual-world/move-agent`, move);
return response.data;
};
// Chat
export const chatWithAgent = async (chat) => {
const response = await axios.post(`${API_URL}/chat`, chat);
return response.data;
};
// Simulation
export const runSimulation = async (params = {}) => {
const response = await axios.post(`${API_URL}/simulate`, params);
return response.data;
};
|