lufthansa

package
v0.0.0-...-847f29c Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: AGPL-3.0 Imports: 19 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aircraft

type Aircraft struct {
	AircraftCode     string `json:"AircraftCode"`
	Names            Names  `json:"Names"`
	AirlineEquipCode string `json:"AirlineEquipCode"`
}

type Airline

type Airline struct {
	AirlineId     string `json:"AirlineID"`
	AirlineIdICAO string `json:"AirlineID_ICAO"`
	Names         Names  `json:"Names"`
}

type Airport

type Airport struct {
	Code         string   `json:"AirportCode"`
	Position     Position `json:"Position"`
	CityCode     string   `json:"CityCode"`
	CountryCode  string   `json:"CountryCode"`
	LocationType string   `json:"LocationType"`
	Names        Names    `json:"Names"`
	UtcOffset    string   `json:"UtcOffset"`
	TimeZoneId   string   `json:"TimeZoneId"`
}

type Airports

type Airports struct {
	AirportCode Array[string] `json:"AirportCode"`
}

type Array

type Array[T any] []T

func (*Array[T]) UnmarshalJSON

func (a *Array[T]) UnmarshalJSON(data []byte) error

type City

type City struct {
	CountryCode string   `json:"CountryCode"`
	CityCode    string   `json:"CityCode"`
	Names       Names    `json:"Names"`
	UtcOffset   string   `json:"UtcOffset"`
	TimeZoneId  string   `json:"TimeZoneId"`
	Airports    Airports `json:"Airports"`
}

type Client

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

func NewClient

func NewClient(clientId, clientSecret string, opts ...ClientOption) *Client

func (*Client) Aircraft

func (c *Client) Aircraft(ctx context.Context) ([]Aircraft, error)

func (*Client) AircraftRaw

func (c *Client) AircraftRaw(ctx context.Context) ([]json.RawMessage, error)

func (*Client) Airlines

func (c *Client) Airlines(ctx context.Context) ([]Airline, error)

func (*Client) AirlinesRaw

func (c *Client) AirlinesRaw(ctx context.Context) ([]json.RawMessage, error)

func (*Client) Airport

func (c *Client) Airport(ctx context.Context, airportCode string) (Airport, error)

func (*Client) AirportRaw

func (c *Client) AirportRaw(ctx context.Context, airportCode string) (json.RawMessage, error)

func (*Client) Airports

func (c *Client) Airports(ctx context.Context) ([]Airport, error)

func (*Client) AirportsRaw

func (c *Client) AirportsRaw(ctx context.Context) ([]json.RawMessage, error)

func (*Client) Cities

func (c *Client) Cities(ctx context.Context) ([]City, error)

func (*Client) CitiesRaw

func (c *Client) CitiesRaw(ctx context.Context) ([]json.RawMessage, error)

func (*Client) Countries

func (c *Client) Countries(ctx context.Context) ([]Country, error)

func (*Client) CountriesRaw

func (c *Client) CountriesRaw(ctx context.Context) ([]json.RawMessage, error)

func (*Client) FlightSchedules

func (c *Client) FlightSchedules(ctx context.Context, airlines []common.AirlineIdentifier, startDate, endDate xtime.LocalDate, daysOfOperation []time.Weekday, options ...FlightSchedulesOption) ([]FlightSchedule, error)

func (*Client) FlightSchedulesRaw

func (c *Client) FlightSchedulesRaw(ctx context.Context, airlines []common.AirlineIdentifier, startDate, endDate xtime.LocalDate, daysOfOperation []time.Weekday, w io.Writer, options ...FlightSchedulesOption) error

type ClientOption

type ClientOption func(c *Client)

func WithBaseUrl

func WithBaseUrl(baseUrl string) ClientOption

func WithHttpClient

func WithHttpClient(httpClient *http.Client) ClientOption

func WithLeeway

func WithLeeway(leeway time.Duration) ClientOption

func WithRateLimiter

func WithRateLimiter(limiter *rate.Limiter) ClientOption

type Coordinate

type Coordinate struct {
	Latitude  float64 `json:"Latitude"`
	Longitude float64 `json:"Longitude"`
}

type Country

type Country struct {
	CountryCode string `json:"CountryCode"`
	Names       Names  `json:"Names"`
}

type DataElement

type DataElement struct {
	StartLegSequenceNumber int    `json:"startLegSequenceNumber"`
	EndLegSequenceNumber   int    `json:"endLegSequenceNumber"`
	Id                     int    `json:"id"`
	Value                  string `json:"value"`
}

type DaysOfOperation

type DaysOfOperation []time.Weekday

func (*DaysOfOperation) UnmarshalJSON

func (d *DaysOfOperation) UnmarshalJSON(bytes []byte) error

type FlightSchedule

type FlightSchedule struct {
	Airline              string            `json:"airline"`
	FlightNumber         int               `json:"flightNumber"`
	Suffix               string            `json:"suffix"`
	PeriodOfOperationUTC PeriodOfOperation `json:"periodOfOperationUTC"`
	Legs                 []Leg             `json:"legs"`
	DataElements         []DataElement     `json:"dataElements"`
}

func (FlightSchedule) DataElementsForSequence

func (fs FlightSchedule) DataElementsForSequence(sequenceNumber int) map[int]string

type FlightSchedulesOption

type FlightSchedulesOption interface {
	Apply(q url.Values)
}

type Leg

type Leg struct {
	SequenceNumber                   int    `json:"sequenceNumber"`
	Origin                           string `json:"origin"`
	Destination                      string `json:"destination"`
	ServiceType                      string `json:"serviceType"`
	AircraftOwner                    string `json:"aircraftOwner"`
	AircraftType                     string `json:"aircraftType"`
	AircraftConfigurationVersion     string `json:"aircraftConfigurationVersion"`
	Registration                     string `json:"registration"`
	Op                               bool   `json:"op"`
	AircraftDepartureTimeUTC         int    `json:"aircraftDepartureTimeUTC"`
	AircraftDepartureTimeDateDiffUTC int    `json:"aircraftDepartureTimeDateDiffUTC"`
	AircraftDepartureTimeVariation   int    `json:"aircraftDepartureTimeVariation"`
	AircraftArrivalTimeUTC           int    `json:"aircraftArrivalTimeUTC"`
	AircraftArrivalTimeDateDiffUTC   int    `json:"aircraftArrivalTimeDateDiffUTC"`
	AircraftArrivalTimeVariation     int    `json:"aircraftArrivalTimeVariation"`
}

func (Leg) ArrivalTime

func (l Leg) ArrivalTime(flightStartDate UTCDate) time.Time

func (Leg) DepartureTime

func (l Leg) DepartureTime(flightStartDate UTCDate) time.Time

type Name

type Name struct {
	LanguageCode string
	Name         string
}

func (*Name) UnmarshalJSON

func (n *Name) UnmarshalJSON(b []byte) error

type Names

type Names struct {
	Name Array[Name] `json:"Name"`
}

type PeriodOfOperation

type PeriodOfOperation struct {
	StartDate       UTCDate         `json:"startDate"`
	EndDate         UTCDate         `json:"endDate"`
	DaysOfOperation DaysOfOperation `json:"daysOfOperation"`
}

type Position

type Position struct {
	Coordinate Coordinate `json:"Coordinate"`
}

type UTCDate

type UTCDate time.Time

func (UTCDate) MarshalJSON

func (d UTCDate) MarshalJSON() ([]byte, error)

func (*UTCDate) UnmarshalJSON

func (d *UTCDate) UnmarshalJSON(bytes []byte) error

type WithAircraftTypes

type WithAircraftTypes []string

func (WithAircraftTypes) Apply

func (opt WithAircraftTypes) Apply(q url.Values)

type WithAirlines

type WithAirlines []common.AirlineIdentifier

func (WithAirlines) Apply

func (opt WithAirlines) Apply(q url.Values)

type WithDaysOfOperation

type WithDaysOfOperation []time.Weekday

func (WithDaysOfOperation) Apply

func (opt WithDaysOfOperation) Apply(q url.Values)

type WithDestination

type WithDestination string

func (WithDestination) Apply

func (opt WithDestination) Apply(q url.Values)

type WithEndDate

type WithEndDate xtime.LocalDate

func (WithEndDate) Apply

func (opt WithEndDate) Apply(q url.Values)

type WithFlightNumber

type WithFlightNumber int

func (WithFlightNumber) Apply

func (opt WithFlightNumber) Apply(q url.Values)

type WithFlightNumberRange

type WithFlightNumberRange [2]int

func (WithFlightNumberRange) Apply

func (opt WithFlightNumberRange) Apply(q url.Values)

type WithOrigin

type WithOrigin string

func (WithOrigin) Apply

func (opt WithOrigin) Apply(q url.Values)

type WithStartDate

type WithStartDate xtime.LocalDate

func (WithStartDate) Apply

func (opt WithStartDate) Apply(q url.Values)

Jump to

Keyboard shortcuts

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