tpcgo

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2025 License: BSD-3-Clause Imports: 6 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

tpcgo

This project is still in work and the readme will be updated upon initial release.

Documentation

Index

Constants

View Source
const VERSION = "0.0.5"

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"
	//ENDPOINTCoreAPI    = "http://127.0.0.1:3000"
	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 }

	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")
)

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
}

func NewCoreAPISession

func NewCoreAPISession(ApiKey string) (c *CoreAPISession, e error)

func (*CoreAPISession) AddSuggestion

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

func (*CoreAPISession) DeleteSuggestion

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

func (*CoreAPISession) GetAllSuggestions

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

func (*CoreAPISession) GetSuggestion

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

func (*CoreAPISession) UupdateSuggestion

func (s *CoreAPISession) UupdateSuggestion(id string, entry *Suggestions) (su *Suggestions, e error)

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 FCPAuditLogAdd struct {
	UserID      string `json:"user_id"`
	SubmittedBy string `json:"submitted_by"`
	Text        string `json:"text"`
}

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
}

func NewFCPSession

func NewFCPSession(ApiKey string, Env string) (f *FCPSession, e error)

func (FCPSession) AddFCPUser

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

func (FCPSession) DeleteFCPUser

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

func (FCPSession) GetAllFBOs

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

func (FCPSession) GetAllFCPUsers

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

func (FCPSession) GetFBO

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

func (FCPSession) GetFCPCallsign

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

func (FCPSession) GetFCPUser

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

func (FCPSession) GetFCPUsersBirthdays

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

func (FCPSession) GetSectors

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

func (FCPSession) PostAuditLogEntry

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

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"`
	QNH_I_Hg       float64     `json:"qnh_i_hg,omitempty"`
	QNH_MB         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 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 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
}

func NewVATSIMSession

func NewVATSIMSession(ApiKey string) (v *VATSIMSession, e error)

func (*VATSIMSession) GetUserDiscordID

func (v *VATSIMSession) GetUserDiscordID(UserID string) (m *MemberDiscord, err error)

func (*VATSIMSession) GetUserHours

func (v *VATSIMSession) GetUserHours(UserID string) (m *VATSIMUserHours, err error)

func (*VATSIMSession) GetVatsimDataFeed

func (v *VATSIMSession) GetVatsimDataFeed() (df *DataFeed, err error)

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