Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #26 from ovh-ux/develop
Browse files Browse the repository at this point in the history
Release v4.0.2
  • Loading branch information
antleblanc authored Jul 16, 2019
2 parents 7c156f4 + d549958 commit a4745bd
Show file tree
Hide file tree
Showing 5 changed files with 670 additions and 648 deletions.
10 changes: 9 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,13 @@
},
"rules": {
"import/no-unresolved": 0
}
},
"overrides": [{
"files": ["**/*.md"],
"rules": {
"no-sequences": "off",
"no-undef": "off",
"no-unused-vars": "off"
}
}]
}
2 changes: 1 addition & 1 deletion .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"*.js": [
"*.{js,md}": [
"eslint --fix",
"git add"
]
Expand Down
108 changes: 108 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ yarn add @ovh-ux/ng-ovh-api-wrappers
## Usage

```js
// index.js
import angular from 'angular';
import ngOvhApiWrappers from '@ovh-ux/ng-ovh-api-wrappers';

Expand All @@ -22,6 +23,113 @@ angular
]);
```

### Api v7

Use of `apiv7` is now deprecated

### Iceberg

#### Simple request

```js
// service.js
function getElements() {
return iceberg('/api/elements')
.query()
.execute({ ...queryParams }, resetCache)
.$promise;
}
```

Response is formatted like

<!-- eslint-skip -->
```js
{
data // data returned by the API
headers // response headers returned
status // call status
}
```

#### Enable aggregation

```js
// service.js
function getAggregatedElements() {
return iceberg('/api/elements')
.query()
.expand(aggregationMode)
.execute();
}
```

`aggregationMode` can be one of those values:
* `CachedObjectList-Cursor`
* `CachedObjectList-Pages`

#### Paginate

```js
// service.js
function getPaginatedElements() {
return iceberg('/api/elements')
.query()
.expand('CachedObjectList-Pages')
.limit(10) // get only 10 results by page
.offset(2) // get results for page 2
.execute();
}
```

#### Filter

```js
// service.js
function getFilteredElements() {
return iceberg('/api/elements')
.query()
.expand('CachedObjectList-Pages')
.addFilter('name', 'like', 'iceberg') // get element with name matching iceberg
.execute();
}
```

```js
// service.js
function getFilteredElements() {
return iceberg('/api/elements')
.query()
.expand('CachedObjectList-Pages')
.addFilter('name', 'like', ['iceberg', 'awesome']) // get element with name matching iceberg and awesome
.execute();
}
```

#### Sort

```js
// service.js
function getSortedElements() {
return iceberg('/api/elements')
.query()
.expand('CachedObjectList-Pages')
.sort('name') // sort elements by ascending names
.execute();
}
```


```js
// service.js
function getAggregatedElements() {
return iceberg('/api/elements')
.query()
.expand('CachedObjectList-Pages')
.sort('name', 'desc') // sort elements by descending names
.execute();
}
```
## Test

```sh
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@
"lodash": "^4.17.11"
},
"devDependencies": {
"@commitlint/cli": "^7.1.2",
"@commitlint/config-angular": "^7.1.2",
"@ovh-ux/component-rollup-config": "^5.0.0-beta.9",
"eslint": "^5.6.1",
"eslint-config-airbnb-base": "^13.1.0",
"@commitlint/cli": "^8.1.0",
"@commitlint/config-angular": "^8.1.0",
"@ovh-ux/component-rollup-config": "^5.2.2",
"eslint": "^6.0.1",
"eslint-config-airbnb-base": "^13.2.0",
"eslint-formatter-pretty": "^2.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-import": "^2.18.0",
"eslint-plugin-markdown": "^1.0.0",
"husky": "^1.1.0",
"lint-staged": "^8.1.4",
"husky": "^3.0.0",
"lint-staged": "^9.2.0",
"npm-run-all": "^4.1.5"
},
"peerDependencies": {
Expand Down
Loading

0 comments on commit a4745bd

Please sign in to comment.