Skip to content

Commit 7ae2232

Browse files
authored
Merge pull request #97 from oneblink/forms-search-docs
Added docs for searching for forms
2 parents 1f5b5d5 + 3b010f2 commit 7ae2232

File tree

3 files changed

+19
-34
lines changed

3 files changed

+19
-34
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Added
6+
7+
- docs for all available search parameters when searching for forms
8+
59
# 0.7.0 (2020-06-10)
610

711
### Breaking Changes

classes/Forms.js

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -159,30 +159,8 @@ module.exports = (tenant /* : Tenant */) =>
159159
}
160160

161161
search(
162-
options /* : ?FormsSearchOptions */,
162+
searchParams /* : ?FormsSearchOptions */,
163163
) /* : Promise<FormsSearchResult> */ {
164-
options = options || {}
165-
166-
let searchParams = {}
167-
168-
if (typeof options.isAuthenticated === 'boolean') {
169-
searchParams = Object.assign({}, searchParams, {
170-
isAuthenticated: options.isAuthenticated,
171-
})
172-
}
173-
174-
if (typeof options.isPublished === 'boolean') {
175-
searchParams = Object.assign({}, searchParams, {
176-
isPublished: options.isPublished,
177-
})
178-
}
179-
180-
if (typeof options.name === 'string') {
181-
searchParams = Object.assign({}, searchParams, {
182-
name: options.name,
183-
})
184-
}
185-
186164
return super.searchRequest(`/forms`, searchParams)
187165
}
188166

docs/forms.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,10 @@ forms.getForm(formId, injectForms).then((form) => {
248248

249249
### Parameters
250250

251-
| Parameter | Required | Type | Description |
252-
| --------- | -------- | -------- | ---------------------------------------- |
253-
| `formId` | Yes | `number` | The exact id of the form you wish to get |
254-
| `injectForms` | No | `boolean` | Set to `true` to inject form elements from nested [Form](./form-elements/form.md) elements and [Info Page](./form-elements/info-page.md) elements. |
251+
| Parameter | Required | Type | Description |
252+
| ------------- | -------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
253+
| `formId` | Yes | `number` | The exact id of the form you wish to get |
254+
| `injectForms` | No | `boolean` | Set to `true` to inject form elements from nested [Form](./form-elements/form.md) elements and [Info Page](./form-elements/info-page.md) elements. |
255255

256256
### Result (Resolved Promise)
257257

@@ -276,7 +276,6 @@ forms.getForm(formId, injectForms).then((form) => {
276276

277277
```javascript
278278
const options = {
279-
isPublished: true,
280279
isAuthenticated: true,
281280
name: 'Form Name',
282281
}
@@ -292,12 +291,16 @@ forms
292291

293292
### Parameters
294293

295-
| Parameter | Required | Type | Description |
296-
| ------------------------- | -------- | --------- | ------------------------------------------------------------------------------------------------- |
297-
| `options` | No | `Object` | Search options. |
298-
| `options.isAuthenticated` | No | `boolean` | Return authenticated forms or unauthenticated forms. If not supplied, all forms will be returned. |
299-
| `options.isPublished` | No | `boolean` | Return published forms or unpublished forms. If not supplied, all forms will be returned. |
300-
| `options.name` | No | `string` | Search on the name property of a form. Can be a prefix, suffix or partial match. |
294+
| Parameter | Required | Type | Description |
295+
| ------------------------------- | -------- | --------- | --------------------------------------------------------------------------------------------------------------- |
296+
| `options` | No | `Object` | Search options. |
297+
| `options.isAuthenticated` | No | `boolean` | Search on the `isAuthenticated` property of a form. Must be either `true` or `false` or not specified. |
298+
| `options.isInfoPage` | No | `boolean` | Search on the `isInfoPage` property of a form. Must be either `true` or `false` or not specified. |
299+
| `options.name` | No | `string` | Search on the `name` property of a form. Can be a prefix, suffix or partial match |
300+
| `options.formsAppId` | No | `number` | Search on the `formsAppIds` property of a form. Must be the exact match of one the ids in `formsAppIds`. |
301+
| `options.formsAppEnvironmentId` | No | `number` | Search on the `formsAppEnvironmentId` property of a form. Must be the exact match of a `formsAppEnvironmentId`. |
302+
| `options.limit` | No | `number` | Limit the number of results returned |
303+
| `options.offset` | No | `number` | Skip a specific number of results, used in conjunction with `limit` to enforce paging |
301304

302305
### Result (Resolved Promise)
303306

0 commit comments

Comments
 (0)