Class AnnounceSupport

java.lang.Object
network.ike.plugin.AnnounceSupport

public final class AnnounceSupport extends Object
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).

  • Method Details

    • validate

      public static String validate(AnnounceSupport.Announcement a)
      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 null when valid
    • formBody

      public static String formBody(AnnounceSupport.Announcement a)
      The form body Zulip's /api/v1/messages endpoint 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

      public static String destination(AnnounceSupport.Announcement a)
      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

      Post the announcement. Zulip authenticates with HTTP basic auth over the bot's email and token.
      Parameters:
      a - the announcement to post
      bot - the posting identity
      Returns:
      the response body, which carries the message id on success
      Throws:
      Exception - when the request fails or Zulip rejects it