libgourou/include/fulfillment_item.h

87 lines
1.9 KiB
C
Raw Permalink Normal View History

2021-07-03 21:57:53 +02:00
/*
Copyright 2021 Grégory Soutadé
This file is part of libgourou.
libgourou is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
libgourou 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
2021-08-21 20:37:07 +02:00
along with libgourou. If not, see <http://www.gnu.org/licenses/>.
2021-07-03 21:57:53 +02:00
*/
#ifndef _FULFILLMENT_ITEM_H_
#define _FULFILLMENT_ITEM_H_
2022-04-03 09:32:06 +02:00
#include "loan_token.h"
2021-07-03 21:57:53 +02:00
#include <pugixml.hpp>
namespace gourou
{
class User;
/**
* @brief This class is a container for a fulfillment object
*/
class FulfillmentItem
{
public:
/**
* @brief Main constructor. Not to be called by user
*
* @param doc Fulfill reply
* @param user User pointer
*/
2021-07-03 21:57:53 +02:00
FulfillmentItem(pugi::xml_document& doc, User* user);
2022-04-03 09:32:06 +02:00
~FulfillmentItem();
2021-07-03 21:57:53 +02:00
/**
* @brief Return metadata value from ACSM metadata section
*
* @param name Name of key to return
*/
std::string getMetadata(std::string name);
/**
* @brief Return rights generated by ACS server (XML format)
*/
std::string getRights();
/**
* @brief Return epub download URL
*/
std::string getDownloadURL();
/**
* @brief Return resource value
*/
std::string getResource();
2022-04-03 09:32:06 +02:00
/**
* @brief Return loan token if there is one
*/
LoanToken* getLoanToken();
2021-07-03 21:57:53 +02:00
private:
pugi::xml_document fulfillDoc;
2021-07-03 21:57:53 +02:00
pugi::xml_node metadatas;
pugi::xml_document rights;
std::string downloadURL;
std::string resource;
2022-04-03 09:32:06 +02:00
LoanToken* loanToken;
2021-07-03 21:57:53 +02:00
void buildRights(const pugi::xml_node& licenseToken, User* user);
};
}
#endif