Skip to content

Commit

Permalink
Updates Project Documentation
Browse files Browse the repository at this point in the history
This commit updates the project README and the handlebars template.

Signed-off-by: Lui de la Parra <lui@mutesymphony.com>
  • Loading branch information
Luidog committed Jan 11, 2019
1 parent e005f30 commit aefe5f4
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 37 deletions.
76 changes: 39 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,9 @@ The custom script parameter follows the following syntax:
]
}
```

> File [./examples/schema/scripts-array-schema.json](./examples/schema/scripts-array-schema.json)
Following the Data API, the `prerequest` phase occurs before executing request and sorting of records, the `presort` phase after executing request and before sorting records. Not specifying a phase will run the script after the request and sorting are executed.

#### Portals Array Syntax

The custom portals parameter follows the following syntax:

```json
Expand All @@ -130,7 +126,8 @@ The custom portals parameter follows the following syntax:

#### Data Syntax

Arrays and objects are stringified before being inserted into field or portal data.
Arrays and objects are stringified before being inserted into field or portal data.


```json
{
Expand Down Expand Up @@ -186,7 +183,7 @@ When using the `find` method a query is required. The query can either be a sing
### Datastore Connection

The connect method must be called before a client is used. The connect method is not currently exposed by fms-api-client, but from the marpat dependency. marpat is a fork of camo. Thanks and love to [Scott Robinson](https://github.com/scottwrobinson) for his creation and maintenance of camo.
The connect method must be called before the FileMaker class is used. The connect method is not currently exposed by fms-api-client, but from the marpat dependency. marpat is a fork of camo. Thanks and love to [Scott Robinson](https://github.com/scottwrobinson) for his creation and maintenance of camo.

marpat is designed to allow the use of multiple datastores with the focus on encrypted file storage and project flexibility.

Expand Down Expand Up @@ -369,36 +366,6 @@ Result:

> File [./examples/results/create-record-example.json](./examples/results/create-record-example.json)
Both the create method and the edit method accept a merge boolean in their option parameters. If the `merge` property is true the data used to create or edit the filemaker record will be merged with the FileMaker Data API results.

```js
const mergeDataOnCreate = client =>
client
.create(
'Heroes',
{
name: 'George Lucas'
},
{ merge: true }
)
.then(result => log('create-record-merge-example', result));
```

> Excerpt from [./examples/create.examples.js](./examples/create.examples.js#L15-L24)
Result:


```json
{
"name": "George Lucas",
"recordId": "1138",
"modId": "327"
}
```

> File [./examples/results/create-record-merge-example.json](./examples/results/create-record-merge-example.json)
The create method also allows you to trigger scripts when creating a record. Notice the scripts property in the following example. You can specify scripts to run using either FileMaker's script.key syntax or specify an array of in a `scripts` property. The script objects should have with `name`, optional `phase`, and optional `params` parameters. For more information see the scripts syntax example in the introduction.

```js
Expand Down Expand Up @@ -1160,10 +1127,45 @@ Result:

### Additional Client Capabilities

The client has the ability to create custom agents and modify requests parameters or use a proxy. Agents, request parameters, and proxies can be configured either when the client is created or when a request is being made.
#### Data Merge

Both the create method and the edit method accept a merge boolean in their option parameters. If the `merge` property is true the data used to create or edit the filemaker record will be merged with the FileMaker Data API results.


```js
const mergeDataOnCreate = client =>
client
.create(
'Heroes',
{
name: 'George Lucas'
},
{ merge: true }
)
.then(result => log('create-record-merge-example', result));
```

> Excerpt from [./examples/create.examples.js](./examples/create.examples.js#L15-L24)

Result:


```json
{
"name": "George Lucas",
"recordId": "1138",
"modId": "327"
}
```

> File [./examples/results/create-record-merge-example.json](./examples/results/create-record-merge-example.json)

#### Custom Request Agents

The client has the ability to create custom agents and modify requests parameters or use a proxy. Agents, request parameters, and proxies can be configured either when the client is created or when a request is being made.

A client can have a custom [Agent](https://nodejs.org/api/http.html#http_class_http_agent). Using a custom request agent will allow you to configure an agent designed for your specific needs. A request agent can be configured to not reject unauthorized request such as those with invalid SSLs, keep the connection alive, or limit the number of sockets to a host. There is no need to create an agent unless theses options are needed.

**Note** If you are using a custom agent you are responsible for destroying that agent with `client.destroy` once the agent is no longer used.
Expand Down
2 changes: 2 additions & 0 deletions examples/templates/README.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ The custom portals parameter follows the following syntax:
Arrays and objects are stringified before being inserted into field or portal data.
<!--@snippet('./examples/schema/data-schema.json', { showSource: true })-->
<!--/@-->

Any property not nested in a `portalData` property will be moved into the `fieldData` property.

#### Sort Syntax

Expand Down

0 comments on commit aefe5f4

Please sign in to comment.