<commit_before>acs-node: The sdk of acs for Node.js
==================

ACS SDK for Node.js

You can install it using npm.
    [sudo] npm install acs-node
    
Usage
-----

Example, do ACS user login:

- var ACS = require('acs-node');
- function login(req, res) {
-	var un = req.body.username;
-	var pw = req.body.password;
-	ACS.Users.login({login: un, password: pw}, function(data) {
-		if(data.success) {
-			var user = data.users[0];
-			if(user.first_name && user.last_name) {
-				user.name = user.first_name + ' ' + user.last_name;
-			} else {
-				user.name = user.username;
-			}
-			req.session.user = user;
-			res.redirect('/');
-		} else {
-			res.render('login', {message: data.message});
-		}
-	});
- }

More examples and how to use a generic method, please look up in the folder test.


Legal
------
This code is proprietary and confidential. 
Copyright (c) 2012 by Appcelerator, Inc.
<commit_msg>NODEJS-1103: Add the usage of generic in README.md.<commit_after>acs-node: The sdk of acs for Node.js
==================

ACS SDK for Node.js

You can install it using npm.
    [sudo] npm install acs-node
    
Usage
-----

Example 1, do ACS user login:

- var ACS = require('acs-node');
- function login(req, res) {
-	var un = req.body.username;
-	var pw = req.body.password;
-	ACS.Users.login({login: un, password: pw}, function(data) {
-		if(data.success) {
-			var user = data.users[0];
-			if(user.first_name && user.last_name) {
-				user.name = user.first_name + ' ' + user.last_name;
-			} else {
-				user.name = user.username;
-			}
-			req.session.user = user;
-			res.redirect('/');
-		} else {
-			res.render('login', {message: data.message});
-		}
-	});
- }

Example 2, a generic method show how to operate an ACS user:

- var ACS = require('acs-node');
- var sdk = ACS.initACS('', '');
- var user_id = null;
- var filePath = "/Users/bill/2012-07.xls";
- var photoPath = "/Users/bill/photo.JPG";
- var useSecure = true;
- sdk.sendRequest('users/create.json', 'POST', {username:'test1', password:'<PASSWORD>', password_confirmation:'<PASSWORD>'}, function(data){
- 	console.log(JSON.stringify(data, null, 2));
- 	user_id = data.response.users[0].id;
- 	sdk.sendRequest('files/create.json', 'POST', {name: 'abcd', file: filePath}, function(data){
- 		console.log(JSON.stringify(data, null, 2));
- 		sdk.sendRequest('users/logout.json', 'DELETE',null, function(data){
- 			console.log(JSON.stringify(data, null, 2));
- 			sdk.sendRequest('users/login.json', 'POST', {login:'test1', password:'<PASSWORD>'}, function(data){
- 				console.log(JSON.stringify(data, null, 2));
- 				sdk.sendRequest('photos/create.json', 'POST', {photo: photoPath}, function(data){
- 					console.log(JSON.stringify(data, null, 2));
- 					sdk.sendRequest('users/update.json', 'PUT', {first_name: 'abcd'}, function(data){
- 						console.log(JSON.stringify(data, null, 2));
- 						sdk.sendRequest('users/delete.json', 'DELETE', null, function(data){
- 							console.log(JSON.stringify(data, null, 2));
- 							sdk.sendRequest('users/show.json', 'GET', {'user_id': user_id}, function(data){
- 								console.log(JSON.stringify(data, null, 2));
- 							}, useSecure);
- 						}, useSecure);
- 					}, useSecure);
- 				}, useSecure);
- 			}, useSecure);
- 		}, useSecure);
- 	}, useSecure);
- }, useSecure);


More examples, please look up in the folder test.


Legal
------
This code is proprietary and confidential. 
Copyright (c) 2012 by Appcelerator, Inc.

{'fraction_non_alphanumeric': 0.19220779220779222, 'fraction_numerical': 0.009523809523809525, 'mean_word_length': 3.2632226322263223, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, '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': '6550486', 'n_tokens_mistral': 1401, 'n_tokens_neox': 1268, 'n_words': 289}