-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprices-nearest-places-matrix.go
44 lines (39 loc) · 1.55 KB
/
prices-nearest-places-matrix.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package aviasales
import "fmt"
type InputPricesNearestPlacesMatrix struct {
Currency string
Origin string
Destination string
ShowToAffiliates bool
DepartDate string
ReturnDate string
}
type DataPriceNearest struct {
Success bool `json:"success" bson:"success"`
Data []PriceNearest `json:"data" bson:"data"`
}
type PriceNearest struct {
Origins []string `json:"origins" bson:"origins"`
Destinations []string `json:"destinations" bson:"destinations"`
Prices []Price `json:"prices" bson:"prices"`
}
// PricesNearestPlacesMatrix returns prices directions between nearest to the target cities.
// Note! If you do not specify a starting point and destination, the API returns a list of the cheapest tickets, which were found in the last 48 hours.
//
// Documentation:
// https://support.travelpayouts.com/hc/ru/articles/203956163#04
//
// Example URI:
// http://api.travelpayouts.com/v2/prices/nearest-places-matrix?currency=rub&origin=LED&destination=HKT&show_to_affiliates=true&token=YOUR_TOKEN
func (a *AviasalesApi) PricesNearestPlacesMatrix(input InputPricesNearestPlacesMatrix) (prices DataPriceNearest, err error) {
err = a.getJson("v2/prices/nearest-places-matrix", map[string]string{
"currency": input.Currency,
"origin": input.Origin,
"destination": input.Destination,
"show_to_affiliates": fmt.Sprint(input.ShowToAffiliates),
"depart_date": input.DepartDate,
"return_date": input.ReturnDate,
"token": a.token,
}, &prices)
return
}