Skip to content

Commit

Permalink
csharp: Adjust to changes of the lower-level generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
svix-jplatte committed Jan 30, 2025
1 parent 871f668 commit 9c81916
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 130 deletions.
8 changes: 4 additions & 4 deletions csharp/Svix/BackgroundTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public BackgroundTaskOut Get(string taskId, string idempotencyKey = default)
{
try
{
var lBackgroundTask = _backgroundTaskApi.GetBackgroundTask(taskId);
var lBackgroundTask = _backgroundTaskApi.V1BackgroundTaskGet(taskId);

return lBackgroundTask;
}
Expand All @@ -45,7 +45,7 @@ public async Task<BackgroundTaskOut> GetAsync(string taskId, string idempotencyK
{
try
{
var lBackgroundTask = await _backgroundTaskApi.GetBackgroundTaskAsync(taskId);
var lBackgroundTask = await _backgroundTaskApi.V1BackgroundTaskGetAsync(taskId);

return lBackgroundTask;
}
Expand All @@ -64,7 +64,7 @@ public ListResponseBackgroundTaskOut List(BackgroundTaskListOptions options = nu
{
try
{
var lResponse = _backgroundTaskApi.ListBackgroundTasks(
var lResponse = _backgroundTaskApi.V1BackgroundTaskList(
options?.Status,
options?.Task,
options?.Limit,
Expand All @@ -88,7 +88,7 @@ public async Task<ListResponseBackgroundTaskOut> ListAsync(BackgroundTaskListOpt
{
try
{
var lResponse = await _backgroundTaskApi.ListBackgroundTasksAsync(
var lResponse = await _backgroundTaskApi.V1BackgroundTaskListAsync(
options?.Status,
options?.Task,
options?.Limit,
Expand Down
164 changes: 52 additions & 112 deletions csharp/Svix/MessageAttempt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,139 +266,79 @@ public async Task<ListResponseMessageAttemptOut> ListAttemptsByMessageAsync(stri

// Deprecated
[Obsolete("Use ListAttemptsByMessage instead, passing the endpoint ID through options")]
public ListResponseMessageAttemptEndpointOut ListAttemptsForEndpoint(string appId, string messageId,
public ListResponseMessageAttemptOut ListAttemptsForEndpoint(string appId, string messageId,
string endpointId, AttemptsByEndpointListOptions options = null, string idempotencyKey = default)
{
try
{
var lResults = _messageAttemptApi.V1MessageAttemptListByEndpointDeprecated(
appId,
messageId,
endpointId,
options?.Limit,
options?.Iterator,
options?.Channel,
options?.Tag,
(Svix.Model.MessageStatus?)options?.Status,
options?.Before,
options?.After,
options?.EventTypes);

return lResults;
}
catch (ApiException e)
{
Logger?.LogError(e, $"{nameof(ListAttemptsForEndpoint)} failed");

if (Throw)
throw;

return new ListResponseMessageAttemptEndpointOut();
}
var listByMessageOptions = new AttemptsByMessageListOptions(
Limit: options?.Limit,

Check failure on line 273 in csharp/Svix/MessageAttempt.cs

View workflow job for this annotation

GitHub Actions / C# Lint

The best overload for 'AttemptsByMessageListOptions' does not have a parameter named 'Limit'
Iterator: options?.Iterator,
Channel: options?.Channel,
Tag: options?.Tag,
Status: options?.Status,
Before: options?.Before,
After: options?.After,
EventTypes: options?.EventTypes,
EndpointId: endpointId
);
return ListAttemptsByMessage(appId, messageId, listByMessageOptions, idempotencyKey);
}

// Deprecated
[Obsolete("Use ListAttemptsByMessageAsync instead, passing the endpoint ID through options")]
public async Task<ListResponseMessageAttemptEndpointOut> ListAttemptsForEndpointAsync(string appId,
public async Task<ListResponseMessageAttemptOut> ListAttemptsForEndpointAsync(string appId,
string messageId, string endpointId, AttemptsByEndpointListOptions options = null, string idempotencyKey = default,
CancellationToken cancellationToken = default)
{
try
{
var lResults = await _messageAttemptApi.V1MessageAttemptListByEndpointDeprecatedAsync(
appId,
messageId,
endpointId,
options?.Limit,
options?.Iterator,
options?.Channel,
options?.Tag,
(Svix.Model.MessageStatus?)options?.Status,
options?.Before,
options?.After,
options?.EventTypes?.ToList(),
cancellationToken);

return lResults;
}
catch (ApiException e)
{
Logger?.LogError(e, $"{nameof(ListAttemptsForEndpointAsync)} failed");

if (Throw)
throw;

return new ListResponseMessageAttemptEndpointOut();
}
var listByMessageOptions = new AttemptsByMessageListOptions(
Limit: options?.Limit,

Check failure on line 293 in csharp/Svix/MessageAttempt.cs

View workflow job for this annotation

GitHub Actions / C# Lint

The best overload for 'AttemptsByMessageListOptions' does not have a parameter named 'Limit'
Iterator: options?.Iterator,
Channel: options?.Channel,
Tag: options?.Tag,
Status: options?.Status,
Before: options?.Before,
After: options?.After,
EventTypes: options?.EventTypes,
EndpointId: endpointId
);
return await ListAttemptsByMessageAsync(appId, messageId, listByMessageOptions, idempotencyKey);
}

// Deprecated
[Obsolete("Use ListAttemptsByEndpoint or ListAttemptsByMessage instead")]
[Obsolete("Use ListAttemptsByMessage instead")]
public ListResponseMessageAttemptOut ListAttempts(string appId, string messageId, MessageAttemptListOptions options = null,
string idempotencyKey = default)
{
try
{
var lResults = _messageAttemptApi.V1MessageAttemptListByMsgDeprecated(
appId,
messageId,
options?.Limit,
options?.Iterator,
options?.EndpointId,
options?.Channel,
options?.Tag,
(Svix.Model.MessageStatus?)options?.Status,
options?.Before,
options?.After,
null,
options?.EventTypes);

return lResults;
}
catch (ApiException e)
{
Logger?.LogError(e, $"{nameof(ListAttempts)} failed");

if (Throw)
throw;

return new ListResponseMessageAttemptOut();
}
ListResponseTemplateOut listByMessageOptions = new AttemptsByMessageListOptions(
Limit: options?.Limit,

Check failure on line 312 in csharp/Svix/MessageAttempt.cs

View workflow job for this annotation

GitHub Actions / C# Lint

The best overload for 'AttemptsByMessageListOptions' does not have a parameter named 'Limit'
Iterator: options?.Iterator,
EndpointId: options?.EndpointId,
Channel: options?.Channel,
Tag: options?.Tag,
Status: options?.Status,
Before: options?.Before,
After: options?.After,
EventTypes: options?.EventTypes
);
return ListAttemptsByMessage(appId, messageId, listByMessageOptions, idempotencyKey);

Check failure on line 322 in csharp/Svix/MessageAttempt.cs

View workflow job for this annotation

GitHub Actions / C# Lint

Argument 3: cannot convert from 'Svix.Model.ListResponseTemplateOut' to 'Svix.Models.AttemptsByMessageListOptions'
}

// Deprecated
[Obsolete("Use ListAttemptsByEndpointAsync or ListAttemptsByMessageAsync instead")]
[Obsolete("Use ListAttemptsByMessageAsync instead")]
public async Task<ListResponseMessageAttemptOut> ListAttemptsAsync(string appId, string messageId, MessageAttemptListOptions options = null,
string idempotencyKey = default, CancellationToken cancellationToken = default)
{
try
{
var lResults = await _messageAttemptApi.V1MessageAttemptListByMsgDeprecatedAsync(
appId,
messageId,
options?.Limit,
options?.Iterator,
options?.EndpointId,
options?.Channel,
options?.Tag,
(Svix.Model.MessageStatus?)options?.Status,
options?.Before,
options?.After,
null,
options?.EventTypes,
cancellationToken);

return lResults;
}
catch (ApiException e)
{
Logger?.LogError(e, $"{nameof(ListAttemptsAsync)} failed");

if (Throw)
throw;

return new ListResponseMessageAttemptOut();
}
ListResponseTemplateOut listByMessageOptions = new AttemptsByMessageListOptions(
Limit: options?.Limit,

Check failure on line 331 in csharp/Svix/MessageAttempt.cs

View workflow job for this annotation

GitHub Actions / C# Lint

The best overload for 'AttemptsByMessageListOptions' does not have a parameter named 'Limit'
Iterator: options?.Iterator,
EndpointId: options?.EndpointId,
Channel: options?.Channel,
Tag: options?.Tag,
Status: options?.Status,
Before: options?.Before,
After: options?.After,
EventTypes: options?.EventTypes
);
return await ListAttemptsByMessageAsync(appId, messageId, listByMessageOptions, idempotencyKey);

Check failure on line 341 in csharp/Svix/MessageAttempt.cs

View workflow job for this annotation

GitHub Actions / C# Lint

Argument 3: cannot convert from 'Svix.Model.ListResponseTemplateOut' to 'Svix.Models.AttemptsByMessageListOptions'
}

public ListResponseMessageEndpointOut ListAttemptedDestinations(string appId, string messageId, ListOptions options = null,
Expand Down
28 changes: 14 additions & 14 deletions csharp/Svix/OperationalWebhookEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public OperationalWebhookEndpointOut Create(
{
try
{
var lEndpoint = _opWebhookEndpointApi.CreateOperationalWebhookEndpoint(
var lEndpoint = _opWebhookEndpointApi.V1OperationalWebhookEndpointCreate(
endpoint,
idempotencyKey);

Expand All @@ -50,7 +50,7 @@ public async Task<OperationalWebhookEndpointOut> CreateAsync(
{
try
{
var lEndpoint = await _opWebhookEndpointApi.CreateOperationalWebhookEndpointAsync(
var lEndpoint = await _opWebhookEndpointApi.V1OperationalWebhookEndpointCreateAsync(
endpoint,
idempotencyKey,
cancellationToken);
Expand All @@ -72,7 +72,7 @@ public bool Delete(string endpointId, string idempotencyKey = default)
{
try
{
var lResponse = _opWebhookEndpointApi.DeleteOperationalWebhookEndpointWithHttpInfo(
var lResponse = _opWebhookEndpointApi.V1OperationalWebhookEndpointDeleteWithHttpInfo(
endpointId);

return lResponse.StatusCode == HttpStatusCode.NoContent;
Expand All @@ -93,7 +93,7 @@ public async Task<bool> DeleteAsync(string endpointId, string idempotencyKey = d
{
try
{
var lResponse = await _opWebhookEndpointApi.DeleteOperationalWebhookEndpointWithHttpInfoAsync(
var lResponse = await _opWebhookEndpointApi.V1OperationalWebhookEndpointDeleteWithHttpInfoAsync(
endpointId,
cancellationToken);

Expand All @@ -114,7 +114,7 @@ public OperationalWebhookEndpointOut Get(string endpointId, string idempotencyKe
{
try
{
var lEndpoint = _opWebhookEndpointApi.GetOperationalWebhookEndpoint(endpointId);
var lEndpoint = _opWebhookEndpointApi.V1OperationalWebhookEndpointGet(endpointId);
return lEndpoint;
}
catch (ApiException e)
Expand All @@ -133,7 +133,7 @@ public async Task<OperationalWebhookEndpointOut> GetAsync(string endpointId, str
{
try
{
var lEndpoint = await _opWebhookEndpointApi.GetOperationalWebhookEndpointAsync(
var lEndpoint = await _opWebhookEndpointApi.V1OperationalWebhookEndpointGetAsync(
endpointId,
cancellationToken);

Expand All @@ -154,7 +154,7 @@ public string GetSecret(string endpointId, string idempotencyKey = default)
{
try
{
var lSecret = _opWebhookEndpointApi.GetOperationalWebhookEndpointSecret(
var lSecret = _opWebhookEndpointApi.V1OperationalWebhookEndpointGetSecret(
endpointId);

return lSecret?.Key;
Expand All @@ -175,7 +175,7 @@ public async Task<string> GetSecretAsync(string endpointId, string idempotencyKe
{
try
{
var lSecret = await _opWebhookEndpointApi.GetOperationalWebhookEndpointSecretAsync(
var lSecret = await _opWebhookEndpointApi.V1OperationalWebhookEndpointGetSecretAsync(
endpointId,
cancellationToken);

Expand All @@ -197,7 +197,7 @@ public ListResponseOperationalWebhookEndpointOut List(ListOptions options = null
{
try
{
var lEndpoints = _opWebhookEndpointApi.ListOperationalWebhookEndpoints(
var lEndpoints = _opWebhookEndpointApi.V1OperationalWebhookEndpointList(
options?.Limit,
options?.Iterator,
options?.Order);
Expand All @@ -221,7 +221,7 @@ public async Task<ListResponseOperationalWebhookEndpointOut> ListAsync(
{
try
{
var lEndpoints = await _opWebhookEndpointApi.ListOperationalWebhookEndpointsAsync(
var lEndpoints = await _opWebhookEndpointApi.V1OperationalWebhookEndpointListAsync(
options?.Limit,
options?.Iterator,
options?.Order,
Expand All @@ -244,7 +244,7 @@ public bool RotateSecret(string endpointId, OperationalWebhookEndpointSecretIn s
{
try
{
var lResponse = _opWebhookEndpointApi.RotateOperationalWebhookEndpointSecretWithHttpInfo(
var lResponse = _opWebhookEndpointApi.V1OperationalWebhookEndpointRotateSecret(

Check failure on line 247 in csharp/Svix/OperationalWebhookEndpoint.cs

View workflow job for this annotation

GitHub Actions / C# Lint

Cannot assign void to an implicitly-typed variable

Check failure on line 247 in csharp/Svix/OperationalWebhookEndpoint.cs

View workflow job for this annotation

GitHub Actions / C# Lint

Cannot assign void to an implicitly-typed variable
endpointId,
secret,
idempotencyKey);
Expand All @@ -267,7 +267,7 @@ public async Task<bool> RotateSecretAsync(string endpointId, OperationalWebhookE
{
try
{
var lResponse = await _opWebhookEndpointApi.RotateOperationalWebhookEndpointSecretWithHttpInfoAsync(
var lResponse = await _opWebhookEndpointApi.V1OperationalWebhookEndpointRotateSecretAsync(

Check failure on line 270 in csharp/Svix/OperationalWebhookEndpoint.cs

View workflow job for this annotation

GitHub Actions / C# Lint

Cannot assign void to an implicitly-typed variable

Check failure on line 270 in csharp/Svix/OperationalWebhookEndpoint.cs

View workflow job for this annotation

GitHub Actions / C# Lint

Cannot assign void to an implicitly-typed variable
endpointId,
secret,
idempotencyKey);
Expand All @@ -290,7 +290,7 @@ public OperationalWebhookEndpointOut Update(string endpointId,
{
try
{
var lEndpoint = _opWebhookEndpointApi.UpdateOperationalWebhookEndpoint(
var lEndpoint = _opWebhookEndpointApi.V1OperationalWebhookEndpointUpdate(
endpointId,
endpoint);

Expand All @@ -313,7 +313,7 @@ public async Task<OperationalWebhookEndpointOut> UpdateAsync(string endpointId,
{
try
{
var lEndpoint = await _opWebhookEndpointApi.UpdateOperationalWebhookEndpointAsync(
var lEndpoint = await _opWebhookEndpointApi.V1OperationalWebhookEndpointUpdateAsync(
endpointId,
endpoint,
cancellationToken);
Expand Down

0 comments on commit 9c81916

Please sign in to comment.