| 1 | /************************************************************************************ |
| 2 | * |
| 3 | * D++, A Lightweight C++ library for Discord |
| 4 | * |
| 5 | * SPDX-License-Identifier: Apache-2.0 |
| 6 | * Copyright 2021 Craig Edwards and D++ contributors |
| 7 | * (https://github.com/brainboxdotcc/DPP/graphs/contributors) |
| 8 | * |
| 9 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 10 | * you may not use this file except in compliance with the License. |
| 11 | * You may obtain a copy of the License at |
| 12 | * |
| 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | * |
| 15 | * Unless required by applicable law or agreed to in writing, software |
| 16 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 18 | * See the License for the specific language governing permissions and |
| 19 | * limitations under the License. |
| 20 | * |
| 21 | ************************************************************************************/ |
| 22 | #pragma once |
| 23 | #include <dpp/export.h> |
| 24 | #include <dpp/snowflake.h> |
| 25 | #include <dpp/json_fwd.h> |
| 26 | #include <dpp/json_interface.h> |
| 27 | |
| 28 | namespace dpp { |
| 29 | |
| 30 | /** |
| 31 | * @brief Defines a request to count prunable users, or start a prune operation |
| 32 | */ |
| 33 | struct DPP_EXPORT prune : public json_interface<prune> { |
| 34 | protected: |
| 35 | friend struct json_interface<prune>; |
| 36 | |
| 37 | /** Fill this object from json. |
| 38 | * @param j JSON object to fill from |
| 39 | * @return A reference to self |
| 40 | */ |
| 41 | prune& fill_from_json_impl(nlohmann::json* j); |
| 42 | |
| 43 | /** Build JSON from this object. |
| 44 | * @param with_prune_count True if the prune count boolean is to be set in the built JSON |
| 45 | * @return The JSON of the prune object |
| 46 | */ |
| 47 | virtual json to_json_impl(bool with_prune_count = false) const; |
| 48 | |
| 49 | public: |
| 50 | /** |
| 51 | * @brief Destroy this prune object |
| 52 | */ |
| 53 | virtual ~prune() = default; |
| 54 | |
| 55 | /** |
| 56 | * @brief Number of days to include in the prune. |
| 57 | */ |
| 58 | uint32_t days = 0; |
| 59 | |
| 60 | /** |
| 61 | * @brief Roles to include in the prune (empty to include everyone). |
| 62 | */ |
| 63 | std::vector<snowflake> include_roles; |
| 64 | |
| 65 | /** |
| 66 | * @brief True if the count of pruneable users should be returned. |
| 67 | * @warning Discord recommend not using this on big guilds. |
| 68 | */ |
| 69 | bool compute_prune_count; |
| 70 | |
| 71 | /** |
| 72 | * @brief Build JSON from this object. |
| 73 | * |
| 74 | * @param with_id True if the prune count boolean is to be set in the built JSON |
| 75 | * @return The JSON of the prune object |
| 76 | */ |
| 77 | json to_json(bool with_id = false) const; // Intentional shadow of json_interface, mostly present for documentation |
| 78 | }; |
| 79 | |
| 80 | } |