@hokuto/jam-node
Version:
JAM Node TS, guardians and utils
24 lines (23 loc) • 1.13 kB
JavaScript
import { CoreApi, BlobContentType, IdKeyType, } from "@hokuto/jam-core";
import { fetchMapImage, fetchMapSvg, fetchBlob, fetchJSON, fetchUpload, SearchViewBoxApi, } from "./fetch.js";
import { ApiMethod } from "../types.js";
import { getMapImageUrl } from "./url.js";
export const MapApi = {
Search: new SearchViewBoxApi(CoreApi.Map.Search),
Create: fetchJSON(CoreApi.Map.Create, ApiMethod.Post),
Read: fetchJSON(CoreApi.Map.Read),
Update: fetchJSON(CoreApi.Map.Update, ApiMethod.Put),
Delete: fetchJSON(CoreApi.Map.Delete, ApiMethod.Delete),
Clone: fetchJSON(CoreApi.Map.Clone, ApiMethod.Post),
Export: fetchBlob(CoreApi.Map.Export, BlobContentType.Json),
Import: fetchUpload(CoreApi.Map.Import),
Centroid: fetchJSON(CoreApi.Map.Centroid),
Image: fetchMapImage(CoreApi.Map.Image),
ImageUrl: getMapImageUrl(CoreApi.Map.Image),
Label: fetchMapImage(CoreApi.Map.Label),
LabelUrl: getMapImageUrl(CoreApi.Map.Label),
Pin: fetchJSON(CoreApi.Map.Pin),
ViewBox: fetchJSON(CoreApi.Map.ViewBox),
Shape: fetchJSON(CoreApi.Map.Shape),
Svg: fetchMapSvg(CoreApi.Map.Svg),
};