Skip to content

Commit 283573e

Browse files
committed
chore: renamed the package
1 parent 61798e6 commit 283573e

File tree

9 files changed

+60
-57
lines changed

9 files changed

+60
-57
lines changed

.github/dependabot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ updates:
1010
schedule:
1111
interval: "weekly"
1212
ignore:
13-
- dependency-name: "ht_*"
13+
- dependency-name: "core"

README.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
# ht_email_client
1+
# email_client
22

33
![coverage: percentage](https://img.shields.io/badge/coverage-XX-green)
44
[![style: very good analysis](https://img.shields.io/badge/style-very_good_analysis-B22C89.svg)](https://pub.dev/packages/very_good_analysis)
55
[![License: PolyForm Free Trial](https://img.shields.io/badge/License-PolyForm%20Free%20Trial-blue)](https://polyformproject.org/licenses/free-trial/1.0.0)
66

7-
Defines the abstract interface for email clients used within the Headlines Toolkit backend system. This package provides the contract (`HtEmailClient`) that concrete implementations (e.g., SMTP, AWS SES, SendGrid clients) should adhere to.
7+
This package provides the contract (`EmailClient`) that concrete implementations (e.g., SMTP, AWS SES, SendGrid clients) should adhere to.
88

99
## Getting Started
1010

1111
To use this package in your Dart backend project (like Dart Frog), add it to your `pubspec.yaml` file:
1212

1313
```yaml
1414
dependencies:
15-
ht_email_client:
15+
email_client:
1616
git:
17-
url: https://github.com/headlines-toolkit/ht-email-client.git
17+
url: https://github.com/flutter-news-app-full-source-code/email-client.git
1818
# Use a specific ref/tag for stability in production
1919
# ref: main
2020
```
@@ -23,29 +23,29 @@ Then run `dart pub get`.
2323

2424
## Features
2525

26-
* **`HtEmailClient` Abstract Class:** Defines a generic, provider-agnostic interface for sending transactional emails. This approach decouples application logic from email content and styling, which can be managed directly within your email service provider (e.g., SendGrid, AWS SES).
27-
* `Future<void> sendTransactionalEmail({required String senderEmail, required String recipientEmail, required String templateId, required Map<String, dynamic> templateData})`: Sends an email using a pre-defined template. Implementations must handle underlying service errors and map them to standard `ht_shared` exceptions.
26+
* **`EmailClient` Abstract Class:** Defines a generic, provider-agnostic interface for sending transactional emails. This approach decouples application logic from email content and styling, which can be managed directly within your email service provider (e.g., SendGrid, AWS SES).
27+
* `Future<void> sendTransactionalEmail({required String senderEmail, required String recipientEmail, required String templateId, required Map<String, dynamic> templateData})`: Sends an email using a pre-defined template. Implementations must handle underlying service errors and map them to standard `core` exceptions.
2828

2929
## Usage
3030

31-
This package only provides the abstract interface. You need a concrete implementation package (e.g., `ht_email_sendgrid`) that implements `HtEmailClient`.
31+
This package only provides the abstract interface. You need a concrete implementation package (e.g., `ht_email_sendgrid`) that implements `EmailClient`.
3232

3333
In your backend application (e.g., Dart Frog), you would typically:
3434

3535
1. Depend on a concrete implementation package.
3636
2. Configure and provide an instance of the concrete client using dependency injection.
37-
3. Inject `HtEmailClient` into your services where email sending is required.
37+
3. Inject `EmailClient` into your services where email sending is required.
3838

3939
```dart
4040
// Example (Conceptual - in a service or route handler)
41-
import 'package:ht_email_client/ht_email_client.dart';
42-
import 'package:ht_shared/ht_shared.dart';
41+
import 'package:email_client/email_client.dart';
42+
import 'package:core/core.dart';
4343
4444
class AuthService {
45-
const AuthService({required HtEmailClient emailClient})
45+
const AuthService({required EmailClient emailClient})
4646
: _emailClient = emailClient;
4747
48-
final HtEmailClient _emailClient;
48+
final EmailClient _emailClient;
4949
5050
Future<void> sendVerificationEmail(String email, String otp) async {
5151
try {
@@ -61,14 +61,17 @@ class AuthService {
6161
},
6262
);
6363
// Handle success
64-
} on HtHttpException {
64+
} on HttpException {
6565
// Handle specific email sending errors (e.g., log, return error response)
6666
rethrow;
6767
}
6868
}
6969
}
7070
```
7171

72-
## License
7372

74-
This package is licensed under the [PolyForm Free Trial](LICENSE). Please review the terms before use.
73+
## 🔑 Licensing
74+
75+
This package is source-available and licensed under the [PolyForm Free Trial 1.0.0](LICENSE). Please review the terms before use.
76+
77+
For commercial licensing options that grant the right to build and distribute unlimited applications, please visit the main [**Flutter News App - Full Source Code Toolkit**](https://github.com/flutter-news-app-full-source-code) organization.

lib/email_client.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/// This package provides the contract (EmailClient) that concrete
2+
/// implementations (e.g., SMTP, AWS SES, SendGrid clients) should
3+
/// adhere to.
4+
library;
5+
6+
export 'src/email_client.dart';

lib/ht_email_client.dart

Lines changed: 0 additions & 5 deletions
This file was deleted.

lib/src/ht_email_client.dart renamed to lib/src/email_client.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import 'package:ht_shared/ht_shared.dart';
1+
import 'package:core/core.dart';
22

3-
/// {@template ht_email_client}
3+
/// {@template email_client}
44
/// Defines the interface for sending emails within the backend system.
55
///
66
/// Concrete implementations (e.g., using specific email providers like
77
/// SendGrid, AWS SES, or a local SMTP server for testing) will handle the
88
/// actual email dispatch.
99
/// {@endtemplate}
10-
abstract class HtEmailClient {
11-
/// {@macro ht_email_client}
12-
const HtEmailClient();
10+
abstract class EmailClient {
11+
/// {@macro email_client}
12+
const EmailClient();
1313

1414
/// Sends a transactional email using a pre-defined template.
1515
///
@@ -25,7 +25,7 @@ abstract class HtEmailClient {
2525
/// - [templateData]: A map of dynamic data to be merged into the template.
2626
/// For example: `{'otpCode': '123456', 'username': 'Alex'}`.
2727
///
28-
/// Throws [HtHttpException] or its subtypes on failure:
28+
/// Throws [HttpException] or its subtypes on failure:
2929
/// - [InvalidInputException] if input parameters are invalid.
3030
/// - [NetworkException] for connectivity issues with the email service.
3131
/// - [ServerException] if the email service reports a server-side error.

pubspec.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
name: ht_email_client
2-
description: Defines the abstract interface for email clients used within the Headlines Toolkit backend systems.
3-
repository: https://github.com/headlines-toolkit/ht-email-client
1+
name: email_client
2+
description: This package provides the contract (EmailClient) that concrete implementations (e.g., SMTP, AWS SES, SendGrid clients) should adhere to.
3+
repository: https://github.com/flutter-news-app-full-source-code/email-client
44
publish_to: none
55

66
environment:
77
sdk: ^3.8.0
88

99
dependencies:
10-
ht_shared:
10+
core:
1111
git:
12-
url: https://github.com/headlines-toolkit/ht-shared.git
12+
url: https://github.com/flutter-news-app-full-source-code/core.git
1313

1414
dev_dependencies:
1515
mocktail: ^1.0.4
1616
test: ^1.25.8
17-
very_good_analysis: ^7.0.0
17+
very_good_analysis: ^9.0.0

test/.test_optimizer.dart

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

test/src/email_client_test.dart

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import 'package:email_client/email_client.dart';
2+
import 'package:mocktail/mocktail.dart';
3+
import 'package:test/test.dart';
4+
5+
// A mock implementation of the EmailClient for testing purposes.
6+
class MockEmailClient extends Mock implements EmailClient {}
7+
8+
void main() {
9+
group('EmailClient', () {
10+
late EmailClient emailClient;
11+
setUp(() {
12+
emailClient = MockEmailClient();
13+
});
14+
15+
test('can be implemented', () {
16+
expect(emailClient, isA<EmailClient>());
17+
});
18+
});
19+
}

test/src/ht_email_client_test.dart

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)