From ad82e701378421f447ddeb4272f255688d6d180d Mon Sep 17 00:00:00 2001 From: Justintime50 <39606064+Justintime50@users.noreply.github.com> Date: Mon, 23 Sep 2024 09:46:29 -0600 Subject: [PATCH 1/3] chore: remove create_list tracker endpoint function --- CHANGELOG.md | 4 ++ tests/cassettes/TestTrackerCreateList.yaml | 58 ---------------------- tracker.go | 11 ---- 3 files changed, 4 insertions(+), 69 deletions(-) delete mode 100644 tests/cassettes/TestTrackerCreateList.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index fe25196..569f0fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## Next Release + +- Removes the deprecated `create_list` tracker endpoint function as it is no longer available via API + ## v4.6.0 (2024-08-16) - Add improved inheritance tree for error types, allowing end-user to properly cast and check for specific error types and sub-types diff --git a/tests/cassettes/TestTrackerCreateList.yaml b/tests/cassettes/TestTrackerCreateList.yaml deleted file mode 100644 index 7b9023e..0000000 --- a/tests/cassettes/TestTrackerCreateList.yaml +++ /dev/null @@ -1,58 +0,0 @@ ---- -version: 1 -interactions: -- request: - body: '{"trackers":{"0":{"tracking_code":"EZ1000000001"},"1":{"tracking_code":"EZ1000000002"},"2":{"tracking_code":"EZ1000000003"}}}' - form: {} - headers: - Authorization: - - REDACTED - Content-Type: - - application/json - User-Agent: - - REDACTED - url: https://api.easypost.com/v2/trackers/create_list - method: POST - response: - body: '{}' - headers: - Cache-Control: - - private, no-cache, no-store - Content-Type: - - application/json; charset=utf-8 - Expires: - - "0" - Pragma: - - no-cache - Referrer-Policy: - - strict-origin-when-cross-origin - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Backend: - - easypost - X-Canary: - - direct - X-Content-Type-Options: - - nosniff - X-Download-Options: - - noopen - X-Ep-Request-Uuid: - - 4d57346d66ad68a1f440b8c700377899 - X-Frame-Options: - - SAMEORIGIN - X-Node: - - bigweb43nuq - X-Permitted-Cross-Domain-Policies: - - none - X-Proxied: - - intlb3nuq c0f5e722d1 - - extlb2nuq fa152d4755 - X-Runtime: - - "0.060048" - X-Version-Label: - - easypost-202408021936-66687f8918-master - X-Xss-Protection: - - 1; mode=block - status: 200 OK - code: 200 - duration: "" diff --git a/tracker.go b/tracker.go index a352d29..210d983 100644 --- a/tracker.go +++ b/tracker.go @@ -171,17 +171,6 @@ func (c *Client) CreateTrackerList(param map[string]interface{}) (bool, error) { return c.CreateTrackerListWithContext(context.Background(), param) } -// CreateTrackerListWithContext performs the same operation as -// CreateTrackerList, but allows specifying a context that can interrupt the -// request. -// -// Deprecated: Use the CreateTracker function instead. CreateTrackerList will be removed in a future release. -func (c *Client) CreateTrackerListWithContext(ctx context.Context, param map[string]interface{}) (bool, error) { - req := map[string]interface{}{"trackers": param} - // This endpoint does not return a response, so we return true here - return true, c.do(ctx, http.MethodPost, "trackers/create_list", req, nil) -} - // ListTrackers provides a paginated result of Tracker objects. func (c *Client) ListTrackers(opts *ListTrackersOptions) (out *ListTrackersResult, err error) { return c.ListTrackersWithContext(context.Background(), opts) From 5b0235e70a8aa568a049c974a6c44df203101400 Mon Sep 17 00:00:00 2001 From: Justintime50 <39606064+Justintime50@users.noreply.github.com> Date: Mon, 23 Sep 2024 10:27:35 -0600 Subject: [PATCH 2/3] fix: remove function --- tracker.go | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/tracker.go b/tracker.go index 210d983..9ed2b33 100644 --- a/tracker.go +++ b/tracker.go @@ -153,24 +153,6 @@ func (c *Client) CreateTrackerWithContext(ctx context.Context, opts *CreateTrack return } -// CreateTrackerList asynchronously creates multiple trackers. -// Input a map of maps that contains multiple tracking codes -// -// Deprecated: Use the CreateTracker function instead. CreateTrackerList will be removed in a future release. -func (c *Client) CreateTrackerList(param map[string]interface{}) (bool, error) { - // The data structure must look like the following when calling the API: - // { - // "trackers": { - // "0": { "tracking_code": "EZ1000000001", "carrier": "USPS" }, - // "1": { "tracking_code": "EZ1000000002", "carrier": "USPS" } - // } - // } - // The keys inside the 'trackers' map (0, 1 in the example) get discarded - // by the API endpoint, so are not important. - // This endpoint does not return a response so we return true here - return c.CreateTrackerListWithContext(context.Background(), param) -} - // ListTrackers provides a paginated result of Tracker objects. func (c *Client) ListTrackers(opts *ListTrackersOptions) (out *ListTrackersResult, err error) { return c.ListTrackersWithContext(context.Background(), opts) From ddf7aff8bc83e7c12d6bc2acd0a82939a79d2ae4 Mon Sep 17 00:00:00 2001 From: Justintime50 <39606064+Justintime50@users.noreply.github.com> Date: Mon, 23 Sep 2024 11:19:39 -0600 Subject: [PATCH 3/3] fix: remove test --- tests/tracker_test.go | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/tests/tracker_test.go b/tests/tracker_test.go index 7dbfd03..aa274aa 100644 --- a/tests/tracker_test.go +++ b/tests/tracker_test.go @@ -2,7 +2,6 @@ package easypost_test import ( "reflect" - "strconv" "strings" "github.com/EasyPost/easypost-go/v4" @@ -63,26 +62,6 @@ func (c *ClientTests) TestTrackerAll() { } } -func (c *ClientTests) TestTrackerCreateList() { - client := c.TestClient() - assert, require := c.Assert(), c.Require() - - trackingCodeParam := make(map[string]interface{}) - trackingCodes := []string{"EZ1000000001", "EZ1000000002", "EZ1000000003"} - - for i := range trackingCodes { - trackingCodeParam[strconv.Itoa(i)] = map[string]string{ - "tracking_code": trackingCodes[i], - } - } - - response, err := client.CreateTrackerList(trackingCodeParam) - require.NoError(err) - - // This endpoint returns nothing, so we assert the function returns true - assert.True(response) -} - func (c *ClientTests) TestTrackersGetNextPage() { client := c.TestClient() assert, require := c.Assert(), c.Require()