rmp

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

README

/rmp profname: <name>: search for a professor by name from Seneca college. If more than 1 professor by that name at Seneca, a select menu will be displayed to prompt to select the prof to display the ratings of. Other wise, the prof's ratings will be displayed.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendProfInformation

func SendProfInformation(sess *discordgo.Session, i *discordgo.InteractionCreate, prof ProfNode) error

SendProfInformation reply to an interaction with information about a professor. sess : discord session. i : discord interaction. prof : professor information to send. return: error if any.

Types

type Node added in v1.5.0

type Node struct {
	Typename      string  `json:"__typename"`
	AvgDifficulty float64 `json:"avgDifficulty"`
	AvgRating     float64 `json:"avgRating"`
	Department    string  `json:"department"`
	FirstName     string  `json:"firstName"`
	ID            string  `json:"id"`
	IsSaved       bool    `json:"isSaved"`
	LastName      string  `json:"lastName"`
	LegacyID      int64   `json:"legacyId"`
	NumRatings    int64   `json:"numRatings"`
	School        struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"school"`
	WouldTakeAgainPercent float64 `json:"wouldTakeAgainPercent"`
}

Node represents a single professor

func (*Node) FullName added in v1.5.0

func (n *Node) FullName() string

FullName get the full name of the professor

type ProfNode

type ProfNode struct {
	Cursor string `json:"cursor"`
	Node   Node   `json:"node"`
}

a single prof from rmp

func FilterProfNodes

func FilterProfNodes(profs SearchResponse) []ProfNode

FilterProfNodes get prof nodes from search result. return: list of prof nodes

type SearchQuery

type SearchQuery struct {
	Query     string `json:"query"`
	Variables struct {
		SchoolID string `json:"schoolID"`
		// contains filtered or unexported fields
	} `json:"variables"`
}

a search query for rmp

type SearchResponse added in v1.5.0

type SearchResponse struct {
	Data struct {
		Search struct {
			Teachers struct {
				DidFallback bool       `json:"didFallback"`
				Edges       []ProfNode `json:"edges"`
				Filters     []struct {
					Field   string `json:"field"`
					Options []struct {
						ID    string `json:"id"`
						Value string `json:"value"`
					} `json:"options"`
				} `json:"filters"`
				PageInfo struct {
					EndCursor   string `json:"endCursor"`
					HasNextPage bool   `json:"hasNextPage"`
				} `json:"pageInfo"`
				ResultCount int64 `json:"resultCount"`
			} `json:"teachers"`
		} `json:"search"`
	} `json:"data"`
	Errors []struct {
		Locations []struct {
			Column int64 `json:"column"`
			Line   int64 `json:"line"`
		} `json:"locations"`
		Message string   `json:"message"`
		Path    []string `json:"path"`
	} `json:"errors"`
}

api response when searching for a prof

func SearchRmpProfByName

func SearchRmpProfByName(name string) SearchResponse

SearchRmpProfByName search for a Seneca professor by name on RMP, using the graphql api name: the name of the professor to search for Returns a `searchResponse` struct

Jump to

Keyboard shortcuts

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