Skip to content

Commit

Permalink
Merge pull request #239 from EasyPost/remove_create_list
Browse files Browse the repository at this point in the history
chore: remove create_list tracker endpoint function
  • Loading branch information
Justintime50 authored Sep 23, 2024
2 parents a9ba547 + ddf7aff commit 46fb527
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 108 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
58 changes: 0 additions & 58 deletions tests/cassettes/TestTrackerCreateList.yaml

This file was deleted.

21 changes: 0 additions & 21 deletions tests/tracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package easypost_test

import (
"reflect"
"strconv"
"strings"

"github.com/EasyPost/easypost-go/v4"
Expand Down Expand Up @@ -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()
Expand Down
29 changes: 0 additions & 29 deletions tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,35 +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)
}

// 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)
Expand Down

0 comments on commit 46fb527

Please sign in to comment.