redmine-api-cpp/include/Redmine/Project.hpp

85 lines
2.4 KiB
C++
Raw Permalink Normal View History

2024-08-05 20:54:45 +02:00
#pragma once
/*
* Copyright (C) 2024 Dominik Meyer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "nlohmann/json_fwd.hpp"
#include <cstdint>
#include <nlohmann/json.hpp>
#include <Redmine/Object.hpp>
#include <string>
/**
* @brief The main namespace of this library for Redmine related datatypes, classes, and functions
*
*/
namespace Redmine
{
/**
* @brief This class represents a user within the redmine server.
*
*/
2024-08-05 23:16:52 +02:00
class Project : public Redmine::Object
2024-08-05 20:54:45 +02:00
{
private:
/// the data store for the issue
nlohmann::json data_;
/**
2024-08-05 23:16:52 +02:00
* @brief verify project data
2024-08-05 20:54:45 +02:00
*
2024-08-05 23:16:52 +02:00
* @param data - the json object containing the project data
2024-08-05 20:54:45 +02:00
*/
void _verify(const nlohmann::json &data);
public:
2024-08-05 23:16:52 +02:00
explicit Project(const nlohmann::json &project);
2024-08-05 20:54:45 +02:00
/**
2024-08-05 23:16:52 +02:00
* @brief set the project object from a json object
2024-08-05 20:54:45 +02:00
*
* @param data
*/
void set(const nlohmann::json &data);
/**
2024-08-05 23:16:52 +02:00
* @brief return a json object from the project object
2024-08-05 20:54:45 +02:00
*
* @return nlohmann::json
*/
nlohmann::json get() const;
2024-08-05 23:16:52 +02:00
/**
* @brief Get the Id of the project
*
* @return std::uint64_t
*/
2024-08-05 20:54:45 +02:00
std::uint64_t getId() const;
2024-08-05 23:16:52 +02:00
std::string getName() const;
std::string getStringID() const;
2024-08-05 20:54:45 +02:00
2024-08-05 23:16:52 +02:00
/**
* @brief convert the project object to a string
*
* @return std::string
*/
std::string to_string() const;
}; // class Project
2024-08-05 20:54:45 +02:00
}; // namespace Redmine