Skip to content

Commit 62690eb

Browse files
Justintime50claude
andauthored
feat: add Tracker.Delete functionality (#643)
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 462a309 commit 62690eb

4 files changed

Lines changed: 124 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- `ApiKey.Delete`
88
- `ApiKey.Enable`
99
- `ApiKey.Disable`
10+
- Adds `Tracker.Delete` function
1011

1112
## v7.4.0 (2025-11-24)
1213

EasyPost.Tests/ServicesTests/TrackerServiceTest.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,21 @@ public async Task TestRetrieve()
147147
Assert.Equal(tracker.Id, retrievedTracker.Id);
148148
}
149149

150+
[Fact]
151+
[CrudOperations.Delete]
152+
[Testing.Function]
153+
public async Task TestDelete()
154+
{
155+
UseVCR("delete");
156+
157+
Tracker tracker = await Client.Tracker.Create(Fixtures.Usps, "EZ1000000001");
158+
159+
await Client.Tracker.Delete(tracker.Id);
160+
161+
// Deleting a Tracker does not return anything, so we can't test the response
162+
Assert.True(true);
163+
}
164+
150165
#endregion
151166

152167
#endregion

EasyPost.Tests/cassettes/net/tracker_service/delete.json

Lines changed: 98 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EasyPost/Services/TrackerService.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,16 @@ public async Task<TrackerCollection> RetrieveBatch(Parameters.Tracker.Batch para
127127
return collection;
128128
}
129129

130+
/// <summary>
131+
/// Delete a <see cref="Tracker"/>.
132+
/// <a href="https://docs.easypost.com/docs/trackers#delete-a-tracker">Related API documentation</a>.
133+
/// </summary>
134+
/// <param name="id">The ID of the <see cref="Tracker"/> to delete.</param>
135+
/// <param name="cancellationToken"><see cref="CancellationToken"/> to use for the HTTP request.</param>
136+
/// <returns>None.</returns>
137+
[CrudOperations.Delete]
138+
public async Task Delete(string id, CancellationToken cancellationToken = default) => await RequestAsync(Method.Delete, $"trackers/{id}", cancellationToken);
139+
130140
#endregion
131141
}
132142
}

0 commit comments

Comments
 (0)