Documentation
¶
Index ¶
- Constants
- Variables
- type ATIS
- type AuditLogEntry
- type AuditLogResponse
- type Controller
- type CoreAPISession
- type DataFeed
- type FBO
- type FCPAuditLogAdd
- type FCPCallsignResponse
- type FCPFBOs
- type FCPFullUser
- type FCPLimitedUser
- type FCPSectors
- type FCPSession
- type FCPUserAdd
- type FCPUserAircraft
- type FlightPlan
- type GeneralInfo
- type MemberDiscord
- type NewSuggestion
- type NotFoundResource
- type Pilot
- type PreFile
- type QuizQuestion
- type QuizQuestionForResponse
- type QuizUserResponse
- type QuizUserResponseSet
- type Sectors
- type Session
- func (s *Session) AddFCPUser(UserID *FCPUserAdd) (a *FCPFullUser, e error)
- func (s *Session) AddNewQuizQuestion(i QuizQuestion) (q *QuizQuestion, e error)
- func (s *Session) AddSuggestion(entry *NewSuggestion) (su *Suggestions, e error)
- func (s *Session) CheckUserQuizResponse(id string) (r bool, e error)
- func (s *Session) DeleteFCPUser(UserID string) (su *SuccessResponse, e error)
- func (s *Session) DeleteQuizQuestion(id string) (d *QuizQuestion, e error)
- func (s *Session) DeleteQuizQuestionForResponse(id string) (d bool, e error)
- func (s *Session) DeleteSuggestion(id string) (d bool, e error)
- func (s *Session) GetAllFBOs() (f *FCPFBOs, e error)
- func (s *Session) GetAllFCPUsers() (u []*FCPLimitedUser, e error)
- func (s *Session) GetAllQuizQuestions() (su []*QuizQuestion, e error)
- func (s *Session) GetAllSuggestions() (su []*Suggestions, e error)
- func (s *Session) GetCurrentQuizQuestions() (q *QuizQuestion, e error)
- func (s *Session) GetFBO(Icao string) (f *FBO, e error)
- func (s *Session) GetFCPCallsign(UserId string) (c *FCPCallsignResponse, e error)
- func (s *Session) GetFCPUser(UserId string) (u *FCPLimitedUser, e error)
- func (s *Session) GetFCPUsersBirthdays() (u []*string, e error)
- func (s *Session) GetNextQuizQuestion() (q *QuizQuestion, e error)
- func (s *Session) GetQuizQuestionByID(id string) (q *QuizQuestion, e error)
- func (s *Session) GetQuizUserResponses(id string, answer string) (r []*QuizUserResponse, e error)
- func (s *Session) GetSectors() (se *FCPSectors, e error)
- func (s *Session) GetSuggestion(id string) (su *Suggestions, e error)
- func (s *Session) GetUserDiscordID(UserID string) (m *MemberDiscord, err error)
- func (s *Session) GetUserHours(UserID string) (m *VATSIMUserHours, err error)
- func (s *Session) GetVatsimDataFeed() (df *DataFeed, err error)
- func (s *Session) PostAuditLogEntry(UserId string, entry AuditLogEntry) (a *AuditLogResponse, e error)
- func (s *Session) ResetQuizUserResponses() (d bool, e error)
- func (s *Session) SetQuestionForResponse(messageID string, questionID string) (c bool, e error)
- func (s *Session) SetQuizUserResponse(i *QuizUserResponseSet) (c bool, e error)
- func (s *Session) UpdateQuizQuestion(id string, i QuizQuestion) (q *QuizQuestion, e error)
- func (s *Session) UpdateSuggestion(id string, entry *Suggestions) (su *Suggestions, e error)
- type SessionConfig
- type SuccessResponse
- type Suggestions
- type VATSIMSession
- type VATSIMUserHours
Constants ¶
View Source
const VERSION = "0.0.7"
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 = "https://api.thepilotclub.org" 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" } 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 = ENDPOINTCoreAPI + "/suggestions/all" ENDPOINTCoreAPINewSuggestion = ENDPOINTCoreAPI + "/suggestions/new" ENDPOINTCoreAPISuggestion = func(id string) string { return ENDPOINTCoreAPI + "/suggestions/" + id } ENDPOINTCoreAPIAllQuizQuestions = ENDPOINTCoreAPI + "/quiz/all" ENDPOINTCoreAPINewQuizQuestion = ENDPOINTCoreAPI + "/quiz/new" ENDPOINTCoreAPINextQuizQuestion = ENDPOINTCoreAPI + "/quiz/next" ENDPOINTCoreAPICurrentQuizQuestion = ENDPOINTCoreAPI + "/quiz/current" EndPointCoreAPIQuizQuestionByID = func(id string) string { return ENDPOINTCoreAPI + "/quiz/" + id } ENDPOINTCoreAPIQuizSetQuestionForResponse = ENDPOINTCoreAPI + "/quiz/responses/question/set" ENDPOINTCoreAPIQuizSetUserResponse = ENDPOINTCoreAPI + "/quiz/responses/user/record" ENDPOINTCoreAPIQuizDeleteQuestionForResponse = func(id string) string { return ENDPOINTCoreAPI + "/quiz/responses/question/" + id } ENDPOINTCoreAPIQuizGetResponses = func(id string, answer string) string { return ENDPOINTCoreAPI + "/quiz/responses/user/responses/" + id + "?answer=" + answer } ENDPOINTCoreAPIResetUserResponses = ENDPOINTCoreAPI + "/quiz/responses/user/responses" ENDPOINTCoreAPICheckUserResponse = func(id string) string { return ENDPOINTCoreAPI + "/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 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 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 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 FCPCallsignResponse ¶
type FCPCallsignResponse struct {
Callsign int `json:"tpcCallsign,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 FCPUserAdd ¶
type FCPUserAdd struct {
UserID string `json:"id"`
}
type FCPUserAircraft ¶
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 NewSuggestion ¶
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 QuizUserResponse ¶ added in v0.0.7
type QuizUserResponseSet ¶ added in v0.0.7
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)
func (*Session) AddFCPUser ¶ added in v0.0.7
func (s *Session) AddFCPUser(UserID *FCPUserAdd) (a *FCPFullUser, e error)
func (*Session) AddNewQuizQuestion ¶ added in v0.0.7
func (s *Session) AddNewQuizQuestion(i QuizQuestion) (q *QuizQuestion, e error)
func (*Session) AddSuggestion ¶ added in v0.0.7
func (s *Session) AddSuggestion(entry *NewSuggestion) (su *Suggestions, e error)
func (*Session) CheckUserQuizResponse ¶ added in v0.0.7
func (*Session) DeleteFCPUser ¶ added in v0.0.7
func (s *Session) DeleteFCPUser(UserID string) (su *SuccessResponse, e error)
func (*Session) DeleteQuizQuestion ¶ added in v0.0.7
func (s *Session) DeleteQuizQuestion(id string) (d *QuizQuestion, e error)
func (*Session) DeleteQuizQuestionForResponse ¶ added in v0.0.7
func (*Session) DeleteSuggestion ¶ added in v0.0.7
func (*Session) GetAllFBOs ¶ added in v0.0.7
func (*Session) GetAllFCPUsers ¶ added in v0.0.7
func (s *Session) GetAllFCPUsers() (u []*FCPLimitedUser, e error)
func (*Session) GetAllQuizQuestions ¶ added in v0.0.7
func (s *Session) GetAllQuizQuestions() (su []*QuizQuestion, e error)
func (*Session) GetAllSuggestions ¶ added in v0.0.7
func (s *Session) GetAllSuggestions() (su []*Suggestions, e error)
func (*Session) GetCurrentQuizQuestions ¶ added in v0.0.7
func (s *Session) GetCurrentQuizQuestions() (q *QuizQuestion, e error)
func (*Session) GetFCPCallsign ¶ added in v0.0.7
func (s *Session) GetFCPCallsign(UserId string) (c *FCPCallsignResponse, e error)
func (*Session) GetFCPUser ¶ added in v0.0.7
func (s *Session) GetFCPUser(UserId string) (u *FCPLimitedUser, e error)
func (*Session) GetFCPUsersBirthdays ¶ added in v0.0.7
func (*Session) GetNextQuizQuestion ¶ added in v0.0.7
func (s *Session) GetNextQuizQuestion() (q *QuizQuestion, e error)
func (*Session) GetQuizQuestionByID ¶ added in v0.0.7
func (s *Session) GetQuizQuestionByID(id string) (q *QuizQuestion, e error)
func (*Session) GetQuizUserResponses ¶ added in v0.0.7
func (s *Session) GetQuizUserResponses(id string, answer string) (r []*QuizUserResponse, e error)
func (*Session) GetSectors ¶ added in v0.0.7
func (s *Session) GetSectors() (se *FCPSectors, e error)
func (*Session) GetSuggestion ¶ added in v0.0.7
func (s *Session) GetSuggestion(id string) (su *Suggestions, e error)
func (*Session) GetUserDiscordID ¶ added in v0.0.7
func (s *Session) GetUserDiscordID(UserID string) (m *MemberDiscord, err error)
func (*Session) GetUserHours ¶ added in v0.0.7
func (s *Session) GetUserHours(UserID string) (m *VATSIMUserHours, err error)
func (*Session) GetVatsimDataFeed ¶ added in v0.0.7
func (*Session) PostAuditLogEntry ¶ added in v0.0.7
func (s *Session) PostAuditLogEntry(UserId string, entry AuditLogEntry) (a *AuditLogResponse, e error)
func (*Session) ResetQuizUserResponses ¶ added in v0.0.7
func (*Session) SetQuestionForResponse ¶ added in v0.0.7
func (*Session) SetQuizUserResponse ¶ added in v0.0.7
func (s *Session) SetQuizUserResponse(i *QuizUserResponseSet) (c bool, e error)
func (*Session) UpdateQuizQuestion ¶ added in v0.0.7
func (s *Session) UpdateQuizQuestion(id string, i QuizQuestion) (q *QuizQuestion, e error)
func (*Session) UpdateSuggestion ¶ added in v0.0.7
func (s *Session) UpdateSuggestion(id string, entry *Suggestions) (su *Suggestions, e error)
type SessionConfig ¶ added in v0.0.7
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 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"`
}
Click to show internal directories.
Click to hide internal directories.