aboutsummaryrefslogtreecommitdiffstats
path: root/src/activitypub/fields.h
blob: 59d3858989cba55a354923a71385f586e4b9ab87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once

#include "src/types.h"
#include <QString>
#include <QStringList>
#include <vector>

enum struct APObjectType {NOTE, QUESTION, UNKNOWN};

// All these fields (including APAttachmentFields, etc. in other files) are made to map to the fields present in the ActivityStream JSON's "object" for very easy construction.
// There are additional fields that we don't use so they are not included in the objects (including parent and APActivity).

struct APQuestionFields {
    QString end_time;
    QString closed_time;
    int total_votes;
    struct Option {
        QString name;
        int votes;
    };
    std::vector<Option> poll_options;
};

struct APAttachmentFields {
    QString path;
    QString filename; // "nicer" filename
    QString media_type;
    QString name;
};

struct APObjectFields {
    QStringList to_actors; // Start APObject
    QStringList cc_actors;
    QString by_actor;
    QString object_url;
    QString web_url;
    QString reply_to_url;
    QString published;
    std::vector<APAttachmentFields> attachments; // End APObject
    QStringList languages; // This is taken from "content_map"
    QString content;
    QString summary;
    StatusType visibility; // status type discovery is better left to the archive/API parser as this can very between fedi implementations and archive formats

    APQuestionFields question = {}; // only fill if it's of type Question.
};