messageCreate method

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

messageCreate -> /v1/messages

Creates a new message with specified details. The UUID and index are ignored in the request body. They are automatically assigned and returned in the response body.

PARAMETERS

postBody (required) : This is the data that must be sent with this request.

Example:

{
  "id": {
    "name": "Test Message",
    "uuid": "942C3FC3-C4B2-44F7-A55D-4CC913BB8A5D",
    "index": 0
  },
  "message": "Text {text}, Clock {System Clock}, Countdown {Timer 1}, Countdown to time {Timer 2}, Elapsed {Timer 3}",
  "tokens": [
    {
      "name": "text",
      "text": {
        "text": "142"
      }
    },
    {
      "name": "System Clock",
      "clock": {
        "format": {
          "date": "short",
          "time": "long",
          "is_24_hours": true
        }
      }
    },
    {
      "name": "Timer 1",
      "timer": {
        "configuration": {
          "id": {
            "name": "Timer 1",
            "uuid": "43b4c5c6-145a-4b19-9968-7b78e6980e82",
            "index": 0
          },
          "allows_overrun": true,
          "countdown": {
            "duration": 300
          }
        },
        "format": {
          "hour": "remove_long",
          "minute": "remove_long",
          "second": "short",
          "millisecond": "none"
        }
      }
    },
    {
      "name": "Timer 2",
      "timer": {
        "configuration": {
          "id": {
            "name": "Timer 2",
            "uuid": "1355b458-5f99-4e6e-8ac7-8522061f6bdb",
            "index": 0
          },
          "allows_overrun": true,
          "count_down_to_time": {
            "time_of_day": "09:30",
            "period": "am"
          }
        },
        "format": {
          "hour": "remove_long",
          "minute": "remove_long",
          "second": "short",
          "millisecond": "none"
        }
      }
    },
    {
      "name": "Timer 3",
      "timer": {
        "configuration": {
          "id": {
            "name": "Timer 3",
            "uuid": "8efe5ec8-daf4-4609-aea2-7c80efa7f6fa",
            "index": 0
          },
          "allows_overrun": true,
          "elapsed": {
            "start_time": 0
          }
        },
        "format": {
          "hour": "remove_long",
          "minute": "remove_long",
          "second": "short",
          "millisecond": "none"
        }
      }
    }
  ],
  "theme": {
    "name": "Default",
    "uuid": "f5468354-01fb-44d8-b7b3-5ede94c6115c",
    "index": 0
  }
}

RESPONSE 200:

The request was processed successfully.

content-type: application/json

schema:

{
  "type": "object",
  "required": [
    "id",
    "message",
    "theme"
  ],
  "example": {
    "id": {
      "name": "Test Message",
      "uuid": "942C3FC3-C4B2-44F7-A55D-4CC913BB8A5D",
      "index": 0
    },
    "message": "Text {text}, Clock {System Clock}, Countdown {Timer 1}, Countdown to time {Timer 2}, Elapsed {Timer 3}",
    "tokens": [
      {
        "name": "text",
        "text": {
          "text": "142"
        }
      },
      {
        "name": "System Clock",
        "clock": {
          "format": {
            "date": "short",
            "time": "long",
            "is_24_hours": true
          }
        }
      },
      {
        "name": "Timer 1",
        "timer": {
          "configuration": {
            "id": {
              "name": "Timer 1",
              "uuid": "43b4c5c6-145a-4b19-9968-7b78e6980e82",
              "index": 0
            },
            "allows_overrun": true,
            "countdown": {
              "duration": 300
            }
          },
          "format": {
            "hour": "remove_long",
            "minute": "remove_long",
            "second": "short",
            "millisecond": "none"
          }
        }
      },
      {
        "name": "Timer 2",
        "timer": {
          "configuration": {
            "id": {
              "name": "Timer 2",
              "uuid": "1355b458-5f99-4e6e-8ac7-8522061f6bdb",
              "index": 0
            },
            "allows_overrun": true,
            "count_down_to_time": {
              "time_of_day": "09:30",
              "period": "am"
            }
          },
          "format": {
            "hour": "remove_long",
            "minute": "remove_long",
            "second": "short",
            "millisecond": "none"
          }
        }
      },
      {
        "name": "Timer 3",
        "timer": {
          "configuration": {
            "id": {
              "name": "Timer 3",
              "uuid": "8efe5ec8-daf4-4609-aea2-7c80efa7f6fa",
              "index": 0
            },
            "allows_overrun": true,
            "elapsed": {
              "start_time": 0
            }
          },
          "format": {
            "hour": "remove_long",
            "minute": "remove_long",
            "second": "short",
            "millisecond": "none"
          }
        }
      }
    ],
    "theme": {
      "name": "Default",
      "uuid": "f5468354-01fb-44d8-b7b3-5ede94c6115c",
      "index": 0
    }
  }
}

RESPONSE 400:

The request was not valid.

content-type: ``

Implementation

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

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