enginustun / rest-in-model Goto Github PK
View Code? Open in Web Editor NEWmodel based REST consumer, request model mapper.
License: MIT License
model based REST consumer, request model mapper.
License: MIT License
It causes a confusion and it should be provided in same way for both.
We should add request timeout to settings.
maybe add to x-www-form-urlencoded setting for oauth operations
We should improve model and config definitions as below:
export default class Foo extends RestBaseModel {
getConfig() {
return {
headers: {},
// idField: 'id', #deprecated
resultListField: 'result',
paths: { default: 'foos/', byQuxId: 'foos/{quxId}' },
endpointName: 'gateway',
fields: {
// idField definition deprecated, use primary attribute instead.
id: { primary: true },
bar: { default: 'baz' },
},
};
}
}
Use following lines:
[![npm version](https://badge.fury.io/js/office-ui-fabric-react.svg)](https://badge.fury.io/js/office-ui-fabric-react) [![Build Status](https://travis-ci.org/OfficeDev/office-ui-fabric-react.svg?branch=master)](https://travis-ci.org/OfficeDev/office-ui-fabric-react)
And output like that below:
We can add mock data support. Add mock data to model folder and decide source by a setting attribute.
const restModelToObject = (restModel, Type) => {
const newObject = new Type();
const config = Type[`${Type.name}_config`];
if (helper.isObject(config.fields)) {
const fieldKeys = Object.keys(config.fields);
for (let i = 0; i < fieldKeys.length; i += 1) {
const fieldKey = fieldKeys[i];
newObject[fieldKey] = restModel[config.fields[fieldKey].map || fieldKey];
}
}
return newObject;
};
This assignment overrides default value of newObject. It should check if given model's current attribute is undefined then do not assign this attribute of newObject.
Supported end point only accepts array to update multiple records at once. It could be nice to have such support with something like this :
const somethingModelArray = [
{
something: 'something1',
anotherThing: 'anotherThing1',
},
{
something: 'something2',
anotherThing: 'anotherThing2',
},
];
const somethingModelArrayInstance = new SomethingModel(somethingModelArray);
somethingModelArrayInstance.save({ modelArray: true });
Maybe we will add xhr file upload property.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.