Class AnnounceSupport
java.lang.Object
network.ike.plugin.AnnounceSupport
Posting an announcement to a Zulip stream, split so that everything
except the network call is pure and testable
(IKE-Network/ike-issues#1016).
Exists because the release and checkpoint chains each carried their
own copy of this as shell inside a CI build step — unreproducible off
the server, and prone to a class of bug a goal cannot have (an
unresolved %parameter% reference silently makes a TeamCity
configuration incompatible with every agent).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA resolved announcement: where it goes and what it says.static final recordCredentials for the posting bot. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringA one-line, credential-free description of where a message would go — what the draft prints, and what the publish echoes.static StringThe form body Zulip's/api/v1/messagesendpoint expects.static StringPost the announcement.static StringValidate an announcement, naming precisely what is missing rather than letting the API answer with a generic rejection.
-
Method Details
-
validate
Validate an announcement, naming precisely what is missing rather than letting the API answer with a generic rejection.- Parameters:
a- the announcement to check- Returns:
- the first problem found, or
nullwhen valid
-
formBody
The form body Zulip's/api/v1/messagesendpoint expects. Built here rather than at the call site so a test can read it.- Parameters:
a- the announcement to encode- Returns:
- the URL-encoded form body
-
destination
A one-line, credential-free description of where a message would go — what the draft prints, and what the publish echoes.- Parameters:
a- the announcement- Returns:
- the destination, e.g.
chat.example/#Stream > topic
-
post
public static String post(AnnounceSupport.Announcement a, AnnounceSupport.BotIdentity bot) throws Exception Post the announcement. Zulip authenticates with HTTP basic auth over the bot's email and token.- Parameters:
a- the announcement to postbot- the posting identity- Returns:
- the response body, which carries the message id on success
- Throws:
Exception- when the request fails or Zulip rejects it
-