Skip to content

Commit a616cad

Browse files
author
Marek Sierociński
committed
Added formData method to APIEntity
1 parent 91602dd commit a616cad

File tree

5 files changed

+26
-6
lines changed

5 files changed

+26
-6
lines changed

dist/cloud-api-client.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Bitbar Cloud API Client for JavaScript v0.19.0 | (c) Bitbar Technologies and contributors | https://github.com/bitbar/cloud-api-client-js/blob/master/LICENSE.md */
1+
/* Bitbar Cloud API Client for JavaScript v0.20.0 | (c) Bitbar Technologies and contributors | https://github.com/bitbar/cloud-api-client-js/blob/master/LICENSE.md */
22
(function (global, factory) {
33
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@bitbar/finka'), require('axios'), require('qs')) :
44
typeof define === 'function' && define.amd ? define(['@bitbar/finka', 'axios', 'qs'], factory) :
@@ -11,7 +11,7 @@
1111

1212
finka();
1313

14-
var version = "0.19.0";
14+
var version = "0.20.0";
1515

1616
/*! *****************************************************************************
1717
Copyright (c) Microsoft Corporation. All rights reserved.
@@ -146,6 +146,12 @@
146146
}).data(data);
147147
return this;
148148
};
149+
APIEntity.prototype.formData = function (data) {
150+
this.headers({
151+
'Content-Type': 'multipart/form-data'
152+
}).data(data);
153+
return this;
154+
};
149155
APIEntity.prototype.paramsSerializer = function (params) {
150156
return qs.stringify(params, {
151157
arrayFormat: 'brackets'

dist/cloud-api-client.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bitbar/cloud-api-client",
3-
"version": "0.19.0",
3+
"version": "0.20.0",
44
"description": "Bitbar Cloud API Client for JavaScript",
55
"main": "dist/cloud-api-client.js",
66
"types": "dist/index.d.ts",

src/api/APIEntity.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,20 @@ class APIEntity {
264264
return this;
265265
}
266266

267+
/**
268+
* Set form data
269+
*
270+
* @public
271+
* @param {object} data - JSON object to be set
272+
* @returns this
273+
*/
274+
public formData (data: FormData) {
275+
this.headers({
276+
'Content-Type': 'multipart/form-data'
277+
}).data(data);
278+
return this;
279+
}
280+
267281
/**
268282
* Custom params serializer
269283
* @private

0 commit comments

Comments
 (0)