libkazv
Loading...
Searching...
No Matches
content-repo.hpp
Go to the documentation of this file.
1/******************************************************************************
2 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
3 */
4
5#pragma once
6
7#include "basejob.hpp"
8#include "file-desc.hpp"
9
10namespace Kazv::Api {
11
15class UploadContentJob : public BaseJob {
16public:
17
18
19
20class JobResponse : public Response
21{
22
23public:
25 bool success() const;
26
27 // Result properties
28
29
30
31
33std::string contentUri() const;
34
35};
36 static constexpr auto needsAuth() {
37 return true
38 ;
39 }
40
41
42// Construction/destruction
43
55 explicit UploadContentJob(std::string serverUrl
56 , std::string _accessToken
57 ,
58 FileDesc content , std::optional<std::string> filename = std::nullopt, std::optional<std::string> contentType = std::nullopt
59 );
60
61
63 std::optional<std::string> filename);
64
65 static BaseJob::Body buildBody(FileDesc content, std::optional<std::string> filename, std::optional<std::string> contentType);
66
67 static std::map<std::string, std::string> buildHeader(std::optional<std::string> contentType);
68
69
70
73 };
75 }
76 namespace nlohmann
77 {
78 using namespace Kazv;
79 using namespace Kazv::Api;
80
81 }
82
83 namespace Kazv::Api
84 {
85
89class GetContentJob : public BaseJob {
90public:
91
92
93
94class JobResponse : public Response
95{
96
97public:
99 bool success() const;
100
101 // Result properties
102
104std::optional<std::string> contentType() const
105 {
106 auto it = header->find("Content-Type");
107 if (it != header->end()) {
108 return it->second;
109 } else {
110 return std::nullopt;
111 }
112 }
113
115std::optional<std::string> contentDisposition() const
116 {
117 auto it = header->find("Content-Disposition");
118 if (it != header->end()) {
119 return it->second;
120 } else {
121 return std::nullopt;
122 }
123 }
124
126 inline Body data() const
127 {
128 return body;
129 }
130
131
132
133};
134 static constexpr auto needsAuth() {
135 return
136 false;
137 }
138
139
140// Construction/destruction
141
155 explicit GetContentJob(std::string serverUrl
156
157 ,
158 std::string serverName , std::string mediaId , bool allowRemote = true
159 , std::optional<FileDesc> downloadTo = std::nullopt);
160
161
163 bool allowRemote);
164
165 static BaseJob::Body buildBody(std::string serverName, std::string mediaId, bool allowRemote);
166
167
168
169 static const immer::array<std::string> expectedContentTypes;
170
173 };
175 }
176 namespace nlohmann
177 {
178 using namespace Kazv;
179 using namespace Kazv::Api;
180
181 }
182
183 namespace Kazv::Api
184 {
185
193public:
194
195
196
197class JobResponse : public Response
198{
199
200public:
202 bool success() const;
203
204 // Result properties
205
207std::optional<std::string> contentType() const
208 {
209 auto it = header->find("Content-Type");
210 if (it != header->end()) {
211 return it->second;
212 } else {
213 return std::nullopt;
214 }
215 }
216
219std::optional<std::string> contentDisposition() const
220 {
221 auto it = header->find("Content-Disposition");
222 if (it != header->end()) {
223 return it->second;
224 } else {
225 return std::nullopt;
226 }
227 }
228
230 inline Body data() const
231 {
232 return body;
233 }
234
235
236
237};
238 static constexpr auto needsAuth() {
239 return
240 false;
241 }
242
243
244// Construction/destruction
245
262 explicit GetContentOverrideNameJob(std::string serverUrl
263
264 ,
265 std::string serverName , std::string mediaId , std::string fileName , bool allowRemote = true
266 , std::optional<FileDesc> downloadTo = std::nullopt);
267
268
270 bool allowRemote);
271
272 static BaseJob::Body buildBody(std::string serverName, std::string mediaId, std::string fileName, bool allowRemote);
273
274
275
276 static const immer::array<std::string> expectedContentTypes;
277
280 };
282 }
283 namespace nlohmann
284 {
285 using namespace Kazv;
286 using namespace Kazv::Api;
287
288 }
289
290 namespace Kazv::Api
291 {
292
299public:
300
301
302
303class JobResponse : public Response
304{
305
306public:
308 bool success() const;
309
310 // Result properties
311
313std::optional<std::string> contentType() const
314 {
315 auto it = header->find("Content-Type");
316 if (it != header->end()) {
317 return it->second;
318 } else {
319 return std::nullopt;
320 }
321 }
322
324 inline Body data() const
325 {
326 return body;
327 }
328
329
330
331};
332 static constexpr auto needsAuth() {
333 return
334 false;
335 }
336
337
338// Construction/destruction
339
365 explicit GetContentThumbnailJob(std::string serverUrl
366
367 ,
368 std::string serverName , std::string mediaId , int width , int height , std::optional<std::string> method = std::nullopt, bool allowRemote = true
369 , std::optional<FileDesc> downloadTo = std::nullopt);
370
371
373 int width, int height, std::optional<std::string> method, bool allowRemote);
374
375 static BaseJob::Body buildBody(std::string serverName, std::string mediaId, int width, int height, std::optional<std::string> method, bool allowRemote);
376
377
378
379 static const immer::array<std::string> expectedContentTypes;
380
383 };
385 }
386 namespace nlohmann
387 {
388 using namespace Kazv;
389 using namespace Kazv::Api;
390
391 }
392
393 namespace Kazv::Api
394 {
395
407class GetUrlPreviewJob : public BaseJob {
408public:
409
410
411
412class JobResponse : public Response
413{
414
415public:
417 bool success() const;
418
419 // Result properties
420
421
422
423
425std::optional<std::int_fast64_t> matrixImageSize() const;
426
427
429std::optional<std::string> ogImage() const;
430
431};
432 static constexpr auto needsAuth() {
433 return true
434 ;
435 }
436
437
438// Construction/destruction
439
450 explicit GetUrlPreviewJob(std::string serverUrl
451 , std::string _accessToken
452 ,
453 std::string url , std::optional<std::int_fast64_t> ts = std::nullopt
454 );
455
456
458 std::string url, std::optional<std::int_fast64_t> ts);
459
460 static BaseJob::Body buildBody(std::string url, std::optional<std::int_fast64_t> ts);
461
462
463
464
465
468 };
470 }
471 namespace nlohmann
472 {
473 using namespace Kazv;
474 using namespace Kazv::Api;
475
476 }
477
478 namespace Kazv::Api
479 {
480
494class GetConfigJob : public BaseJob {
495public:
496
497
498
499class JobResponse : public Response
500{
501
502public:
504 bool success() const;
505
506 // Result properties
507
508
509
510
514std::optional<std::int_fast64_t> uploadSize() const;
515
516};
517 static constexpr auto needsAuth() {
518 return true
519 ;
520 }
521
522
523// Construction/destruction
524
526 explicit GetConfigJob(std::string serverUrl
527 , std::string _accessToken
528
529
530 );
531
532
534 );
535
536 static BaseJob::Body buildBody();
537
538
539
540
541
543 GetConfigJob withData(JsonWrap j) const &;
544 };
546 }
547 namespace nlohmann
548 {
549 using namespace Kazv;
550 using namespace Kazv::Api;
551
552 }
553
554 namespace Kazv::Api
555 {
556
557} // namespace Kazv::Api
Definition content-repo.hpp:500
bool success() const
Definition content-repo.cpp:472
std::optional< std::int_fast64_t > uploadSize() const
The maximum size an upload can be in bytes.
Definition content-repo.cpp:482
Get the configuration for the content repository.
Definition content-repo.hpp:494
GetConfigJob withData(JsonWrap j) &&
Definition content-repo.cpp:455
static constexpr auto needsAuth()
Definition content-repo.hpp:517
static BaseJob::Query buildQuery()
Definition content-repo.cpp:415
static BaseJob::Body buildBody()
Definition content-repo.cpp:423
Definition content-repo.hpp:95
Body data() const
The content that was previously uploaded.
Definition content-repo.hpp:126
std::optional< std::string > contentType() const
The content type of the file that was previously uploaded.
Definition content-repo.hpp:104
bool success() const
Definition content-repo.cpp:164
std::optional< std::string > contentDisposition() const
The name of the file that was previously uploaded, if set.
Definition content-repo.hpp:115
Download content from the content repository.
Definition content-repo.hpp:89
static constexpr auto needsAuth()
Definition content-repo.hpp:134
GetContentJob withData(JsonWrap j) &&
Definition content-repo.cpp:147
static BaseJob::Query buildQuery(bool allowRemote)
Definition content-repo.cpp:106
static BaseJob::Body buildBody(std::string serverName, std::string mediaId, bool allowRemote)
Definition content-repo.cpp:115
static const immer::array< std::string > expectedContentTypes
Definition content-repo.hpp:169
bool success() const
Definition content-repo.cpp:234
Body data() const
The content that was previously uploaded.
Definition content-repo.hpp:230
std::optional< std::string > contentType() const
The content type of the file that was previously uploaded.
Definition content-repo.hpp:207
std::optional< std::string > contentDisposition() const
The fileName requested or the name of the file that was previously uploaded, if set.
Definition content-repo.hpp:219
Download content from the content repository overriding the file name.
Definition content-repo.hpp:192
GetContentOverrideNameJob withData(JsonWrap j) &&
Definition content-repo.cpp:217
static constexpr auto needsAuth()
Definition content-repo.hpp:238
static BaseJob::Query buildQuery(bool allowRemote)
Definition content-repo.cpp:176
static BaseJob::Body buildBody(std::string serverName, std::string mediaId, std::string fileName, bool allowRemote)
Definition content-repo.cpp:185
static const immer::array< std::string > expectedContentTypes
Definition content-repo.hpp:276
Definition content-repo.hpp:304
std::optional< std::string > contentType() const
The content type of the thumbnail.
Definition content-repo.hpp:313
bool success() const
Definition content-repo.cpp:310
Body data() const
A thumbnail of the requested content.
Definition content-repo.hpp:324
Download a thumbnail of content from the content repository.
Definition content-repo.hpp:298
GetContentThumbnailJob withData(JsonWrap j) &&
Definition content-repo.cpp:293
static BaseJob::Query buildQuery(int width, int height, std::optional< std::string > method, bool allowRemote)
Definition content-repo.cpp:246
static const immer::array< std::string > expectedContentTypes
Definition content-repo.hpp:379
static constexpr auto needsAuth()
Definition content-repo.hpp:332
static BaseJob::Body buildBody(std::string serverName, std::string mediaId, int width, int height, std::optional< std::string > method, bool allowRemote)
Definition content-repo.cpp:261
Definition content-repo.hpp:413
bool success() const
Definition content-repo.cpp:382
std::optional< std::string > ogImage() const
An MXC URI to the image. Omitted if there is no image.
Definition content-repo.cpp:403
std::optional< std::int_fast64_t > matrixImageSize() const
The byte-size of the image. Omitted if there is no image attached.
Definition content-repo.cpp:392
Get information about a URL for a client.
Definition content-repo.hpp:407
GetUrlPreviewJob withData(JsonWrap j) &&
Definition content-repo.cpp:365
static BaseJob::Query buildQuery(std::string url, std::optional< std::int_fast64_t > ts)
Definition content-repo.cpp:322
static BaseJob::Body buildBody(std::string url, std::optional< std::int_fast64_t > ts)
Definition content-repo.cpp:333
static constexpr auto needsAuth()
Definition content-repo.hpp:432
Definition content-repo.hpp:21
std::string contentUri() const
The MXC URI to the uploaded content.
Definition content-repo.cpp:94
bool success() const
Definition content-repo.cpp:83
Upload some content to the content repository.
Definition content-repo.hpp:15
static std::map< std::string, std::string > buildHeader(std::optional< std::string > contentType)
Definition content-repo.cpp:12
static BaseJob::Query buildQuery(std::optional< std::string > filename)
Definition content-repo.cpp:22
UploadContentJob withData(JsonWrap j) &&
Definition content-repo.cpp:66
static constexpr auto needsAuth()
Definition content-repo.hpp:36
static BaseJob::Body buildBody(FileDesc content, std::optional< std::string > filename, std::optional< std::string > contentType)
Definition content-repo.cpp:31
Definition basejob.hpp:94
Definition basejob.hpp:68
std::string url() const
Definition basejob.cpp:111
::Kazv::Body Body
Definition basejob.hpp:103
Definition file-desc.hpp:225
Definition jsonwrap.hpp:23
Definition location.hpp:10
Definition location.hpp:10
Definition location.hpp:27
Definition basejob.hpp:49
Header header
Definition basejob.hpp:53
Body body
Definition basejob.hpp:52