Client

Client

The class used to integrate with the FileMaker server Data API

Constructor

new Client()

Source:

Members

agent :Object

The client agent object.

Source:
Type:
  • Object

data :Object

The client data logger.

Source:
Type:
  • Object

name :String

A name for the client.

Source:
Type:
  • String

Methods

(private, static) _save(response) → {Any}

Triggers a save and returns the response. This is responsible for ensuring the documents are up to date.

Source:
Parameters:
Name Type Description
response Any

The response data from the data api request.

Returns:
Type:
Any

Returns the umodified response.

(static) create(layout, data, parameters) → {Promise}

Creates a record in FileMaker. This method accepts a layout variable and a data variable.

Source:
Parameters:
Name Type Description
layout String

The layout to use when creating a record.

data Object

The data to use when creating a record.

parameters Object

The request parameters to use when creating the record.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) databases(credentialsopt, version) → {Promise}

Retrieves information about the FileMaker Server's hosted databases.

Source:
See:
  • Metadata Service#databases
Parameters:
Name Type Attributes Description
credentials Object <optional>

Credentials to use when listing server databases

Name Type Attributes Default Description
user String <optional>
'configured user'

Credentials to use when listing server databases

password String <optional>
'configured password'

Credentials to use when listing server databases

version String

The API version to use when gathering databases.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) delete(layout, recordId, parameters) → {Promise}

Deletes a filemaker record.

Source:
Parameters:
Name Type Description
layout String

The layout to use when deleting the record.

recordId String

The FileMaker internal record ID to use when editing the record.

parameters Object

parameters to use when performing the query.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) destroy() → {Promise}

The destroy method is tied to the base model's delete method method. This allows you to delete a client.

Source:
See:
Returns:
Type:
Promise

returns a promise inherited by the clients bas class

(static) duplicate(layout, recordId, parametersopt) → {Promise}

Retrieves information about the FileMaker Server's hosted databases.

Source:
Parameters:
Name Type Attributes Description
layout String

The layout to use in the request.

recordId String

The record id to target for duplication.

parameters Object <optional>

optional request parameters for the request.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) edit(layout, recordId, data, parameters) → {Promise}

Edits a filemaker record.

Source:
Parameters:
Name Type Description
layout String

The layout to use when editing the record.

recordId String

The FileMaker internal record ID to use when editing the record.

data Object

The data to use when editing a record.

parameters Object

parameters to use when performing the query.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) find(layout, query, parameters) → {Promise}

performs a FileMaker find.

Source:
Parameters:
Name Type Description
layout String

The layout to use when performing the find.

query Object

to use in the find request.

parameters Object

the parameters to use to modify the query.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) get(layout, recordId, parametersopt) → {Promise}

Retrieves a filemaker record based upon the layout and recordId.

Source:
Parameters:
Name Type Attributes Description
layout String

The layout to use when retrieving the record.

recordId String

The FileMaker internal record ID to use when retrieving the record.

parameters Object <optional>

Parameters to add for the get query.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) globals(data, parameters) → {Promise}

Sets global fields for the current session.

Source:
Parameters:
Name Type Description
data Object | Array

a json object containing the name value pairs to set.

parameters Object

parameters to use when performing the query.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) layout(layout, parametersopt) → {Promise}

Retrieves information about the FileMaker Server's hosted databases.

Source:
Parameters:
Name Type Attributes Description
layout String

The layout to use in the request.

parameters Object <optional>

optional request parameters for the request.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) layouts(parametersopt) → {Promise}

Retrieves information about the FileMaker Server's hosted databases.

Source:
Parameters:
Name Type Attributes Description
parameters Object <optional>

optional request parameters for the request.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) list(layout, parametersopt) → {Promise}

Retrieves a list of FileMaker records based upon a layout.

Source:
Parameters:
Name Type Attributes Description
layout String

The layout to use when retrieving the record.

parameters Object <optional>

the parameters to use to modify the query.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) login() → {Promise}

creates a session with the Data API and returns a token.

Source:
See:
  • {@method Client#authenticate}
Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) logout(idopt) → {Promise}

logs out of the current authentication session and clears the saved token.

Source:
See:
  • {@method Connnection#end}
Parameters:
Name Type Attributes Description
id String <optional>

the connection id to logout.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) productInfo() → {Promise}

Retrieves information about the FileMaker Server or FileMaker Cloud host.

Source:
Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) reset() → {Promise}

Resets the client, clearing pending and queued requests and DAPI sessions.

Source:
Returns:
Type:
Promise

returns a promise that will either with a message object.

(static) run(layout, scripts, parameters, request) → {Promise}

A public method to make triggering a script easier. This method uses the list method with a limit of 1. This is the lightest weight query possible while still allowing for a script to be triggered. For a more robust query with scripts use the find method.

Source:
Parameters:
Name Type Description
layout String

The layout to use for the list request

scripts Object | Array

The name of the script

parameters Object

Parameters to pass to the script

request Object

A request to run alongside the list method.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) script(layout, script, param, parametersopt) → {Promise}

A public method to make triggering a script easier.

Source:
Parameters:
Name Type Attributes Description
layout String

The layout to use for the list request

script String

The name of the script

param Object | String

Parameter to pass to the script

parameters Object <optional>

Optional request parameters.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) scripts(parametersopt) → {Promise}

Retrieves information about the FileMaker Server's hosted databases.

Source:
Parameters:
Name Type Attributes Description
parameters Object <optional>

optional request parameters for the request.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) status() → {Promise}

Compiles Data API Client status information.

Source:
Returns:
Type:
Promise

returns a promise that will either resolve with client status information

(static) upload(file, layout, containerFieldName, recordId, parameters) → {Promise}

Allows you to upload a file to a FileMaker record container field. This method currently creates a record for each upload. This method will use fs to read the file at the given path to a stream. If a record Id is not passed to this method a new record will be created.

Source:
Parameters:
Name Type Description
file String

The path to the file to upload.

layout String

The layout to use when performing the find.

containerFieldName String

The field name to insert the data into. It must be a container field.

recordId Number | String

the recordId to use when uploading the file.

parameters Object

parameters to use when performing the query.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

preDelete(data) → {null}

The client delete hook ensures a client attempts to log out before it is destroyed.

Source:
Parameters:
Name Type Description
data Object

The data used to create the client.

Returns:
Type:
null

The delete hook does not return anything.

preInit(data)

The client preInit hook creates a data embedded document and a connection embedded document on create.

Source:
Parameters:
Name Type Description
data Object

The data used to create the client.

Client

new Client()

Source:

Members

agent :Object

The client agent object.

Source:
Type:
  • Object

data :Object

The client data logger.

Source:
Type:
  • Object

name :String

A name for the client.

Source:
Type:
  • String

Methods

(private, static) _save(response) → {Any}

Triggers a save and returns the response. This is responsible for ensuring the documents are up to date.

Source:
Parameters:
Name Type Description
response Any

The response data from the data api request.

Returns:
Type:
Any

Returns the umodified response.

(static) create(layout, data, parameters) → {Promise}

Creates a record in FileMaker. This method accepts a layout variable and a data variable.

Source:
Parameters:
Name Type Description
layout String

The layout to use when creating a record.

data Object

The data to use when creating a record.

parameters Object

The request parameters to use when creating the record.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) databases(credentialsopt, version) → {Promise}

Retrieves information about the FileMaker Server's hosted databases.

Source:
See:
  • Metadata Service#databases
Parameters:
Name Type Attributes Description
credentials Object <optional>

Credentials to use when listing server databases

Name Type Attributes Default Description
user String <optional>
'configured user'

Credentials to use when listing server databases

password String <optional>
'configured password'

Credentials to use when listing server databases

version String

The API version to use when gathering databases.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) delete(layout, recordId, parameters) → {Promise}

Deletes a filemaker record.

Source:
Parameters:
Name Type Description
layout String

The layout to use when deleting the record.

recordId String

The FileMaker internal record ID to use when editing the record.

parameters Object

parameters to use when performing the query.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) destroy() → {Promise}

The destroy method is tied to the base model's delete method method. This allows you to delete a client.

Source:
See:
Returns:
Type:
Promise

returns a promise inherited by the clients bas class

(static) duplicate(layout, recordId, parametersopt) → {Promise}

Retrieves information about the FileMaker Server's hosted databases.

Source:
Parameters:
Name Type Attributes Description
layout String

The layout to use in the request.

recordId String

The record id to target for duplication.

parameters Object <optional>

optional request parameters for the request.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) edit(layout, recordId, data, parameters) → {Promise}

Edits a filemaker record.

Source:
Parameters:
Name Type Description
layout String

The layout to use when editing the record.

recordId String

The FileMaker internal record ID to use when editing the record.

data Object

The data to use when editing a record.

parameters Object

parameters to use when performing the query.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) find(layout, query, parameters) → {Promise}

performs a FileMaker find.

Source:
Parameters:
Name Type Description
layout String

The layout to use when performing the find.

query Object

to use in the find request.

parameters Object

the parameters to use to modify the query.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) get(layout, recordId, parametersopt) → {Promise}

Retrieves a filemaker record based upon the layout and recordId.

Source:
Parameters:
Name Type Attributes Description
layout String

The layout to use when retrieving the record.

recordId String

The FileMaker internal record ID to use when retrieving the record.

parameters Object <optional>

Parameters to add for the get query.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) globals(data, parameters) → {Promise}

Sets global fields for the current session.

Source:
Parameters:
Name Type Description
data Object | Array

a json object containing the name value pairs to set.

parameters Object

parameters to use when performing the query.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) layout(layout, parametersopt) → {Promise}

Retrieves information about the FileMaker Server's hosted databases.

Source:
Parameters:
Name Type Attributes Description
layout String

The layout to use in the request.

parameters Object <optional>

optional request parameters for the request.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) layouts(parametersopt) → {Promise}

Retrieves information about the FileMaker Server's hosted databases.

Source:
Parameters:
Name Type Attributes Description
parameters Object <optional>

optional request parameters for the request.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) list(layout, parametersopt) → {Promise}

Retrieves a list of FileMaker records based upon a layout.

Source:
Parameters:
Name Type Attributes Description
layout String

The layout to use when retrieving the record.

parameters Object <optional>

the parameters to use to modify the query.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) login() → {Promise}

creates a session with the Data API and returns a token.

Source:
See:
  • {@method Client#authenticate}
Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) logout(idopt) → {Promise}

logs out of the current authentication session and clears the saved token.

Source:
See:
  • {@method Connnection#end}
Parameters:
Name Type Attributes Description
id String <optional>

the connection id to logout.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) productInfo() → {Promise}

Retrieves information about the FileMaker Server or FileMaker Cloud host.

Source:
Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) reset() → {Promise}

Resets the client, clearing pending and queued requests and DAPI sessions.

Source:
Returns:
Type:
Promise

returns a promise that will either with a message object.

(static) run(layout, scripts, parameters, request) → {Promise}

A public method to make triggering a script easier. This method uses the list method with a limit of 1. This is the lightest weight query possible while still allowing for a script to be triggered. For a more robust query with scripts use the find method.

Source:
Parameters:
Name Type Description
layout String

The layout to use for the list request

scripts Object | Array

The name of the script

parameters Object

Parameters to pass to the script

request Object

A request to run alongside the list method.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) script(layout, script, param, parametersopt) → {Promise}

A public method to make triggering a script easier.

Source:
Parameters:
Name Type Attributes Description
layout String

The layout to use for the list request

script String

The name of the script

param Object | String

Parameter to pass to the script

parameters Object <optional>

Optional request parameters.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) scripts(parametersopt) → {Promise}

Retrieves information about the FileMaker Server's hosted databases.

Source:
Parameters:
Name Type Attributes Description
parameters Object <optional>

optional request parameters for the request.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

(static) status() → {Promise}

Compiles Data API Client status information.

Source:
Returns:
Type:
Promise

returns a promise that will either resolve with client status information

(static) upload(file, layout, containerFieldName, recordId, parameters) → {Promise}

Allows you to upload a file to a FileMaker record container field. This method currently creates a record for each upload. This method will use fs to read the file at the given path to a stream. If a record Id is not passed to this method a new record will be created.

Source:
Parameters:
Name Type Description
file String

The path to the file to upload.

layout String

The layout to use when performing the find.

containerFieldName String

The field name to insert the data into. It must be a container field.

recordId Number | String

the recordId to use when uploading the file.

parameters Object

parameters to use when performing the query.

Returns:
Type:
Promise

returns a promise that will either resolve or reject based on the Data API.

preDelete(data) → {null}

The client delete hook ensures a client attempts to log out before it is destroyed.

Source:
Parameters:
Name Type Description
data Object

The data used to create the client.

Returns:
Type:
null

The delete hook does not return anything.

preInit(data)

The client preInit hook creates a data embedded document and a connection embedded document on create.

Source:
Parameters:
Name Type Description
data Object

The data used to create the client.