buildPayload method

Map<String, dynamic> buildPayload(
  1. String text
)

Renders the request body for provider.

Implementation

Map<String, dynamic> buildPayload(String text) => switch (provider) {
      NotifyProvider.slack => {'text': text},
      NotifyProvider.discord => {'content': text},
      NotifyProvider.telegram => {'chat_id': chatId, 'text': text},
      // A generic endpoint gets a self-describing body rather than a shape
      // borrowed from one of the chat providers.
      NotifyProvider.webhook => {
          'text': text,
          'source': 'distribute_cli',
        },
    };