import { baseCellTypes } from '../sheet';
const f = (...args) => fetch(...args)
    .then(response => response.json());
export function matchType(type) {
    switch (type) {
        case 'str': {
            return baseCellTypes.string;
        }
        case 'int': {
            return baseCellTypes.number;
        }
        case 'dict': {
            return baseCellTypes.object;
        }
        case 'list': {
            return baseCellTypes.array;
        }
        default: {
            if (type.startsWith('typing.List')) {
                const size = 'typing.List'.length;
                return matchType(type.substr(size + 1, type.length - size - 2));
            }
            return baseCellTypes.string;
        }
    }
}
export async function getList(url, init) {
    return f(url, {
        ...init,
        method: 'GET'
    });
}
export async function getParam(url, init) {
    return f(url, {
        ...init,
        method: 'GET'
    });
}
export async function callFunction(url, body, init) {
    return f(url, {
        ...init,
        method: 'POST',
        body: JSON.stringify(body),
        headers: {
            ...init?.headers,
            'Content-Type': 'application/json'
        }
    });
}
//# sourceMappingURL=index.js.map