Skip to content
This repository was archived by the owner on Mar 28, 2022. It is now read-only.

Commit af51b4f

Browse files
committed
docs: add new methods to docs
1 parent a14bf26 commit af51b4f

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

README.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ The UMD build is also available on unpkg:
3131
All methods described in the [Api](#api) (except the `config` method) return Promises when executed:
3232

3333
```js
34-
import { about, settings } from "@mocks-server/admin-api-client";
34+
import { readAbout, readSettings, updateSettings } from "@mocks-server/admin-api-client";
3535

3636
const example = async () => {
37-
const { version } = await about.read();
37+
const { version } = await readAbout();
3838
console.log(`Current Admin API plugin version is ${version}`);
3939

40-
const currentSettings = await settings.read();
40+
const currentSettings = await readSettings();
4141
console.log("Current Mocks Server settings are", currentSettings);
4242

43-
await settings.update({
43+
await updateSettings({
4444
mock: "user-super-admin",
4545
delay: 1000
4646
});
@@ -52,18 +52,27 @@ example();
5252

5353
## Api
5454

55-
* `about.read()` - Returns info about the Admin API plugin, such as current version.
56-
* `settings.read()` - Returns current Mocks Server settings.
57-
* `settings.update(settingsObject)` - Updates Mocks Server settings. A settings object has to be provided. Read the [Mocks Server configuration docs](https://www.mocks-server.org/docs/configuration-options) for further info.
58-
* `alerts.read()` - Returns array of current alerts.
59-
* `alert(alertId).read()` - Returns an specific alert.
55+
* `readAbout()` - Returns info about the Admin API plugin, such as current version.
56+
* `readSettings()` - Returns current Mocks Server settings.
57+
* `updateSettings(settingsObject)` - Updates Mocks Server settings. A settings object has to be provided. Read the [Mocks Server configuration docs](https://www.mocks-server.org/docs/configuration-options) for further info.
58+
* `readAlerts()` - Returns array of current alerts.
59+
* `readAlert(alertId)` - Returns an specific alert.
60+
* `readMocks()` - Returns available mocks.
61+
* `readMock(id)` - Returns data of a specific mock.
62+
* `readRoutes()` - Returns available routes.
63+
* `readRoute(id)` - Returns data of a specific route.
64+
* `readRoutesVariants()` - Returns available routes variants.
65+
* `readRouteVariant(id)` - Returns data of a specific route variant.
66+
* `readMockCustomRoutesVariants()` - Returns current routes variants manually added to current mock.
67+
* `addMockCustomRouteVariant(id)` - Add a route variant to current mock.
68+
* `restoreMockRoutesVariants()` - Restore current mock original routes variants.
6069

6170
##### Legacy methods
6271

63-
* `behaviors.read()` - Returns collection of available behaviors.
64-
* `behavior(behaviorName).read()` - Returns an specific behavior.
65-
* `fixtures.read()` - Returns collection of available fixtures.
66-
* `fixture(fixtureId).read()` - Returns an specific fixture.
72+
* `readBehaviors()` - Returns collection of available behaviors.
73+
* `readBehavior(behaviorName)` - Returns an specific behavior.
74+
* `readFixtures()` - Returns collection of available fixtures.
75+
* `readFixture(fixtureId)` - Returns an specific fixture.
6776

6877
## Configuration
6978

0 commit comments

Comments
 (0)