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

Commit 3f40f5a

Browse files
committed
docs: improve docs
1 parent b2b1625 commit 3f40f5a

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

README.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
# Mocks-server administration api client
99

10-
This package contains methods for administrating Mocks Server _(using the [@mocks-server/plugin-admin-api](https://github.com/mocks-server/plugin-admin-api) REST API)_.
10+
This package contains methods for administrating Mocks Server _(using the [Admin API plugin](https://github.com/mocks-server/plugin-admin-api) under the hood)_.
1111

12-
Requests to the Mocks Server API are made using [cross-fetch](https://www.npmjs.com/package/cross-fetch), which makes this package compatible with browsers and nodejs environments, but, if you are going to build a browser application, you'll probably prefer to use the [@mocks-server/admin-api-client-data-provider package](https://www.npmjs.com/package/@mocks-server/admin-api-client-data-provider), which uses [@data-provider](https://github.com/data-provider), and works well with Redux, React, etc.
12+
Requests to the Mocks Server API are made using [`cross-fetch`](https://www.npmjs.com/package/cross-fetch), which makes this package compatible with browsers and nodejs environments, but, if you are going to build a browser application, you'll probably prefer to use the [`@mocks-server/admin-api-client-data-provider` package](https://www.npmjs.com/package/@mocks-server/admin-api-client-data-provider), which uses [Data Provider](https://www.data-provider.org), and works well with Redux, React, etc.
1313

1414
## Install
1515

@@ -28,45 +28,48 @@ The UMD build is also available on unpkg:
2828
2929
## Usage
3030

31-
All methods described in the [Api](#api) (expect the `config` method) return Promises when executed:
31+
All methods described in the [Api](#api) (except the `config` method) return Promises when executed:
3232

3333
```js
3434
import { about, settings } from "@mocks-server/admin-api-client";
3535

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

4040
const currentSettings = await settings.read();
41-
console.log("Current mocks-server settings are", currentSettings);
41+
console.log("Current Mocks Server settings are", currentSettings);
4242

4343
await settings.update({
44-
behavior: "user-super-admin",
44+
mock: "user-super-admin",
4545
delay: 1000
4646
});
47-
console.log("Behavior and delay changed");
47+
console.log("Mock and delay changed");
4848
};
4949

5050
example();
5151
```
5252

5353
## Api
5454

55-
* `about.read()` - Returns info about mocks-server/plugin-admin-api, 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 documentation](https://www.mocks-server.org/docs/configuration-options) for further info.
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.
60+
61+
##### Legacy methods
62+
5863
* `behaviors.read()` - Returns collection of available behaviors.
5964
* `behavior(behaviorName).read()` - Returns an specific behavior.
6065
* `fixtures.read()` - Returns collection of available fixtures.
6166
* `fixture(fixtureId).read()` - Returns an specific fixture.
62-
* `alerts.read()` - Returns array of current alerts.
63-
* `alert(alertId).read()` - Returns an specific alert.
6467

6568
## Configuration
6669

6770
By default, the client is configured to request to `http://localhost:3100/admin`, based in the [default options of Mocks Server](https://www.mocks-server.org/docs/configuration-options)
6871

69-
You can change both the base url of Mocks Server, and the base api path of the "@mocks-server/plugin-admin-api" using the `config` method:
72+
You can change both the base url of Mocks Server, and the base api path of the Admin API plugin using the `config` method:
7073

7174
```js
7275
import { config } from "@mocks-server/admin-api-client";

0 commit comments

Comments
 (0)