@@ -147,6 +147,55 @@ public function getDDoSHistory() {
147
147
return $ this ->getApi ()->dataGet ($ url );
148
148
}
149
149
150
+ /**
151
+ * Lists all changelog items, which are available for the service.
152
+ * A changelog item consists of a message with additional information.
153
+ * This items will be used to show game updates and other notification
154
+ * type messages to the service. A changelog item has the following
155
+ * attributes:
156
+ *
157
+ * category Which category the item will be (default "Game")
158
+ * created When the item is created
159
+ * status
160
+ * name What status the item has (e.g. "Update")
161
+ * icon Icon name to use for display purpose
162
+ * button_class CSS Class to use for display purpose
163
+ * text The actual message to display
164
+ * game The full game name
165
+ * alert If the message is an alert message
166
+ *
167
+ * If the first parameter is set to true, changelog items for all
168
+ * games will be returned. With the second parameter you can
169
+ * suppress all non alert messages.
170
+ *
171
+ * @param boolean true if you need items from all games
172
+ * @param boolean true if only alerts should be shown
173
+ *
174
+ * @return array a list of changelog items
175
+ */
176
+ public function getChangelogItems ($ allGames = false , $ onlyAlerts = false ) {
177
+ $ changelogs = $ this ->getApi ()->dataGet ('/changelogs ' );
178
+ if (!isset ($ changelogs ['changelogs ' ])) return [];
179
+
180
+ $ filteredChangelogs = $ changelogs ['changelogs ' ];
181
+
182
+ // Filter out all non current game related items
183
+ if (!$ allGames ) {
184
+ $ details = $ this ->getServiceDetails ();
185
+ if (!isset ($ details ['game ' ])) return [];
186
+ foreach ($ filteredChangelogs as $ i => $ changelog )
187
+ if (!isset ($ changelog ['game ' ]) || $ changelog ['game ' ] != $ details ['game ' ])
188
+ unset($ filteredChangelogs [$ i ]);
189
+ }
190
+
191
+ // Filter out all normal items (only alerts)
192
+ if ($ onlyAlerts )
193
+ foreach ($ filteredChangelogs as $ i => $ changelog )
194
+ if (!$ changelog ['alert ' ]) unset($ filteredChangelogs [$ i ]);
195
+
196
+ return $ filteredChangelogs ;
197
+ }
198
+
150
199
/**
151
200
* Returns the last log entries. You can optionally
152
201
* provide a page number.
0 commit comments