Følg

API:ExorLive.data

Data API

To get/set data using the `ExorLive.data` API, you simply call the asynchronous methods provided under this namespace.

If no token exists, or if a method requires a `scope` not provided by the current token, the user will be asked to authorize the application for this scope.


Instead of having to receive multiple authorizations, you should instead use the `ExorLive.authorize` method to receive all needed scopes, or add `requiredScopes: '......'` to your initialization code.

Methods

The following methods are available on the `ExorLive.data` object:

ExorLive.data.queryWorkouts(config, successFN, errorFN)

  • Scope: read_workout
  • config {object} The object defining the query
    • Location {number} The type of location to search in. Defaults to 0.
    • LocationId {number} An id specifying the exact location to search in. Defaults to 0.
    • Start {number} The index for the first result. Defaults to 0.
    • Length {number} The number of records to return. Defaults to 10.
    • Query {string} The query string to search for. Defaults to "".
    • Nested {boolean} Whether to search in sub units (if applicable). Defaults to false.
  • successFN {function(result)} The callback that should receive the result.
  • errorFN {function(error)} The callback that should be called if an error occurs.

Example:

API_ex_1.PNG

ExorLive.data.getWorkout(id, successFn, errorFn)

  • Scope: read_workout
  • id {number} id The id of the workout to return.
  • successFn {function} The callback that should receive the result.
  • errorFn {function} The callback that should be called if an error occurs.

Example:

API_ex_2.PNG

ExorLive.data.queryExercises(config, successFn, errorFn)

  • Scope: read_workout
  • config {object} The object defining the query.
    • QueryType {number} The type of query to run. Defaults to 0.
      • Regular = 0
      • Specific = 1 Comma sepaated list
      • Random = 2
    • Type {number} The Type filter. Defaults to 0.
    • Equipment {number} The Equipment filter. Defaults to 0.
    • Focus {number} The Focus filter. Defaults to 0.
    • StartPosition {number} The StartPosition filter. Defaults to 0.
    • AgeGroup {number} The AgeGroup filter. Defaults to 0.
    • SortBy {number} Specifies how to sort the result. Defaults to 0.
      • Alphabetic = 1
      • Difficulty = 2
      • StartPosition = 3
      • NewestFirst = 4
      • Usage = 5
    • Level {number} The Level filter. Defaults to 0.
    • Start {number} The index for the first result. Defaults to 0.
    • Length {number} The number of records to return. Defaults to 10.
    • Query {string} The query string to search for. Defaults to "".
  • successFn {function} The callback that should receive the result.
  • errorFn {function} The callback that should be called if an error occurs.

Example:

API_ex_3.PNG

ExorLive.data.print(config)

  • Scope: read_workout
  • config {object} The object defining what to print.
    • id {number} The id of the workout to print.
    • format {string} PDF or HTML. Defaults to "HTML".
    • showNumber {boolean} Defaults to true.
    • showName {boolean} Defaults to true.
    • showCode {boolean} Defaults to true.
    • showImages {boolean} Defaults to true.
    • showAnatomy {boolean} Defaults to true.
    • showFocus {boolean} Defaults to false.
    • showSettings {boolean} Defaults to true.
    • showSetxReps {boolean} Defaults to true.
    • showDescription {boolean} Defaults to true.
    • showAddition {boolean} Defaults to true.
    • whoExerciseId {boolean} Defaults to false.
    • perPage {number} The number of exercises to display per page. Defaults to 6.
    • fontsize {number} The fontsize to use. Defaults to 7.
    • layout {number} 0 for table, 1 for squares. Defaults to 0.
    • locking {boolean} Whether do display the lock data. Defaults to false.
    • preview {boolean} Whether to only display on screen. Defaults to false.
    • emailRecipient {string} A valid email address if this should be sent using email instead of displayed on screen. Defaults to "".
    • message {string} A message to send along with the PDF when using email.

Example:

API_ex_4.PNG