Twitch SDK (Internal)
chatroomfetchmessagestask.h
Go to the documentation of this file.
1 /********************************************************************************************
2  * Twitch Broadcasting SDK
3  *
4  * This software is supplied under the terms of a license agreement with Twitch Interactive, Inc. and
5  * may not be copied or used except in accordance with the terms of that agreement
6  * Copyright (c) 2012-2016 Twitch Interactive, Inc.
7  *********************************************************************************************/
8 
9 #pragma once
10 
14 
15 namespace ttv
16 {
17  namespace chat
18  {
19  class ChatRoomFetchMessagesTask;
20  }
21 }
22 
24 {
25 public:
26  using Callback = std::function<void(ChatRoomFetchMessagesTask* source, TTV_ErrorCode ec, std::vector<ChatRoomMessage>&& messages, std::string&& nextCursor, bool moreMessages)>;
27 
28  ChatRoomFetchMessagesTask(const std::string& roomId, ChannelId channelId, bool fetchNewer, uint32_t limit, const std::string& authToken, Callback&& callback);
29 
30  virtual void OnComplete() override;
31 
32  virtual void SetCursor(const std::string& cursor);
33  virtual void SetTime(Timestamp timestamp);
34 
35 protected:
36  virtual const char* GetTaskName() const override { return "ChatRoomFetchMessagesTask"; }
37 
38  virtual void FillHttpRequestInfo(HttpRequestInfo& requestInfo) override;
39  virtual void ProcessResponse(uint statusCode, const std::vector<char>& response) override;
40 
41 private:
42  std::vector<ChatRoomMessage> mResultMessages;
44  std::string mRoomId;
45  std::string mVariableValue;
46  std::string mResultCursor;
48  uint32_t mLimit;
52 };
std::vector< ChatRoomMessage > mResultMessages
Definition: chatroomfetchmessagestask.h:42
bool mResultMoreMessages
Definition: chatroomfetchmessagestask.h:49
uint32_t Timestamp
Definition: coretypes.h:27
Definition: httptask.h:19
std::string mVariableValue
Definition: chatroomfetchmessagestask.h:45
virtual void SetTime(Timestamp timestamp)
bool mFetchAfter
Definition: chatroomfetchmessagestask.h:50
Callback mCallback
Definition: chatroomfetchmessagestask.h:43
virtual void ProcessResponse(uint statusCode, const std::vector< char > &response) override
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
virtual const char * GetTaskName() const override
Definition: chatroomfetchmessagestask.h:36
uint32_t mLimit
Definition: chatroomfetchmessagestask.h:48
ChannelId mChannelId
Definition: chatroomfetchmessagestask.h:47
Definition: chatroomfetchmessagestask.h:23
unsigned int uint
Definition: coretypes.h:18
bool mUseTimestamp
Definition: chatroomfetchmessagestask.h:51
std::function< void(ChatRoomFetchMessagesTask *source, TTV_ErrorCode ec, std::vector< ChatRoomMessage > &&messages, std::string &&nextCursor, bool moreMessages)> Callback
Definition: chatroomfetchmessagestask.h:26
virtual void FillHttpRequestInfo(HttpRequestInfo &requestInfo) override
ChatRoomFetchMessagesTask(const std::string &roomId, ChannelId channelId, bool fetchNewer, uint32_t limit, const std::string &authToken, Callback &&callback)
virtual void OnComplete() override
uint32_t ChannelId
Definition: coretypes.h:23
std::string mResultCursor
Definition: chatroomfetchmessagestask.h:46
std::string mRoomId
Definition: chatroomfetchmessagestask.h:44
Definition: httptask.h:22
virtual void SetCursor(const std::string &cursor)