<commit_before>var request = require("request");
var api = module.exports = {};

var base = "https://api.relayr.io";

api.devices = function(user, token, callback) {

	var options = addHeaders({
        uri: base + "/users/"+user+"/devices",
    }, token);
    
	request.get(options,function(err,data, body){
		callback(err,JSON.parse(body));
	});
        

}
api.user = function(token, callback) {
	var options = addHeaders({
        uri: base + "/oauth2/user-info"
    }, token);
    
	request.get(options,function(err,data, body){
		callback(err, body);
	});
}

api.createChannel = function(token, dev_id, callback) {
	var options = {
		url:"https://api.relayr.io/channels",
		headers: {'Authorization': 'Bearer ' + token},
        json: true,
        body : {
            "deviceId":dev_id,
            "transport": "mqtt"
        }
	}<commit_msg>fixed parsing on user function<commit_after>var request = require("request");
var api = module.exports = {};

var base = "https://api.relayr.io";

api.devices = function(user, token, callback) {

	var options = addHeaders({
        uri: base + "/users/"+user+"/devices",
    }, token);
    
	request.get(options,function(err,data, body){
		callback(err,JSON.parse(body));
	});
        

}
api.user = function(token, callback) {
	var options = addHeaders({
        uri: base + "/oauth2/user-info"
    }, token);
    
	request.get(options,function(err,data, body){
		callback(err, JSON.parse(body));
	});
}

api.createChannel = function(token, dev_id, callback) {
	var options = {
		url:"https://api.relayr.io/channels",
		headers: {'Authorization': 'Bearer ' + token},
        json: true,
        body : {
            "deviceId":dev_id,
            "transport": "mqtt"
        }
	}
{'fraction_non_alphanumeric': 0.17388792605430387, 'fraction_numerical': 0.0011554015020219526, 'mean_word_length': 2.954337899543379, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7082464', 'n_tokens_mistral': 586, 'n_tokens_neox': 573, 'n_words': 112}