Awesome
ti-superagent
Titanium.Network.HTTPClient with less suck!
This is a titaniumified version of superagent, built using grunt-titaniumifier
.
Installation
With gitTio for Titanium SDK you can easily install it with
$ gittio install superagent
To download the module for manual install (e.g. through Appcelerator Studio) then head over the releases page to download the latest packaged module.
If you are instead
- porting with titaniumifier a Node.js module to Titanium, and it uses superagent;
- or building CommonJS module using titaniumifier and you want to have a reliable, stable, tested HTTPClient;
then you can install this module with
$ npm install --save superagent ti-superagent
In your package.json
add
{
"name": "...",
"version": "...",
// ...
"titanium": {
"superagent": "ti-superagent"
}
}
This will tell titaniumifier that when your code requires superagent
, ti-superagent
is served instead.
You can use this package.json from one of our modules as a reference.
Usage overview
For the full documentation head over the original repository.
var request = require('superagent');
request.get('http://my-awesome-server.it/api.txt')
.end(function (res) {
console.log('Textual version of APIs:');
console.log(res.text);
});
// The server will respond with: '{ "methods": [ "read", "update" ] }'
request.get('http://my-awesome-server.it/api.json')
.end(function (res) {
console.log('JSON version of APIs:');
res.body.methods.forEach(function (method) {
console.log('I’ll be able to call ' + method);
});
});
Credits
Kudos to @visionmedia for building superagent in the first place.
Humbly made by the spry ladies and gents at SMC.
License
This library, ti-superagent, is free software ("Licensed Software"); you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; including but not limited to, the implied warranty of MERCHANTABILITY, NONINFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA