Skip to content

Commit

Permalink
feat: ambassador stats endpoint (#1611)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinenerio authored Nov 19, 2024
1 parent 53bee06 commit f6d3714
Show file tree
Hide file tree
Showing 6 changed files with 239 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/espressocash_api/lib/espressocash_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export 'package:jupiter_aggregator/jupiter_aggregator.dart';

export 'src/client.dart';
export 'src/dto/ambassador_referral.dart';
export 'src/dto/ambassador_stats.dart';
export 'src/dto/create_payment.dart';
export 'src/dto/dln_payment.dart';
export 'src/dto/durable_transactions.dart';
Expand Down
3 changes: 3 additions & 0 deletions packages/espressocash_api/lib/src/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ abstract class EspressoCashClient {
Future<void> addAmbassadorReferral(
@Body() AmbassadorReferralRequestDto request,
);

@POST('/ambassador/stats')
Future<AmbassadorStatsResponseDto> getAmbassadorStats();
}

extension EspressoCashClientExt on EspressoCashClient {
Expand Down
27 changes: 27 additions & 0 deletions packages/espressocash_api/lib/src/client.g.dart

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

14 changes: 14 additions & 0 deletions packages/espressocash_api/lib/src/dto/ambassador_stats.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'package:freezed_annotation/freezed_annotation.dart';

part 'ambassador_stats.freezed.dart';
part 'ambassador_stats.g.dart';

@freezed
class AmbassadorStatsResponseDto with _$AmbassadorStatsResponseDto {
const factory AmbassadorStatsResponseDto({
required int referralCount,
}) = _AmbassadorStatsResponseDto;

factory AmbassadorStatsResponseDto.fromJson(Map<String, dynamic> json) =>
_$AmbassadorStatsResponseDtoFromJson(json);
}
175 changes: 175 additions & 0 deletions packages/espressocash_api/lib/src/dto/ambassador_stats.freezed.dart

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

19 changes: 19 additions & 0 deletions packages/espressocash_api/lib/src/dto/ambassador_stats.g.dart

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

0 comments on commit f6d3714

Please sign in to comment.