Skip to content

Commit

Permalink
docs: fixed missing/incorrect params for many functions (#1110)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaskowicz1 authored Mar 28, 2024
1 parent 4f83914 commit 44bfb17
Show file tree
Hide file tree
Showing 18 changed files with 68 additions and 28 deletions.
2 changes: 1 addition & 1 deletion include/dpp/cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -2804,7 +2804,7 @@ class DPP_EXPORT cluster {
* @brief Get the guild's onboarding configuration
*
* @see https://discord.com/developers/docs/resources/guild#get-guild-onboarding
* @param o The onboarding object
* @param guild_id The guild to pull the onboarding configuration from.
* @param callback Function to call when the API call completes.
* On success the callback will contain a dpp::onboarding object in confirmation_callback_t::value filled to match the vanity url. On failure, the value is undefined and confirmation_callback_t::is_error() method will return true. You can obtain full error details with confirmation_callback_t::get_error().
*/
Expand Down
11 changes: 10 additions & 1 deletion include/dpp/cluster_coro_calls.h
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@
*
* @see dpp::cluster::guild_get_onboarding
* @see https://discord.com/developers/docs/resources/guild#get-guild-onboarding
* @param o The onboarding object
* @param guild_id The guild to pull the onboarding configuration from.
* @return onboarding returned object on completion
* \memberof dpp::cluster
*/
Expand Down Expand Up @@ -1528,6 +1528,15 @@
*/
[[nodiscard]] async<confirmation_callback_t> co_message_edit(const struct message &m);

/**
* @brief Edit the flags of a message on a channel. The callback function is called when the message has been edited
*
* @param m Message to edit the flags of
* @return message returned object on completion
* \memberof dpp::cluster
*/
[[nodiscard]] async<confirmation_callback_t> co_message_edit_flags(const struct message &m);

/**
* @brief Get a message
*
Expand Down
14 changes: 13 additions & 1 deletion include/dpp/cluster_sync_calls.h
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ confirmation guild_sync_integration_sync(snowflake guild_id, snowflake integrati
*
* @see dpp::cluster::guild_get_onboarding
* @see https://discord.com/developers/docs/resources/guild#get-guild-onboarding
* @param o The onboarding object
* @param guild_id The guild to pull the onboarding configuration from.
* @return onboarding returned object on completion
* \memberof dpp::cluster
* @throw dpp::rest_exception upon failure to execute REST function
Expand Down Expand Up @@ -1870,6 +1870,18 @@ confirmation message_delete_reaction_emoji_sync(snowflake message_id, snowflake
*/
message message_edit_sync(const struct message &m);

/**
* @brief Edit the flags of a message on a channel. The callback function is called when the message has been edited
*
* @param m Message to edit the flags of
* @return message returned object on completion
* \memberof dpp::cluster
* @throw dpp::rest_exception upon failure to execute REST function
* @warning This function is a blocking (synchronous) call and should only be used from within a separate thread.
* Avoid direct use of this function inside an event handler.
*/
message message_edit_flags_sync(const struct message &m);

/**
* @brief Get a message
*
Expand Down
2 changes: 1 addition & 1 deletion include/dpp/coro/coroutine.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ using handle_t = std_coroutine::coroutine_handle<promise_t<R>>;
/**
* @brief Base class of dpp::coroutine<R>.
*
* @warn This class should not be used directly by a user, use dpp::coroutine<R> instead.
* @warning This class should not be used directly by a user, use dpp::coroutine<R> instead.
* @note This class contains all the functions used internally by co_await. It is intentionally opaque and a private base of dpp::coroutine<R> so a user cannot call await_suspend and await_resume directly.
*/
template <typename R>
Expand Down
4 changes: 2 additions & 2 deletions include/dpp/discordevents.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void DPP_EXPORT set_snowflake_array_not_null(const nlohmann::json* j, const char

/**
* @brief Applies a function to each element of a json array.
* @param j nlohmann::json instance to retrieve value from
* @param parent nlohmann::json instance to retrieve value from
* @param key key name to check for the values
* @param fn function to apply to each element
*/
Expand All @@ -65,7 +65,7 @@ void DPP_EXPORT for_each_json(nlohmann::json* parent, std::string_view key, cons
* @brief Sets an array of objects from a json field value, if defined, else does nothing
* @tparam T The class of which the array consists of. Must be derived from dpp::json_interface
* @param j nlohmann::json instance to retrieve value from
* @param keyname key name to check for the values
* @param key key name to check for the values
* @param v Value to change
*/
template<class T> void set_object_array_not_null(nlohmann::json* j, std::string_view key, std::vector<T>& v) {
Expand Down
2 changes: 1 addition & 1 deletion include/dpp/discordvoiceclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ class DPP_EXPORT discord_voice_client : public websocket_client
/**
* @brief Change the iteration interval time.
*
* @param time The time (in milliseconds) between each interval when parsing audio.
* @param interval The time (in milliseconds) between each interval when parsing audio.
*
* @return Reference to self.
*/
Expand Down
3 changes: 2 additions & 1 deletion include/dpp/emoji.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ class DPP_EXPORT emoji : public managed, public json_interface<emoji> {
/**
* @brief Load an image into the object
*
* @param image_blob Image binary data
* @param data Image binary data
* @param size Size of the image.
* @param type Type of image. It can be one of `i_gif`, `i_jpg` or `i_png`.
* @return emoji& Reference to self
* @throw dpp::length_exception Image content exceeds discord maximum of 256 kilobytes
Expand Down
2 changes: 1 addition & 1 deletion include/dpp/event_router.h
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ template<class T> class event_router_t {
* @brief Attach a callable to the event, adding a listener.
* The callable should be of the form `void(const T&)`
* where T is the event type for this event router.
*
*f
* @warning You cannot call this within an event handler.
*
* @param fun Callable to attach to event
Expand Down
2 changes: 1 addition & 1 deletion include/dpp/guild.h
Original file line number Diff line number Diff line change
Expand Up @@ -1990,7 +1990,7 @@ struct DPP_EXPORT onboarding : public json_interface<onboarding> {
/**
* @brief Set guild_id of this onboarding object
*
* @param guild_id Guild ID to set
* @param id Guild ID to set
* @return Reference to self, so these method calls may be chained
*/
onboarding& set_guild_id(const snowflake id);
Expand Down
2 changes: 1 addition & 1 deletion include/dpp/httpsclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class DPP_EXPORT https_client : public ssl_client {
* @param extra_headers Additional request headers, e.g. user-agent, authorization, etc
* @param plaintext_connection Set to true to make the connection plaintext (turns off SSL)
* @param request_timeout How many seconds before the connection is considered failed if not finished
* @param http_protocol Request HTTP protocol
* @param protocol Request HTTP protocol (default: 1.1)
*/
https_client(const std::string &hostname, uint16_t port = 443, const std::string &urlpath = "/", const std::string &verb = "GET", const std::string &req_body = "", const http_headers& extra_headers = {}, bool plaintext_connection = false, uint16_t request_timeout = 5, const std::string &protocol = "1.1");

Expand Down
2 changes: 1 addition & 1 deletion include/dpp/prune.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct DPP_EXPORT prune : public json_interface<prune> {
/**
* @brief Build JSON from this object.
*
* @param with_prune_count True if the prune count boolean is to be set in the built JSON
* @param with_id True if the prune count boolean is to be set in the built JSON
* @return The JSON of the prune object
*/
json to_json(bool with_id = false) const; // Intentional shadow of json_interface, mostly present for documentation
Expand Down
3 changes: 2 additions & 1 deletion include/dpp/role.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ class DPP_EXPORT role : public managed, public json_interface<role> {
/**
* @brief Load a role icon.
*
* @param image_blob Image binary data
* @param data Image binary data
* @param size Size of the image.
* @param type Type of image. It can be one of `i_gif`, `i_jpg` or `i_png`.
* @return emoji& Reference to self
*/
Expand Down
3 changes: 2 additions & 1 deletion include/dpp/scheduled_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ struct DPP_EXPORT scheduled_event : public managed, public json_interface<schedu
/**
* @brief Load an image for the event cover.
*
* @param image_blob Image binary data
* @param data Image binary data
* @param size Size of the image.
* @param type Type of image. It can be one of `i_gif`, `i_jpg` or `i_png`.
* @return emoji& Reference to self
*/
Expand Down
8 changes: 7 additions & 1 deletion include/dpp/sku.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,13 @@ class DPP_EXPORT sku : public managed, public json_interface<sku> {
/**
* @brief Construct a new SKU object with all data required.
*
* @param id SKU id.
* @param id ID of the SKU.
* @param type Type of SKU (sku_type).
* @param application_id ID of the parent application.
* @param name Customer-facing name of your premium offering.
* @param slug System-generated URL slug based on the SKU's name.
* @param flags Flags bitmap from dpp::sku_flags.
*
*/
sku(const snowflake id, const sku_type type, const snowflake application_id, const std::string name, const std::string slug, const uint16_t flags);

Expand Down
1 change: 1 addition & 0 deletions include/dpp/sslclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ bool close_socket(dpp::socket sfd);
* @brief Set a socket to blocking or non-blocking IO
*
* @param sockfd socket to act upon
* @param non_blocking should socket be non-blocking?
* @return false on error, true on success
*/
bool set_nonblocking(dpp::socket sockfd, bool non_blocking);
Expand Down
27 changes: 14 additions & 13 deletions include/dpp/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,13 +365,13 @@ struct DPP_EXPORT image_data {
*
* @param rhs Image to copy
*/
image_data(image_data&&) noexcept = default;
image_data(image_data&& rhs) noexcept = default;

/**
* @brief Construct from string buffer
*
* @param format Image format
* @param str Data in a string
* @param bytes Data in a string
* @see image_type
*/
image_data(image_type format, std::string_view bytes);
Expand All @@ -380,8 +380,8 @@ struct DPP_EXPORT image_data {
* @brief Construct from byte buffer
*
* @param format Image format
* @param buf Byte buffer
* @param size_t Image size in bytes
* @param bytes Data of the image
* @param byte_size Image size in bytes
* @see image_type
*/
image_data(image_type format, const std::byte* bytes, uint32_t byte_size);
Expand All @@ -405,16 +405,17 @@ struct DPP_EXPORT image_data {
/**
* @brief Set image data.
*
* @param format Format of the image
* @param data Data of the image
* @param format Image format
* @param bytes Data of the image
*/
void set(image_type format, std::string_view bytes);

/**
* @brief Set image data.
*
* @param format Format of the image
* @param data Data of the image
* @param bytes Data of the image
* @param byte_size Image size in bytes
*/
void set(image_type format, const std::byte* bytes, uint32_t byte_size);

Expand Down Expand Up @@ -507,23 +508,23 @@ struct icon {
/**
* @brief Get as icon hash.
*
* @warn The behavior is undefined if `is_iconhash() == false`
* @warning The behavior is undefined if `is_iconhash() == false`
* @return iconhash& This iconhash
*/
iconhash& as_iconhash() &;

/**
* @brief Get as icon hash.
*
* @warn The behavior is undefined if `is_iconhash() == false`
* @warning The behavior is undefined if `is_iconhash() == false`
* @return iconhash& This iconhash
*/
const iconhash& as_iconhash() const&;

/**
* @brief Get as icon hash.
*
* @warn The behavior is undefined if `is_iconhash() == false`
* @warning The behavior is undefined if `is_iconhash() == false`
* @return iconhash& This iconhash
*/
iconhash&& as_iconhash() &&;
Expand All @@ -539,23 +540,23 @@ struct icon {
/**
* @brief Get as image data.
*
* @warn The behavior is undefined if `is_image_data() == false`
* @warning The behavior is undefined if `is_image_data() == false`
* @return image_data& This image
*/
image_data& as_image_data() &;

/**
* @brief Get as image.
*
* @warn The behavior is undefined if `is_image_data() == false`
* @warning The behavior is undefined if `is_image_data() == false`
* @return image_data& This image
*/
const image_data& as_image_data() const&;

/**
* @brief Get as image.
*
* @warn The behavior is undefined if `is_image_data() == false`
* @warning The behavior is undefined if `is_image_data() == false`
* @return image_data& This image
*/
image_data&& as_image_data() &&;
Expand Down
4 changes: 4 additions & 0 deletions src/dpp/cluster_coro_calls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,10 @@ async<confirmation_callback_t> cluster::co_message_edit(const message &m) {
return async{ this, static_cast<void (cluster::*)(const message &, command_completion_event_t)>(&cluster::message_edit), m };
}

async<confirmation_callback_t> cluster::co_message_edit_flags(const message &m) {
return async{ this, static_cast<void (cluster::*)(const message &, command_completion_event_t)>(&cluster::message_edit_flags), m };
}

async<confirmation_callback_t> cluster::co_message_get(snowflake message_id, snowflake channel_id) {
return async{ this, static_cast<void (cluster::*)(snowflake, snowflake, command_completion_event_t)>(&cluster::message_get), message_id, channel_id };
}
Expand Down
4 changes: 4 additions & 0 deletions src/dpp/cluster_sync_calls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,10 @@ message cluster::message_edit_sync(const message &m) {
return dpp::sync<message>(this, static_cast<void (cluster::*)(const message &, command_completion_event_t)>(&cluster::message_edit), m);
}

message cluster::message_edit_flags_sync(const message &m) {
return dpp::sync<message>(this, static_cast<void (cluster::*)(const message &, command_completion_event_t)>(&cluster::message_edit_flags), m);
}

message cluster::message_get_sync(snowflake message_id, snowflake channel_id) {
return dpp::sync<message>(this, static_cast<void (cluster::*)(snowflake, snowflake, command_completion_event_t)>(&cluster::message_get), message_id, channel_id);
}
Expand Down

0 comments on commit 44bfb17

Please sign in to comment.