Skip to content

Commit 8b5b30e

Browse files
authored
Fix #1373 LogsResponse in AuditClient returns "ok: false" when request was a success (#1374)
* Fix #1373 LogsResponse in AuditClient returns "ok: false" when request was a success * Fix
1 parent 46b1fcd commit 8b5b30e

File tree

11 files changed

+70
-7
lines changed

11 files changed

+70
-7
lines changed

json-logs/raw/audit/v1/actions.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,9 @@
323323
"external_shared_channel_invite_request_approved",
324324
"external_shared_channel_invite_request_denied",
325325
"channel_tab_added",
326-
"channel_tab_removed"
326+
"channel_tab_removed",
327+
"external_shared_channel_host_transferred",
328+
"channel_template_provisioned"
327329
],
328330
"app": [
329331
"app_installed",
@@ -502,6 +504,11 @@
502504
"native_dlp_rule_reactivated",
503505
"native_dlp_rule_edited",
504506
"native_dlp_rule_action_applied"
507+
],
508+
"template": [
509+
"template_created",
510+
"template_deleted",
511+
"template_provisioned"
505512
]
506513
}
507514
}

json-logs/raw/audit/v1/schemas.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@
142142
"template_id": "string",
143143
"step_configuration": "vec\u003cdict\u003cstring, mixed\u003e\u003e"
144144
}
145+
},
146+
{
147+
"type": "template",
148+
"template": {
149+
"id": "string",
150+
"template_name": "string"
151+
}
145152
}
146153
]
147154
}

json-logs/samples/audit/v1/actions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@
5959
],
6060
"native_dlp": [
6161
""
62+
],
63+
"template": [
64+
""
6265
]
6366
},
6467
"ok": false,

json-logs/samples/audit/v1/logs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"ok": false,
2+
"ok": true,
33
"warning": "",
44
"error": "",
55
"needed": "",

json-logs/samples/audit/v1/schemas.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@
8484
"updated_by": "",
8585
"step_configuration": "",
8686
"template_id": ""
87+
},
88+
"template": {
89+
"id": "",
90+
"template_name": ""
8791
}
8892
}
8993
],

slack-api-client/src/main/java/com/slack/api/audit/Actions.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ private Channel() {
347347
public static final String external_shared_channel_invite_request_denied = "external_shared_channel_invite_request_denied";
348348
public static final String channel_tab_added = "channel_tab_added";
349349
public static final String channel_tab_removed = "channel_tab_removed";
350+
public static final String external_shared_channel_host_transferred = "external_shared_channel_host_transferred";
351+
public static final String channel_template_provisioned = "channel_template_provisioned";
350352
}
351353

352354
public static class App {
@@ -591,4 +593,13 @@ private NativeDlp() {
591593
public static final String native_dlp_rule_edited = "native_dlp_rule_edited";
592594
public static final String native_dlp_rule_action_applied = "native_dlp_rule_action_applied";
593595
}
596+
597+
public static class Template {
598+
private Template() {
599+
}
600+
601+
public static final String template_created = "template_created";
602+
public static final String template_deleted = "template_deleted";
603+
public static final String template_provisioned = "template_provisioned";
604+
}
594605
}

slack-api-client/src/main/java/com/slack/api/audit/response/ActionsResponse.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@
1212
public class ActionsResponse implements AuditApiResponse {
1313
private transient String rawBody;
1414

15-
private boolean ok;
15+
@Deprecated // when an error is returned, it will be an exception instead
16+
private boolean ok = true;
17+
@Deprecated // when an error is returned, it will be an exception instead
1618
private String warning;
19+
@Deprecated // when an error is returned, it will be an exception instead
1720
private String error;
21+
@Deprecated // when an error is returned, it will be an exception instead
1822
private String needed;
23+
@Deprecated // when an error is returned, it will be an exception instead
1924
private String provided;
2025

2126
private Actions actions;
@@ -43,5 +48,6 @@ public static class Actions {
4348
private List<String> function;
4449
private List<String> salesElevate;
4550
private List<String> nativeDlp;
51+
private List<String> template;
4652
}
4753
}

slack-api-client/src/main/java/com/slack/api/audit/response/LogsResponse.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@
1414
public class LogsResponse implements AuditApiResponse {
1515
private transient String rawBody;
1616

17-
private boolean ok;
17+
@Deprecated // when an error is returned, it will be an exception instead
18+
private boolean ok = true;
19+
@Deprecated // when an error is returned, it will be an exception instead
1820
private String warning;
21+
@Deprecated // when an error is returned, it will be an exception instead
1922
private String error;
23+
@Deprecated // when an error is returned, it will be an exception instead
2024
private String needed;
25+
@Deprecated // when an error is returned, it will be an exception instead
2126
private String provided;
2227

2328
private ResponseMetadata responseMetadata;

slack-api-client/src/main/java/com/slack/api/audit/response/SchemasResponse.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111
public class SchemasResponse implements AuditApiResponse {
1212
private transient String rawBody;
1313

14-
private boolean ok;
14+
@Deprecated // when an error is returned, it will be an exception instead
15+
private boolean ok = true;
16+
@Deprecated // when an error is returned, it will be an exception instead
1517
private String warning;
18+
@Deprecated // when an error is returned, it will be an exception instead
1619
private String error;
20+
@Deprecated // when an error is returned, it will be an exception instead
1721
private String needed;
22+
@Deprecated // when an error is returned, it will be an exception instead
1823
private String provided;
1924

2025
private List<Schema> schemas;
@@ -36,6 +41,7 @@ public static class Schema {
3641
private Barrier barrier;
3742
private Canvas canvas;
3843
private WorkflowV2 workflowV2;
44+
private Template template;
3945
}
4046

4147
@Data
@@ -148,4 +154,10 @@ public static class WorkflowV2 {
148154
private String stepConfiguration;
149155
private String templateId;
150156
}
157+
158+
@Data
159+
public static class Template {
160+
private String id;
161+
private String templateName;
162+
}
151163
}

slack-api-client/src/test/java/test_locally/api/util/json/GsonAuditLogsDetailsChangedValueFactoryTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public void serialize_array() {
231231
List<LogsResponse.Entry> entries = Arrays.asList(entry);
232232
response.setEntries(entries);
233233
String json = gson.toJson(response);
234-
assertThat(json, is("{\"ok\":false,\"entries\":[{\"details\":{" +
234+
assertThat(json, is("{\"ok\":true,\"entries\":[{\"details\":{" +
235235
"\"new_value\":[\"C111\",\"C222\"]," +
236236
"\"previous_value\":[\"C111\",\"C222\"]" +
237237
"}}]}"));
@@ -254,7 +254,7 @@ public void serialize_object() {
254254
List<LogsResponse.Entry> entries = Arrays.asList(entry);
255255
response.setEntries(entries);
256256
String json = gson.toJson(response);
257-
assertThat(json, is("{\"ok\":false,\"entries\":[{\"details\":{" +
257+
assertThat(json, is("{\"ok\":true,\"entries\":[{\"details\":{" +
258258
"\"new_value\":{\"type\":[\"TOPLEVEL_ADMINS_AND_OWNERS_AND_SELECTED\"]}," +
259259
"\"previous_value\":{\"type\":[\"TOPLEVEL_ADMINS_AND_OWNERS_AND_SELECTED\"]}" +
260260
"}}]}"));

0 commit comments

Comments
 (0)