Categorygithub.com/lpieri/sendcloud
repositorypackage
0.0.0-20240215172057-4fd35ae8be62
Repository: https://github.com/lpieri/sendcloud.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

build

sendcloud-go

An API-client for Sendcloud written in Golang.

Overview GoDoc

This package currently supports:

  • parcels
  • labels
  • methods
  • addresses
  • integrations

Install

go get github.com/lpieri/sendcloud

Examples

Some examples on how to use the client are found below.

To initialize the client:

api := client.API{}
api.Init("api_key", "api_secret")

To list shipping methods:

methods, err := api.Method.GetMethods()
if err != nil {
    log.Fatal(err)
}

for _, m := range methods {
    log.Print(*m)
}

Create a parcel:

params := &sendcloud.ParcelParams{
	Name:             "Sendcloud-GO",
	CompanyName:      "Afosto SaaS BV",
	Street:           "Grondzijl",
	HouseNumber:      "16",
	City:             "Groningen",
	PostalCode:       "9731DG",
	PhoneNumber:      "0507119519",
	EmailAddress:     "[email protected]",
	CountryCode:      "NL",
	IsLabelRequested: true,
	Method:           8,
	ExternalID:       uuid.New().String(),
}
parcel, err := api.Parcel.New(params)

resolve a service point id from postnl,dhl,dpd to a sendcloud service point id

spid, err := api.ServicePoint.GetServicePoint(servicepoint.Matcher{
    SPID:        "NL-972301",
    Carrier:     "dhl",
    Country:     "NL",
    PostalCode:  "9731AR",
    HouseNumber: "41",
    Latitude:    53.226994,
    Longitude:   6.608120,
})

fmt.PrintLn(spid) 

this service point id can then be placed on an parcel on creation

Contributing

All contributions / suggestions are welcome. Please raise an issue or submit a PR.

Thanks

This package was heavily inspired by stripe-go.

Author

This package is developed by Afosto SaaS BV.

License

MIT.