-
Notifications
You must be signed in to change notification settings - Fork 1
/
operation-manage-create-poll-request.x
146 lines (127 loc) · 3.69 KB
/
operation-manage-create-poll-request.x
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
%#include "xdr/reviewable-request-create-poll.h"
namespace stellar
{
//: Actions that can be applied to a `CREATE_POLL` request
enum ManageCreatePollRequestAction
{
CREATE = 0,
CANCEL = 1
};
//: CreatePollRequestData is used to pass necessary data to create a `CREATE_POLL` request
struct CreatePollRequestData
{
//: Body of `CREATE_POLL` request
CreatePollRequest request;
//: Bit mask that will be used instead of the value from key-value entry by
//: `create_poll_tasks:<permissionType>` key
uint32* allTasks;
//: reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
//: CancelPollRequestData is used to pass necessary data to remove a `CREATE_POLL` request
struct CancelPollRequestData
{
//: ID of `CREATE_POLL` request to remove
uint64 requestID;
//: reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
//: ManageCreatePollRequestOp is used to create or remove a `CREATE_POLL` request
struct ManageCreatePollRequestOp
{
//: data is used to pass one of `ManageCreatePollRequestAction` with required params
union switch (ManageCreatePollRequestAction action)
{
case CREATE:
CreatePollRequestData createData;
case CANCEL:
CancelPollRequestData cancelData;
}
data;
//: reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
//: Result codes of ManageCreatePollRequestOp
enum ManageCreatePollRequestResultCode
{
//: `CREATE_POLL` request has either been successfully created
//: or auto approved
SUCCESS = 0,
// codes considered as "failure" for the operation
//: Passed details have invalid json structure
INVALID_CREATOR_DETAILS = -1,
//: There is no `CREATE_POLL` request with such id
NOT_FOUND = -2,
//: Not allowed to create poll which has `endTime` not later than `startTime`
INVALID_DATES = -3,
//: Not allowed to create poll which `endTime` early than currentTime
INVALID_END_TIME = -4,
//: There is no account which such id
RESULT_PROVIDER_NOT_FOUND = -5,
//: There is no key-value entry by `create_poll_tasks:<permissionType>` key in the system;
//: configuration does not allow to create `CREATE_POLL` request with such `permissionType`
CREATE_POLL_TASKS_NOT_FOUND = -6,
//: Not allowed to create poll with zero number of choices
INVALID_NUMBER_OF_CHOICES = -7
};
//: CreatePollRequestResponse is used to pass useful fields after `CREATE_POLL` request creation
struct CreatePollRequestResponse
{
//: ID of a created request
uint64 requestID;
//: Indicates whether or not the `CREATE_POLL` request was auto approved and fulfilled
//: True means that poll was successfully created
bool fulfilled;
//: ID of created poll if request was fulfilled
uint64* pollID;
//: reserved for the future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
//: Success result of operation application
struct ManageCreatePollRequestSuccessResult
{
//: `details` id used to pass useful fields
union switch (ManageCreatePollRequestAction action)
{
case CREATE:
CreatePollRequestResponse response;
case CANCEL:
void;
} details;
//: reserved for future use
union switch (LedgerVersion v)
{
case EMPTY_VERSION:
void;
}
ext;
};
//: Result of ManageCreatePollRequestOp application
union ManageCreatePollRequestResult switch (ManageCreatePollRequestResultCode code)
{
case SUCCESS:
ManageCreatePollRequestSuccessResult success;
default:
void;
};
}