29 lines
572 B
C++
29 lines
572 B
C++
#pragma once
|
|
|
|
#include <chrono>
|
|
#include <optional>
|
|
#include <string>
|
|
|
|
namespace Spotify {
|
|
|
|
struct CallbackResult {
|
|
std::string code;
|
|
std::string state;
|
|
std::string error;
|
|
};
|
|
|
|
class HttpCallbackServer {
|
|
public:
|
|
HttpCallbackServer(std::string host, uint16_t port, std::string path);
|
|
|
|
// Wait for one callback request or timeout. Returns std::nullopt on timeout.
|
|
std::optional<CallbackResult> WaitForCallback(std::chrono::milliseconds timeout);
|
|
|
|
private:
|
|
std::string m_Host;
|
|
uint16_t m_Port;
|
|
std::string m_Path;
|
|
};
|
|
|
|
} // namespace ts6bot
|