38 template<>
struct core<discord_core_api::forum_thread_message_data> {
39 using value_type = discord_core_api::forum_thread_message_data;
40 static constexpr auto parseValue =
41 createValue(
"attachments", &value_type::attachments,
"components", &value_type::components,
"allowedMentions", &value_type::allowedMentions,
"stickerIds",
42 &value_type::stickerIds,
"embeds", &value_type::embeds,
"content", &value_type::content,
"flags", &value_type::flags);
45 template<>
struct core<discord_core_api::start_thread_with_message_data> {
46 using value_type = discord_core_api::start_thread_with_message_data;
47 static constexpr auto parseValue = createValue(
"autoArchiveDuration", &value_type::autoArchiveDuration,
"rateLimitPerUser", &value_type::rateLimitPerUser,
"threadName",
48 &value_type::threadName,
"messageId", &value_type::messageId,
"channelId", &value_type::channelId);
51 template<>
struct core<discord_core_api::start_thread_without_message_data> {
52 using value_type = discord_core_api::start_thread_without_message_data;
53 static constexpr auto parseValue =
54 createValue(
"autoArchiveDuration", &value_type::autoArchiveDuration,
"type", &value_type::type,
"rateLimitPerUser", &value_type::rateLimitPerUser,
"threadName",
55 &value_type::threadName,
"channelId", &value_type::channelId,
"invitable", &value_type::invitable);
58 template<>
struct core<discord_core_api::start_thread_in_forum_channel_data> {
59 using value_type = discord_core_api::start_thread_in_forum_channel_data;
60 static constexpr auto parseValue = createValue(
"autoArchiveDuration", &value_type::autoArchiveDuration,
"message", &value_type::message,
"rateLimitPerUser",
61 &value_type::rateLimitPerUser,
"channelId", &value_type::channelId,
"name", &value_type::name);
69 threads::httpsClient = client;
73 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Post_Thread_With_Message };
75 workload.workloadClass = discord_core_internal::https_workload_class::Post;
76 workload.relativePath =
"/channels/" + dataPackage.
channelId +
"/messages/" + dataPackage.
messageId +
"/threads";
77 parser.serializeJson(dataPackage, workload.content);
78 workload.callStack =
"threads::startThreadWithMessageAsync()";
79 if (dataPackage.
reason !=
"") {
80 workload.headersToInsert[
"x-audit-log-reason"] = dataPackage.
reason;
82 thread_data returnData{};
83 threads::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
88 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Post_Thread_Without_Message };
90 workload.workloadClass = discord_core_internal::https_workload_class::Post;
91 workload.relativePath =
"/channels/" + dataPackage.
channelId +
"/threads";
92 parser.serializeJson(dataPackage, workload.content);
93 workload.callStack =
"threads::startThreadWithoutMessageAsync()";
94 if (dataPackage.
reason !=
"") {
95 workload.headersToInsert[
"x-audit-log-reason"] = dataPackage.
reason;
97 thread_data returnData{};
98 threads::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
103 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Post_Thread_In_Forum_Channel };
105 workload.workloadClass = discord_core_internal::https_workload_class::Post;
106 workload.relativePath =
"/channels/" + dataPackage.
channelId +
"/threads";
107 parser.serializeJson(dataPackage, workload.content);
108 workload.callStack =
"threads::startThreadInForumChannelAsync()";
109 if (dataPackage.
reason !=
"") {
110 workload.headersToInsert[
"x-audit-log-reason"] = dataPackage.
reason;
112 thread_data returnData{};
113 threads::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
114 co_return returnData;
118 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Put_Self_In_Thread };
120 workload.workloadClass = discord_core_internal::https_workload_class::Put;
121 workload.relativePath =
"/channels/" + dataPackage.
channelId +
"/thread-members/@me";
122 workload.callStack =
"threads::joinThreadAsync()";
123 threads::httpsClient->submitWorkloadAndGetResult(std::move(workload));
128 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Put_Thread_Member };
130 workload.workloadClass = discord_core_internal::https_workload_class::Put;
131 workload.relativePath =
"/channels/" + dataPackage.
channelId +
"/thread-members/" + dataPackage.
userId;
132 workload.callStack =
"threads::addThreadMemberAsync()";
133 threads::httpsClient->submitWorkloadAndGetResult(std::move(workload));
138 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Delete_Self_From_Thread };
140 workload.workloadClass = discord_core_internal::https_workload_class::Delete;
141 workload.relativePath =
"/channels/" + dataPackage.
channelId +
"/thread-members/@me";
142 workload.callStack =
"threads::leaveThreadAsync()";
143 threads::httpsClient->submitWorkloadAndGetResult(std::move(workload));
148 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Delete_Thread_Member };
150 workload.workloadClass = discord_core_internal::https_workload_class::Delete;
151 workload.relativePath =
"/channels/" + dataPackage.
channelId +
"/thread-members/" + dataPackage.
userId;
152 workload.callStack =
"threads::removeThreadMemberAsync()";
153 threads::httpsClient->submitWorkloadAndGetResult(std::move(workload));
158 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Thread_Member };
160 workload.workloadClass = discord_core_internal::https_workload_class::Get;
161 workload.relativePath =
"/channels/" + dataPackage.
channelId +
"/thread-members/" + dataPackage.
userId;
162 workload.callStack =
"threads::getThreadMemberAsync()";
163 thread_member_data returnData{};
164 threads::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
165 co_return returnData;
169 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Thread_Members };
171 workload.workloadClass = discord_core_internal::https_workload_class::Get;
172 workload.relativePath =
"/channels/" + dataPackage.
channelId +
"/thread-members";
173 workload.callStack =
"threads::getThreadMembersAsync()";
174 jsonifier::vector<thread_member_data> returnData{};
175 threads::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
176 co_return returnData;
180 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Active_Threads };
182 workload.workloadClass = discord_core_internal::https_workload_class::Get;
183 workload.relativePath =
"/channels/" + dataPackage.
channelId +
"/threads/active";
184 workload.callStack =
"threads::getActiveThreadsAsync()";
185 active_threads_data returnData{};
186 threads::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
187 co_return returnData;
191 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Public_Archived_Threads };
193 workload.workloadClass = discord_core_internal::https_workload_class::Get;
194 workload.relativePath =
"/channels/" + dataPackage.
channelId +
"/threads/archived/public";
195 if (dataPackage.
before !=
"") {
196 workload.relativePath +=
"?before=" + dataPackage.
before;
197 if (dataPackage.
limit != 0) {
198 workload.relativePath +=
"&limit=" + jsonifier::toString(dataPackage.
limit);
200 }
else if (dataPackage.
limit != 0) {
201 workload.relativePath +=
"?limit=" + jsonifier::toString(dataPackage.
limit);
203 workload.callStack =
"threads::getPublicArchivedThreadsAsync()";
204 archived_threads_data returnData{};
205 threads::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
206 co_return returnData;
210 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Private_Archived_Threads };
212 workload.workloadClass = discord_core_internal::https_workload_class::Get;
213 workload.relativePath =
"/channels/" + dataPackage.
channelId +
"/threads/archived/protected";
214 if (dataPackage.
before !=
"") {
215 workload.relativePath +=
"?before=" + dataPackage.
before;
216 if (dataPackage.
limit != 0) {
217 workload.relativePath +=
"&limit=" + jsonifier::toString(dataPackage.
limit);
219 }
else if (dataPackage.
limit != 0) {
220 workload.relativePath +=
"?limit=" + jsonifier::toString(dataPackage.
limit);
222 workload.callStack =
"threads::getPrivateArchivedThreadsAsync()";
223 archived_threads_data returnData{};
224 threads::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
225 co_return returnData;
229 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Joined_Private_Archived_Threads };
231 workload.workloadClass = discord_core_internal::https_workload_class::Get;
232 workload.relativePath =
"/channels/" + dataPackage.
channelId +
"/users/@me/threads/archived/protected";
233 if (dataPackage.
before !=
"") {
234 workload.relativePath +=
"?before=" + dataPackage.
before;
235 if (dataPackage.
limit != 0) {
236 workload.relativePath +=
"&limit=" + jsonifier::toString(dataPackage.
limit);
238 }
else if (dataPackage.
limit != 0) {
239 workload.relativePath +=
"?limit=" + jsonifier::toString(dataPackage.
limit);
241 workload.callStack =
"threads::getJoinedPrivateArchivedThreadsAsync()";
242 archived_threads_data returnData{};
243 threads::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
244 co_return returnData;
248 discord_core_internal::https_workload_data workload{ discord_core_internal::https_workload_type::Get_Guild_Active_Threads };
250 workload.workloadClass = discord_core_internal::https_workload_class::Get;
251 workload.relativePath =
"/guilds/" + dataPackage.
guildId +
"/threads/active";
252 workload.callStack =
"threads::listActiveThreadsAsync()";
253 active_threads_data returnData{};
254 threads::httpsClient->submitWorkloadAndGetResult(std::move(workload), returnData);
255 co_return returnData;
A co_routine - representing a potentially asynchronous operation/function.
For sending Https requests.
static co_routine< jsonifier::vector< thread_member_data > > getThreadMembersAsync(get_thread_members_data dataPackage)
Collects a list of thread_members if they exist.
static co_routine< active_threads_data > getActiveGuildThreadsAsync(get_active_guild_threads_data dataPackage)
Lists all of the active threads of a chosen guild.
static co_routine< archived_threads_data > getJoinedPrivateArchivedThreadsAsync(get_joined_private_archived_threads_data dataPackage)
Collects a list of joined protected archived threads from a given channel.
static co_routine< thread_member_data > getThreadMemberAsync(get_thread_member_data dataPackage)
Collects a thread_member if they exist.
static co_routine< archived_threads_data > getPrivateArchivedThreadsAsync(get_private_archived_threads_data dataPackage)
Collects a list of protected archived threads from a given channel.
static co_routine< void > addThreadMemberAsync(add_thread_member_data dataPackage)
Adds a new user_data to a chosen thread_data.
static co_routine< void > leaveThreadAsync(leave_thread_data dataPackage)
Leaves a thread_data.
static co_routine< thread_data > startThreadWithoutMessageAsync(start_thread_without_message_data dataPackage)
Starts a thread_data, not based on a starting message_data.
static co_routine< void > joinThreadAsync(join_thread_data dataPackage)
Joins a thread_data.
static co_routine< void > removeThreadMemberAsync(remove_thread_member_data dataPackage)
Removes a user from a chosen thread_data.
static co_routine< thread_data > startThreadWithMessageAsync(start_thread_with_message_data dataPackage)
Starts a thread_data, based on a starting message_data.
static co_routine< archived_threads_data > getPublicArchivedThreadsAsync(get_public_archived_threads_data dataPackage)
Collects a list of public archived threads from a given channel.
static co_routine< active_threads_data > getActiveThreadsAsync(get_active_threads_data dataPackage)
Collects a list of threads from a given channel.
static co_routine< thread_data > startThreadInForumChannelAsync(start_thread_in_forum_channel_data dataPackage)
Starts a thread_data, in a forum channel.
DCA_INLINE auto newThreadAwaitable()
An awaitable that can be used to launch the co_routine onto a new thread - as well as return the hand...
The main namespace for the forward-facing interfaces.
For adding a chosen user_data to a chosen thread_data.
snowflake channelId
The id of the thread_data to join.
snowflake userId
The id of the user_data to add to the thread_data.
For listing the active threads in a chosen guild.
snowflake guildId
The guild from which to list the threads from.
For collecting the list of active threads.
snowflake channelId
The id of the channel_data to collect the threads from.
For collecting joined protected archived threads from a given channel.
snowflake channelId
The channel_data to acquire the threads from.
jsonifier::string before
Returns threads before this timeStamp.
int32_t limit
Maximum number of threads to return.
For collecting protected archived threads from a given channel.
jsonifier::string before
Returns threads before this timeStamp.
snowflake channelId
The channel_data to acquire the threads from.
int32_t limit
Maximum number of threads to return.
For collecting puiblic archived threads from a given channel.
snowflake channelId
The channel_data to acquire the threads from.
jsonifier::string before
Returns threads before this timeStamp.
int32_t limit
Maximum number of threads to return.
For collecting a thread_member responseData structure for a given thread_member.
snowflake channelId
The id of the thread_data to collect them from.
snowflake userId
The id of the user_data to collect from the thread_data.
For collecting the list of thread_members from a thread_data.
snowflake channelId
The id of the thread_data to collect them from.
For joining a thread_data.
snowflake channelId
The id of the thread_data to join.
For leaving a thread_data.
snowflake channelId
The id of the thread_data to leave.
For removing a chosen user_data from a thread_data.
snowflake channelId
The id of the thread_data to remove them from.
snowflake userId
The id of the user_data to remove from the thread_data.
For starting a thread_data, in a forum channel.
jsonifier::string reason
Reason for starting the thread_data.
snowflake channelId
The id of the channel.
For starting a thread_data, based on a message.
snowflake channelId
The channel_data to start the thread_data in.
jsonifier::string reason
Reason for starting the thread_data.
snowflake messageId
The message snowflake to base the thread_data off of.
For starting a thread_data, not based on a message.
jsonifier::string reason
Reason for starting the thread_data.
snowflake channelId
The channel_data to start the thread_data in.