Skip to content

Commit

Permalink
- Can update a Webhook without parameters (#471)
Browse files Browse the repository at this point in the history
- Fix ordering of parameters in docstrings
  • Loading branch information
nwithan8 authored May 12, 2023
1 parent 1ffd795 commit 11b4926
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion EasyPost.Tests/ServicesTests/WebhookServiceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public async Task TestUpdate()
Thread.Sleep(10000); // Wait enough time to process
}

webhook = await Client.Webhook.Update(webhook.Id);
webhook = await Client.Webhook.Update(webhook.Id, new Dictionary<string, object>());

Assert.IsType<Webhook>(webhook);
Assert.StartsWith("hook_", webhook.Id);
Expand Down
8 changes: 4 additions & 4 deletions EasyPost/Services/WebhookService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ public async Task<Webhook> Create(Parameters.Webhook.Create parameters, Cancella
/// Enable a disabled <see cref="Webhook"/> or alter its secret.
/// <a href="https://www.easypost.com/docs/api#update-a-webhook">Related API documentation</a>.
/// </summary>
/// <param name="parameters">Data to update <see cref="Webhook"/> with.</param>
/// <param name="id">The ID of the <see cref="Webhook"/> to update.</param>
/// <param name="parameters">Data to update <see cref="Webhook"/> with.</param>
/// <param name="cancellationToken"><see cref="CancellationToken"/> to use for the HTTP request.</param>
/// <returns>The updated <see cref="Webhook"/>.</returns>
[CrudOperations.Update]
Expand All @@ -106,14 +106,14 @@ public async Task<Webhook> Update(string id, Dictionary<string, object>? paramet
/// Enable a disabled <see cref="Webhook"/> or alter its secret.
/// <a href="https://www.easypost.com/docs/api#update-a-webhook">Related API documentation</a>.
/// </summary>
/// <param name="parameters">Data to update <see cref="Webhook"/> with.</param>
/// <param name="id">The ID of the <see cref="Webhook"/> to update.</param>
/// <param name="parameters">Optional data to update <see cref="Webhook"/> with.</param>
/// <param name="cancellationToken"><see cref="CancellationToken"/> to use for the HTTP request.</param>
/// <returns>The updated <see cref="Webhook"/>.</returns>
[CrudOperations.Update]
public async Task<Webhook> Update(string id, Parameters.Webhook.Update parameters, CancellationToken cancellationToken = default)
public async Task<Webhook> Update(string id, Parameters.Webhook.Update? parameters = null, CancellationToken cancellationToken = default)
{
return await RequestAsync<Webhook>(Method.Put, $"webhooks/{id}", cancellationToken, parameters.ToDictionary());
return await RequestAsync<Webhook>(Method.Put, $"webhooks/{id}", cancellationToken, parameters?.ToDictionary());
}

/// <summary>
Expand Down

0 comments on commit 11b4926

Please sign in to comment.