UNPKG

retrofit-axios-ts

Version:

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

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