aftership / aftership-sdk-go Goto Github PK
View Code? Open in Web Editor NEWGolang SDK for Aftership API
License: Apache License 2.0
Golang SDK for Aftership API
License: Apache License 2.0
Hi, go mod requires tags to start with a "v" prefix.
go get
will end up with v2.0.4 as newer versions don't have the 'v' prefix and meanwhile we target specific commits.
Currently, the API client fails to process an error response from the create tracking endpoint.
Steps to reproduce:
package main
import (
"context"
"fmt"
"time"
"github.com/aftership/aftership-sdk-go/v2"
)
func main() {
unauthorizedTracker, err := aftership.NewClient(aftership.Config{APIKey: "UNAUTHORIZED"})
if err != nil {
panic(err)
}
_, err = unauthorizedTracker.CreateTracking(context.Background(),
aftership.CreateTrackingParams{Slug: []string{"total-express"}, TrackingNumber: time.Now().String()})
fmt.Println(err)
}
Expected behaviour
The function call should return an error of type APIError that contains the error code and error message ("unauthorized").
Actual behaviour
Returns the unstructured error:
error unmarshalling the JSON response: json: cannot unmarshal array into Go struct field Tracking.data.tracking.slug of type string
As far as I understand, the problem arises from line 78 in requests.go file, where we try to unmarshal the response. The expected response has field Tracking.Slug
of type string, while the received type is a slice of strings.
test send slack msg
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.