import { Fail, Ok } from '../../fail';
import { Http, HttpResponseType } from '../../http';
/** Api to access MapBox functionality in the Twinfinity backend. */
export class TwinfinityMapBoxApiClient {
    _baseUrl;
    constructor(_baseUrl) {
        this._baseUrl = _baseUrl;
    }
    async getAccessToken(hostname = window.location.hostname) {
        const response = await Http.get(`${this._baseUrl}_ps/api/mapbox/token?hostname=${hostname}`, HttpResponseType.json);
        if (response.status !== 200)
            return Fail(await response.json());
        return Ok(response.value);
    }
}
//# sourceMappingURL=MapBoxApiClient.js.map