slack

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchAttachedFiles

func FetchAttachedFiles(logger logrus.FieldLogger, inputArchive string, outputArchive string) error

FetchAttachedFiles takes the Slack input file at absolute path inputArchive and parses it. Upon discovering references to attached files, those files are fetched from Slack's servers and added to outputArchive, which at the end will contain all the data from inputArchive as well as all attached files

func TransformSlack

func TransformSlack(translation *model.Translation, inputFilePath, outputFilePath, attachmentsDir, workdir string, logger log.FieldLogger) error

TransformSlack takes an absolute filepath inputFilePath which points to a Slack workspace archive which already contains file attachments and outputs an MBIF to outputFilePath with references in the JSONL lines that make up the MBIF referring to any attached files in attachmentsDir. The attached files will also be extracted from the file at inputFilePath and stored in attachmentsDir

Types

type SlackFile

type SlackFile struct {
	ID                 string `json:"id"`
	Name               string `json:"name"`
	URLPrivate         string `json:"url_private"`
	URLPrivateDownload string `json:"url_private_download"`
}

SlackFile is a holding type for files attached to Slack messages

type SlackPost

type SlackPost struct {
	User    string       `json:"user"`
	Type    string       `json:"type"`
	Subtype string       `json:"subtype"`
	Text    string       `json:"text"`
	Ts      string       `json:"ts"`
	File    *SlackFile   `json:"file"`
	Files   []*SlackFile `json:"files"`
}

SlackPost is a holding type for Slack posts

type SlackTranslator

type SlackTranslator struct {
	// contains filtered or unexported fields
}

SlackTranslator is responsible for translating Slack workspace archives into a format compatible with Mattermost.

func NewSlackTranslator

func NewSlackTranslator(bucket, workingDir string) (*SlackTranslator, error)

NewSlackTranslator creates a new Translator instance for translating Slack workspaces.

func (*SlackTranslator) Cleanup added in v0.3.0

func (st *SlackTranslator) Cleanup() error

Cleanup performs necessary cleanup operations after the translation process.

func (*SlackTranslator) GetOutputArchiveLocalPath added in v0.3.0

func (st *SlackTranslator) GetOutputArchiveLocalPath() (string, error)

GetOutputArchiveLocalPath returns the local file path of the translated archive.

func (*SlackTranslator) Translate

func (st *SlackTranslator) Translate(translation *model.Translation) (string, error)

Translate satisfies the Translator interface for the SlackTranslator. It performs the Translation represented by the input struct and uploads the resulting .zip archive to S3. On success it returns the file name of the output zip file without a path and on error it returns the error and an empty string

type SlackUser

type SlackUser struct {
	ID      string           `json:"id"`
	Profile SlackUserProfile `json:"profile"`
}

SlackUser is a holding type for Users in the Slack representation As it appears in users.json and /api/users.list. There are obviously many more fields, but we only need a couple of them.

type SlackUserProfile

type SlackUserProfile struct {
	Email string `json:"email"`
}

SlackUserProfile is a holding type for extracting users' emails out of a Slack export archive

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL