Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- func (c Client) BarcodePng(barcode string) (binary.ByteOrder, error)
- func (c Client) ClaimAttributesValid(claimAttributes models.ClaimAttributes) error
- func (c Client) CreatePacket(packetAttributes models.PacketAttributes) (*models.CreatePacketResponse, error)
- func (c Client) CreatePacketClaim(claimAttributes models.ClaimAttributes) (*models.PacketIdDetail, error)
- func (c Client) CreatePacketClaimWithPassword(createPacketClaimWithPassword models.CreatePacketClaimWithPassword) (models.PacketDetail, error)
- func (c *Client) EndpointURL() *url.URL
- func (c Client) PacketAttributesValid(packetAttributes models.PacketAttributes) error
- func (c Client) PacketGetStoredUntil(packetId int) (models.ZasilkovnaDate, error)
- func (c Client) PacketInfo(packetId int) (models.PacketInfoResponse, error)
- func (c Client) PacketLabelPdf(packetIds models.Ids, format string, offset int) (binary.ByteOrder, error)
- func (c Client) PacketStatus(packetId int) (models.CurrentStatusRecord, error)
- func (c Client) PacketTracking(packetId int) (models.StatusRecords, error)
- type Credentials
- type Options
- type ToRfc7807Error
Constants ¶
const BasicUrl = "https://www.zasilkovna.cz/api/rest/"
Variables ¶
var DefaultTransport = func() (*http.Transport, error) { tr := &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, }).DialContext, MaxIdleConns: 256, MaxIdleConnsPerHost: 16, ResponseHeaderTimeout: time.Minute, IdleConnTimeout: time.Minute, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 10 * time.Second, DisableCompression: true, } tr.TLSClientConfig = &tls.Config{ MinVersion: tls.VersionTLS12, } return tr, nil }
DefaultTransport - this default transport is similar to http.DefaultTransport but with additional param DisableCompression is set to true to avoid decompressing content with 'gzip' encoding.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (Client) BarcodePng ¶
BarcodePng returns binary result in base64 encoding. The barcode is created with Code 128 symbology. NOTE: The method does not validate the barcode in any way. If you wish to create a barcode to use it on your labels, it is important that you use packetId prefixed by the letter Z e.g. Z1234567890.
func (Client) ClaimAttributesValid ¶
func (c Client) ClaimAttributesValid(claimAttributes models.ClaimAttributes) error
ClaimAttributesValid Validates PacketAttributes. On success (the attributes are valid) returns <status>ok</status> `err.Status == ResponseStatusOk`. On error (the attributes are NOT valid) returns <status>fault</status> as Rfc7807Error `err.Status == ResponseStatusFault`.
func (Client) CreatePacket ¶
func (c Client) CreatePacket(packetAttributes models.PacketAttributes) (*models.CreatePacketResponse, error)
CreatePacket Creates packet from PacketAttributes. On success returns PacketIdDetail with information about the newly created packet.
func (Client) CreatePacketClaim ¶
func (c Client) CreatePacketClaim(claimAttributes models.ClaimAttributes) (*models.PacketIdDetail, error)
CreatePacketClaim Creates a claim assistant packet from ClaimAttributes. On success returns PacketIdDetail with information about the newly created packet.
func (Client) CreatePacketClaimWithPassword ¶
func (c Client) CreatePacketClaimWithPassword(createPacketClaimWithPassword models.CreatePacketClaimWithPassword) (models.PacketDetail, error)
CreatePacketClaimWithPassword Creates a claim assistant packet from ClaimWithPasswordAttributes. On success returns PacketDetail with information about the newly created packet.
func (*Client) EndpointURL ¶
EndpointURL returns the URL of the zasilkovna.
func (Client) PacketAttributesValid ¶
func (c Client) PacketAttributesValid(packetAttributes models.PacketAttributes) error
PacketAttributesValid Validates PacketAttributes. On success (the attributes are valid) returns <status>ok</status> `err.Status == ResponseStatusOk`. On error (the attributes are NOT valid) returns <status>fault</status> as Rfc7807Error `err.Status == ResponseStatusFault`.
func (Client) PacketGetStoredUntil ¶
func (c Client) PacketGetStoredUntil(packetId int) (models.ZasilkovnaDate, error)
PacketGetStoredUntil Fetches the date until which the packet specified by packetId is stored and waiting for pickup. If the packet is not yet ready for pickup or is already returning to sender null is returned.
func (Client) PacketInfo ¶
func (c Client) PacketInfo(packetId int) (models.PacketInfoResponse, error)
PacketInfo Returns additional information about packet and its consignment to an external courier, if there is one. On success it returns PacketInfoResult.
func (Client) PacketLabelPdf ¶
func (c Client) PacketLabelPdf(packetIds models.Ids, format string, offset int) (binary.ByteOrder, error)
PacketLabelPdf returns binary result in base64 encoding. Fetches a label for packet specified by packetId in format specified by format on a position specified by offset. The position is calculated left to right starting at top left corner of the document.
func (Client) PacketStatus ¶
func (c Client) PacketStatus(packetId int) (models.CurrentStatusRecord, error)
PacketStatus fetches information about the current status of the packet specified by packetId. On success returns CurrentStatusRecord.
func (Client) PacketTracking ¶
func (c Client) PacketTracking(packetId int) (models.StatusRecords, error)
PacketTracking Fetches the whole tracking history of the packet specified by packetId. On success returns StatusRecords struct
type Credentials ¶
func NewCredentials ¶
func NewCredentials(key string) *Credentials
type Options ¶
type Options struct { Transport http.RoundTripper Creds *Credentials }