summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/api/history.h
blob: 0eaea38fb119b92d1d0398aab6d9a577a02bf6f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef _STEAM_REQUEST_HISTORY_H_
#define _STEAM_REQUEST_HISTORY_H_

class GetConversationsRequest : public HttpRequest
{
public:
	GetConversationsRequest(const char *token) :
		HttpRequest(HttpGet, STEAM_API_URL "/IFriendMessagesService/GetActiveMessageSessions/v0001")
	{
		Uri << CHAR_PARAM("access_token", token);
	}

	//{
	//	"response": {
	//		"message_sessions": [
	//			{
	//				"accountid_friend": XXXXXXXXX,
	//				"last_message" : 1514975719,
	//				"last_view" : 1514975719,
	//				"unread_message_count" : 0
	//			}
	//		]
	//		,
	//		"timestamp": 1515007542
	//	}
	//}
};

class GetHistoryMessagesRequest : public HttpRequest
{
public:
	GetHistoryMessagesRequest(const char *token, const char *steamId, const char *who, time_t since) :
		HttpRequest(HttpGet, STEAM_API_URL "/IFriendMessagesService/GetRecentMessages/v0001")
	{
		Uri
			<< CHAR_PARAM("access_token", token)
			<< CHAR_PARAM("steamid1", steamId)
			<< CHAR_PARAM("steamid2", who)
			// Steam somehow doesn't respect too precise start time parameter, so we better request older time and then do own filtering again
			<< INT64_PARAM("rtime32_start_time", since - 1500);
	}
};

#endif //_STEAM_REQUEST_HISTORY_H_