From 42027791cb5c4102a59442c1a3dbd434872f80c7 Mon Sep 17 00:00:00 2001 From: panxl6 Date: Wed, 20 Dec 2023 16:04:06 +0800 Subject: [PATCH 1/5] fix: upgrade auth header key --- request.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/request.go b/request.go index f5c91eb..77ba69d 100644 --- a/request.go +++ b/request.go @@ -81,7 +81,7 @@ func (client *Client) makeRequest(ctx context.Context, method string, path strin req.Header.Add("date", date) req.Header.Add(signatureHeader, signature) } else { - req.Header.Add("aftership-api-key", apiKey) + req.Header.Add("as-api-key", apiKey) } // Send request From d838c4b9da924fcbea47a28b99749c72d886c6f8 Mon Sep 17 00:00:00 2001 From: panxl6 Date: Thu, 21 Dec 2023 16:11:29 +0800 Subject: [PATCH 2/5] doc: updated example --- README.md | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 17ac645..76a2160 100644 --- a/README.md +++ b/README.md @@ -68,17 +68,26 @@ make test ## Table of contents -- [NewClient(config)](#newaftershipconfig) -- [Rate Limiter](#rate-limiter) -- [Error Handling](#error-handling) -- [Examples](#examples) - - [/couriers](#couriers) - - [/trackings](#trackings) - - [/last_checkpoint](#last_checkpoint) - - [/notifications](#notifications) -- [Migrations](#migrations) -- [Help](#help) -- [Contributing](#contributing) +- [aftership-sdk-go](#aftership-sdk-go) + - [Introduction](#introduction) + - [Installation](#installation) + - [Quick Start](#quick-start) + - [Test](#test) + - [Table of contents](#table-of-contents) + - [NewClient(config)](#newclientconfig) + - [Rate Limiter](#rate-limiter) + - [Error Handling](#error-handling) + - [SDK Error](#sdk-error) + - [Request Error](#request-error) + - [API Error](#api-error) + - [Examples](#examples) + - [/couriers](#couriers) + - [/trackings](#trackings) + - [/last\_checkpoint](#last_checkpoint) + - [/notifications](#notifications) + - [Migrations](#migrations) + - [Help](#help) + - [Contributing](#contributing) ## NewClient(config) @@ -347,11 +356,11 @@ fmt.Println(result) > Create a tracking. ```go -newTracking := aftership.NewTracking{ +newTracking := aftership.CreateTrackingParams{ TrackingNumber: "1234567890", - Slug: []string{"dhl"}, + Slug: "dhl", Title: "Title Name", - Smses: []string{ + SMSes: []string{ "+18555072509", "+18555072501", }, From 66d887647bc1e859e949fcd985422179d00593fa Mon Sep 17 00:00:00 2001 From: panxl6 Date: Thu, 21 Dec 2023 16:32:58 +0800 Subject: [PATCH 3/5] doc: remove useless content --- README.md | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 76a2160..7e5feb9 100644 --- a/README.md +++ b/README.md @@ -67,27 +67,17 @@ make test ``` ## Table of contents - -- [aftership-sdk-go](#aftership-sdk-go) - - [Introduction](#introduction) - - [Installation](#installation) - - [Quick Start](#quick-start) - - [Test](#test) - - [Table of contents](#table-of-contents) - - [NewClient(config)](#newclientconfig) - - [Rate Limiter](#rate-limiter) - - [Error Handling](#error-handling) - - [SDK Error](#sdk-error) - - [Request Error](#request-error) - - [API Error](#api-error) - - [Examples](#examples) - - [/couriers](#couriers) - - [/trackings](#trackings) - - [/last\_checkpoint](#last_checkpoint) - - [/notifications](#notifications) - - [Migrations](#migrations) - - [Help](#help) - - [Contributing](#contributing) +- [NewClient(config)](#newaftershipconfig) +- [Rate Limiter](#rate-limiter) +- [Error Handling](#error-handling) +- [Examples](#examples) + - [/couriers](#couriers) + - [/trackings](#trackings) + - [/last_checkpoint](#last_checkpoint) + - [/notifications](#notifications) +- [Migrations](#migrations) +- [Help](#help) +- [Contributing](#contributing) ## NewClient(config) From 86490b898355f348e7a971f7fc3f5e11a8128778 Mon Sep 17 00:00:00 2001 From: panxl6 Date: Thu, 21 Dec 2023 17:02:56 +0800 Subject: [PATCH 4/5] doc: update url style --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7e5feb9..91791df 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ Create AfterShip SDK instance with config - `APIKey` - **Required**, AfterShip API key - `AuthenticationType` - `APIKey` / `AES` - `APISecret` - if AuthenticationType is AES, use aes api secret - - `Endpoint` - *string*, AfterShip endpoint, default "https://api.aftership.com/tracking/2023-10 + - `Endpoint` - *string*, AfterShip endpoint, default 'https://api.aftership.com/tracking/2023-10' " - `UserAagentPrefix` - *string*, prefix of User-Agent in headers, default "aftership-sdk-go" @@ -104,9 +104,9 @@ client, err := aftership.NewClient(aftership.Config{ AuthenticationType `AES` signature ```go client, err := aftership.NewClient(aftership.Config{ -APIKey: "YOUR_API_KEY", -AuthenticationType: aftership.AES, -APISecret: "YOUR_API_SECRET", + APIKey: "YOUR_API_KEY", + AuthenticationType: aftership.AES, + APISecret: "YOUR_API_SECRET", }) ``` From f7a6781efe17ae7f33e5c39c750a22f01dbe9cb6 Mon Sep 17 00:00:00 2001 From: panxl6 Date: Thu, 21 Dec 2023 17:04:30 +0800 Subject: [PATCH 5/5] doc: remove useless document --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 91791df..34d15a8 100644 --- a/README.md +++ b/README.md @@ -88,8 +88,6 @@ Create AfterShip SDK instance with config - `AuthenticationType` - `APIKey` / `AES` - `APISecret` - if AuthenticationType is AES, use aes api secret - `Endpoint` - *string*, AfterShip endpoint, default 'https://api.aftership.com/tracking/2023-10' - -" - `UserAagentPrefix` - *string*, prefix of User-Agent in headers, default "aftership-sdk-go" Example: