UNPKG

retrofit-axios-ts

Version:

A declarative and axios based retrofit implementation for JavaScript and TypeScript.

21 lines (20 loc) 719 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Field = void 0; const ensureMeta_1 = require("../helpers/ensureMeta"); /** * Set field of form for API endpoint. Only effective when method has been decorated by @FormUrlEncoded. * @param paramName * @sample @Field("title") title: string * @constructor */ const Field = (paramName) => { return (target, methodName, paramIndex) => { (0, ensureMeta_1.ensureMeta)(target, methodName); if (!target.__meta__[methodName].fields) { target.__meta__[methodName].fields = {}; } target.__meta__[methodName].fields[paramIndex] = paramName; }; }; exports.Field = Field;