'use strict';
import { apiBaseGet, apiBaseGetBlob, postBaseApi, baseApiHandleResponse, putBaseApi, deleteBaseApi } from './base-api.js';
import { getApiPath } from './api-paths.js';
import { getODataParams } from '../odata/odata.js';
import { getAuthToken } from '../auth/tokens.js';
import { headerNames, httpContentTypes } from '../constants/header-names.js';
import { httpMethods } from '../../base-repo/constants/http-methods.js';

var __defProp=Object['defineProperty'],__name=(_0x2df7a7,_0x1cf661)=>__defProp(_0x2df7a7,'name',{'value':_0x1cf661,'configurable':!![]});async function apiGet(_0x193285,_0x58855a,_0x2f7b65,_0xbf8958){const _0x3969b4=getApiPath(_0x193285,_0x58855a,_0x2f7b65);return apiBaseGet(_0x3969b4,getApiHeaders(_0xbf8958));}__name(apiGet,'apiGet');async function apiGetBlob(_0x29b4ba,_0x1f8056,_0x152473,_0x28e9f8){const _0x449338=getApiPath(_0x29b4ba,_0x1f8056,_0x152473);return apiBaseGetBlob(_0x449338,getApiHeaders(_0x28e9f8,!![]));}__name(apiGetBlob,'apiGetBlob');async function apiGetWithOData(_0x321066,_0xbf1548,_0x437609){const _0x428d68=getODataParams(_0xbf1548);return apiGet(_0x321066,_0x437609,_0x428d68);}__name(apiGetWithOData,'apiGetWithOData');async function apiPost(_0x2932fc,_0x38cbb0,_0x57c0b5){const _0x2dc0aa=getApiPath(_0x2932fc);return postBaseApi(_0x2dc0aa,_0x38cbb0,getApiHeaders(_0x57c0b5));}__name(apiPost,'apiPost');async function apiPostFile(_0x69fe20,_0x1175cf,_0x16e46a){const _0x573349=getApiPath(_0x69fe20),_0x17d308=await fetch(_0x573349,{'method':httpMethods['post'],'body':_0x1175cf,'headers':getApiHeaders(_0x16e46a,!![])});return baseApiHandleResponse(_0x17d308);}__name(apiPostFile,'apiPostFile');async function apiPut(_0x4dd2bd,_0xb18f0,_0x2c8d32){const _0xc8aaae=getApiPath(_0x4dd2bd);return putBaseApi(_0xc8aaae,_0xb18f0,getApiHeaders(_0x2c8d32));}__name(apiPut,'apiPut');async function apiDelete(_0x2fd92d,_0x448c07,_0x54271e){const _0xfa90e0=getApiPath(_0x2fd92d,_0x448c07);return deleteBaseApi(_0xfa90e0,getApiHeaders(_0x54271e));}__name(apiDelete,'apiDelete');function getApiHeaders(_0x2bf627,_0x2583b2=![]){const _0x5593fe=_0x2bf627??new Headers(),_0x4bad1d=getAuthToken();return (!_0x5593fe['get'](headerNames['authHeaderName'])||_0x5593fe['get'](headerNames['authHeaderName'])==='')&&_0x4bad1d&&_0x5593fe['set'](headerNames['authHeaderName'],headerNames['authHeaderValuePrefix']+_0x4bad1d),!_0x2583b2&&!_0x5593fe['get'](httpContentTypes['contentTypeHeaderName'])&&_0x5593fe['set'](httpContentTypes['contentTypeHeaderName'],httpContentTypes['contentTypeApplicationJson']),_0x5593fe;}__name(getApiHeaders,'getApiHeaders');

export { apiDelete, apiGet, apiGetBlob, apiGetWithOData, apiPost, apiPostFile, apiPut };
