Skip to content

Commit

Permalink
fixup! Update APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
jaymell committed Nov 17, 2023
1 parent b6fcb61 commit 6ce945c
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 82 deletions.
4 changes: 2 additions & 2 deletions csharp/Svix/Abstractions/IStatistics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ namespace Svix.Abstractions
{
public interface IStatistics
{
AppUsageStatsOut CalculateAggregateAppStats(AppUsageStatsIn appUsageStatsIn, string idempotencyKey = default);
AppUsageStatsOut AggregateAppStats(AppUsageStatsIn appUsageStatsIn, string idempotencyKey = default);

Task<AppUsageStatsOut> CalculateAggregateAppStatsAsync(AppUsageStatsIn appUsageStatsIn, string idempotencyKey = default);
Task<AppUsageStatsOut> AggregateAppStatsAsync(AppUsageStatsIn appUsageStatsIn, string idempotencyKey = default);

AggregateEventTypesOut AggregateEventTypes();

Expand Down
16 changes: 8 additions & 8 deletions csharp/Svix/Statistics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ public Statistics(ISvixClient svixClient, IStatisticsApi statisticsApi)
_statisticsApi = statisticsApi ?? throw new ArgumentNullException(nameof(statisticsApi));
}

public AppUsageStatsOut CalculateAggregateAppStats(AppUsageStatsIn appUsageStatsIn, string idempotencyKey = default)
public AppUsageStatsOut AggregateAppStats(AppUsageStatsIn appUsageStatsIn, string idempotencyKey = default)
{
try
{
var res = _statisticsApi.CalculateAggregateAppStats(
var res = _statisticsApi.AggregateAppStats(
appUsageStatsIn,
idempotencyKey);

return res;
}
catch (ApiException e)
{
Logger?.LogError(e, $"{nameof(CalculateAggregateAppStats)} failed");
Logger?.LogError(e, $"{nameof(AggregateAppStats)} failed");

if (Throw)
throw;
Expand All @@ -39,19 +39,19 @@ public AppUsageStatsOut CalculateAggregateAppStats(AppUsageStatsIn appUsageStats
}
}

public async Task<AppUsageStatsOut> CalculateAggregateAppStatsAsync(AppUsageStatsIn appUsageStatsIn, string idempotencyKey = default)
public async Task<AppUsageStatsOut> AggregateAppStatsAsync(AppUsageStatsIn appUsageStatsIn, string idempotencyKey = default)
{
try
{
var res = await _statisticsApi.CalculateAggregateAppStatsAsync(
var res = await _statisticsApi.AggregateAppStatsAsync(
appUsageStatsIn,
idempotencyKey);

return res;
}
catch (ApiException e)
{
Logger?.LogError(e, $"{nameof(CalculateAggregateAppStatsAsync)} failed");
Logger?.LogError(e, $"{nameof(AggregateAppStatsAsync)} failed");

if (Throw)
throw;
Expand All @@ -70,7 +70,7 @@ public AggregateEventTypesOut AggregateEventTypes()
}
catch (ApiException e)
{
Logger?.LogError(e, $"{nameof(CalculateAggregateAppStatsAsync)} failed");
Logger?.LogError(e, $"{nameof(AggregateAppStatsAsync)} failed");

if (Throw)
throw;
Expand All @@ -89,7 +89,7 @@ public async Task<AggregateEventTypesOut> AggregateEventTypesAsync()
}
catch (ApiException e)
{
Logger?.LogError(e, $"{nameof(CalculateAggregateAppStatsAsync)} failed");
Logger?.LogError(e, $"{nameof(AggregateAppStatsAsync)} failed");

if (Throw)
throw;
Expand Down
99 changes: 51 additions & 48 deletions go/internal/openapi/api_statistics.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions go/statistics.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ type (
AggregateEventTypesOut = openapi.AggregateEventTypesOut
)

func (s *Statistics) CalculateAggregateAppStats(ctx context.Context, appUsageStatsIn *AppUsageStatsIn, options *PostOptions) (*AppUsageStatsOut, error) {
req := s.api.StatisticsApi.CalculateAggregateAppStats(ctx)
func (s *Statistics) AggregateAppStats(ctx context.Context, appUsageStatsIn *AppUsageStatsIn, options *PostOptions) (*AppUsageStatsOut, error) {
req := s.api.StatisticsApi.AggregateAppStats(ctx)
if appUsageStatsIn != nil {
req = req.AppUsageStatsIn(*appUsageStatsIn)
}
Expand Down
4 changes: 2 additions & 2 deletions java/lib/src/main/java/com/svix/Statistics.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public class Statistics {
api = new StatisticsApi();
}

public AppUsageStatsOut calculateAggregateAppStats(final AppUsageStatsIn appUsageStatsIn, final PostOptions options) throws ApiException {
public AppUsageStatsOut aggregateAppStats(final AppUsageStatsIn appUsageStatsIn, final PostOptions options) throws ApiException {
try {
return api.calculateAggregateAppStats(appUsageStatsIn, options.getIdempotencyKey());
return api.aggregateAppStats(appUsageStatsIn, options.getIdempotencyKey());
} catch (com.svix.internal.ApiException e) {
throw Utils.wrapInternalApiException(e);
}
Expand Down
4 changes: 2 additions & 2 deletions javascript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -893,11 +893,11 @@ class Statistics {
return this.api.aggregateEventTypes({});
}

public calculateAggregateAppStats(
public aggregateAppStats(
appUsageStatsIn: AppUsageStatsIn,
options?: PostOptions
): Promise<AppUsageStatsOut> {
return this.api.calculateAggregateAppStats({
return this.api.aggregateAppStats({
appUsageStatsIn,
...options,
});
Expand Down
4 changes: 2 additions & 2 deletions kotlin/lib/src/main/kotlin/Statistics.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class Statistics internal constructor(token: String, options: SvixOptions) {
options.numRetries?.let { api.numRetries = it }
}

suspend fun calculateAggregateAppStats(appUsageStatsIn: AppUsageStatsIn, options: PostOptions = PostOptions()): AppUsageStatsOut {
suspend fun aggregateAppStats(appUsageStatsIn: AppUsageStatsIn, options: PostOptions = PostOptions()): AppUsageStatsOut {
try {
return api.calculateAggregateAppStats(appUsageStatsIn, options.idempotencyKey)
return api.aggregateAppStats(appUsageStatsIn, options.idempotencyKey)
} catch (e: Exception) {
throw ApiException.wrap(e)
}
Expand Down
6 changes: 3 additions & 3 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -18002,7 +18002,7 @@
"/api/v1/stats/usage/app/": {
"post": {
"description": "Creates a background task to calculate the message destinations for all applications in the environment.\n\nNote that this endpoint is asynchronous. You will need to poll the `Get Background Task` endpoint to\nretrieve the results of the operation.",
"operationId": "calculate_aggregate_app_stats",
"operationId": "aggregate_app_stats",
"parameters": [
{
"description": "The request's idempotency key",
Expand Down Expand Up @@ -18111,15 +18111,15 @@
"HTTPBearer": []
}
],
"summary": "Calculate Aggregate App Stats",
"summary": "Aggregate App Stats",
"tags": [
"Statistics"
]
}
},
"/api/v1/stats/usage/event-types/": {
"put": {
"description": "Creates a background task to calculate the listed event types for all apps in the organization",
"description": "Creates a background task to calculate the listed event types for all apps in the organization.\n\nNote that this endpoint is asynchronous. You will need to poll the `Get Background Task` endpoint to\nretrieve the results of the operation.",
"operationId": "aggregate_event_types",
"responses": {
"202": {
Expand Down
10 changes: 5 additions & 5 deletions python/svix/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
v1_message_attempt_list_by_msg,
v1_message_attempt_resend,
)
from .internal.openapi_client.api.statistics import aggregate_event_types, calculate_aggregate_app_stats
from .internal.openapi_client.api.statistics import aggregate_event_types, aggregate_app_stats
from .internal.openapi_client.client import AuthenticatedClient
from .internal.openapi_client.models.app_portal_access_in import AppPortalAccessIn
from .internal.openapi_client.models.app_portal_access_out import AppPortalAccessOut
Expand Down Expand Up @@ -1040,10 +1040,10 @@ def get(self, task_id: str) -> BackgroundTaskOut:


class StatisticsAsync(ApiBase):
async def calculate_aggregate_app_stats(
async def aggregate_app_stats(
self, app_usage_stats_in: AppUsageStatsIn, options: PostOptions = PostOptions()
) -> AppUsageStatsOut:
return await calculate_aggregate_app_stats.asyncio(
return await aggregate_app_stats.asyncio(
client=self._client,
json_body=app_usage_stats_in,
**options.to_dict(),
Expand All @@ -1054,10 +1054,10 @@ async def aggregate_event_types(self, task_id: str) -> AggregateEventTypesOut:


class Statistics(ApiBase):
def calculate_aggregate_app_stats(
def aggregate_app_stats(
self, app_usage_stats_in: AppUsageStatsIn, options: PostOptions = PostOptions()
) -> AppUsageStatsOut:
return calculate_aggregate_app_stats.sync(
return aggregate_app_stats.sync(
client=self._client,
json_body=app_usage_stats_in,
**options.to_dict(),
Expand Down
4 changes: 2 additions & 2 deletions ruby/lib/svix/statistics_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ def initialize(api_client)
@api = StatisticsApi.new(api_client)
end

def calculate_aggregate_app_stats(options = {})
return @api.calculate_aggregate_app_stats(options)
def aggregate_app_stats(options = {})
return @api.aggregate_app_stats(options)
end

def aggregate_event_types(options = {})
Expand Down
Loading

0 comments on commit 6ce945c

Please sign in to comment.