gosendcloud
With this library it should be possible to interact with the endpoints of the sendcloud API via golang functions. Since we can not implement this library project-specific completely, you are welcome to extend it with us.
Install
go get github.com/jjideenschmiede/gosendcloud
How to use?
Create a Parcel
If a new dispatch note is to be created, then this can be done directly with the following function. You can find more information about the structure of the request in the sendcloud documentation.
// Define request
r := gosendcloud.Request{
PublicKey: "",
SecretKey: "",
}
// Define request body
body := gosendcloud.CreateAParcelBody{
Parcel: gosendcloud.CreateAParcelBodyParcel{
Name: "Jonas Kwiedor",
CompanyName: "J&J Ideenschmiede GmbH",
Address: "Mercatorstraße",
HouseNumber: "32a",
City: "Geesthacht",
PostalCode: "21502",
Telephone: "+4941528903730",
RequestLabel: true,
Email: "[email protected]",
Country: "DE",
Shipment: gosendcloud.CreateAParcelBodyShipment{
Id: 8,
},
Weight: "10.000",
OrderNumber: "41267142142",
InsuredValue: 2000,
TotalOrderValueCurrency: "EUR",
TotalOrderValue: "24.99",
Quantity: 1,
ShippingMethodCheckoutName: "DPD",
},
}
// Create a new parcel
create, err := gosendcloud.CreateAParcel(body, r)
if err != nil {
log.Fatalln(err)
} else {
log.Println(create)
}