Data Types

When using the MyDataHelps SDK, there are several query parameters with flexible or custom data types.

General

Several functions return a JavaScript Promise. Promises allow the rest of your application to proceed while waiting for the requested operation to finish.

Promise return types are described with angle-brackets to convey what they resolve to. For example, Promise<string> is a Promise that will provide a single string parameter to subsequent operations.

Custom Types

The MyDataHelps SDK is implemented in TypeScript, so many methods return a strongly typed Promise value. For example: querySurveyAnswers returns Promise<SurveyAnswersPage>. Type details are given in the return value fields.

Date

Dates in MyDataHelps are composed of a date, time and offset.

Many queries allow for dates to narrow results. If not specified, the default time is midnight and the default offset is +0. Provide dates in a form that can be parsed into a JavaScript Date object, such as:

  • Another JavaScript Date object. e.g. new Date(2021, 5, 20)
  • Any string that can be parsed into a JavaScript Date object. e.g. "2021-02-16T16:00:00+04:00"

Methods whose results include date types will provide an ISO8601 string representation of the date.

Guid

A guid should be provided as a string containing a series of hexadecimal characters, separated by hyphens. Guids are not typically available in any user interface, but are often found in the results of queries.

Example: "92f2e02c-256b-eb11-aa7f-f8e4e3480e0d"

String Array

Some query parameters can accept an array of strings.

Provide these parameters as:

  • An array of strings. e.g. ["MoodRating_QuestionStep", "MoodRating_SlidingScaleStep"]
  • In the case of a single-element array, you can just provide the string itself. e.g. "MoodRating_SlidingScaleStep"