redmine-api-cpp/src/Redmine-CLI/Command/MyAccount.hpp

105 lines
2.7 KiB
C++

#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 <CLI/App.hpp>
#include <Redmine/API.hpp>
#include <atomic>
#include <cstdint>
#include <memory>
#include <string>
#define LOGURU_WITH_STREAMS 1
#include <loguru.hpp>
#include <CLI/CLI.hpp>
// forward declaration
namespace RedmineCLI
{
class Redmine;
};
namespace Command
{
/**
* @brief class for processing the CLI11 parsed command lines
*
*/
class MyAccount
{
private:
/// the main redmine cli application context
RedmineCLI::Redmine *redmine_;
/// enum for identifying supported output types
enum outputType : std::uint16_t
{
/// output is just text
TEXT,
/// output is yaml
YAML
};
std::map<std::string, outputType> outputMap{{"text", TEXT}, {"yaml", YAML}};
/// pointer to the get subcommand
CLI::App* myAccountGet;
/// pointer to the set subcommand
CLI::App* myAccountSet;
/// vector to hold requested attribute fields
std::vector<std::string> fields_;
/// requested output type
outputType output_;
/// the actual implementation of the information get
void get_() const;
/// the actual implementation of the information set
void set_() const;
/// parameter for setting the firstname
std::string firstname_;
/// parameter for setting the lastname
std::string lastname_;
/// parameter for setting the login
std::string login_;
/// parameter for setting the id
std::string id_;
/// parameter for setting the email
std::string mail_;
public:
/**
* @brief Construct a new CLIProcessor object
*
*/
MyAccount(RedmineCLI::Redmine *r);
}; // class MyAccount
}; // namespace Command