location

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AreaRows added in v1.0.0

type AreaRows struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Alias    string `json:"alias"`
	PostCode string `json:"postcode"`
}

type Areas

type Areas struct {
	Status string `json:"status"`
	Data   struct {
		Title   string     `json:"title"`
		Content string     `json:"content"`
		Rows    []AreaRows `json:"rows"`
	} `json:"data"`
}

Areas struct contains response from API GetAreas.

func GetAreas

func GetAreas(areaIDS string) (Areas, error)

GetAreas retrieves areas based on submitted suburb ID.

func GetAreasWithContext

func GetAreasWithContext(ctx context.Context, areaIDS string) (Areas, error)

GetAreasWithContext retrieves areas based on submitted suburb ID.

type AreasV3 added in v1.0.0

type AreasV3 struct {
	Metadata struct {
		Path           string `json:"path"`
		HttpStatusCode int    `json:"http_status_code"`
		HttpStatus     string `json:"http_status"`
		Timestamp      int    `json:"timestamp"`
	} `json:"metadata"`
	Data []struct {
		Suburb struct {
			Id   int     `json:"id"`
			Name string  `json:"name"`
			Lat  float64 `json:"lat"`
			Lng  float64 `json:"lng"`
		} `json:"suburb"`
		City struct {
			Id   int     `json:"id"`
			Name string  `json:"name"`
			Lat  float64 `json:"lat"`
			Lng  float64 `json:"lng"`
		} `json:"city"`
		Province struct {
			Id   int     `json:"id"`
			Name string  `json:"name"`
			Lat  float64 `json:"lat"`
			Lng  float64 `json:"lng"`
		} `json:"province"`
		Country struct {
			Id   int    `json:"id"`
			Name string `json:"name"`
			Code string `json:"code"`
		} `json:"country"`
		Id       int     `json:"id"`
		Name     string  `json:"name"`
		Postcode string  `json:"postcode"`
		Lat      float64 `json:"lat"`
		Lng      float64 `json:"lng"`
	} `json:"data"`
	Pagination struct {
		CurrentPage     int `json:"current_page"`
		CurrentElements int `json:"current_elements"`
		TotalPages      int `json:"total_pages"`
		TotalElements   int `json:"total_elements"`
	} `json:"pagination"`
}

func (AreasV3) ToAreas added in v1.0.0

func (r AreasV3) ToAreas() Areas

type Cities

type Cities struct {
	Status string `json:"status"`
	Data   struct {
		Title   string     `json:"title"`
		Content string     `json:"content"`
		Rows    []CityRows `json:"rows"`
	} `json:"data"`
}

func GetCities

func GetCities(provinceID int) (Cities, error)

GetCities retrieves cities based on province ID.

func GetCitiesWithContext

func GetCitiesWithContext(ctx context.Context, provinceID int) (Cities, error)

GetCitiesWithContext retrieves cities based on province ID with context.

func GetOriginCities

func GetOriginCities() (Cities, error)

GetOriginCities retrieves provinces in which Shipper provides pickup service.

func GetOriginCitiesWithContext

func GetOriginCitiesWithContext(ctx context.Context) (Cities, error)

GetOriginCitiesWithContext retrieves provinces in which Shipper provides pickup service with context.

type CitiesV3 added in v1.0.0

type CitiesV3 struct {
	Metadata struct {
		Path           string `json:"path"`
		HttpStatusCode int    `json:"http_status_code"`
		HttpStatus     string `json:"http_status"`
		Timestamp      int    `json:"timestamp"`
	} `json:"metadata"`
	Data []struct {
		Province struct {
			Id   int     `json:"id"`
			Name string  `json:"name"`
			Lat  float64 `json:"lat"`
			Lng  float64 `json:"lng"`
		} `json:"province"`
		Country struct {
			Id   int    `json:"id"`
			Name string `json:"name"`
			Code string `json:"code"`
		} `json:"country"`
		Id   int     `json:"id"`
		Name string  `json:"name"`
		Lat  float64 `json:"lat"`
		Lng  float64 `json:"lng"`
	} `json:"data"`
	Pagination struct {
		CurrentPage     int `json:"current_page"`
		CurrentElements int `json:"current_elements"`
		TotalPages      int `json:"total_pages"`
		TotalElements   int `json:"total_elements"`
	} `json:"pagination"`
}

func (CitiesV3) ToCities added in v1.0.0

func (r CitiesV3) ToCities() Cities

type CityRows added in v1.0.0

type CityRows struct {
	ID           int    `json:"id"`
	Name         string `json:"name"`
	ProvinceID   int    `json:"province_id"`
	ProvinceName string `json:"province_name"`
}

type Coordinate added in v1.0.0

type Coordinate struct {
	Lat float64 `json:"lat"`
	Lng float64 `json:"lng"`
}

type Countries

type Countries struct {
	Status string `json:"status"`
	Data   struct {
		Title   string        `json:"title"`
		Content string        `json:"content"`
		Rows    []CountryRows `json:"rows"`
	} `json:"data"`
}

func GetCountries

func GetCountries() (Countries, error)

GetCountries retrieves country data in a list.

func GetCountriesWithContext

func GetCountriesWithContext(ctx context.Context) (Countries, error)

GetCountriesWithContext retrieves country data in a list with context.

type CountriesV3 added in v1.0.0

type CountriesV3 struct {
	Metadata struct {
		Path           string `json:"path"`
		HttpStatusCode int    `json:"http_status_code"`
		HttpStatus     string `json:"http_status"`
		Timestamp      int    `json:"timestamp"`
	} `json:"metadata"`
	Data []struct {
		Id   int    `json:"id"`
		Name string `json:"name"`
		Code string `json:"code"`
	} `json:"data"`
	Pagination struct {
		CurrentPage     int `json:"current_page"`
		CurrentElements int `json:"current_elements"`
		TotalPages      int `json:"total_pages"`
		TotalElements   int `json:"total_elements"`
	} `json:"pagination"`
}

func (CountriesV3) ToCountries added in v1.0.0

func (r CountriesV3) ToCountries() Countries

type CountryRows added in v1.0.0

type CountryRows struct {
	CountryName string `json:"country_name"`
	CountryID   int    `json:"country_id"`
}

type Level added in v1.0.0

type Level struct {
	Id       int        `json:"id"`
	Level    int        `json:"level"`
	Type     string     `json:"type"`
	Name     string     `json:"name"`
	GeoCoord Coordinate `json:"geo_coord"`
	Postcode string     `json:"postcode"`
}

type Locations

type Locations struct {
	Status string `json:"status"`
	Data   struct {
		Title   string          `json:"title"`
		Content string          `json:"content"`
		Rows    []LocationsRows `json:"rows"`
	} `json:"data"`
}

Locations struct contains response from API SearchLocations.

func SearchLocation

func SearchLocation(keyword string) (Locations, error)

SearchLocation retrieves every area, suburb, and city whose names include the submitted substring (including postcode).

func SearchLocationWithContext

func SearchLocationWithContext(ctx context.Context, keyword string) (Locations, error)

SearchLocationWithContext retrieves every area, suburb, and city whose names include the submitted substring (including postcode) with context.

type LocationsRows added in v1.0.0

type LocationsRows struct {
	AreaID       int    `json:"area_id"`
	AreaName     string `json:"area_name"`
	AreaAlias    string `json:"area_alias"`
	CityID       int    `json:"city_id"`
	CityName     string `json:"city_name"`
	Label        string `json:"label"`
	OrderList    int    `json:"order_list"`
	ProvinceID   int    `json:"province_id"`
	ProvinceName string `json:"province_name"`
	SuburbID     int    `json:"suburb_id"`
	SuburbName   string `json:"suburb_name"`
	SuburbAlias  string `json:"suburb_alias"`
	Value        string `json:"value"`
}

type LocationsV3 added in v1.0.0

type LocationsV3 struct {
	Metadata structs.Metadata `json:"metadata"`
	Data     []struct {
		AdmLevel1   Level    `json:"adm_level_1"`
		AdmLevel2   Level    `json:"adm_level_2"`
		AdmLevel3   Level    `json:"adm_level_3"`
		AdmLevel4   Level    `json:"adm_level_4"`
		AdmLevel5   Level    `json:"adm_level_5"`
		AdmLevelCur Level    `json:"adm_level_cur"`
		DisplayTxt  string   `json:"display_txt"`
		Postcodes   []string `json:"postcodes"`
	} `json:"data"`
	Pagination struct {
		CurrentPage     int `json:"current_page"`
		CurrentElements int `json:"current_elements"`
		TotalPages      int `json:"total_pages"`
		TotalElements   int `json:"total_elements"`
	} `json:"pagination"`
}

func (LocationsV3) ToLocations added in v1.0.0

func (r LocationsV3) ToLocations() Locations

type ProvinceRows added in v1.0.0

type ProvinceRows struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type Provinces

type Provinces struct {
	Status string `json:"status"`
	Data   struct {
		Title   string         `json:"title"`
		Content string         `json:"content"`
		Rows    []ProvinceRows `json:"rows"`
	} `json:"data"`
}

Provinces struct contains response from API GetProvinces.

func GetProvinces

func GetProvinces() (Provinces, error)

GetProvinces retrieves all provinces in Indonesia in a list.

func GetProvincesWithContext

func GetProvincesWithContext(ctx context.Context) (Provinces, error)

GetProvincesWithContext retrieves all provinces in Indonesia in a list with context.

type ProvincesV3 added in v1.0.0

type ProvincesV3 struct {
	Metadata struct {
		Path           string `json:"path"`
		HttpStatusCode int    `json:"http_status_code"`
		HttpStatus     string `json:"http_status"`
		Timestamp      int    `json:"timestamp"`
	} `json:"metadata"`
	Data []struct {
		Id      int     `json:"id"`
		Name    string  `json:"name"`
		Lat     float64 `json:"lat"`
		Lng     float64 `json:"lng"`
		Country struct {
			Id   int    `json:"id"`
			Name string `json:"name"`
			Code string `json:"code"`
		} `json:"country"`
	} `json:"data"`
	Pagination struct {
		CurrentPage     int `json:"current_page"`
		CurrentElements int `json:"current_elements"`
		TotalPages      int `json:"total_pages"`
		TotalElements   int `json:"total_elements"`
	} `json:"pagination"`
}

func (ProvincesV3) ToProvince added in v1.0.0

func (r ProvincesV3) ToProvince() Provinces

type Suburbs

type Suburbs struct {
	Status string `json:"status"`
	Data   struct {
		Title   string        `json:"title"`
		Content string        `json:"content"`
		Rows    []SuburbsRows `json:"rows"`
	} `json:"data"`
}

Suburbs struct contains response from API GetSuburbs.

func GetSuburbs

func GetSuburbs(cityID int) (Suburbs, error)

GetSuburbs retrieves suburbs based on submitted city ID.

func GetSuburbsWithContext

func GetSuburbsWithContext(ctx context.Context, cityID int) (Suburbs, error)

GetSuburbsWithContext retrieves suburbs based on submitted city ID with context.

type SuburbsRows added in v1.0.0

type SuburbsRows struct {
	ID    int    `json:"id"`
	Name  string `json:"name"`
	Alias string `json:"alias"`
}

type SuburbsV3 added in v1.0.0

type SuburbsV3 struct {
	Metadata struct {
		Path           string `json:"path"`
		HttpStatusCode int    `json:"http_status_code"`
		HttpStatus     string `json:"http_status"`
		Timestamp      int    `json:"timestamp"`
	} `json:"metadata"`
	Data []struct {
		Id   int     `json:"id"`
		Name string  `json:"name"`
		Lat  float64 `json:"lat"`
		Lng  float64 `json:"lng"`
		City struct {
			Id   int     `json:"id"`
			Name string  `json:"name"`
			Lat  float64 `json:"lat"`
			Lng  float64 `json:"lng"`
		} `json:"city"`
		Province struct {
			Id   int     `json:"id"`
			Name string  `json:"name"`
			Lat  float64 `json:"lat"`
			Lng  float64 `json:"lng"`
		} `json:"province"`
		Country struct {
			Id   int    `json:"id"`
			Name string `json:"name"`
			Code string `json:"code"`
		} `json:"country"`
	} `json:"data"`
	Pagination struct {
		CurrentPage     int `json:"current_page"`
		CurrentElements int `json:"current_elements"`
		TotalPages      int `json:"total_pages"`
		TotalElements   int `json:"total_elements"`
	} `json:"pagination"`
}

func (SuburbsV3) ToSuburbs added in v1.0.0

func (r SuburbsV3) ToSuburbs() Suburbs

Jump to

Keyboard shortcuts

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