server

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SlackToken    string
	ListenAddress string
	TLS           certs.Config
}

Config ..

type Server

type Server struct {
	pb.UnimplementedApprouvezServer

	Slack    *slack.Client
	Sessions Sessions
}

Server handles necessary components to run the server side of the app

func New

func New(slackToken string) *Server

New ..

func (*Server) CreateStream

func (s *Server) CreateStream(req *pb.SlackUserRequest, stream pb.Approuvez_CreateStreamServer) error

CreateStream ..

func (*Server) GetSlackUser

func (s *Server) GetSlackUser(ref string) (*slack.User, error)

GetSlackUser returns a slack user based on its email, name or ID

func (*Server) HandleSlackCallback

func (s *Server) HandleSlackCallback(w http.ResponseWriter, r *http.Request)

HandleSlackCallback ..

func (*Server) NewSession

func (s *Server) NewSession(ctx context.Context, _ *pb.Empty) (*pb.Session, error)

NewSession ..

func (*Server) PromptSlackUser

func (s *Server) PromptSlackUser(msg SlackMessage, userID string) error

PromptSlackUser ..

func (*Server) UpdateMessage

func (s *Server) UpdateMessage(channelID, messageTimestamp string, msg SlackMessage)

UpdateMessage ..

type Session

type Session struct {
	ID     string
	Stream pb.Approuvez_CreateStreamServer
	Error  chan error
}

Session ..

type Sessions

type Sessions map[string]*Session

Sessions ..

type SlackMessage

type SlackMessage struct {
	SessionID      string
	Message        string
	LinkButtonName string
	LinkButtonURL  string
	ActionButtons  bool
	StatusMessage  string
	Color          string
}

SlackMessage ..

func (*SlackMessage) Recompose

func (msg *SlackMessage) Recompose(payload slack.Message)

Recompose a message from an interaction payload

func (*SlackMessage) Render

func (msg *SlackMessage) Render() slack.MsgOption

Render compute the message blocks

Jump to

Keyboard shortcuts

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