<commit_before>// Package slack provides all the Slack specific code for Igor
package slack

import (
	"strings"
)

type SlackResponse struct {
	Text         string       `json:"text"`
	ResponseType string       `json:"response_type,omitempty"`
	Attachments  []Attachment `json:"attachments,omitempty"`
	UnfurlLinks  bool         `json:"unfurl_links,omitempty"`
	UnfurlMedia  bool         `json:"unfurl_media,omitempty"`
	Markdown     bool         `json:"mrkdwn,omitempty"`
	Username     string       `json:"username,omitempty"`
	IconEmoji    string       `json:"icon_emoji,omitempty"`
}

type Attachment struct {
	Title      string   `json:"title,omitempty"`
	TitleLink  string   `json:"title_link,omitempty"`
	Text       string   `json:"text,omitempty"`
	PreText    string   `json:"pretext,omitempty"`
	Color      string   `json:"color,omitempty"`
	Markdown   []string `json:"mrkdwn_in,omitempty"`
	Fallback   string   `json:"fallback,omitempty"`
	AuthorName string   `json:"author_name,omitempty"`
	AuthorLink string   `json:"author_link,omitempty"`
	AuthorIcon string   `json:"author_icon,omitempty"`
	ImageUrl   string   `json:"image_url,omitempty"`
	ThumbUrl   string   `json:"thumb_url,omitempty"`
	Fields     []Field  `json:"fields,omitempty"`
}

type Field struct {
	Title string `json:"title"`
	Value string `json:"value"`
	Short bool   `json:"short,omitempty"`
}

//TODO validation
func (a *Attachment) EnableMarkdownFor(value string) {
	var markin []string
	if a.Markdown != nil {
		markin = a.Markdown
	}
	a.Markdown = append(markin, value)
}

//TODO validation
func (s *SlackResponse) AddAttachment(a Attachment) {
	var attachments []Attachment
	if s.Attachments != nil {
		attachments = s.Attachments
	}
	s.Attachments = append(attachments, a)
}

func (s *SlackResponse) SetPublic() {
	s.ResponseType = "in_channel"
}<commit_msg>Helper method for adding fields<commit_after>// Package slack provides all the Slack specific code for Igor
package slack

import (
	"strings"
)

type SlackResponse struct {
	Text         string       `json:"text"`
	ResponseType string       `json:"response_type,omitempty"`
	Attachments  []Attachment `json:"attachments,omitempty"`
	UnfurlLinks  bool         `json:"unfurl_links,omitempty"`
	UnfurlMedia  bool         `json:"unfurl_media,omitempty"`
	Markdown     bool         `json:"mrkdwn,omitempty"`
	Username     string       `json:"username,omitempty"`
	IconEmoji    string       `json:"icon_emoji,omitempty"`
}

type Attachment struct {
	Title      string   `json:"title,omitempty"`
	TitleLink  string   `json:"title_link,omitempty"`
	Text       string   `json:"text,omitempty"`
	PreText    string   `json:"pretext,omitempty"`
	Color      string   `json:"color,omitempty"`
	Markdown   []string `json:"mrkdwn_in,omitempty"`
	Fallback   string   `json:"fallback,omitempty"`
	AuthorName string   `json:"author_name,omitempty"`
	AuthorLink string   `json:"author_link,omitempty"`
	AuthorIcon string   `json:"author_icon,omitempty"`
	ImageUrl   string   `json:"image_url,omitempty"`
	ThumbUrl   string   `json:"thumb_url,omitempty"`
	Fields     []Field  `json:"fields,omitempty"`
}

type Field struct {
	Title string `json:"title"`
	Value string `json:"value"`
	Short bool   `json:"short,omitempty"`
}

//TODO validation
func (a *Attachment) EnableMarkdownFor(value string) {
	var markin []string
	if a.Markdown != nil {
		markin = a.Markdown
	}
	a.Markdown = append(markin, value)
}

//TODO validation
func (s *SlackResponse) AddAttachment(a Attachment) {
	var attachments []Attachment
	if s.Attachments != nil {
		attachments = s.Attachments
	}
	s.Attachments = append(attachments, a)
}

func (a *Attachment) AddField(f Field) {
	var fields []Field
	if a.Fields != nil {
		fields = a.Fields
	}
	a.Fields = append(fields, f)
}

func (s *SlackResponse) SetPublic() {
	s.ResponseType = "in_channel"
}
{'fraction_non_alphanumeric': 0.11937581274382315, 'fraction_numerical': 0.0, 'mean_word_length': 4.254098360655738, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1729930', 'n_tokens_mistral': 1236, 'n_tokens_neox': 1234, 'n_words': 296}