tpcgo

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: BSD-3-Clause Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

The Pilot Club Logo

tpcgo

Go client for The Pilot Club (TPC) APIs (Core API + Flight Crew Portal) plus the VATSIM endpoints used by TPC tooling.

Go Reference

Features

  • Single session that groups credentials/config for:
    • FCP (Flight Crew Portal) API
    • Core API (suggestions + quiz)
    • VATSIM (datafeed + member lookups)
  • Typed request/response structs
  • Common HTTP error mapping via exported sentinel errors (e.g. ErrUnAuthorized, ErrNotFound)

Requirements

  • Go 1.24+ (see go.mod)

Install

go get github.com/the-pilot-club/tpcgo

Quick start

Create a session by providing the keys you plan to use. Use empty strings for services you don’t need.

package main

import (
	"fmt"
	"log"
	"github.com/the-pilot-club/tpcgo"
)

func main() { 
	s, err := tpcgo.NewSession(tpcgo.SessionConfig{
		FCPKey: "<FCP_API_KEY>", 
		FCPEnv: "production", // "production" or "beta" 
		VATSIMAPIKey: "<VATSIM_API_KEY>", 
		CoreApiKey: "<CORE_API_KEY>", 
	}) 
	
	if err != nil { 
		log.Fatal(err) 
	}
	
	df, err := s.GetVatsimDataFeed()
	
	if err != nil {
		log.Fatal(err)
	}

	fmt.Printf("Connected clients: %d\n", df.General.ConnectedClients)
}

Configuration

FCP environment

FCP requests require an environment string:

  • production
  • beta

If an unsupported value is used, endpoint construction may produce an empty base URL and requests will fail.

Authentication

Keys are sent as HTTP headers. Never hardcode secrets in source code.

Suggested approaches:

  • environment variables
  • your preferred secrets manager / CI secret store
  • local .env loaded by your application (not committed)

Notes / limitations

  • Requests are performed with net/http using a default client configuration. If you need timeouts, retries, custom transports, or tracing, you may want to wrap/fork the request layer to accept an *http.Client.
  • APIs evolve. If you encounter a mismatched field or endpoint change, please open an issue or PR.

Versioning

This project follows Go module versioning. Please pin to a release/tag in production usage.

Releases are automated: a GitHub Actions workflow (.github/workflows/release.yml) tags and publishes a GitHub Release whenever the VERSION const in tpcgo.go is bumped and merged to main. To cut a release, bump VERSION in tpcgo.go as part of your PR; merging to main pushes the matching vX.Y.Z tag automatically.

Contributing

Issues and PRs are welcome. Keep changes focused and include tests where possible.

License

See LICENSE.

Documentation

Index

Constants

View Source
const VERSION = "0.1.1"

Variables

View Source
var (
	VATSIMDataFeedVersion = "3"
	VATSIMAPIVersion      = "2"

	EndpointFCP = func(Env string) string {
		if Env == "production" {
			return "https://flightcrew.thepilotclub.org/api"
		} else if Env == "beta" {
			return "https://flightcrew-beta.thepilotclub.org/api"
		} else {
			return ""
		}
	}

	EndpointCoreAPI = func(env Environment) string {
		return coreAPIBaseURLs[env]
	}

	EndpointVATSIMAPI  = "https://api.vatsim.net/"
	EndpointVATSIMData = "https://data.vatsim.net/"

	EndPointFCPALLFBOs = func(env string) string { return EndpointFCP(env) + "/fbos" }
	EndPointFCPFBO     = func(icao string, env string) string { return EndpointFCP(env) + "/fbo/" + icao }
	EndPointFCPSectors = func(env string) string { return EndpointFCP(env) + "/sectors" }

	ENDPOINTFCPGetAllUsers    = func(env string) string { return EndpointFCP(env) + "/users/get" }
	ENDPOINTFCPGetAllUsersCID = func(env string) string { return EndpointFCP(env) + "/users/get/cid" }
	ENDPOINTFCPUser           = func(userId string, env string) string { return EndpointFCP(env) + "/users/find/" + userId }
	ENDPOINTFCPUserBirthdays  = func(env string) string { return EndpointFCP(env) + "/users/birthdays" }
	ENDPOINTFCPUserAdd        = func(env string) string { return EndpointFCP(env) + "/users/new" }
	ENDPOINTFCPUserDelete     = func(userId string, env string) string { return EndpointFCP(env) + "/users/find/" + userId + "/delete" }
	ENDPOINTFCPUserCallsign   = func(userId string, env string) string {
		return EndpointFCP(env) + "/users/find/" + userId + "/callsign"
	}
	ENDPOINTFCPUserAuditLogAdd = func(userId string, env string) string {
		return EndpointFCP(env) + "/users/find/" + userId + "/audit-logs/new"
	}

	ENDPOINTCoreAPIAllSuggestions                = func(env Environment) string { return EndpointCoreAPI(env) + "/suggestions/all" }
	ENDPOINTCoreAPINewSuggestion                 = func(env Environment) string { return EndpointCoreAPI(env) + "/suggestions/new" }
	ENDPOINTCoreAPISuggestion                    = func(id string, env Environment) string { return EndpointCoreAPI(env) + "/suggestions/" + id }
	ENDPOINTCoreAPIAllQuizQuestions              = func(env Environment) string { return EndpointCoreAPI(env) + "/quiz/all" }
	ENDPOINTCoreAPINewQuizQuestion               = func(env Environment) string { return EndpointCoreAPI(env) + "/quiz/new" }
	ENDPOINTCoreAPINextQuizQuestion              = func(env Environment) string { return EndpointCoreAPI(env) + "/quiz/next" }
	ENDPOINTCoreAPICurrentQuizQuestion           = func(env Environment) string { return EndpointCoreAPI(env) + "/quiz/current" }
	EndPointCoreAPIQuizQuestionByID              = func(id string, env Environment) string { return EndpointCoreAPI(env) + "/quiz/" + id }
	ENDPOINTCoreAPIQuizSetQuestionForResponse    = func(env Environment) string { return EndpointCoreAPI(env) + "/quiz/responses/question/set" }
	ENDPOINTCoreAPIQuizSetUserResponse           = func(env Environment) string { return EndpointCoreAPI(env) + "/quiz/responses/user/record" }
	ENDPOINTCoreAPIQuizDeleteQuestionForResponse = func(id string, env Environment) string {
		return EndpointCoreAPI(env) + "/quiz/responses/question/" + id
	}
	ENDPOINTCoreAPIQuizGetResponses = func(id string, answer string, env Environment) string {
		return EndpointCoreAPI(env) + "/quiz/responses/user/responses/" + id + "?answer=" + answer
	}
	ENDPOINTCoreAPIResetUserResponses = func(env Environment) string { return EndpointCoreAPI(env) + "/quiz/responses/user/responses" }
	ENDPOINTCoreAPICheckUserResponse  = func(id string, env Environment) string {
		return EndpointCoreAPI(env) + "/quiz/responses/user/check/" + id
	}

	EndpointVATSIMDataFeed  = EndpointVATSIMData + "v" + VATSIMDataFeedVersion + "/vatsim-data.json"
	EndpointVATSIMDiscordId = func(userId string) string {
		return EndpointVATSIMAPI + "v" + VATSIMAPIVersion + "/members/discord/" + userId
	}
	EndpointVATSIMUserHours = func(userId string) string {
		return EndpointVATSIMAPI + "v" + VATSIMAPIVersion + "/members/" + userId + "/stats"
	}
)
View Source
var (
	ErrJSONUnmarshal   = errors.New("json unmarshal")
	ErrNoKeyError      = errors.New("no api key found")
	ErrUnAuthorized    = errors.New("unauthorized")
	ErrNotFound        = errors.New("resource not found")
	ErrBadForm         = errors.New("invalid form")
	ErrAlreadyReported = errors.New("already reported")
)

all errors that are present in the package

Functions

This section is empty.

Types

type ATIS

type ATIS struct {
	CID         int      `json:"cid,omitempty"`
	Name        string   `json:"name,omitempty"`
	Callsign    string   `json:"callsign,omitempty"`
	Frequency   string   `json:"frequency,omitempty"`
	Facility    int      `json:"facility,omitempty"`
	Rating      int      `json:"rating,omitempty"`
	ATISCode    string   `json:"atis_code,omitempty"`
	Server      string   `json:"server,omitempty"`
	VisualRange int      `json:"visual_range,omitempty"`
	TextAtis    []string `json:"text_atis,omitempty"`
	LogonTime   string   `json:"logon_time,omitempty"`
}

type AuditLogEntry

type AuditLogEntry struct {
	UserId      string `json:"user_id,omitempty"`
	SubmittedBy string `json:"submitted_by,omitempty"`
	Text        string `json:"text,omitempty"`
}

type AuditLogResponse

type AuditLogResponse struct {
	Success string        `json:"success,omitempty"`
	Entry   AuditLogEntry `json:"entry,omitempty"`
}

type Controller

type Controller struct {
	CID         int      `json:"cid,omitempty"`
	Name        string   `json:"name,omitempty"`
	Callsign    string   `json:"callsign,omitempty"`
	Frequency   string   `json:"frequency,omitempty"`
	Facility    int      `json:"facility,omitempty"`
	Rating      int      `json:"rating,omitempty"`
	Server      string   `json:"server,omitempty"`
	VisualRange int      `json:"visual_range,omitempty"`
	TextAtis    []string `json:"text_atis,omitempty"`
	LogonTime   string   `json:"logon_time,omitempty"`
}

type CoreAPISession

type CoreAPISession struct {
	ApiKeyHeader string
	ApiKey       string
	UserAgent    string
	Environment  Environment
}

type DataFeed

type DataFeed struct {
	General     *GeneralInfo `json:"general,omitempty"`
	Pilots      []Pilot      `json:"pilots,omitempty"`
	Controllers []Controller `json:"controllers,omitempty"`
	ATISs       []ATIS       `json:"atis,omitempty"`
}

type Environment added in v0.1.1

type Environment string

Environment identifies which deployment of a service to target (e.g. production, beta).

const (
	EnvProduction Environment = "production"
	EnvBeta       Environment = "beta"
)

type FBO

type FBO struct {
	ICAO        string    `json:"icao,omitempty"`
	Name        string    `json:"name,omitempty"`
	Region      string    `json:"region,omitempty"`
	Fuel        string    `json:"fuel,omitempty"`
	Focus       string    `json:"focus,omitempty"`
	PublicNotes string    `json:"publicNotes,omitempty"`
	Sectors     []Sectors `json:"sectors,omitempty"`
}

type FCPAuditLogAdd

type FCPAuditLogAdd struct {
	UserID      string `json:"user_id"`
	SubmittedBy string `json:"submitted_by"`
	Text        string `json:"text"`
}

type FCPCIDOnly added in v0.0.9

type FCPCIDOnly struct {
	VATSIMCid int `json:"vatsim_cid,omitempty"`
}

type FCPCallsignResponse

type FCPCallsignResponse struct {
	Callsign int `json:"tpcCallsign,omitempty"`
}

type FCPFBOs

type FCPFBOs struct {
	FBO []FBO `json:"fbos,omitempty"`
}

type FCPFullUser

type FCPFullUser struct {
	ID              string            `json:"id"`
	DiscordID       string            `json:"discordId,omitempty"`
	DiscordUsername string            `json:"discordUsername,omitempty"`
	FirstName       string            `json:"firstName,omitempty"`
	LastName        string            `json:"lastName,omitempty"`
	Callsign        int               `json:"callsign,omitempty"`
	VATSIMCid       int               `json:"vatsimCid,omitempty"`
	Email           string            `json:"email,omitempty"`
	HomeAirport     string            `json:"homeAirport,omitempty"`
	ChartersCode    string            `json:"chartersCode,omitempty"`
	Bio             string            `json:"bio,omitempty"`
	Status          string            `json:"status,omitempty"`
	AircraftHangar  []FCPUserAircraft `json:"aircraftHangar,omitempty"`
}

type FCPLimitedUser

type FCPLimitedUser struct {
	ID             string            `json:"id,omitempty"`
	DiscordID      string            `json:"discordId,omitempty"`
	Callsign       int               `json:"callsign,omitempty"`
	VATSIMCid      int               `json:"vatsimCid,omitempty"`
	HomeAirport    string            `json:"homeAirport,omitempty"`
	ChartersCode   string            `json:"chartersCode,omitempty"`
	Bio            string            `json:"bio,omitempty"`
	AircraftHangar []FCPUserAircraft `json:"aircraftHangar,omitempty"`
}

type FCPSectors

type FCPSectors struct {
	Sectors []Sectors `json:"sectors,omitempty"`
}

type FCPSession

type FCPSession struct {
	ApiKeyHeader string
	ApiKey       string
	UserAgent    string
	Environment  string
}

type FCPUserAdd

type FCPUserAdd struct {
	UserID string `json:"id"`
}

type FCPUserAircraft

type FCPUserAircraft struct {
	ICAO string `json:"icao,omitempty"`
	Name string `json:"aircraftName,omitempty"`
}

type FlightPlan

type FlightPlan struct {
	FlightRules         string `json:"flight_rules,omitempty"`
	Aircraft            string `json:"aircraft,omitempty"`
	AircraftFAA         string `json:"aircraft_faa,omitempty"`
	AircraftShort       string `json:"aircraft_short,omitempty"`
	Departure           string `json:"departure,omitempty"`
	Arrival             string `json:"arrival,omitempty"`
	Alternate           string `json:"alternate,omitempty"`
	CruiseTAS           string `json:"cruise_tas,omitempty"`
	Altitude            string `json:"altitude,omitempty"`
	DepTime             string `json:"deptime,omitempty"`
	EnrouteTime         string `json:"enroute_time,omitempty"`
	FuelTime            string `json:"fuel_time,omitempty"`
	Remarks             string `json:"remarks,omitempty"`
	Route               string `json:"route,omitempty"`
	RevisionID          int    `json:"revision_id,omitempty"`
	AssignedTransponder string `json:"assigned_transponder,omitempty"`
}

type GeneralInfo

type GeneralInfo struct {
	Version          int    `json:"version,omitempty"`
	Reload           int    `json:"reload,omitempty"`
	Update           string `json:"update,omitempty"`
	UpdateTimestamp  string `json:"update_timestamp,omitempty"`
	ConnectedClients int    `json:"connected_clients,omitempty"`
	UniqueUsers      int    `json:"unique_users,omitempty"`
}

type MemberDiscord

type MemberDiscord struct {
	ID        string `json:"id,omitempty"`
	DiscordID string `json:"user_id,omitempty"`
}

type NewSuggestion

type NewSuggestion struct {
	StatusID  int    `json:"statusId"`
	DiscordID string `json:"discordId"`
	IdeaText  string `json:"ideaText"`
}

type NotFoundResource

type NotFoundResource struct {
	Detail string `json:"detail,omitempty"`
}

type Pilot

type Pilot struct {
	CID            int         `json:"cid,omitempty"`
	Name           string      `json:"name,omitempty"`
	Callsign       string      `json:"callsign,omitempty"`
	Server         string      `json:"server,omitempty"`
	PilotRating    int         `json:"pilot_rating,omitempty"`
	MilitaryRating int         `json:"military_rating,omitempty"`
	Latitude       float64     `json:"latitude,omitempty"`
	Longitude      float64     `json:"longitude,omitempty"`
	Altitude       int         `json:"altitude,omitempty"`
	Groundspeed    int         `json:"groundspeed,omitempty"`
	Transponder    string      `json:"transponder,omitempty"`
	Heading        int         `json:"heading,omitempty"`
	QnhIHg         float64     `json:"qnh_i_hg,omitempty"`
	QnhMb          int         `json:"qnh_mb,omitempty"`
	FlightPlan     *FlightPlan `json:"flight_plan,omitempty"`
	LogonTime      string      `json:"logon_time,omitempty"`
	LastUpdated    string      `json:"last_updated,omitempty"`
}

type PreFile

type PreFile struct {
	CID        int         `json:"cid,omitempty"`
	Name       string      `json:"name,omitempty"`
	Callsign   string      `json:"callsign,omitempty"`
	FlightPlan *FlightPlan `json:"flight_plan,omitempty"`
	LastUpdate string      `json:"last_updated,omitempty"`
}

type QuizQuestion added in v0.0.7

type QuizQuestion struct {
	ID                string `json:"id,omitempty"`
	Question          string `json:"question,omitempty"`
	OptionA           string `json:"optionA,omitempty"`
	OptionB           string `json:"optionB,omitempty"`
	OptionC           string `json:"optionC,omitempty"`
	CorrectAnswer     string `json:"correctAnswer,omitempty"`
	AnswerDescription string `json:"answerDescription,omitempty"`
	IsActive          bool   `json:"isActive,omitempty"`
	IsOld             bool   `json:"isOld,omitempty"`
	CreatedAt         string `json:"createdAt,omitempty"`
	UpdatedAt         string `json:"updatedAt,omitempty"`
}

type QuizQuestionForResponse added in v0.0.7

type QuizQuestionForResponse struct {
	MessageID  string `json:"messageId,omitempty"`
	QuestionID string `json:"questionId,omitempty"`
}

type QuizUserResponse added in v0.0.7

type QuizUserResponse struct {
	User *discordgo.Member `json:"user,omitempty"`
}

type QuizUserResponseSet added in v0.0.7

type QuizUserResponseSet struct {
	MessageID string            `json:"messageId,omitempty"`
	UserID    string            `json:"userId,omitempty"`
	Answer    string            `json:"answer,omitempty"`
	User      *discordgo.Member `json:"user,omitempty"`
}

type Sectors

type Sectors struct {
	StartICAO    string `json:"startIcao,omitempty"`
	EndICAO      string `json:"endIcao,omitempty"`
	Size         string `json:"size,omitempty"`
	SectorNumber int    `json:"sectorNumber,omitempty"`
}

type Session added in v0.0.7

type Session struct {
	FCPSession     *FCPSession
	CoreAPISession *CoreAPISession
	VATSIMSession  *VATSIMSession
}

func NewSession added in v0.0.7

func NewSession(config SessionConfig) (s *Session, e error)

NewSession creates a new session that can be used anywhere in the project assuming you put it in the root of the directory.

func (*Session) AddFCPUser added in v0.0.7

func (s *Session) AddFCPUser(UserID *FCPUserAdd) (a *FCPFullUser, e error)

AddFCPUser creates/adds a new user in FCP (requires an FCP API key).

func (*Session) AddNewQuizQuestion added in v0.0.7

func (s *Session) AddNewQuizQuestion(i QuizQuestion) (q *QuizQuestion, e error)

AddNewQuizQuestion creates a new quiz question in the TPC Core API.

func (*Session) AddSuggestion added in v0.0.7

func (s *Session) AddSuggestion(entry *NewSuggestion) (su *Suggestions, e error)

AddSuggestion creates a new suggestion in the TPC Core API.

func (*Session) CheckUserQuizResponse added in v0.0.7

func (s *Session) CheckUserQuizResponse(id string) (r bool, e error)

CheckUserQuizResponse checks whether a user (by ID) has already recorded a quiz response.

func (*Session) DeleteFCPUser added in v0.0.7

func (s *Session) DeleteFCPUser(UserID string) (su *SuccessResponse, e error)

DeleteFCPUser removes a user from FCP by user ID (requires an FCP API key).

func (*Session) DeleteQuizQuestion added in v0.0.7

func (s *Session) DeleteQuizQuestion(id string) (d *QuizQuestion, e error)

DeleteQuizQuestion removes a quiz question by ID in the TPC Core API.

func (*Session) DeleteQuizQuestionForResponse added in v0.0.7

func (s *Session) DeleteQuizQuestionForResponse(id string) (d bool, e error)

DeleteQuizQuestionForResponse removes the question-to-message association used for collecting quiz responses.

func (*Session) DeleteSuggestion added in v0.0.7

func (s *Session) DeleteSuggestion(id string) (d bool, e error)

DeleteSuggestion deletes a suggestion by ID in the TPC Core API.

func (*Session) GetAllFBOs added in v0.0.7

func (s *Session) GetAllFBOs() (f *FCPFBOs, e error)

GetAllFBOs fetches all FBOs from the configured FCP environment.

func (*Session) GetAllFCPUsers added in v0.0.7

func (s *Session) GetAllFCPUsers() (u []*FCPLimitedUser, e error)

GetAllFCPUsers fetches all FCP users (limited user fields) from the configured FCP environment.

func (*Session) GetAllFCPUsersCID added in v0.0.9

func (s *Session) GetAllFCPUsersCID() (u []*FCPCIDOnly, e error)

GetAllFCPUsersCID fetches only VATSIM CIDs for all FCP users from the configured FCP environment.

func (*Session) GetAllQuizQuestions added in v0.0.7

func (s *Session) GetAllQuizQuestions() (su []*QuizQuestion, e error)

GetAllQuizQuestions fetches all quiz questions from the TPC Core API.

func (*Session) GetAllSuggestions added in v0.0.7

func (s *Session) GetAllSuggestions() (su []*Suggestions, e error)

GetAllSuggestions fetches all suggestions from the TPC Core API.

func (*Session) GetCurrentQuizQuestions added in v0.0.7

func (s *Session) GetCurrentQuizQuestions() (q *QuizQuestion, e error)

GetCurrentQuizQuestions fetches the current quiz question from the TPC Core API.

func (*Session) GetFBO added in v0.0.7

func (s *Session) GetFBO(Icao string) (f *FBO, e error)

GetFBO fetches a single FBO by ICAO from the configured FCP environment.

func (*Session) GetFCPCallsign added in v0.0.7

func (s *Session) GetFCPCallsign(UserId string) (c *FCPCallsignResponse, e error)

GetFCPCallsign fetches a users TPC Callsign based on the Discord ID provided.

func (*Session) GetFCPUser added in v0.0.7

func (s *Session) GetFCPUser(UserId string) (u *FCPLimitedUser, e error)

GetFCPUser fetches a single FCP user (limited user fields) by user ID from the configured FCP environment.

func (*Session) GetFCPUsersBirthdays added in v0.0.7

func (s *Session) GetFCPUsersBirthdays() (u []*string, e error)

GetFCPUsersBirthdays fetches the FCP birthdays list (requires an FCP API key).

func (*Session) GetNextQuizQuestion added in v0.0.7

func (s *Session) GetNextQuizQuestion() (q *QuizQuestion, e error)

GetNextQuizQuestion fetches the next quiz question from the TPC Core API.

func (*Session) GetQuizQuestionByID added in v0.0.7

func (s *Session) GetQuizQuestionByID(id string) (q *QuizQuestion, e error)

GetQuizQuestionByID fetches a quiz question by ID from the TPC Core API.

func (*Session) GetQuizUserResponses added in v0.0.7

func (s *Session) GetQuizUserResponses(id string, answer string) (r []*QuizUserResponse, e error)

GetQuizUserResponses fetches quiz responses for a given question/message identifier, optionally filtered by answer.

func (*Session) GetSectors added in v0.0.7

func (s *Session) GetSectors() (se *FCPSectors, e error)

GetSectors fetches all sectors from the configured FCP environment.

func (*Session) GetSuggestion added in v0.0.7

func (s *Session) GetSuggestion(id string) (su *Suggestions, e error)

GetSuggestion fetches a single suggestion by ID from the TPC Core API.

func (*Session) GetUserDiscordID added in v0.0.7

func (s *Session) GetUserDiscordID(UserID string) (m *MemberDiscord, err error)

GetUserDiscordID looks up a VATSIM member by Discord ID and returns the mapped member info.

func (*Session) GetUserHours added in v0.0.7

func (s *Session) GetUserHours(UserID string) (m *VATSIMUserHours, err error)

GetUserHours fetches a VATSIM member's hours/stats by VATSIM CID.

func (*Session) GetVatsimDataFeed added in v0.0.7

func (s *Session) GetVatsimDataFeed() (df *DataFeed, err error)

GetVatsimDataFeed fetches the latest VATSIM datafeed and decodes it into a DataFeed struct.

func (*Session) PostAuditLogEntry added in v0.0.7

func (s *Session) PostAuditLogEntry(UserId string, entry AuditLogEntry) (a *AuditLogResponse, e error)

PostAuditLogEntry creates a new audit log entry for the given user ID in FCP (requires an FCP API key).

func (*Session) ResetQuizUserResponses added in v0.0.7

func (s *Session) ResetQuizUserResponses() (d bool, e error)

ResetQuizUserResponses clears all recorded quiz user responses.

func (*Session) SetQuestionForResponse added in v0.0.7

func (s *Session) SetQuestionForResponse(messageID string, questionID string) (c bool, e error)

SetQuestionForResponse records which quiz question is associated with a given message ID for collecting responses.

func (*Session) SetQuizUserResponse added in v0.0.7

func (s *Session) SetQuizUserResponse(i *QuizUserResponseSet) (c bool, e error)

SetQuizUserResponse records a user's answer for the currently tracked quiz question.

func (*Session) UpdateQuizQuestion added in v0.0.7

func (s *Session) UpdateQuizQuestion(id string, i QuizQuestion) (q *QuizQuestion, e error)

UpdateQuizQuestion updates an existing quiz question by ID in the TPC Core API.

func (*Session) UpdateSuggestion added in v0.0.7

func (s *Session) UpdateSuggestion(id string, entry *Suggestions) (su *Suggestions, e error)

UpdateSuggestion updates an existing suggestion by ID in the TPC Core API.

type SessionConfig added in v0.0.7

type SessionConfig struct {
	FCPKey       string
	FCPEnv       string
	VATSIMAPIKey string
	CoreApiKey   string
	CoreAPIEnv   Environment
}

type SuccessResponse

type SuccessResponse struct {
	Success string `json:"success,omitempty"`
}

type Suggestions

type Suggestions struct {
	ID           string `json:"id,omitempty"`
	StatsID      int    `json:"statsId,omitempty"`
	DiscordId    string `json:"discordId,omitempty"`
	IdeaText     string `json:"ideaText,omitempty"`
	Reason       string `json:"reason,omitempty"`
	MessageID    string `json:"messageId,omitempty"`
	ChannelID    string `json:"channelId,omitempty"`
	ActionUserID string `json:"actionUserId,omitempty"`
}

type VATSIMSession

type VATSIMSession struct {
	ApiKeyHeader string
	ApiKey       string
	UserAgent    string
}

type VATSIMUserHours

type VATSIMUserHours struct {
	ID    int     `json:"id,omitempty"`
	ATC   float64 `json:"atc,omitempty"`
	Pilot float64 `json:"pilot,omitempty"`
	S1    float64 `json:"s1,omitempty"`
	S2    float64 `json:"s2,omitempty"`
	S3    float64 `json:"s3,omitempty"`
	C1    float64 `json:"c1,omitempty"`
	C2    float64 `json:"c2,omitempty"`
	C3    float64 `json:"c3,omitempty"`
	I1    float64 `json:"i1,omitempty"`
	I2    float64 `json:"i2,omitempty"`
	I3    float64 `json:"i3,omitempty"`
	SUP   float64 `json:"sup,omitempty"`
	ADM   float64 `json:"adm,omitempty"`
}

Jump to

Keyboard shortcuts

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