shippinglabel

package module
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: MIT Imports: 14 Imported by: 0

README

Golang SDK for the Shippinglabel REST API

This Golang package is an SDK for the Shippinglabel REST API (https://shippinglabel.de). Documentation can be found at https://developer.shippinglabel.de

Usage

Install
go get github.com/dewaco/shippinglabel
Create Client and API Context
package main

import (
	"context"
	"github.com/dewaco/shippinglabel"
)

func main() {
	// Create request client
	client, err := shippinglabel.NewClient("CLIENT_ID", "CLIENT_SECRET")
	// Handle error

	// Create an access token
	ctx := context.Background()
	tk, err := client.ClientCredentials(ctx)
	// Handle error

	// Create a context
	api, err := client.APIContext(tk)
	// Handle error
	
	// Request: Get user details
	user, err := api.GetUser(ctx)
	// Handle error
	
	// Request: Create parcel
	parcel, err := api.CreateParcel(ctx, &shippinglabel.Parcel{})
	// Handle error
	
	// Request: Delete a shipment
	err = api.DeleteShipment(ctx, 1)
	// Handle error
	
	// ...
}
Handle Response Error
package main

import (
	"context"
	"github.com/dewaco/shippinglabel"
)

func main() {
	client, err := shippinglabel.NewClient("CLIENT_ID", "SECRET")
	ctx := context.Background()
	tk, err := client.ClientCredentials(ctx)
	api, err := client.APIContext(tk)
	
	// Send request
	_, err := api.GetUser(ctx)
	
	// Parse error
	if err != nil {
		switch err.(type) {
		case *shippinglabel.Error:
			// Is SL error
			break
		default:
			// Is an unexpected error
		}
		
		// Another way
		_, ok := err.(*shippinglabel.Error)
		if ok { 
			// Is SL error
                }
	}
}

Documentation

Index

Constants

View Source
const (
	HeaderContentTypeJSON = "application/json; charset=utf-8"
	HeaderContentTypeForm = "application/x-www-form-urlencoded"
)

Variables

View Source
var (
	ErrRequiredClientIDAndSecret = errors.New("clientID and clientSecret are required")
	ErrRequiredClient            = errors.New("client is required")
	ErrRequiredToken             = errors.New("token is required")
	ErrRequiredID                = errors.New("id is required")
	ErrWrongType                 = errors.New("wrong type")
)

Functions

This section is empty.

Types

type APIContext

type APIContext struct {
	// contains filtered or unexported fields
}

APIContext represents the context for making API requests with an authenticated client and token.

It provides methods for sending requests to different endpoints.

func NewAPIContext

func NewAPIContext(c *Client, token *AuthToken) (*APIContext, error)

NewAPIContext creates an API context

func (*APIContext) CreateAddress

func (c *APIContext) CreateAddress(ctx context.Context, v *Address) (resp *Address, err error)

CreateAddress creates a new shipment address [POST]: /addresses

func (*APIContext) CreateCSVProfile added in v1.0.10

func (c *APIContext) CreateCSVProfile(ctx context.Context, v *CSVProfile) (resp *CSVProfile, err error)

CreateCSVProfile creates a csv profile [POST]: /csv/profiles

func (*APIContext) CreateCarrier

func (c *APIContext) CreateCarrier(ctx context.Context, v *Carrier) (resp *Carrier, err error)

CreateCarrier creates a carrier [POST]: /carriers

func (*APIContext) CreateDHLProduct

func (c *APIContext) CreateDHLProduct(ctx context.Context, v *Product) (resp *Product, err error)

CreateDHLProduct creates a DHL product [POST]: /carriers/DHL/products

func (*APIContext) CreateJob added in v1.0.10

func (c *APIContext) CreateJob(ctx context.Context, v *ShipmentQueueItem) (resp *ShipmentQueueItem, err error)

CreateJob creates a job [POST]: /shipments/jobs

func (*APIContext) CreateParcel

func (c *APIContext) CreateParcel(ctx context.Context, v *Parcel) (resp *Parcel, err error)

CreateParcel creates a parcel [POST]: /parcels

func (*APIContext) CreateQueueItem added in v1.0.10

func (c *APIContext) CreateQueueItem(ctx context.Context, v *ShipmentQueueItem) (resp *ShipmentQueueItem, err error)

CreateQueueItem creates a queue item [POST]: /shipments/queue

func (*APIContext) CreateShipment

func (c *APIContext) CreateShipment(ctx context.Context, v *Shipment) (resp *Shipment, err error)

CreateShipment creates a shipment [POST]: /shipments

func (*APIContext) CreateShipments

func (c *APIContext) CreateShipments(ctx context.Context, v []*Shipment) (resp []*Shipment, err error)

CreateShipments creates multiple shipments [POST]: /shipments/bulk

func (*APIContext) DeleteAddress

func (c *APIContext) DeleteAddress(ctx context.Context, id int) (err error)

DeleteAddress deletes a shipment address [DELETE]: /addresses/{id}

func (*APIContext) DeleteCSVProfile added in v1.0.10

func (c *APIContext) DeleteCSVProfile(ctx context.Context, id int) (err error)

DeleteCSVProfile deletes a csv profile [DELETE]: /csv/profiles/{id}

func (*APIContext) DeleteCarrier

func (c *APIContext) DeleteCarrier(ctx context.Context, code CarrierCode) (err error)

DeleteCarrier deletes a carrier [DELETE]: /carriers/{id}

func (*APIContext) DeleteDHLProduct

func (c *APIContext) DeleteDHLProduct(ctx context.Context, id int) (err error)

DeleteDHLProduct deletes a DHL product [DELETE]: /carriers/DHL/products/{id}

func (*APIContext) DeleteJob added in v1.0.10

func (c *APIContext) DeleteJob(ctx context.Context, id int) (err error)

DeleteJob deletes a job [DELETE]: /shipments/jobs/{id}

func (*APIContext) DeleteParcel

func (c *APIContext) DeleteParcel(ctx context.Context, id int) (err error)

DeleteParcel deletes a parcel [DELETE]: /parcels/{id}

func (*APIContext) DeleteQueueItem added in v1.0.10

func (c *APIContext) DeleteQueueItem(ctx context.Context, id int) (err error)

DeleteQueueItem deletes a queue item [DELETE]: /shipments/queue/{id}

func (*APIContext) DeleteShipment

func (c *APIContext) DeleteShipment(ctx context.Context, id int) (err error)

DeleteShipment deletes a shipment [DELETE]: /shipments/{id}

func (*APIContext) GetAddress

func (c *APIContext) GetAddress(ctx context.Context, id int) (resp *Address, err error)

GetAddress returns an address [GET]: /addresses/{id}

func (*APIContext) GetCSVProfile added in v1.0.10

func (c *APIContext) GetCSVProfile(ctx context.Context, id int) (resp *CSVProfile, err error)

GetCSVProfile returns a csv profile [GET]: /csv/profiles/{id}

func (*APIContext) GetCarrier

func (c *APIContext) GetCarrier(ctx context.Context, code CarrierCode) (resp *Carrier, err error)

GetCarrier returns a carrier [GET]: /carriers/{id}

func (*APIContext) GetJob added in v1.0.10

func (c *APIContext) GetJob(ctx context.Context, id int) (resp *ShipmentQueueItem, err error)

GetJob returns a job [GET]: /shipments/jobs/{id}

func (*APIContext) GetLabel

func (c *APIContext) GetLabel(ctx context.Context, id int) (resp *bytes.Buffer, err error)

GetLabel returns a shipment label in PDF format [GET]: /shipments/{id}

func (*APIContext) GetLabels

func (c *APIContext) GetLabels(ctx context.Context, ids any) (resp *bytes.Buffer, err error)

GetLabels returns labels in PDF format [GET]: /shipments/labels/{id1,id2,...,idn} Value: 'ids' can be from type []string or []int

func (*APIContext) GetParcel

func (c *APIContext) GetParcel(ctx context.Context, id int) (resp *Parcel, err error)

GetParcel returns a parcel [GET]: /parcels/{id}

func (*APIContext) GetQueueItem added in v1.0.10

func (c *APIContext) GetQueueItem(ctx context.Context, id int) (resp *ShipmentQueueItem, err error)

GetQueueItem returns a queue item [GET]: /shipments/queue/{id}

func (*APIContext) GetShipment

func (c *APIContext) GetShipment(ctx context.Context, id int) (resp *Shipment, err error)

GetShipment returns a shipment [GET]: /shipments/{id}

func (*APIContext) GetUser

func (c *APIContext) GetUser(ctx context.Context) (resp *User, err error)

GetUser returns the user details [GET]: /user

func (*APIContext) ListAddresses

func (c *APIContext) ListAddresses(ctx context.Context) (resp []*Address, err error)

ListAddresses returns all available user addresses [GET]: /addresses

func (*APIContext) ListCSVProfiles added in v1.0.10

func (c *APIContext) ListCSVProfiles(ctx context.Context) (resp []*CSVProfile, err error)

ListCSVProfiles returns all csv profiles [GET]: /csv/profiles

func (*APIContext) ListCarriers

func (c *APIContext) ListCarriers(ctx context.Context) (resp []*Carrier, err error)

ListCarriers returns all user created carriers [GET]: /carriers

func (*APIContext) ListJobs added in v1.0.10

func (c *APIContext) ListJobs(ctx context.Context) (resp []*ShipmentQueueItem, err error)

ListJobs returns all jobs [GET]: /shipments/jobs

func (*APIContext) ListParcels

func (c *APIContext) ListParcels(ctx context.Context) (resp []*Parcel, err error)

ListParcels returns all parcels [GET]: /parcels

func (*APIContext) ListQueueItems added in v1.0.10

func (c *APIContext) ListQueueItems(ctx context.Context) (resp []*ShipmentQueueItem, err error)

ListQueueItems returns all queue items [GET]: /shipments/queue

func (*APIContext) ListShipments

func (c *APIContext) ListShipments(ctx context.Context, page int, size int, order string) (resp []*Shipment, err error)

ListShipments returns all shipments [GET]: /shipments Query parameters: page: The page number to retrieve for the list of shipments. For example page = 0 and page_size = 10 return the first 10 shipments. page = 1 and page_size=10 return the next shipments (11-20). Default: 0 page_size: The maximum number of shipments to return in the response. Must be an integer between 0 and 10000. Default: 10000 order: Specifies the order of shipments. Available values are 'asc' or 'desc'. Default: asc

func (*APIContext) Metadata

func (c *APIContext) Metadata(ctx context.Context) (resp []*CarrierMetadata, err error)

Metadata returns the carrier metadata [GET]: /metadata/carriers

func (*APIContext) UpdateAddress

func (c *APIContext) UpdateAddress(ctx context.Context, v *Address) (err error)

UpdateAddress updates a shipment address [PUT]: /addresses/{id}

func (*APIContext) UpdateCSVProfile added in v1.0.10

func (c *APIContext) UpdateCSVProfile(ctx context.Context, v *CSVProfile) (err error)

UpdateCSVProfile updates a csv profile [PUT]: /csv/profiles/{id}

func (*APIContext) UpdateCarrier

func (c *APIContext) UpdateCarrier(ctx context.Context, v *Carrier) (err error)

UpdateCarrier updates a carrier [PUT]: /carriers/{id}

func (*APIContext) UpdateCarrierCredentials

func (c *APIContext) UpdateCarrierCredentials(ctx context.Context, v *Carrier) (err error)

UpdateCarrierCredentials updates the user credentials from the carrier [PUT]: /carriers/{id}/cred

func (*APIContext) UpdateDHLProduct

func (c *APIContext) UpdateDHLProduct(ctx context.Context, v *Product) (err error)

UpdateDHLProduct updates a DHL product [PUT]: /carriers/DHL/products/{id}

func (*APIContext) UpdateJob added in v1.0.10

func (c *APIContext) UpdateJob(ctx context.Context, v *ShipmentQueueItem) (err error)

UpdateJob updates a job [PUT]: /shipments/jobs/{id}

func (*APIContext) UpdateParcel

func (c *APIContext) UpdateParcel(ctx context.Context, v *Parcel) (err error)

UpdateParcel updates a parcel [PUT]: /parcels/{id}

func (*APIContext) UpdateQueueItem added in v1.0.10

func (c *APIContext) UpdateQueueItem(ctx context.Context, v *ShipmentQueueItem) (err error)

UpdateQueueItem updates a queue item [PUT]: /shipments/queue/{id}

func (*APIContext) UploadCSVFile added in v1.0.10

func (c *APIContext) UploadCSVFile(ctx context.Context, csv []byte, csvProfileID int) (resp []*ShipmentQueueItem, err error)

UploadCSVFile uploads a csv file and sets the items in the shipment queue [POST]: /shipments/queue/csv

func (*APIContext) ValidateShipment

func (c *APIContext) ValidateShipment(ctx context.Context, v *Shipment) (err error)

ValidateShipment validates a shipment [POST]: /shipments/validate

func (*APIContext) VerifyCarrier

func (c *APIContext) VerifyCarrier(ctx context.Context, code CarrierCode) (err error)

VerifyCarrier validates the user credentials [POST]: /carriers/{id}/verify

type Address added in v1.0.1

type Address struct {
	ID              int             `json:"id,omitempty"`
	Company         string          `json:"company,omitempty"`   // Name 1
	FirstName       string          `json:"firstName,omitempty"` // Name 2
	LastName        string          `json:"lastName,omitempty"`  // Name 3
	Street          string          `json:"street,omitempty"`
	StreetNumber    string          `json:"streetNumber,omitempty"`
	PostalCode      string          `json:"postalCode,omitempty"`
	AddressAddition string          `json:"addressAddition,omitempty"`
	City            string          `json:"city,omitempty"`
	Country         string          `json:"country,omitempty"`
	State           string          `json:"state,omitempty"`
	Mail            string          `json:"mail,omitempty"`
	Phone           string          `json:"phone,omitempty"`
	VATNumber       string          `json:"vatNumber,omitempty"`
	AddressType     AddressTypeCode `json:"addressType,omitempty"`
}

type AddressTypeCode added in v1.0.1

type AddressTypeCode string
const (
	AddressTypeShipping AddressTypeCode = "SHIPPING"
	AddressTypeReturn   AddressTypeCode = "RETURN"
)

type Amount added in v1.0.9

type Amount struct {
	Value    float64 `json:"value,omitempty"`
	Currency string  `json:"currency,omitempty"`
}

type AuthToken added in v1.0.1

type AuthToken struct {
	AccessToken           string `json:"accessToken,omitempty"`
	ExpiresIn             int    `json:"expiresIn,omitempty"`
	RefreshToken          string `json:"refreshToken,omitempty"`
	RefreshTokenExpiresIn int    `json:"refreshTokenExpiresIn,omitempty"`
	TokenType             string `json:"tokenType,omitempty"`
	// contains filtered or unexported fields
}

func NewToken added in v1.0.1

func NewToken(refreshToken string) *AuthToken

NewToken creates a new struct from a refresh token

func (*AuthToken) IsExpired added in v1.0.1

func (m *AuthToken) IsExpired() bool

IsExpired returns whether the access token has expired

func (*AuthToken) SetAccessToken added in v1.0.1

func (m *AuthToken) SetAccessToken(tk *AuthToken)

SetAccessToken updates the struct and sets a new access token

func (*AuthToken) SetExpirationTime added in v1.0.1

func (m *AuthToken) SetExpirationTime()

SetExpirationTime converts the ExpiresIn value to a time.Time

type BodyParser

type BodyParser func() (io.ReadCloser, error)

type CSVProfile added in v1.0.10

type CSVProfile struct {
	ID         int          `json:"id,omitempty"`
	Name       string       `json:"name,omitempty"`
	Delimiter  string       `json:"delimiter,omitempty"`
	DateFormat string       `json:"dateFormat,omitempty"`
	Encoding   EncodingCode `json:"encoding,omitempty"`
	Mapping    []*Mapping   `json:"mapping,omitempty"`
	IsDefault  bool         `json:"isDefault,omitempty"`
	Created    *time.Time   `json:"created,omitempty"`
}

type Carrier added in v1.0.1

type Carrier struct {
	Code                 CarrierCode       `json:"carrierCode,omitempty"`
	Name                 string            `json:"name,omitempty"`
	IsDefault            bool              `json:"isDefault,omitempty"`
	Username             string            `json:"username,omitempty"`
	UserSecret           string            `json:"userSecret,omitempty"`
	UserSecretExpiration *time.Time        `json:"userSecretExpiration,omitempty"`
	Product              string            `json:"product,omitempty"`
	LabelFormat          string            `json:"labelFormat,omitempty"` // Default label format for shipments
	Created              *time.Time        `json:"created,omitempty"`
	Services             []*CarrierService `json:"services,omitempty"`   // Additional carrier services
	Parameters           map[string]any    `json:"parameters,omitempty"` // Additional parameters for the carrier (e.h. DHL EKP)
}

type CarrierCode added in v1.0.1

type CarrierCode string
const (
	CarrierDHL        CarrierCode = "DHL"
	CarrierDP         CarrierCode = "DP"
	CarrierDPD        CarrierCode = "DPD"
	CarrierGLS        CarrierCode = "GLS"
	CarrierHermes     CarrierCode = "HERMES"
	CarrierUPS        CarrierCode = "UPS"
	CarrierPostAT     CarrierCode = "POST_AT"
	CarrierDHLExpress CarrierCode = "DHL_EXPRESS"
)

type CarrierMetadata added in v1.0.1

type CarrierMetadata struct {
	Code         CarrierCode    `json:"carrierCode,omitempty"`
	Name         string         `json:"name,omitempty"`
	Products     []*Product     `json:"products,omitempty"`
	LabelFormats []*LabelFormat `json:"labelFormats,omitempty"`
}

type CarrierService added in v1.0.2

type CarrierService struct {
	Service    CarrierServiceCode `json:"service,omitempty"`
	Parameters map[string]any     `json:"parameters,omitempty"`
}

func (*CarrierService) AddParameter added in v1.0.2

func (m *CarrierService) AddParameter(key string, param any)

type CarrierServiceCode added in v1.0.2

type CarrierServiceCode string
const (
	CarrierServicePreferredNeighbour    CarrierServiceCode = "PREFERRED_NEIGHBOUR"
	CarrierServicePreferredLocation     CarrierServiceCode = "PREFERRED_LOCATION"
	CarrierServiceVisualCheckOfAge      CarrierServiceCode = "VISUAL_CHECK_OF_AGE"
	CarrierServiceNamedPersonOnly       CarrierServiceCode = "NAMED_PERSON_ONLY"
	CarrierServiceIdentCheck            CarrierServiceCode = "IDENT_CHECK"
	CarrierServicePreferredDay          CarrierServiceCode = "PREFERRED_DAY"
	CarrierServiceNoNeighbourDelivery   CarrierServiceCode = "NO_NEIGHBOUR_DELIVERY"
	CarrierServiceAdditionalInsurance   CarrierServiceCode = "ADDITIONAL_INSURANCE"
	CarrierServiceBulkyGoods            CarrierServiceCode = "BULKY_GOODS"
	CarrierServiceCashOnDelivery        CarrierServiceCode = "CASH_ON_DELIVERY"
	CarrierServicePackagingReturn       CarrierServiceCode = "PACKAGING_RETURN"
	CarrierServiceParcelOutletRouting   CarrierServiceCode = "PARCEL_OUTLET_ROUTING"
	CarrierServiceFlexDelivery          CarrierServiceCode = "FLEX_DELIVERY"
	CarrierServiceNextDay               CarrierServiceCode = "NEXT_DAY"
	CarrierServiceShopReturn            CarrierServiceCode = "SHOP_RETURN"
	CarrierServiceShopDelivery          CarrierServiceCode = "SHOP_DELIVERY"
	CarrierServiceIdentPin              CarrierServiceCode = "IDENT_PIN"
	CarrierServiceSaturdayDelivery      CarrierServiceCode = "SATURDAY_DELIVERY"
	CarrierServiceNoShipmentRedirection CarrierServiceCode = "NO_SHIPMENT_REDIRECTION"
	CarrierServiceNoShopAuthorization   CarrierServiceCode = "NO_SHOP_AUTHORIZATION"
	CarrierServiceHazardousGoods        CarrierServiceCode = "HAZARDOUS_GOODS"
	CarrierServiceFragile               CarrierServiceCode = "FRAGILE"
	CarrierServicePremium               CarrierServiceCode = "PREMIUM"
	CarrierServicePickup                CarrierServiceCode = "PICKUP"
	CarrierServiceSignature             CarrierServiceCode = "SIGNATURE"
)

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(clientID string, clientSecret string) (*Client, error)

func (*Client) APIContext

func (c *Client) APIContext(token *AuthToken) (*APIContext, error)

APIContext creates a token specific context for the REST API

func (*Client) AuthCodeURL

func (c *Client) AuthCodeURL(redirectURL string, state string) string

AuthCodeURL creates a redirect url for the shippinglabel oauth process (AuthorizationCode)

func (*Client) AuthorizationCode

func (c *Client) AuthorizationCode(ctx context.Context, authCode string) (resp *AuthToken, err error)

AuthorizationCode exchanges the authorization code for an access token

func (*Client) ClientCredentials

func (c *Client) ClientCredentials(ctx context.Context) (*AuthToken, error)

ClientCredentials creates an access token with the client credentials

func (*Client) Development

func (c *Client) Development()

Development sets the developmentURL as default

func (*Client) Production

func (c *Client) Production()

Production sets the productionURL as default

func (*Client) RefreshToken

func (c *Client) RefreshToken(ctx context.Context, refreshToken string) (resp *AuthToken, err error)

RefreshToken creates an access token through a refresh token

func (*Client) SetHTTPClient

func (c *Client) SetHTTPClient(hc *http.Client)

SetHTTPClient sets the default http.Client

type Customs added in v1.0.9

type Customs struct {
	ExportType                      ExportTypeCode `json:"exportType,omitempty"`
	ExportDescription               string         `json:"exportDescription,omitempty"`
	ShippingCosts                   *Amount        `json:"shippingCosts,omitempty"`
	InvoiceNumber                   string         `json:"invoiceNumber,omitempty"`
	InvoiceDate                     string         `json:"invoiceDate,omitempty"`
	SenderCustomsReference          string         `json:"senderCustomsReference,omitempty"`
	ReceiverCustomsReference        string         `json:"receiverCustomsReference,omitempty"`
	HasElectronicExportNotification bool           `json:"hasElectronicExportNotification,omitempty"`
	Items                           []*CustomsItem `json:"items,omitempty"`
}

type CustomsItem added in v1.0.9

type CustomsItem struct {
	Description   string  `json:"description,omitempty"`
	Quantity      int     `json:"quantity,omitempty"`
	HsCode        string  `json:"hsCode,omitempty"`
	OriginCountry string  `json:"originCountry,omitempty"`
	UnitValue     *Amount `json:"unitValue,omitempty"`
	Weight        float64 `json:"weight,omitempty"`
}

type EncodingCode added in v1.0.10

type EncodingCode string
const (
	EncodingUTF8     EncodingCode = "UTF-8"
	EncodingISO88591 EncodingCode = "ISO-8859-1"
	EncodingUTF8BOM  EncodingCode = "UTF-8-BOM"
)

type Error added in v1.0.1

type Error struct {
	Message  string   `json:"message,omitempty"`
	Code     string   `json:"code,omitempty"`
	Messages []string `json:"messages,omitempty"`
	Detail   string   `json:"detail,omitempty"`
}

func (*Error) Error added in v1.0.1

func (m *Error) Error() string

type ExportTypeCode added in v1.0.9

type ExportTypeCode string
const (
	ExportTypeOther           ExportTypeCode = "OTHER"
	ExportTypePresent         ExportTypeCode = "PRESENT"
	ExportTypeSample          ExportTypeCode = "SAMPLE"
	ExportTypeDocument        ExportTypeCode = "DOCUMENT"
	ExportTypeReturnOfGoods   ExportTypeCode = "RETURN_OF_GOODS"
	ExportTypeCommercialGoods ExportTypeCode = "COMMERCIAL_GOODS"
)

type JobStatusCode added in v1.0.10

type JobStatusCode string
const (
	JobStatusCreated   JobStatusCode = "CREATED"
	JobStatusRunning   JobStatusCode = "RUNNING"
	JobStatusCancelled JobStatusCode = "CANCELLED"
	JobStatusCompleted JobStatusCode = "COMPLETED"
)

type LabelFormat added in v1.0.2

type LabelFormat struct {
	ID              int    `json:"id,omitempty"`
	LabelFormat     string `json:"labelFormat,omitempty"`
	Name            string `json:"name,omitempty"`
	HasAddressField bool   `json:"hasAddressField,omitempty"`
	LabelCountX     int    `json:"labelCountX,omitempty"`
	LabelCountY     int    `json:"labelCountY,omitempty"`
}

type Mapping added in v1.0.10

type Mapping struct {
	HeaderField string `json:"headerField,omitempty"`
	ValueID     string `json:"valueId,omitempty"`
}

type Parcel added in v1.0.1

type Parcel struct {
	ID           int            `json:"id,omitempty"`
	Name         string         `json:"name,omitempty"`
	Description  string         `json:"description,omitempty"`
	Weight       float64        `json:"weight,omitempty"`
	Length       float64        `json:"length,omitempty"`
	Width        float64        `json:"width,omitempty"`
	Height       float64        `json:"height,omitempty"`
	Reference    string         `json:"reference,omitempty"`
	CustomFields map[string]any `json:"customFields,omitempty"`
	IsDefault    bool           `json:"isDefault,omitempty"`
}

type Product added in v1.0.2

type Product struct {
	ID                int     `json:"id,omitempty"`
	Product           string  `json:"product,omitempty"`
	Name              string  `json:"name,omitempty"`
	UserParticipation string  `json:"userParticipation,omitempty"`
	Annotation        string  `json:"annotation,omitempty"`
	Price             float64 `json:"price,omitempty"`
	IsInternational   bool    `json:"isInternational,omitempty"`
	MinWeight         int     `json:"minWeight,omitempty"`
	MaxWeight         int     `json:"maxWeight,omitempty"`
	MinLength         int     `json:"minLength,omitempty"`
	MaxLength         int     `json:"maxLength,omitempty"`
	MinWidth          int     `json:"minWidth,omitempty"`
	MaxWidth          int     `json:"maxWidth,omitempty"`
	MinHeight         int     `json:"minHeight,omitempty"`
	MaxHeight         int     `json:"maxHeight,omitempty"`
}

type ResponseHandler

type ResponseHandler = func(*http.Response) error

type Shipment added in v1.0.1

type Shipment struct {
	ID                int            `json:"id,omitempty"`
	ShipmentNumber    string         `json:"shipmentNumber,omitempty"`
	Carrier           *Carrier       `json:"carrier,omitempty"`
	Parcels           []*Parcel      `json:"parcels,omitempty"`
	Sender            *Address       `json:"sender,omitempty"`
	Receiver          *Address       `json:"receiver,omitempty"`
	Reference         string         `json:"reference,omitempty"`
	ShipmentDate      *time.Time     `json:"shipmentDate,omitempty"`
	Customs           *Customs       `json:"customs,omitempty"`
	Created           *time.Time     `json:"created,omitempty"`
	AdditionalDetails map[string]any `json:"additionalDetails,omitempty"`
	Label             string         `json:"label,omitempty"`
	Status            *Status        `json:"status,omitempty"`
}

type ShipmentJob added in v1.0.10

type ShipmentJob struct {
	ID                  int                  `json:"id,omitempty"`
	Status              JobStatusCode        `json:"status,omitempty"`
	ExecutionTime       *time.Time           `json:"executionTime,omitempty"`
	LastUpdate          time.Time            `json:"lastUpdate,omitempty"`
	Created             time.Time            `json:"created,omitempty"`
	QueueItems          []*ShipmentQueueItem `json:"queueItems,omitempty"`
	TotalQueueItems     int                  `json:"totalQueueItems,omitempty"`
	ProcessedQueueItems int                  `json:"processedQueueItems,omitempty"`
}

type ShipmentQueueItem added in v1.0.10

type ShipmentQueueItem struct {
	ID          int        `json:"id,omitempty"`
	Shipment    *Shipment  `json:"shipment,omitempty"`
	ProcessTime *time.Time `json:"processTime,omitempty"`
	Created     *time.Time `json:"created,omitempty"`
}

type Stats added in v1.0.1

type Stats struct {
	Total        float32 `json:"total,omitempty"`
	CurrentYear  float32 `json:"currentYear,omitempty"`
	CurrentMonth float32 `json:"currentMonth,omitempty"`
	Today        float32 `json:"today,omitempty"`
	LastYear     float32 `json:"lastYear,omitempty"`
}

type Status added in v1.0.1

type Status struct {
	Code  int    `json:"code,omitempty"`
	Error *Error `json:"error,omitempty"`
}

type User added in v1.0.1

type User struct {
	ID            int        `json:"id,omitempty"`
	Email         string     `json:"email,omitempty"`
	Lang          string     `json:"language,omitempty"`
	RegisterDate  *time.Time `json:"registerDate,omitempty"`
	LastSeen      *time.Time `json:"lastSeen,omitempty"`
	Balance       float64    `json:"balance,omitempty"`
	Address       *Address   `json:"address,omitempty"`
	ShipmentStats *Stats     `json:"shipmentStats,omitempty"`
}

Jump to

Keyboard shortcuts

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