@dcl/protocol 1.0.0-5824184720.commit-b3b5ebf → 1.0.0-6160718705.commit-03626d7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcl/protocol",
3
- "version": "1.0.0-5824184720.commit-b3b5ebf",
3
+ "version": "1.0.0-6160718705.commit-03626d7",
4
4
  "description": "",
5
5
  "repository": "decentraland/protocol.git",
6
6
  "homepage": "https://github.com/decentraland/protocol#readme",
@@ -29,5 +29,5 @@
29
29
  "out-js",
30
30
  "public"
31
31
  ],
32
- "commit": "b3b5ebfeb9468854c4d492df514113421a572916"
32
+ "commit": "03626d76db879afcdfd4fbcdc0342a04e5b4f663"
33
33
  }
@@ -0,0 +1,185 @@
1
+ syntax = "proto3";
2
+ package decentraland.quests;
3
+
4
+ import "google/protobuf/empty.proto";
5
+
6
+ // Errors
7
+ message InvalidQuest {}
8
+
9
+ message NotUUID {}
10
+
11
+ message InternalServerError {}
12
+
13
+ message NotFoundQuestInstance {}
14
+
15
+ message QuestAlreadyStarted {}
16
+
17
+ message NotOwner {}
18
+
19
+ message IgnoredEvent {}
20
+
21
+ message StartQuestRequest {
22
+ string quest_id = 1;
23
+ }
24
+
25
+ message StartQuestResponse {
26
+ /* There are a few valid reasons to not be accepted:
27
+ * - Quest is not found
28
+ * - Quest is deactivated (the owner deleted it)
29
+ * - User already started the quest
30
+ * - Internal errors (DB connection failed or something like that) */
31
+ message Accepted {}
32
+ oneof response {
33
+ Accepted accepted = 1;
34
+ InvalidQuest invalid_quest = 2;
35
+ NotUUID not_uuid_error = 3;
36
+ InternalServerError internal_server_error = 4;
37
+ QuestAlreadyStarted quest_already_started = 5;
38
+ }
39
+ }
40
+
41
+ message AbortQuestRequest {
42
+ string quest_instance_id = 1;
43
+ }
44
+
45
+ message AbortQuestResponse {
46
+ /* There are a few valid reasons to not be accepted:
47
+ * - Quest instance is not found
48
+ * - Quest instance is from another user
49
+ * - Quest instance already aborted
50
+ * - Internal errors (DB connection failed or something like that) */
51
+ message Accepted {}
52
+ oneof response {
53
+ Accepted accepted = 1;
54
+ NotFoundQuestInstance not_found_quest_instance = 2;
55
+ NotUUID not_uuid_error = 3;
56
+ NotOwner not_owner = 4;
57
+ InternalServerError internal_server_error = 5;
58
+ }
59
+ }
60
+
61
+ message Event {
62
+ string id = 1;
63
+ string address = 2;
64
+ Action action = 3;
65
+ }
66
+
67
+ message EventRequest {
68
+ Action action = 1;
69
+ }
70
+
71
+ message EventResponse {
72
+ oneof response {
73
+ string accepted_event_id = 1;
74
+ IgnoredEvent ignored_event = 2;
75
+ InternalServerError internal_server_error = 3;
76
+ }
77
+ }
78
+
79
+ message QuestDefinition {
80
+ repeated Step steps = 1;
81
+ repeated Connection connections = 2;
82
+ }
83
+
84
+ message Connection {
85
+ string step_from = 1;
86
+ string step_to = 2;
87
+ }
88
+
89
+ message Step {
90
+ string id = 1;
91
+ string description = 2;
92
+ repeated Task tasks = 3;
93
+ }
94
+
95
+ message Action {
96
+ string type = 1;
97
+ map<string, string> parameters = 2;
98
+ }
99
+
100
+ message Task {
101
+ string id = 1;
102
+ string description = 2;
103
+ repeated Action action_items = 3;
104
+ }
105
+
106
+ message StepContent {
107
+ repeated Task to_dos = 1;
108
+ repeated Task tasks_completed = 2;
109
+ }
110
+
111
+ message QuestState {
112
+ map<string, StepContent> current_steps = 2;
113
+ fixed32 steps_left = 3;
114
+ repeated string steps_completed = 4;
115
+ repeated string required_steps = 5;
116
+ }
117
+
118
+ message Quest {
119
+ string id = 1;
120
+ string name = 2;
121
+ string description = 3;
122
+ QuestDefinition definition = 4;
123
+ string creator_address = 5;
124
+ string image_url = 6;
125
+ bool active = 7;
126
+ fixed32 created_at = 8;
127
+ }
128
+
129
+ message QuestInstance {
130
+ string id = 1;
131
+ Quest quest = 2;
132
+ QuestState state = 3;
133
+ }
134
+
135
+ message QuestStateUpdate {
136
+ string instance_id = 1;
137
+ QuestState quest_state = 2;
138
+ string event_id = 3;
139
+ }
140
+
141
+ message UserUpdate {
142
+ oneof message {
143
+ bool subscribed = 1;
144
+ QuestStateUpdate quest_state_update = 2;
145
+ QuestInstance new_quest_started = 3;
146
+ string event_ignored = 4;
147
+ }
148
+ string user_address = 5;
149
+ }
150
+
151
+ message Quests {
152
+ repeated QuestInstance instances = 1;
153
+ }
154
+
155
+ message GetAllQuestsResponse {
156
+ oneof response {
157
+ Quests quests = 1;
158
+ InternalServerError internal_server_error = 2;
159
+ }
160
+ }
161
+
162
+ message GetQuestDefinitionRequest {
163
+ string quest_id = 1;
164
+ }
165
+
166
+ message GetQuestDefinitionResponse {
167
+ oneof response {
168
+ Quest quest = 1;
169
+ InternalServerError internal_server_error = 2;
170
+ }
171
+ }
172
+
173
+ service QuestsService {
174
+ // User actions
175
+ rpc StartQuest(StartQuestRequest) returns (StartQuestResponse) {}
176
+ rpc AbortQuest(AbortQuestRequest) returns (AbortQuestResponse) {}
177
+ rpc SendEvent(EventRequest) returns (EventResponse) {}
178
+
179
+ // Listen to changes in quest states and event processing updates
180
+ rpc Subscribe(google.protobuf.Empty) returns (stream UserUpdate) {}
181
+
182
+ // Query quest information
183
+ rpc GetAllQuests(google.protobuf.Empty) returns (GetAllQuestsResponse) {}
184
+ rpc GetQuestDefinition(GetQuestDefinitionRequest) returns (GetQuestDefinitionResponse) {}
185
+ }