-
Notifications
You must be signed in to change notification settings - Fork 0
Messages
Kason Chan edited this page Jun 16, 2015
·
6 revisions
Messages are the basic atomic building block of all things PlayChat.
Field | Type | Description |
---|---|---|
owner |
String |
The user-defined login, handle, or alias that indicating who sent this message. Valid length range: 1 - 50. Example: "owner": "playchatapi"
|
users |
Seq[String] |
Sequence of current room users, limited to 100 users. Example: "users": "["a", "playchatapi"]"
|
reads |
Seq[User] |
Sequence of current room users, limited to 100 users. When true, indicates that the user has read the message. Example: "users": [ { "login" : "a", "read" : true }, { "login" : "playchat", "read" : true } ]
|
coordinates |
Coordinates |
Represents the geographic location of this message as reported by the user application. The inner coordinates array is formatted as latitude first, then longitude. Optional. Example: "coordinates": { }
|
text |
String |
The actual UTF-8 text of the message. Valid length range: 1 - 1000. Example: "text": "Hello world!"
|
created_at |
Long |
The system datetime that the message was created on PlayChat. Example: "created_at": 1432441527583
|
updated_at |
Long |
The system datetime that the room was updated on PlayChat. Example: "updated_at": 1432441527583
|
Field | Type | Description |
---|---|---|
login |
String |
The user-defined login, handle, or alias that this user identifies themselves with. Logins are unique. Valid length range: 1 - 50. Example: "login": "playchatapi"
|
read |
Boolean |
When true, indicates that the user has read the message. Default to false .Example: "read": true
|
Field | Type | Description |
---|---|---|
coordinates |
Seq[Double] |
The latitude and longitude of the message’s location, as an sequence in the form of [latitude, longitude]. Example: "coordinates": [0.0, 0.0]
|
Get all messages for the authenticated user
You must pass authentication information with your request.
GET /users/:username/messages
200 OK
[ {
"owner": "playchatapi",
"users": [
"a",
"playchat"
],
"reads": [ {
"login": "a",
"read": true
}, {
"login": "playchat",
"read": true
} ],
"coordinates": {
"coordinates": { }
}
"created_at": 1432441529876,
"updated_at": 1432441529876
} ]
Get all specified room messages for the authenticated user
You must pass authentication information with your request.
POST /user/room/messages
{
"users": [
"a",
"b"
]
}
200 OK
[ {
"owner": "a",
"users": [
"a",
"b"
],
"reads": [ {
"login": "a",
"read": true
}, {
"login": "b",
"read": true
} ],
"coordinates": {
"coordinates": { }
}
"created_at": 1432441584799,
"updated_at": 1432441619287
} ]
Create a new message for the authenticated user
You must pass authentication information with your request.
POST /user/messages
{
"owner": "a",
"users": [
"a",
"b"
],
"text": "Hi, this is A with coords.",
"coordinates": {
"coordinates": [
-34.397,
150.644
]
}
}
201 Created
{
"owner": "a",
"users": [
"a",
"b"
],
"reads": [ {
"login": "a",
"read": true
}, {
"login": "b",
"read": false
} ],
"text": "Hi, this is A with coords.",
"coordinates": {
"coordinates": [
-34.397,
150.644
]
}
"created_at": 1432441584799,
"updated_at": 1432441584799
}