@spinque/query-api
Advanced tools
Comparing version 0.17.0 to 0.17.1
@@ -11,2 +11,3 @@ import { ApiConfig, Query } from '.'; | ||
export declare const pathFromQuery: (query: Query) => string; | ||
export declare const apiUrl: (config: ApiConfig) => string; | ||
/** | ||
@@ -13,0 +14,0 @@ * Takes an ApiConfig object and array of Query objects and returns a Query API request URL. |
@@ -39,3 +39,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isBrowser = exports.stringifyQueries = exports.parseQueries = exports.join = exports.tupleListToString = exports.stringToTupleList = exports.urlFromQueries = exports.pathFromQuery = exports.pathFromQueries = void 0; | ||
exports.isBrowser = exports.stringifyQueries = exports.parseQueries = exports.join = exports.tupleListToString = exports.stringToTupleList = exports.urlFromQueries = exports.apiUrl = exports.pathFromQuery = exports.pathFromQueries = void 0; | ||
/** | ||
@@ -62,2 +62,28 @@ * Takes an array of Query objects and returns the path they would represent in a Query API request URL. | ||
exports.pathFromQuery = pathFromQuery; | ||
var apiUrl = function (config) { | ||
if (!config.baseUrl) { | ||
throw new Error('Base URL missing'); | ||
} | ||
if (!config.version) { | ||
throw new Error('Version missing'); | ||
} | ||
if (!config.workspace) { | ||
throw new Error('Workspace missing'); | ||
} | ||
if (!config.api) { | ||
throw new Error('API name missing'); | ||
} | ||
var url = config.baseUrl; | ||
if (!url.endsWith('/')) { | ||
url += '/'; | ||
} | ||
// Construct base URL containing Spinque version and workspace | ||
url += (0, exports.join)(config.version, config.workspace, 'api', config.api); | ||
// Add config if provided | ||
if (config.config) { | ||
url += "?config=".concat(config.config); | ||
} | ||
return url; | ||
}; | ||
exports.apiUrl = apiUrl; | ||
/** | ||
@@ -64,0 +90,0 @@ * Takes an ApiConfig object and array of Query objects and returns a Query API request URL. |
{ | ||
"name": "@spinque/query-api", | ||
"version": "0.17.0", | ||
"version": "0.17.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
159214
2336