-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.go
54 lines (45 loc) · 1.17 KB
/
api.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
45
46
47
48
49
50
51
52
53
54
package main
type City struct {
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Country string `json:"country,omitempty"`
}
var cities = []City{
{1, "Русе", "България"},
{2, "Трявна", "България"},
{3, "Пловдив", "България"},
{4, "Плевен", "България"},
{5, "София", "България"},
{6, "Сливен", "България"},
}
type citiesResponse struct {
Cities []City `json:"cities"`
}
type Office struct {
ID int `json:"id,omitempty"`
CityID int `json:"city_id,omitempty"`
Name string `json:"name,omitempty"`
}
var offices = []Office{
{1, 1, "Майкати"},
{2, 2, "DJ Шанаджия"},
{3, 3, "Zeron"},
{4, 4, "Курви"},
{5, 5, "Ало"},
{6, 6, "Пико"},
}
type officesResponse struct {
Offices []Office `json:"offices"`
}
type shippingRequest struct {
CityID int `json:"city_id" form:"city_id"`
OfficeID int `json:"office_id" form:"office_id"`
Extra string `json:"extra" form:"extra"`
}
type shippingResponse struct {
ID string `json:"id"`
Extra string `json:"extra"`
}
type errorResponse struct {
Error error `json:"error"`
}