retrofit-axios-ts
Version:
A declarative and axios based retrofit implementation for JavaScript and TypeScript.
21 lines (20 loc) • 663 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Path = void 0;
const ensureMeta_1 = require("../helpers/ensureMeta");
/**
* Set path parameter for API endpoint.
* @param paramName
* @sample @Path("userId") userId: number
* @constructor
*/
const Path = (paramName) => {
return (target, methodName, paramIndex) => {
(0, ensureMeta_1.ensureMeta)(target, methodName);
if (!target.__meta__[methodName].pathParams) {
target.__meta__[methodName].pathParams = {};
}
target.__meta__[methodName].pathParams[paramIndex] = paramName;
};
};
exports.Path = Path;