G3N1US Elementary Model
Get Started
Model { superarguments0; thisconnectionendpoint = '//example.com/api/files.json'; }
About
G3N1US Elementary Model lets you keep your application's logic separate from your API's schema. API's go away, change, sometimes don't work. Keep your app untethered from your API.
Model { superarguments0; thisconnectionendpoint = '//example.com/api/files.json'; // Add headers to the api request thisheaders = 'Api-Key': '8675309-90210' // filterResponse is called on the raw output from the API. // You can modify each response object, or get a nested object in the response. // Each model must have an 'id' attribute! This is a great place to add this if needed. this{ return response; } } // After declaring a model, call add_model to add it to the application containerg3n1usContainer;
Querying
Querying is done against a static instance of your model
id
Find an item by it's Animal;
Query for items by attribute
Animal;
Animal;
Other operators
'=' |
equals |
'>' |
greater than |
'<' |
less than |
'>=' |
greater than or equal to |
'<=' |
less than or equal to |
'exists' |
exists/not null |
'!=' |
not equal to |
'<>' |
not equal to |
'in' |
in array |
'!in' |
not in array |
'out' |
not in array |
'regex' |
matches regular expression |
Note, this is always the operator if a regex is provided as the query argument
Don't like Promises?! All query methods can also accept a callback as the last argument
Animal;
Relations
TODO
Saving Models
TODO