Skip to content

Commit

Permalink
Adds service resource documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
coconutcraig committed Jan 14, 2019
1 parent d24e1ac commit 9aafb04
Showing 1 changed file with 75 additions and 9 deletions.
84 changes: 75 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,35 @@ $ yarn add coconut-open-api-js

##### Methods

- `assigned(assigned: boolean = true)`
- `assigned(assigned: boolean = true)`

Set a filter which will tell the API to return locations that have public user and service assignments.
Set a filter which will tell the API to return locations that have a public user and service assignments.

- `containing(user: number | string)`
- `containing(user: number | string)`

Set a filter which will tell the API to return locations where the supplied user identifier is assigned.

- `get()`
- `get()`

Send the API request using the pre-set filters.

- `invitable()`
- `invitable()`

Set a filter which will tell the API to return locations that are specifically invite only.

- `on(page: number)`
- `on(page: number)`

Set the page offset which you want to view.

- `providing(services: number | number[] | string | string[])`
- `providing(services: number | number[] | string | string[])`

Set a filter which will tell the API to return locations where the supplied service identifier(s) is / are assigned.

- `sortBy(sortable: string)`
- `sortBy(sortable: string)`

Set a sorting string to determine how the returned results are sorted.

- `take(limit: number)`
- `take(limit: number)`

Set the limit which you want returned.

Expand Down Expand Up @@ -83,6 +83,72 @@ class Locations {
}
```

### Services

##### Methods

- `assigned(assigned: boolean = true)`

Set a filter which will tell the API to return services that have a public user and location assignments.

- `at(location: number | string)`

Set a filter which will tell the API to return services that are provided at the location matching the provided identifier.

- `by(user: number | string)`

Set a filter which will tell the API to return services that are provided by the user matching the provided identifier.

- `get()`

Send the API request using the pre-set filters.

- `in(category: number | string)`

Set a filter which will tell the API to return services that match the given category identifier.

- `invitable()`

Set a filter which will tell the API to return services that are specifically invite only.

- `on(page: number)`

Set the page offset which you want to view.

- `sortBy(sortable: string)`

Set a sorting string to determine how the returned results are sorted.

- `take(limit: number)`

Set the limit which you want returned.

##### Example

```javascript
import OpenApi from 'coconut-open-api-js';

class Services {
constructor() {
this.api = new OpenApi();
}

async get() {
return await this.api
.services
.assigned()
.at(1)
.by(2)
.in(3)
.invitable()
.on(2)
.sortBy('name,-created')
.take(10)
.get()
}
}
```

## Change log

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
Expand Down

0 comments on commit 9aafb04

Please sign in to comment.