DiscordCoreAPI
A Discord bot library written in C++, with custom asynchronous coroutines.
Loading...
Searching...
No Matches
GuildScheduledEventEntities.hpp
Go to the documentation of this file.
1/*
2 DiscordCoreAPI, A bot library for Discord, written in C++, and featuring explicit multithreading through the usage of custom, asynchronous C++ CoRoutines.
3
4 Copyright 2021, 2022 Chris M. (RealTimeChris)
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 USA
20*/
21/// GuildScheduledEventEntities.hpp - Header for the Guild Scheduled Events stuff.
22/// Nov 27, 2021 Chris M.
23/// https://discordcoreapi.com
24/// \file GuildScheduledEventEntities.hpp
25
26#pragma once
27
30
31namespace DiscordCoreAPI {
32
33 /**
34 * \addtogroup foundation_entities
35 * @{
36 */
37 /// \brief For collecting a list of a Guild's scheduled events.
38 struct DiscordCoreAPI_Dll GetGuildScheduledEventsData {
39 bool withUserCount{};///< Do we collect the user counts?
40 Snowflake guildId{};///< Guild from which we would like to collect the events.
41 };
42
43 /// \brief For creating a GuildScheduledEvent.
44 struct DiscordCoreAPI_Dll CreateGuildScheduledEventData {
46 GuildScheduledEventPrivacyLevel::Guild_Only
47 };///< The privacy level of the scheduled event.
48 GuildScheduledEventMetadata entityMetadata{};/// The entity metadata of the scheduled event.
49 GuildScheduledEventEntityType entityType{};///< The entity type of the scheduled event.
50 std::string scheduledStartTime{};///< The time to schedule the scheduled event.
51 std::string scheduledEndTime{};///< The time when the scheduled event is scheduled to end.
52 std::string description{};///< The description of the scheduled event.
53 Snowflake channelId{};///< The Channel id of the scheduled event.
54 Snowflake guildId{};///< The Guild within which to create the event.
55 std::string name{};///< The name of the scheduled event.
56
57 operator Serializer();
58 };
59
60 /// \brief For collecting a single Guild scheduled event.
61 struct DiscordCoreAPI_Dll GetGuildScheduledEventData {
62 Snowflake guildScheduledEventId{};///< The id of the desired scheduled event.
63 bool withUserCount{};///< Do we collect the user counts?
64 Snowflake guildId{};///< Guild from which we would like to collect the events.
65 };
66
67 /// \brief For modifying a single Guild Scheduled Event.
68 struct DiscordCoreAPI_Dll ModifyGuildScheduledEventData {
70 GuildScheduledEventPrivacyLevel::Guild_Only
71 };///< The privacy level of the scheduled event.
72 GuildScheduledEventStatus status{ GuildScheduledEventStatus::Active };///< The status of the scheduled event.
73 GuildScheduledEventMetadata entityMetadata{};///< The entity metadata of the scheduled event.
74 GuildScheduledEventEntityType entityType{};///< The entity type of the scheduled event.
75 Snowflake guildScheduledEventId{};///< The id of the event to modify.
76 std::string scheduledStartTime{};///< The time to schedule the scheduled event.
77 std::string scheduledEndTime{};///< The time when the scheduled event is scheduled to end.
78 std::string description{};///< The description of the scheduled event.
79 Snowflake channelId{};///< The Channel id of the scheduled event, set to null if changing entity type to External.
80 Snowflake guildId{};///< The Guild within which to modify the event.
81 std::string name{};///< The name of the scheduled event.
82
83 operator Serializer();
84 };
85
86 /// \brief For deleting a single Guild Scheduled Event.
87 struct DiscordCoreAPI_Dll DeleteGuildScheduledEventData {
88 Snowflake guildScheduledEventId{};///< The id of the event to modify.
89 Snowflake guildId{};///< The Guild within which to modify the event.
90 };
91
92 /// \brief For collecting a list of Guild Scheduled Event Users.
93 struct DiscordCoreAPI_Dll GetGuildScheduledEventUsersData {
94 Snowflake guildScheduledEventId{};///< The id of the event to modify.
95 Snowflake guildId{};///< The Guild within which to modify the event.
96 Snowflake before{};///< Consider only users before given user id.
97 bool withMember{};///< Include Guild member responseData if it exists.
98 Snowflake after{};///< Consider only users after given user id.
99 uint32_t limit{};///< How many users to receive from the event.
100 };
101
102 /// \brief A single GuildScheduledEvent responseData structure.
103 class DiscordCoreAPI_Dll GuildScheduledEvent : public GuildScheduledEventData {
104 public:
105 GuildScheduledEvent() noexcept = default;
106
107 GuildScheduledEvent(Value jsonData);
108
109 virtual ~GuildScheduledEvent() noexcept = default;
110 };
111
112 class DiscordCoreAPI_Dll GuildScheduledEventVector {
113 public:
114 GuildScheduledEventVector() noexcept = default;
115
116 operator std::vector<GuildScheduledEvent>();
117
118 GuildScheduledEventVector(Value jsonData);
119
120 virtual ~GuildScheduledEventVector() noexcept = default;
121
122 protected:
123 std::vector<GuildScheduledEvent> guildScheduledEvents{};
124 };
125
126 /**@}*/
127
128 /**
129 * \addtogroup main_endpoints
130 * @{
131 */
132 /// \brief An interface class for the GuildScheduledEvent related Discord endpoints.
133 class DiscordCoreAPI_Dll GuildScheduledEvents {
134 public:
135 static void initialize(DiscordCoreInternal::HttpsClient*);
136
137 /// \brief Gets a list of a given Guild's scheduled events.
138 /// \param dataPackage A GetGuildScheduledEventsstructure.
139 /// \returns A CoRoutine containing a vector<GuildScheduledEvent>.
140 static CoRoutine<std::vector<GuildScheduledEvent>> getGuildScheduledEventsAsync(GetGuildScheduledEventsData dataPackage);
141
142 /// \brief Creates a new GuildScheduledEvent within a chosen Guild.
143 /// \param dataPackage A CreateGuildScheduledEventData structure.
144 /// \returns A CoRoutine containing a GuildScheduledEvent.
145 static CoRoutine<GuildScheduledEvent> createGuildScheduledEventAsync(CreateGuildScheduledEventData dataPackage);
146
147 /// \brief Collects a single GuildScheduledEvent.
148 /// \param dataPackage A GetGuildScheduledEventData structure.
149 /// \returns A CoRoutine containing a GuildScheduledEvent.
150 static CoRoutine<GuildScheduledEvent> getGuildScheduledEventAsync(GetGuildScheduledEventData dataPackage);
151
152 /// \brief Modifies a single GuildScheduledEvent.
153 /// \param dataPackage A ModifyGuildScheduledEventData structure.
154 /// \returns A CoRoutine containing a GuildScheduledEvent.
155 static CoRoutine<GuildScheduledEvent> modifyGuildScheduledEventAsync(ModifyGuildScheduledEventData dataPackage);
156
157 /// \brief Deletes a single GuildScheduledEvent.
158 /// \param dataPackage A DeleteGuildScheduledEventData structure.
159 /// \returns A CoRoutine containing void.
160 static CoRoutine<void> deleteGuildScheduledEventAsync(DeleteGuildScheduledEventData dataPackage);
161
162 /// \brief Collects a list of Users for a given GuildScheduledEvent.
163 /// \param dataPackage A GetGuildScheduledEventUsersData structure.
164 /// \returns A CoRoutine containing a vector<GuildScheduledEventUser>.
165 static CoRoutine<std::vector<GuildScheduledEventUserData>> getGuildScheduledEventUsersAsync(
167
168 protected:
169 static DiscordCoreInternal::HttpsClient* httpsClient;
170 };
171 /**@}*/
172}// namespace DiscordCoreAPI
GuildScheduledEventStatus
GuildScheduledEventStatus.
GuildScheduledEventPrivacyLevel
Guild scheduled event privacy levels.
GuildScheduledEventEntityType
Guild scheduled event entity types.
The main namespace for this library.
A CoRoutine - representing a potentially asynchronous operation/function.
Definition: CoRoutine.hpp:52
Guild scheduled event entity metadata.
Data representing a Guild Scheduled Event.
For collecting a list of a Guild's scheduled events.
For collecting a single Guild scheduled event.
For modifying a single Guild Scheduled Event.
For deleting a single Guild Scheduled Event.
For collecting a list of Guild Scheduled Event Users.
A single GuildScheduledEvent responseData structure.
An interface class for the GuildScheduledEvent related Discord endpoints.