Ditto 4.9.4
 
Loading...
Searching...
No Matches
AttachmentToken.hpp
1#ifndef _DITTO_ATTACHMENT_TOKEN_
2#define _DITTO_ATTACHMENT_TOKEN_
3
4#include "any.hpp"
5#include "json.hpp"
6
7#include <map>
8#include <string>
9#include <vector>
10
11namespace ditto {
12
17class AttachmentToken {
18 friend class AttachmentFetcher;
19 friend struct AttachmentFetcherCtx;
20 friend class AbstractDocumentPath;
21 friend class DocumentPath;
22 friend class MutableDocumentPath;
23 friend class Store;
24
25public:
31 std::string get_id() const;
32
38 uint64_t get_len() const;
39
45 std::map<std::string, std::string> get_metadata() const { return metadata; }
46
47private:
48 nlohmann::json::binary_t id;
49 uint64_t len;
50 std::map<std::string, std::string> metadata;
51
52 explicit AttachmentToken(nlohmann::json const &info);
53 explicit AttachmentToken(
54 std::unordered_map<std::string, any> const &map_representation);
55};
56} // namespace ditto
57#endif
Serves as a token for a specific attachment that you can pass to a call to Store::fetch_attachment.
Definition AttachmentToken.hpp:17
std::string get_id() const
Gets the attachment's ID.
Definition AttachmentToken.cpp:80
uint64_t get_len() const
Gets the attachment's size in bytes.
Definition AttachmentToken.cpp:85
std::map< std::string, std::string > get_metadata() const
Gets the attachment's metadata.
Definition AttachmentToken.hpp:45