From d700c4fe4c4ba473584d7102ea98bba33b22da9f Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Tue, 21 Feb 2023 14:28:02 -0600 Subject: [PATCH] docs: added example usages for canConnect, getApps, getAppById, and getAppsByIds methods --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index 785218b..a11bd24 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,10 @@ You may wish to refer to the full [Onspring API documentation](https://software. #### Verify connectivity ```js +import { client } from './onspringClient.mjs'; +const res = await client.canConnect(); +console.log(res); // true or false ``` ### Apps @@ -127,13 +130,29 @@ You may wish to refer to the full [Onspring API documentation](https://software. Returns a paged collection of apps and/or surveys that can be paged through. By default the page size is 50 and page number is 1. ```js +const res = await client.getApps(); +const apps = res.data.items; +for (const app of apps) { + console.log(app.name); + console.log(app.id); + console.log(app.href); +} ``` You can set your own page size and page number (max is 1,000) as well. ```js +import { PagingRequest } from 'onspring-api-sdk'; +const res = await client.getApps(new PagingRequest(1, 1)); +const apps = res.data.items; + +for (const app of apps) { + console.log(app.name); + console.log(app.id); + console.log(app.href); +} ``` #### Get App By Id @@ -141,7 +160,12 @@ You can set your own page size and page number (max is 1,000) as well. Returns an Onspring app or survey according to provided id. ```js +const res = await client.getAppById(130); +const app = res.data; +console.log(app.name); +console.log(app.id); +console.log(app.href); ``` #### Get Apps By Ids @@ -149,7 +173,14 @@ Returns an Onspring app or survey according to provided id. Returns a collection of Onspring apps and/or surveys according to provided ids. ```js +const res = await client.getAppsByIds([130, 131]); +const apps = res.data.items; +for (const app of apps) { + console.log(app.name); + console.log(app.id); + console.log(app.href); +} ``` ### Fields