mastodon-cpp  0.18.8
notification.hpp
1 /* This file is part of mastodon-cpp.
2  * Copyright © 2018 tastytea <tastytea@tastytea.de>
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef MASTODON_CPP_EASY_NOTIFICATION_HPP
18 #define MASTODON_CPP_EASY_NOTIFICATION_HPP
19 
20 #include <string>
21 #include <cstdint>
22 #include <chrono>
23 
24 // If we are compiling mastodon-cpp, use another include path
25 #ifdef MASTODON_CPP
26  #include "mastodon-cpp.hpp"
27  #include "easy/easy.hpp"
28  #include "easy/entities/account.hpp"
29  #include "easy/entities/status.hpp"
30 #else
31  #include <mastodon-cpp/mastodon-cpp.hpp>
32  #include <mastodon-cpp/easy/easy.hpp>
33  #include <mastodon-cpp/easy/entities/account.hpp>
34  #include <mastodon-cpp/easy/entities/status.hpp>
35 #endif
36 
37 using std::string;
38 using std::uint_fast64_t;
39 using std::chrono::system_clock;
40 
41 namespace Mastodon
42 {
49  {
50  public:
58  explicit Notification(const string &json);
59 
65  Notification();
66 
67  virtual const bool valid() const;
68 
74  const Account account() const;
75 
81  const system_clock::time_point created_at() const;
82 
88  const uint_fast64_t id() const;
89 
96  const Status status() const;
97 
103  const Easy::notification_type type() const;
104  };
105 }
106 
107 #endif // MASTODON_CPP_EASY_NOTIFICATION_HPP
const Status status() const
Returns the Status associated with the notification, if applicable.
Definition: notification.cpp:66
const uint_fast64_t id() const
Returns notification ID.
Definition: notification.cpp:61
Class to hold notifications.
Definition: notification.hpp:48
const system_clock::time_point created_at() const
Returns time of creation.
Definition: notification.cpp:56
const Account account() const
Returns the Account sending the notification to the user.
Definition: notification.cpp:44
virtual const bool valid() const
Returns true if the Entity holds valid data.
Definition: notification.cpp:31
notification_type
Describes the notification type.
Definition: easy.hpp:110
Class to hold statuses.
Definition: status.hpp:57
Class to hold accounts.
Definition: account.hpp:46
Notification()
Constructs an empty Notification object.
Definition: notification.cpp:27
Definition: mastodon-cpp.hpp:52
Base class for all entities.
Definition: easy.hpp:304
const Easy::notification_type type() const
Returns notification type.
Definition: notification.cpp:78