Documentation
¶
Index ¶
- Constants
- func CourierParams(couriers ...string) string
- func GetApiURL(accountType string) string
- type API
- type City
- type CityParams
- type Config
- type Cost
- type CostParams
- type Courier
- type CourierCost
- type Province
- type ProvinceParams
- type ResponseBase
- type ResponseCities
- type ResponseCost
- type ResponseProvinces
- type ResponseStatus
Constants ¶
View Source
const ( StarterAPIUrl = "https://api.rajaongkir.com/starter" BasicAPIUrl = "https://api.rajaongkir.com/basic" ProAPIUrl = "https://pro.rajaongkir.com/api" )
View Source
const AccountBasic = "basic"
View Source
const AccountPro = "pro"
View Source
const AccountStarter = "starter"
View Source
const ESL = "esl"
View Source
const JNE = "jne"
View Source
const PCP = "pcp"
View Source
const POS = "pos"
View Source
const RPX = "rpx"
View Source
const TIKI = "tiki"
Variables ¶
This section is empty.
Functions ¶
func CourierParams ¶
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func (API) GetCities ¶
func (a API) GetCities(opts *CityParams) (respCities ResponseCities, err error)
func (API) GetCost ¶
func (a API) GetCost(opts *CostParams) (respCost ResponseCost, err error)
func (API) GetProvinces ¶
func (a API) GetProvinces(opts *ProvinceParams) (respProv ResponseProvinces, err error)
type CityParams ¶
type CostParams ¶
type Courier ¶
type Courier struct {
Code string `json:"code"`
Name string `json:"name"`
Costs []CourierCost `json:"costs"`
}
type CourierCost ¶
type ProvinceParams ¶
type ProvinceParams struct {
ID string `query:"id" json:"id"`
}
type ResponseBase ¶
type ResponseBase[T interface{}, P interface{}] struct {
Query P `json:"query"`
Status ResponseStatus `json:"status"`
Results []T `json:"results"`
}
func (*ResponseBase[T, P]) StatusValid ¶
func (b *ResponseBase[T, P]) StatusValid() error
func (*ResponseBase[T, P]) Unmarshal ¶
func (b *ResponseBase[T, P]) Unmarshal(v []byte) error
type ResponseCities ¶
type ResponseCities struct {
ResponseBase[City, CityParams]
}
type ResponseCost ¶
type ResponseCost struct {
ResponseBase[Courier, CostParams]
}
type ResponseProvinces ¶
type ResponseProvinces struct {
ResponseBase[Province, ProvinceParams]
}
type ResponseStatus ¶
Click to show internal directories.
Click to hide internal directories.