This project contains some examples of using the GenMyModel API (https://api.genmymodel.com/doc) in JavaScript.
Simply list the first page of public projects in GenMyModel repository (https://repository.genmymodel.com).
This demo works as follow :
- Get the list of public project by sending a GET to https://api.genmymodel.com/projects/public
- Create the list of public projects in the DOM
In pure JS : http://plnkr.co/edit/YoVT9y015vgI81zbNcjE?p=preview
Using JQuery : http://plnkr.co/edit/KTqy4xqy4bZ6oiNuuJqb?p=preview
Get the list of private projects from a user account and displays it.
This demo works as follow :
- Use an OAuth2 flow to authenticate user
- Get the list of user private project by sending a GET to https://api.genmymodel.com/projects/my
- Create the list of user's projects in the DOM
To see how the OAuth flow works, check here : https://repository.genmymodel.com/a.baron/GMM-js-client-sample/OAuth-Client-flow/1
These demo requires you to be logged in to GenMyModel : https://api.genmymodel.com/login
In pure JS : http://plnkr.co/edit/r9WdO187BblKxoTTV3hC?p=preview
Using JQuery : http://plnkr.co/edit/0gjSCVix64UQ8xNdM7D2?p=preview
Update the model from a given project by sending a command to the API.
This demo works as follow :
- Use an OAuth2 flow to authenticate user
- Get the list of user private project by sending a GET to https://api.genmymodel.com/projects/my
- Click on a project to select it
- Set the path to the element to change. A class name MyClass in the package myPackage as the following path : //myPackage/MyClass
- Set the new name of your element
- Click "Send request"
- It sends a POST to https://api.genmymodel.com/projects/PROJECT_ID/commands
You can see the changes live in the genmymodel editor if it's opened on this project.
These demo requires you to be logged in to GenMyModel : https://api.genmymodel.com/login
Using JQuery : http://plnkr.co/edit/GjJ6tuo1KiG2woCE8ulb?p=preview