toadkicker/generator-fumunda — pull request #1 by LucasMaciuga (2014-07-28 11:22:04+00:00)
Title: Added WADL methode extraction ; Extraction of XSD-Types ; Output of JS to use as API

Hi,

I used your work as a base for generating a API to access my REST-Service and maybe it is helpful for you.

I did a lot changes in reading the WADL file and xsd file to generate a API that offers a 'easy' way of accessing the methods and types (the resulting file will use jQuery for accessing the data).
The resulting structure looks like:
```javascript
dal.'myType'.'myMethod'([param1(optional),][param2(optional),][data(optional),]successCallBack, errorCallBack)
```
It offers a structure(object) of the type, too via
```javascript
dal.'myType'.baseType
```
I use it for creating new copy's of it to benefit of the Netbeans CodeCompletition.

Note: I use only 'application/json' for response and request!

If you have some questions or suggestions, don't hesitate to ask!

---

Some Example:
```javascript
//The clone function
function clone(obj) {
if (null === obj || "object" !== typeof obj) return obj;
var copy = obj.constructor();
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) copy[attr] = obj[attr];
}
return copy;
}

//Create a new translation and a new category
var newTranslation = clone(dal.translation.baseType);
newTranslation.description = 'Group ' + data;
newTranslation.translationId = '';

//create the translation
dal.translation.create(newTranslation,
function(translationId)/*the method responses the new id*/ {
var newCategory = clone(dal.category.baseType);
newTranslation.translationId = Number(translationId);
newCategory.translationId = newTranslation;
newCategory.categoryId = '';

dal.category.create(
newCategory, function(categoryId)
{/*more fancy stuff*/}, function() {
alert('failed to creat a new category');
});
},
function() {
alert('failed creation of a new translation');
});
```
Node of the WADL for the translation. You will see, that I'm ignoring the method nodes with the name 'OPTIONS', because I couldn't find a use for it (yet).
```xml

```