From 9aafb048ef110bacf8d8ae567faea3e3fb3196cf Mon Sep 17 00:00:00 2001 From: Craig Paul Date: Mon, 14 Jan 2019 14:30:41 -0600 Subject: [PATCH] Adds service resource documentation --- README.md | 84 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 75 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3d32436..d224510 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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.