1
// Package qpxexpress provides access to the QPX Express API.
3
// See http://developers.google.com/qpx-express
7
// import "google.golang.org/api/qpxexpress/v1"
9
// qpxexpressService, err := qpxexpress.New(oauthHttpClient)
17
"google.golang.org/api/googleapi"
25
// Always reference these packages, just in case the auto-generated code
27
var _ = bytes.NewBuffer
30
var _ = json.NewDecoder
33
var _ = googleapi.Version
35
var _ = strings.Replace
37
const apiId = "qpxExpress:v1"
38
const apiName = "qpxExpress"
39
const apiVersion = "v1"
40
const basePath = "https://www.googleapis.com/qpxExpress/v1/trips/"
42
func New(client *http.Client) (*Service, error) {
44
return nil, errors.New("client is nil")
46
s := &Service{client: client, BasePath: basePath}
47
s.Trips = NewTripsService(s)
53
BasePath string // API endpoint base URL
58
func NewTripsService(s *Service) *TripsService {
59
rs := &TripsService{s: s}
63
type TripsService struct {
67
type AircraftData struct {
68
// Code: The aircraft code. For example, for a Boeing 777 the code would
70
Code string `json:"code,omitempty"`
72
// Kind: Identifies this as an aircraftData object. Value: the fixed
73
// string qpxexpress#aircraftData
74
Kind string `json:"kind,omitempty"`
76
// Name: The name of an aircraft, for example Boeing 777.
77
Name string `json:"name,omitempty"`
80
type AirportData struct {
81
// City: The city code an airport is located in. For example, for JFK
82
// airport, this is NYC.
83
City string `json:"city,omitempty"`
85
// Code: An airport's code. For example, for Boston Logan airport, this
87
Code string `json:"code,omitempty"`
89
// Kind: Identifies this as an airport object. Value: the fixed string
90
// qpxexpress#airportData.
91
Kind string `json:"kind,omitempty"`
93
// Name: The name of an airport. For example, for airport BOS the name
94
// is "Boston Logan International".
95
Name string `json:"name,omitempty"`
98
type BagDescriptor struct {
99
// CommercialName: Provides the commercial name for an optional service.
100
CommercialName string `json:"commercialName,omitempty"`
102
// Count: How many of this type of bag will be checked on this flight.
103
Count int64 `json:"count,omitempty"`
105
// Description: A description of the baggage.
106
Description []string `json:"description,omitempty"`
108
// Kind: Identifies this as a baggage object. Value: the fixed string
109
// qpxexpress#bagDescriptor.
110
Kind string `json:"kind,omitempty"`
112
// Subcode: The standard IATA subcode used to identify this optional
114
Subcode string `json:"subcode,omitempty"`
117
type CarrierData struct {
118
// Code: The IATA designator of a carrier (airline, etc). For example,
119
// for American Airlines, the code is AA.
120
Code string `json:"code,omitempty"`
122
// Kind: Identifies this as a kind of carrier (ie. an airline, bus line,
123
// railroad, etc). Value: the fixed string qpxexpress#carrierData.
124
Kind string `json:"kind,omitempty"`
126
// Name: The long, full name of a carrier. For example: American
128
Name string `json:"name,omitempty"`
131
type CityData struct {
132
// Code: The IATA character ID of a city. For example, for Boston this
134
Code string `json:"code,omitempty"`
136
// Country: The two-character country code of the country the city is
137
// located in. For example, US for the United States of America.
138
Country string `json:"country,omitempty"`
140
// Kind: Identifies this as a city, typically with one or more airports.
141
// Value: the fixed string qpxexpress#cityData.
142
Kind string `json:"kind,omitempty"`
144
// Name: The full name of a city. An example would be: New York.
145
Name string `json:"name,omitempty"`
149
// Aircraft: The aircraft that is flying between an origin and
151
Aircraft []*AircraftData `json:"aircraft,omitempty"`
153
// Airport: The airport of an origin or destination.
154
Airport []*AirportData `json:"airport,omitempty"`
156
// Carrier: The airline carrier of the aircraft flying between an origin
157
// and destination. Allowed values are IATA carrier codes.
158
Carrier []*CarrierData `json:"carrier,omitempty"`
160
// City: The city that is either the origin or destination of part of a
162
City []*CityData `json:"city,omitempty"`
164
// Kind: Identifies this as QPX Express response resource, including a
165
// trip's airport, city, taxes, airline, and aircraft. Value: the fixed
166
// string qpxexpress#data.
167
Kind string `json:"kind,omitempty"`
169
// Tax: The taxes due for flying between an origin and a destination.
170
Tax []*TaxData `json:"tax,omitempty"`
173
type FareInfo struct {
174
BasisCode string `json:"basisCode,omitempty"`
176
// Carrier: The carrier of the aircraft or other vehicle commuting
177
// between two points.
178
Carrier string `json:"carrier,omitempty"`
180
// Destination: The city code of the city the trip ends at.
181
Destination string `json:"destination,omitempty"`
183
// Id: A unique identifier of the fare.
184
Id string `json:"id,omitempty"`
186
// Kind: Identifies this as a fare object. Value: the fixed string
187
// qpxexpress#fareInfo.
188
Kind string `json:"kind,omitempty"`
190
// Origin: The city code of the city the trip begins at.
191
Origin string `json:"origin,omitempty"`
193
// Private: Whether this is a private fare, for example one offered only
194
// to select customers rather than the general public.
195
Private bool `json:"private,omitempty"`
198
type FlightInfo struct {
199
Carrier string `json:"carrier,omitempty"`
201
// Number: The flight number.
202
Number string `json:"number,omitempty"`
205
type FreeBaggageAllowance struct {
206
// BagDescriptor: A representation of a type of bag, such as an ATPCo
207
// subcode, Commercial Name, or other description.
208
BagDescriptor []*BagDescriptor `json:"bagDescriptor,omitempty"`
210
// Kilos: The maximum number of kilos all the free baggage together may
212
Kilos int64 `json:"kilos,omitempty"`
214
// KilosPerPiece: The maximum number of kilos any one piece of baggage
216
KilosPerPiece int64 `json:"kilosPerPiece,omitempty"`
218
// Kind: Identifies this as free baggage object, allowed on one segment
219
// of a trip. Value: the fixed string qpxexpress#freeBaggageAllowance.
220
Kind string `json:"kind,omitempty"`
222
// Pieces: The number of free pieces of baggage allowed.
223
Pieces int64 `json:"pieces,omitempty"`
225
// Pounds: The number of pounds of free baggage allowed.
226
Pounds int64 `json:"pounds,omitempty"`
229
type LegInfo struct {
230
// Aircraft: The aircraft (or bus, ferry, railcar, etc) travelling
231
// between the two points of this leg.
232
Aircraft string `json:"aircraft,omitempty"`
234
// ArrivalTime: The scheduled time of arrival at the destination of the
235
// leg, local to the point of arrival.
236
ArrivalTime string `json:"arrivalTime,omitempty"`
238
// ChangePlane: Whether you have to change planes following this leg.
239
// Only applies to the next leg.
240
ChangePlane bool `json:"changePlane,omitempty"`
242
// ConnectionDuration: Duration of a connection following this leg, in
244
ConnectionDuration int64 `json:"connectionDuration,omitempty"`
246
// DepartureTime: The scheduled departure time of the leg, local to the
247
// point of departure.
248
DepartureTime string `json:"departureTime,omitempty"`
250
// Destination: The leg destination as a city and airport.
251
Destination string `json:"destination,omitempty"`
253
// DestinationTerminal: The terminal the flight is scheduled to arrive
255
DestinationTerminal string `json:"destinationTerminal,omitempty"`
257
// Duration: The scheduled travelling time from the origin to the
259
Duration int64 `json:"duration,omitempty"`
261
// Id: An identifier that uniquely identifies this leg in the solution.
262
Id string `json:"id,omitempty"`
264
// Kind: Identifies this as a leg object. A leg is the smallest unit of
265
// travel, in the case of a flight a takeoff immediately followed by a
266
// landing at two set points on a particular carrier with a particular
267
// flight number. Value: the fixed string qpxexpress#legInfo.
268
Kind string `json:"kind,omitempty"`
270
// Meal: A simple, general description of the meal(s) served on the
271
// flight, for example: "Hot meal".
272
Meal string `json:"meal,omitempty"`
274
// Mileage: The number of miles in this leg.
275
Mileage int64 `json:"mileage,omitempty"`
277
// OnTimePerformance: In percent, the published on time performance on
279
OnTimePerformance int64 `json:"onTimePerformance,omitempty"`
281
// OperatingDisclosure: Department of Transportation disclosure
282
// information on the actual operator of a flight in a code share. (A
283
// code share refers to a marketing agreement between two carriers,
284
// where one carrier will list in its schedules (and take bookings for)
285
// flights that are actually operated by another carrier.)
286
OperatingDisclosure string `json:"operatingDisclosure,omitempty"`
288
// Origin: The leg origin as a city and airport.
289
Origin string `json:"origin,omitempty"`
291
// OriginTerminal: The terminal the flight is scheduled to depart from.
292
OriginTerminal string `json:"originTerminal,omitempty"`
294
// Secure: Whether passenger information must be furnished to the United
295
// States Transportation Security Administration (TSA) prior to
297
Secure bool `json:"secure,omitempty"`
300
type PassengerCounts struct {
301
// AdultCount: The number of passengers that are adults.
302
AdultCount int64 `json:"adultCount,omitempty"`
304
// ChildCount: The number of passengers that are children.
305
ChildCount int64 `json:"childCount,omitempty"`
307
// InfantInLapCount: The number of passengers that are infants
308
// travelling in the lap of an adult.
309
InfantInLapCount int64 `json:"infantInLapCount,omitempty"`
311
// InfantInSeatCount: The number of passengers that are infants each
313
InfantInSeatCount int64 `json:"infantInSeatCount,omitempty"`
315
// Kind: Identifies this as a passenger count object, representing the
316
// number of passengers. Value: the fixed string
317
// qpxexpress#passengerCounts.
318
Kind string `json:"kind,omitempty"`
320
// SeniorCount: The number of passengers that are senior citizens.
321
SeniorCount int64 `json:"seniorCount,omitempty"`
324
type PricingInfo struct {
325
// BaseFareTotal: The total fare in the base fare currency (the currency
326
// of the country of origin). This element is only present when the
327
// sales currency and the currency of the country of commencement are
329
BaseFareTotal string `json:"baseFareTotal,omitempty"`
331
// Fare: The fare used to price one or more segments.
332
Fare []*FareInfo `json:"fare,omitempty"`
334
// FareCalculation: The horizontal fare calculation. This is a field on
335
// a ticket that displays all of the relevant items that go into the
336
// calculation of the fare.
337
FareCalculation string `json:"fareCalculation,omitempty"`
339
// Kind: Identifies this as a pricing object, representing the price of
340
// one or more travel segments. Value: the fixed string
341
// qpxexpress#pricingInfo.
342
Kind string `json:"kind,omitempty"`
344
// LatestTicketingTime: The latest ticketing time for this pricing
345
// assuming the reservation occurs at ticketing time and there is no
346
// change in fares/rules. The time is local to the point of sale (POS).
347
LatestTicketingTime string `json:"latestTicketingTime,omitempty"`
349
// Passengers: The number of passengers to which this price applies.
350
Passengers *PassengerCounts `json:"passengers,omitempty"`
352
// Ptc: The passenger type code for this pricing. An alphanumeric code
353
// used by a carrier to restrict fares to certain categories of
354
// passenger. For instance, a fare might be valid only for senior
356
Ptc string `json:"ptc,omitempty"`
358
// Refundable: Whether the fares on this pricing are refundable.
359
Refundable bool `json:"refundable,omitempty"`
361
// SaleFareTotal: The total fare in the sale or equivalent currency.
362
SaleFareTotal string `json:"saleFareTotal,omitempty"`
364
// SaleTaxTotal: The taxes in the sale or equivalent currency.
365
SaleTaxTotal string `json:"saleTaxTotal,omitempty"`
367
// SaleTotal: Total per-passenger price (fare and tax) in the sale or
368
// equivalent currency.
369
SaleTotal string `json:"saleTotal,omitempty"`
371
// SegmentPricing: The per-segment price and baggage information.
372
SegmentPricing []*SegmentPricing `json:"segmentPricing,omitempty"`
374
// Tax: The taxes used to calculate the tax total per ticket.
375
Tax []*TaxInfo `json:"tax,omitempty"`
378
type SegmentInfo struct {
379
// BookingCode: The booking code or class for this segment.
380
BookingCode string `json:"bookingCode,omitempty"`
382
// BookingCodeCount: The number of seats available in this booking code
384
BookingCodeCount int64 `json:"bookingCodeCount,omitempty"`
386
// Cabin: The cabin booked for this segment.
387
Cabin string `json:"cabin,omitempty"`
389
// ConnectionDuration: In minutes, the duration of the connection
390
// following this segment.
391
ConnectionDuration int64 `json:"connectionDuration,omitempty"`
393
// Duration: The duration of the flight segment in minutes.
394
Duration int64 `json:"duration,omitempty"`
396
// Flight: The flight this is a segment of.
397
Flight *FlightInfo `json:"flight,omitempty"`
399
// Id: An id uniquely identifying the segment in the solution.
400
Id string `json:"id,omitempty"`
402
// Kind: Identifies this as a segment object. A segment is one or more
403
// consecutive legs on the same flight. For example a hypothetical
404
// flight ZZ001, from DFW to OGG, could have one segment with two legs:
405
// DFW to HNL (leg 1), HNL to OGG (leg 2). Value: the fixed string
406
// qpxexpress#segmentInfo.
407
Kind string `json:"kind,omitempty"`
409
// Leg: The legs composing this segment.
410
Leg []*LegInfo `json:"leg,omitempty"`
412
// MarriedSegmentGroup: The solution-based index of a segment in a
413
// married segment group. Married segments can only be booked together.
414
// For example, an airline might report a certain booking code as sold
415
// out from Boston to Pittsburgh, but as available as part of two
416
// married segments Boston to Chicago connecting through Pittsburgh. For
417
// example content of this field, consider the round-trip flight ZZ1
418
// PHX-PHL ZZ2 PHL-CLT ZZ3 CLT-PHX. This has three segments, with the
419
// two outbound ones (ZZ1 ZZ2) married. In this case, the two outbound
420
// segments belong to married segment group 0, and the return segment
421
// belongs to married segment group 1.
422
MarriedSegmentGroup string `json:"marriedSegmentGroup,omitempty"`
424
// SubjectToGovernmentApproval: Whether the operation of this segment
425
// remains subject to government approval.
426
SubjectToGovernmentApproval bool `json:"subjectToGovernmentApproval,omitempty"`
429
type SegmentPricing struct {
430
// FareId: A segment identifier unique within a single solution. It is
431
// used to refer to different parts of the same solution.
432
FareId string `json:"fareId,omitempty"`
434
// FreeBaggageOption: Details of the free baggage allowance on this
436
FreeBaggageOption []*FreeBaggageAllowance `json:"freeBaggageOption,omitempty"`
438
// Kind: Identifies this as a segment pricing object, representing the
439
// price of this segment. Value: the fixed string
440
// qpxexpress#segmentPricing.
441
Kind string `json:"kind,omitempty"`
443
// SegmentId: Unique identifier in the response of this segment.
444
SegmentId string `json:"segmentId,omitempty"`
447
type SliceInfo struct {
448
// Duration: The duration of the slice in minutes.
449
Duration int64 `json:"duration,omitempty"`
451
// Kind: Identifies this as a slice object. A slice represents a
452
// traveller's intent, the portion of a low-fare search corresponding to
453
// a traveler's request to get between two points. One-way journeys are
454
// generally expressed using 1 slice, round-trips using 2. Value: the
455
// fixed string qpxexpress#sliceInfo.
456
Kind string `json:"kind,omitempty"`
458
// Segment: The segment(s) constituting the slice.
459
Segment []*SegmentInfo `json:"segment,omitempty"`
462
type SliceInput struct {
463
// Alliance: Slices with only the carriers in this alliance should be
464
// returned; do not use this field with permittedCarrier. Allowed values
465
// are ONEWORLD, SKYTEAM, and STAR.
466
Alliance string `json:"alliance,omitempty"`
468
// Date: Departure date in YYYY-MM-DD format.
469
Date string `json:"date,omitempty"`
471
// Destination: Airport or city IATA designator of the destination.
472
Destination string `json:"destination,omitempty"`
474
// Kind: Identifies this as a slice input object, representing the
475
// criteria a desired slice must satisfy. Value: the fixed string
476
// qpxexpress#sliceInput.
477
Kind string `json:"kind,omitempty"`
479
// MaxConnectionDuration: The longest connection between two legs, in
480
// minutes, you are willing to accept.
481
MaxConnectionDuration int64 `json:"maxConnectionDuration,omitempty"`
483
// MaxStops: The maximum number of stops you are willing to accept in
485
MaxStops int64 `json:"maxStops,omitempty"`
487
// Origin: Airport or city IATA designator of the origin.
488
Origin string `json:"origin,omitempty"`
490
// PermittedCarrier: A list of 2-letter IATA airline designators. Slices
491
// with only these carriers should be returned.
492
PermittedCarrier []string `json:"permittedCarrier,omitempty"`
494
// PermittedDepartureTime: Slices must depart in this time of day range,
495
// local to the point of departure.
496
PermittedDepartureTime *TimeOfDayRange `json:"permittedDepartureTime,omitempty"`
498
// PreferredCabin: Prefer solutions that book in this cabin for this
499
// slice. Allowed values are COACH, PREMIUM_COACH, BUSINESS, and FIRST.
500
PreferredCabin string `json:"preferredCabin,omitempty"`
502
// ProhibitedCarrier: A list of 2-letter IATA airline designators.
503
// Exclude slices that use these carriers.
504
ProhibitedCarrier []string `json:"prohibitedCarrier,omitempty"`
507
type TaxData struct {
508
// Id: An identifier uniquely identifying a tax in a response.
509
Id string `json:"id,omitempty"`
511
// Kind: Identifies this as a tax data object, representing some tax.
512
// Value: the fixed string qpxexpress#taxData.
513
Kind string `json:"kind,omitempty"`
515
// Name: The name of a tax.
516
Name string `json:"name,omitempty"`
519
type TaxInfo struct {
520
// ChargeType: Whether this is a government charge or a carrier
522
ChargeType string `json:"chargeType,omitempty"`
524
// Code: The code to enter in the ticket's tax box.
525
Code string `json:"code,omitempty"`
527
// Country: For government charges, the country levying the charge.
528
Country string `json:"country,omitempty"`
530
// Id: Identifier uniquely identifying this tax in a response. Not
531
// present for unnamed carrier surcharges.
532
Id string `json:"id,omitempty"`
534
// Kind: Identifies this as a tax information object. Value: the fixed
535
// string qpxexpress#taxInfo.
536
Kind string `json:"kind,omitempty"`
538
// SalePrice: The price of the tax in the sales or equivalent currency.
539
SalePrice string `json:"salePrice,omitempty"`
542
type TimeOfDayRange struct {
543
// EarliestTime: The earliest time of day in HH:MM format.
544
EarliestTime string `json:"earliestTime,omitempty"`
546
// Kind: Identifies this as a time of day range object, representing two
547
// times in a single day defining a time range. Value: the fixed string
548
// qpxexpress#timeOfDayRange.
549
Kind string `json:"kind,omitempty"`
551
// LatestTime: The latest time of day in HH:MM format.
552
LatestTime string `json:"latestTime,omitempty"`
555
type TripOption struct {
556
// Id: Identifier uniquely identifying this trip in a response.
557
Id string `json:"id,omitempty"`
559
// Kind: Identifies this as a trip information object. Value: the fixed
560
// string qpxexpress#tripOption.
561
Kind string `json:"kind,omitempty"`
563
// Pricing: Per passenger pricing information.
564
Pricing []*PricingInfo `json:"pricing,omitempty"`
566
// SaleTotal: The total price for all passengers on the trip, in the
567
// form of a currency followed by an amount, e.g. USD253.35.
568
SaleTotal string `json:"saleTotal,omitempty"`
570
// Slice: The slices that make up this trip's itinerary.
571
Slice []*SliceInfo `json:"slice,omitempty"`
574
type TripOptionsRequest struct {
575
// MaxPrice: Do not return solutions that cost more than this price. The
576
// alphabetical part of the price is in ISO 4217. The format, in regex,
577
// is [A-Z]{3}\d+(\.\d+)? Example: $102.07
578
MaxPrice string `json:"maxPrice,omitempty"`
580
// Passengers: Counts for each passenger type in the request.
581
Passengers *PassengerCounts `json:"passengers,omitempty"`
583
// Refundable: Return only solutions with refundable fares.
584
Refundable bool `json:"refundable,omitempty"`
586
// SaleCountry: IATA country code representing the point of sale. This
587
// determines the "equivalent amount paid" currency for the ticket.
588
SaleCountry string `json:"saleCountry,omitempty"`
590
// Slice: The slices that make up the itinerary of this trip. A slice
591
// represents a traveler's intent, the portion of a low-fare search
592
// corresponding to a traveler's request to get between two points.
593
// One-way journeys are generally expressed using one slice, round-trips
594
// using two. An example of a one slice trip with three segments might
595
// be BOS-SYD, SYD-LAX, LAX-BOS if the traveler only stopped in SYD and
596
// LAX just long enough to change planes.
597
Slice []*SliceInput `json:"slice,omitempty"`
599
// Solutions: The number of solutions to return, maximum 500.
600
Solutions int64 `json:"solutions,omitempty"`
603
type TripOptionsResponse struct {
604
// Data: Informational data global to list of solutions.
605
Data *Data `json:"data,omitempty"`
607
// Kind: Identifies this as a QPX Express trip response object, which
608
// consists of zero or more solutions. Value: the fixed string
609
// qpxexpress#tripOptions.
610
Kind string `json:"kind,omitempty"`
612
// RequestId: An identifier uniquely identifying this response.
613
RequestId string `json:"requestId,omitempty"`
615
// TripOption: A list of priced itinerary solutions to the QPX Express
617
TripOption []*TripOption `json:"tripOption,omitempty"`
620
type TripsSearchRequest struct {
621
// Request: A QPX Express search request. Required values are at least
622
// one adult or senior passenger, an origin, a destination, and a date.
623
Request *TripOptionsRequest `json:"request,omitempty"`
626
type TripsSearchResponse struct {
627
// Kind: Identifies this as a QPX Express API search response resource.
628
// Value: the fixed string qpxExpress#tripsSearch.
629
Kind string `json:"kind,omitempty"`
631
// Trips: All possible solutions to the QPX Express search request.
632
Trips *TripOptionsResponse `json:"trips,omitempty"`
635
// method id "qpxExpress.trips.search":
637
type TripsSearchCall struct {
639
tripssearchrequest *TripsSearchRequest
640
opt_ map[string]interface{}
643
// Search: Returns a list of flights.
644
func (r *TripsService) Search(tripssearchrequest *TripsSearchRequest) *TripsSearchCall {
645
c := &TripsSearchCall{s: r.s, opt_: make(map[string]interface{})}
646
c.tripssearchrequest = tripssearchrequest
650
// Fields allows partial responses to be retrieved.
651
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
652
// for more information.
653
func (c *TripsSearchCall) Fields(s ...googleapi.Field) *TripsSearchCall {
654
c.opt_["fields"] = googleapi.CombineFields(s)
658
func (c *TripsSearchCall) Do() (*TripsSearchResponse, error) {
659
var body io.Reader = nil
660
body, err := googleapi.WithoutDataWrapper.JSONReader(c.tripssearchrequest)
664
ctype := "application/json"
665
params := make(url.Values)
666
params.Set("alt", "json")
667
if v, ok := c.opt_["fields"]; ok {
668
params.Set("fields", fmt.Sprintf("%v", v))
670
urls := googleapi.ResolveRelative(c.s.BasePath, "search")
671
urls += "?" + params.Encode()
672
req, _ := http.NewRequest("POST", urls, body)
673
googleapi.SetOpaque(req.URL)
674
req.Header.Set("Content-Type", ctype)
675
req.Header.Set("User-Agent", "google-api-go-client/0.5")
676
res, err := c.s.client.Do(req)
680
defer googleapi.CloseBody(res)
681
if err := googleapi.CheckResponse(res); err != nil {
684
var ret *TripsSearchResponse
685
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
690
// "description": "Returns a list of flights.",
691
// "httpMethod": "POST",
692
// "id": "qpxExpress.trips.search",
695
// "$ref": "TripsSearchRequest"
698
// "$ref": "TripsSearchResponse"