Audacity 3.2.0
SentryRequestBuilder.cpp
Go to the documentation of this file.
1/*!********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file SentryRequestBuilder.h
6 @brief Define a class to generate the requests to Sentry.
7
8 Dmitry Vedenko
9 **********************************************************************/
10
12
13#include <chrono>
14
15namespace audacity
16{
17namespace sentry
18{
19
21{
22 static SentryRequestBuilder builder;
23
24 return builder;
25}
26
28{
29 using namespace std::chrono;
30
31 const std::string sentryAuth =
32 std::string("Sentry sentry_version=7,sentry_timestamp=") +
33 std::to_string(
34 duration_cast<seconds>(system_clock::now().time_since_epoch())
35 .count()) +
36 ",sentry_client=sentry-audacity/1.0,sentry_key=" + SENTRY_DSN_KEY;
37
39
40 request.setHeader("Content-Type", "application/json");
41 request.setHeader("X-Sentry-Auth", sentryAuth);
42
43 return request;
44}
45
47{
48 mUrl = std::string("https://") + SENTRY_DSN_KEY + "@" + SENTRY_HOST +
49 "/api/" + SENTRY_PROJECT + "/store/";
50}
51
52} // namespace sentry
53} // namespace audacity
Define a class to generate the requests to Sentry.
Request & setHeader(const std::string &name, std::string value)
Definition: Request.cpp:46
A helper, that creates a correct Request to Sentry.
static const SentryRequestBuilder & Get()
network_manager::Request CreateRequest() const