services

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2021 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIGatewayProxyRequestToHTTPRequest

func APIGatewayProxyRequestToHTTPRequest(req events.APIGatewayProxyRequest) (*http.Request, error)

func AuthenticateStravaUser

func AuthenticateStravaUser(userAuthCode string) (*db.StravaUser, error)

func DeauthorizeStravaForCravackUser

func DeauthorizeStravaForCravackUser(user *db.CravackUser) error

func DeleteActivityMessage

func DeleteActivityMessage(event *db.CravackActivityEvent) error

func DeleteCravackActivityEvent

func DeleteCravackActivityEvent(event *db.StravaEvent) (*db.CravackActivityEvent, error)

func DeleteCravackUser

func DeleteCravackUser(user *db.CravackUser) error

func GetCravackActivityEvent

func GetCravackActivityEvent(event *db.StravaEvent) (*db.CravackActivityEvent, error)

func GetCravackUser

func GetCravackUser(athleteID int) (*db.CravackUser, error)

func GetCravackUserBySlackID

func GetCravackUserBySlackID(slackUserID string) (*db.CravackUser, error)

func GetStravaActivityForUser

func GetStravaActivityForUser(event *db.StravaEvent, user *db.StravaUser) (*db.StravaEventFull, error)

func GetStravaUserRefreshToken

func GetStravaUserRefreshToken(refreshToken string) (*db.StravaRefreshToken, error)

Fetch Strava refresh token from Strava API

func HandleErrorAndLambdaReturn

func HandleErrorAndLambdaReturn(err error, statusCode int) (events.APIGatewayProxyResponse, error)

func PostActivityMessage

func PostActivityMessage(activity *db.StravaEventFull, user *db.CravackUser) (string, string, error)

func PostCravackAuthenticationSuccess

func PostCravackAuthenticationSuccess(user *db.CravackUser) (string, error)

func PutCravackActivityEvent

func PutCravackActivityEvent(event *db.StravaEvent, slackChannelId, slackMsgTs string) (*dynamodb.PutItemOutput, error)

func PutCravackUser

func PutCravackUser(user *db.CravackUser) (*dynamodb.PutItemOutput, error)

func SendStravaActivityEventMessage

func SendStravaActivityEventMessage(event *db.StravaEvent) (string, error)

func UpdateActivityMessage

func UpdateActivityMessage(activity *db.StravaEventFull, user *db.CravackUser, event *db.CravackActivityEvent) (string, string, error)

func UpdateCravackStravaToken

func UpdateCravackStravaToken(refreshedUser *db.StravaRefreshToken, athleteID int) (*db.CravackUser, error)

Types

type SlackSlashCommand

type SlackSlashCommand struct {
	Token          string `form:"token"`
	TeamID         string `form:"team_id"`
	TeamDomain     string `form:"team_domain"`
	EnterpriseID   string `form:"enterprise_id"`
	EnterpriseName string `form:"enterprise_name"`
	ChannelID      string `form:"channel_id"`
	ChannelName    string `form:"channel_name"`
	UserID         string `form:"user_id"`
	UserName       string `form:"user_name"`
	Command        string `form:"command"`
	Text           string `form:"text"`
	ResponseURL    string `form:"response_url"`
	TriggerID      string `form:"trigger_id"`
	APIAppID       string `form:"api_app_id"`
}

func NewSlashCommandFromForm

func NewSlashCommandFromForm(form *url.Values) *SlackSlashCommand

Creates a new SlackSlashCommand struct from an array of URL values. It uses the reflection API to fill all fields of the struct dynamically. I am assuming that this is poor Golang practice, due to risk of runtime panic.

func (*SlackSlashCommand) GetDeauthorizeCravackResponse

func (slashCommand *SlackSlashCommand) GetDeauthorizeCravackResponse(host string) (*slack.WebhookMessage, error)

func (*SlackSlashCommand) GetStravaConnectResponse

func (slashCommand *SlackSlashCommand) GetStravaConnectResponse(host string) (*slack.WebhookMessage, error)

func (*SlackSlashCommand) GetUnknownCommandResponse

func (slashCommand *SlackSlashCommand) GetUnknownCommandResponse(host string) (*slack.WebhookMessage, error)

Jump to

Keyboard shortcuts

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