timerCreate method

Future<Map<String, dynamic>> timerCreate(
  1. String postBody
)
inherited

timerCreate -> /v1/timers

Creates a new timer with the specified details. The newly created timer's UUID and index are returned in the response body.

PARAMETERS

postBody (optional) : This is the data that can be sent with this request.

Example (set_configuration_countdown):

{
  "name": "Timer 1",
  "allows_overrun": true,
  "countdown": {
    "duration": 300
  }
}

Example (set_configuration_countdown_to_time):

{
  "name": "Timer 1",
  "allows_overrun": true,
  "count_down_to_time": {
    "time_of_day": 3600,
    "period": "pm"
  }
}

Example (set_configuration_elapsed):

{
  "name": "Timer 1",
  "allows_overrun": true,
  "elapsed": {
    "start_time": 0,
    "end_time": 120
  }
}

RESPONSE 200:

The request was processed successfully.

content-type: application/json

schema:

{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "id",
        "allows_overrun"
      ]
    },
    {
      "type": "object",
      "required": [
        "id",
        "allows_overrun"
      ]
    },
    {
      "type": "object",
      "required": [
        "id",
        "allows_overrun"
      ]
    }
  ]
}

RESPONSE 400:

The request was not valid.

content-type: ``

Implementation

Future<Map<String, dynamic>> timerCreate(String postBody) async {
  String url = '/v1/timers';

  return await call('post', url, httpAccept: 'application/json');
}