@@ -38,6 +38,8 @@ namespace caffql {
3838 using absl::monostate;
3939 using absl::visit;
4040
41+ enum class Operation { Query, Mutation, Subscription };
42+
4143 struct GraphqlError {
4244 std::string message;
4345 };
@@ -685,6 +687,8 @@ namespace caffql {
685687 */
686688 struct StageField {
687689
690+ static Operation constexpr operation = Operation::Subscription;
691+
688692 static Json request (Id const & clientId, ClientType clientType, std::string const & username, optional<bool > constrainedBaseline, optional<std::vector<StageSubscriptionViewerStreamInput>> const & viewerStreams, optional<bool > skipStreamAllocation) {
689693 Json query = R"(
690694 subscription Stage(
@@ -867,6 +871,8 @@ namespace caffql {
867871 */
868872 struct StageField {
869873
874+ static Operation constexpr operation = Operation::Query;
875+
870876 static Json request (std::string const & username) {
871877 Json query = R"(
872878 query Stage(
@@ -1091,9 +1097,20 @@ namespace caffql {
10911097
10921098 Adding a feed may mutate other feeds, since Reyes always maintains a legal
10931099 assignment of roles to the various feeds.
1100+
1101+ Roles are assigned according to the following rules:
1102+
1103+ 1. Each client may have at most 2 feeds on the stage.
1104+ 2. Each client may have at most 1 live hosting feed on the stage.
1105+ 3. If the client did not specify the roles on the feeds, then the last feed
1106+ that was added will be PRIMARY.
1107+ 4. However, if one of the feeds is live hosting, then that feed will be made
1108+ PRIMARY.
10941109 */
10951110 struct AddFeedField {
10961111
1112+ static Operation constexpr operation = Operation::Mutation;
1113+
10971114 static Json request (Id const & clientId, ClientType clientType, FeedInput const & input) {
10981115 Json query = R"(
10991116 mutation AddFeed(
@@ -1246,6 +1263,8 @@ namespace caffql {
12461263 */
12471264 struct SetLiveHostingFeedField {
12481265
1266+ static Operation constexpr operation = Operation::Mutation;
1267+
12491268 static Json request (Id const & clientId, ClientType clientType, FeedInput const & input) {
12501269 Json query = R"(
12511270 mutation SetLiveHostingFeed(
@@ -1390,6 +1409,8 @@ namespace caffql {
13901409 */
13911410 struct UpdateFeedField {
13921411
1412+ static Operation constexpr operation = Operation::Mutation;
1413+
13931414 static Json request (Id const & clientId, ClientType clientType, FeedInput const & input) {
13941415 Json query = R"(
13951416 mutation UpdateFeed(
@@ -1535,6 +1556,8 @@ namespace caffql {
15351556 */
15361557 struct RemoveFeedField {
15371558
1559+ static Operation constexpr operation = Operation::Mutation;
1560+
15381561 static Json request (Id const & clientId, ClientType clientType, Id const & feedId) {
15391562 Json query = R"(
15401563 mutation RemoveFeed(
@@ -1640,6 +1663,8 @@ namespace caffql {
16401663 // If a client is controlling the stage, then only that client may change the title.
16411664 struct ChangeStageTitleField {
16421665
1666+ static Operation constexpr operation = Operation::Mutation;
1667+
16431668 static Json request (Id const & clientId, ClientType clientType, std::string const & title) {
16441669 Json query = R"(
16451670 mutation ChangeStageTitle(
@@ -1748,6 +1773,8 @@ namespace caffql {
17481773 */
17491774 struct StartBroadcastField {
17501775
1776+ static Operation constexpr operation = Operation::Mutation;
1777+
17511778 static Json request (Id const & clientId, ClientType clientType, optional<std::string> const & title) {
17521779 Json query = R"(
17531780 mutation StartBroadcast(
@@ -1856,6 +1883,8 @@ namespace caffql {
18561883 */
18571884 struct StopBroadcastField {
18581885
1886+ static Operation constexpr operation = Operation::Mutation;
1887+
18591888 static Json request (Id const & clientId, optional<bool > keepLiveHostingFeeds) {
18601889 Json query = R"(
18611890 mutation StopBroadcast(
@@ -1966,6 +1995,8 @@ namespace caffql {
19661995 */
19671996 struct RequestViewerStreamField {
19681997
1998+ static Operation constexpr operation = Operation::Mutation;
1999+
19692000 static Json request (Id const & clientId, Id const & feedId) {
19702001 Json query = R"(
19712002 mutation RequestViewerStream(
@@ -2004,6 +2035,8 @@ namespace caffql {
20042035 // This is an admin-only mutation.
20052036 struct TakedownStageField {
20062037
2038+ static Operation constexpr operation = Operation::Mutation;
2039+
20072040 static Json request (std::string const & username) {
20082041 Json query = R"(
20092042 mutation TakedownStage(
0 commit comments