importer

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNotFound    = GemConnectorError("user was not found")
	ErrInvalidData = GemConnectorError("user had invalid data")
)

Variables

This section is empty.

Functions

func ImportUsers

func ImportUsers(username, password, eventId, csvPath string)

Types

type ApiResponse

type ApiResponse struct {
	Results []struct {
		Id   string `json:"id"`
		Text string `json:"text"`
	} `json:"results"`
}

type CookieConnector

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

func (*CookieConnector) AddUsersToEvent

func (connector *CookieConnector) AddUsersToEvent(eventId string, users []User) bool

func (*CookieConnector) Connect

func (connector *CookieConnector) Connect() bool

func (*CookieConnector) GetCsrfTokenFromAddPage

func (connector *CookieConnector) GetCsrfTokenFromAddPage(eventId string) string

func (*CookieConnector) GetCsrfTokenFromLoginPage

func (connector *CookieConnector) GetCsrfTokenFromLoginPage() string

Regex is more than 3 times faster than using Goquery in this case according to benchmarks

func (*CookieConnector) GetUserByGemId

func (connector *CookieConnector) GetUserByGemId(eventId, gemId string) (User, error)

func (*CookieConnector) GetUsersFromEvent

func (connector *CookieConnector) GetUsersFromEvent(eventId string) []User

type CsvUser

type CsvUser struct {
	Name  string
	GemId string
}

func Read

func Read(csvPath string) []CsvUser

type GemConnector

type GemConnector interface {
	Connect(username, password string) bool
	GetUsersFromEvent(eventId string) []User
	GetUserByGemId(gemId string) User
	AddUsersToEvent(eventId string, users []User) bool
}

type GemConnectorError

type GemConnectorError string

func (GemConnectorError) Error

func (e GemConnectorError) Error() string

type User

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

Users know their gemId, but GEM uses its internal userId that is different from the gemId. We need to fetch the userId from the gemId to add the user to the event.

Jump to

Keyboard shortcuts

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