DiscordCoreAPI
A Discord bot library written in C++, with custom asynchronous coroutines.
Loading...
Searching...
No Matches
StickerEntities.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/// StickerEntities.hpp - Header for the sticker related classes and structs.
22/// May 13, 2021
23/// https://discordcoreapi.com
24/// \file StickerEntities.hpp
25
26#pragma once
27
30
31namespace DiscordCoreAPI {
32
33 /**
34 * \addtogroup foundation_entities
35 * @{
36 */
37 /// \brief For getting a Sticker object for the given sticker ID.
38 struct DiscordCoreAPI_Dll GetStickerData {
39 Snowflake stickerId{};///< The chosen Sticker's Id.
40 };
41
42 /// \brief For collecting a list of Stickers from a chosen Guild.
43 struct DiscordCoreAPI_Dll GetGuildStickersData {
44 Snowflake guildId{};///< The chosen Guild from which you would like to collect the Stickers from.
45 };
46
47 /// \brief For creating a single Sticker.
48 struct DiscordCoreAPI_Dll CreateGuildStickerData {
49 std::string description{};///< Description of the Sticker.
50 std::string reason{};///< The reason for creating the Sticker.
51 Snowflake guildId{};///< The Guild within which to create the Sticker.
52 std::string file{};///< The sticker file to upload, must be a Png, Apng, or Lottie JSON file, max 500 KB.
53 std::string name{};///< Name of the Sticker.
54 std::string tags{};///< Autocomplete / suggestion tags for the sticker(max 200 characters).
55 };
56
57 /// \brief For modifying a single Sticker.
58 struct DiscordCoreAPI_Dll ModifyGuildStickerData {
59 std::string description{};///< Description of the Sticker.
60 Snowflake stickerId{};///< The Sticker you wish to modify.
61 std::string reason{};///< The reason for modifying the Sticker.
62 Snowflake guildId{};///< The Guild within which to modify the Sticker.
63 std::string name{};///< Name of the Sticker.
64 std::string tags{};///< Autocomplete / suggestion tags for the sticker(max 200 characters).
65 };
66
67 /// \brief For deleting a single Sticker.
68 struct DiscordCoreAPI_Dll DeleteGuildStickerData {
69 Snowflake stickerId{};///< The Sticker you wish to delete.
70 std::string reason{};///< The reason for deleting the Sticker.
71 Snowflake guildId{};///< The Guild within which to delete the Sticker.
72 };
73
74 /// \brief A single Sticker.
75 class DiscordCoreAPI_Dll Sticker : public StickerData {
76 public:
77 Sticker() noexcept = default;
78
79 Sticker(Value jsonData);
80
81 virtual ~Sticker() noexcept = default;
82 };
83
84 class DiscordCoreAPI_Dll StickerVector {
85 public:
86 StickerVector() noexcept = default;
87
88 operator std::vector<Sticker>();
89
90 StickerVector(Value jsonData);
91
92 virtual ~StickerVector() noexcept = default;
93
94 protected:
95 std::vector<Sticker> stickers{};
96 };
97
98 /**@}*/
99
100 /**
101 * \addtogroup main_endpoints
102 * @{
103 */
104 /// \brief An interface class for the Sticker related Discord endpoints.
105 class DiscordCoreAPI_Dll Stickers {
106 public:
107 static void initialize(DiscordCoreInternal::HttpsClient*);
108
109 /// \brief Gets a single Sticker item.
110 /// \param dataPackage A GetStickerData structure.
111 /// \returns A CoRoutine containing a Sticker.
112 static CoRoutine<Sticker> getStickerAsync(GetStickerData dataPackage);
113
114 /// \brief Gets a list of nitro-available Sticker packs
115 /// \returns A CoRoutine containing a StickerPackDataVector.
116 static CoRoutine<std::vector<StickerPackData>> getNitroStickerPacksAsync();
117
118 /// \brief Gets a list of Stickers from a Guild.
119 /// \param dataPackage A GetGuildStickersData structure.
120 /// \returns A CoRoutine containing a StickerVector.
121 static CoRoutine<std::vector<Sticker>> getGuildStickersAsync(GetGuildStickersData dataPackage);
122
123 /// \brief Creates a new Sticker within a chosen Guild.
124 /// \param dataPackage A CreateGuildStickerData structure.
125 /// \returns A CoRoutine containing a Sticker.
126 static CoRoutine<Sticker> createGuildStickerAsync(CreateGuildStickerData dataPackage);
127
128 /// \brief Modifies a Sticker within a chosen Guild.
129 /// \param dataPackage A ModifyGuildStickerData structure.
130 /// \returns A CoRoutine containing a Sticker.
131 static CoRoutine<Sticker> modifyGuildStickerAsync(ModifyGuildStickerData dataPackage);
132
133 /// \brief Deletes a Sticker within a chosen Guild.
134 /// \param dataPackage A DeleteGuildStickerData structure.
135 /// \returns A CoRoutine containing void.
136 static CoRoutine<void> deleteGuildStickerAsync(DeleteGuildStickerData dataPackage);
137
138 protected:
139 static DiscordCoreInternal::HttpsClient* httpsClient;
140 };
141 /**@}*/
142};// namespace DiscordCoreAPI
The main namespace for this library.
A CoRoutine - representing a potentially asynchronous operation/function.
Definition: CoRoutine.hpp:52
Data representing a single Sticker.
For getting a Sticker object for the given sticker ID.
For collecting a list of Stickers from a chosen Guild.
For creating a single Sticker.
For modifying a single Sticker.
For deleting a single Sticker.
An interface class for the Sticker related Discord endpoints.