53e9646092 | ||
---|---|---|
.vscode | ||
src | ||
test | ||
.gitignore | ||
.travis.yml | ||
CONTRIBUTING.md | ||
LICENSE.txt | ||
README.md | ||
gulpfile.js | ||
karma.conf.js | ||
package.json | ||
tsconfig.json | ||
tslint.json | ||
typings.json | ||
webpack.config.js | ||
webpack.test.config.js | ||
webpack.test.tsconfig.json |
README.md
powerbi-models
Contains JavaScript & TypeScript object models for Microsoft Power BI JavaScript SDK.
For each model there is a TypeScript interface, a json schema definitions, and a validation function to ensure a given object is a valid model.
Documentation
https://microsoft.github.io/powerbi-models
Getting Started
Install
npm install --save powerbi-models
Import
import * as models from 'powerbi-models';
Usage
Validation:
let testObject = { x: 1 };
const errors = models.validateLoad(testObject);
if(errors) {
console.warn(errors);
}
Would output to the console:
[
{
message: 'accessToken is required'
}
]
Creating filters:
const basicFilter: models.IBasicFilter = {
target: {
table: "Products",
column: "Version"
},
operator: "In",
values: [
1,
2,
3,
4
]
};
const advancedFilter: models.IAdvancedFilter = {
target: {
table: "Products",
column: "Name"
},
logicalOperator: "Or",
conditions: [
{
operator: "Contains",
value: "Power"
},
{
operator: "Contains",
value: "Microsoft"
}
]
};
Or use the constructor methods:
const advancedFilter = new models.AdvancedFilter(
{
table: "Products",
column: "Name"
},
"Or",
{
operator: "Contains",
value: "Power"
},
{
operator: "Contains",
value: "Microsoft"
}
);