Skip to content

Commit 913c226

Browse files
committed
chore: renamed the package
1 parent 0e70bf7 commit 913c226

File tree

8 files changed

+65
-61
lines changed

8 files changed

+65
-61
lines changed

.github/dependabot.yaml

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

README.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
# ht_email_repository
1+
# email_repository
22

33
![coverage: percentage](https://img.shields.io/badge/coverage-100-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-
A Dart package providing a repository layer for email operations within the
8-
Headlines Toolkit ecosystem.
7+
A repository that provides an abstraction layer over email operations.
98

109
## Description
1110

12-
This package contains the `HtEmailRepository`, which acts as an abstraction
13-
layer over an `HtEmailClient` implementation (from the `ht_email_client`
11+
This package contains the `EmailRepository`, which acts as an abstraction
12+
layer over an `EmailClient` implementation (from the `email_client`
1413
package). Its primary purpose is to provide a clean, business-focused interface
1514
for email-related tasks while ensuring consistent error handling.
1615

1716
The repository translates business-specific requests (e.g., "send an OTP")
18-
into generic, template-based calls to the underlying `HtEmailClient`,
17+
into generic, template-based calls to the underlying `EmailClient`,
1918
decoupling the application's core logic from the specifics of email
2019
formatting and delivery.
2120

@@ -25,34 +24,34 @@ Add the package to your `pubspec.yaml`:
2524

2625
```yaml
2726
dependencies:
28-
ht_email_repository:
27+
email_repository:
2928
git:
30-
url: https://github.com/headlines-toolkit/ht-email-repository.git
29+
url: https://github.com/flutter-news-app-full-source-code/email-repository.git
3130
# ref: <specific_tag_or_commit> # Optional: Pin to a specific version
3231
```
3332

3433
Then, import the library:
3534

3635
```dart
37-
import 'package:ht_email_repository/ht_email_repository.dart';
36+
import 'package:email_repository/email_repository.dart';
3837
```
3938

4039
## Features
4140

42-
* Provides the `HtEmailRepository` class.
41+
* Provides the `EmailRepository` class.
4342
* Offers a `sendOtpEmail` method that abstracts the process of sending an
4443
OTP. It calls the underlying client's `sendTransactionalEmail` method,
4544
passing the required template ID and data.
4645

4746
## Usage
4847

4948
To use this repository, you need to provide an instance of a concrete
50-
`HtEmailClient` implementation during instantiation. The consumer of the
49+
`EmailClient` implementation during instantiation. The consumer of the
5150
repository is responsible for providing the template ID.
5251

5352
```dart
5453
// Example (in a service that has access to config)
55-
final emailRepository = HtEmailRepository(emailClient: myEmailClient);
54+
final emailRepository = EmailRepository(emailClient: myEmailClient);
5655
const otpTemplateId = 'd-123456789'; // This would come from config
5756
5857
// Now you can use the repository methods
@@ -64,13 +63,18 @@ try {
6463
templateId: otpTemplateId,
6564
);
6665
print('OTP email sent successfully!');
67-
} on HtHttpException catch (e) {
66+
} on HttpException catch (e) {
6867
print('Failed to send OTP email: $e');
6968
}
7069
```
7170

72-
*(Note: The specific `HtEmailClient` implementation will depend on your project's setup, e.g., using a real email service client or an in-memory version for testing.)*
71+
*(Note: The specific `EmailClient` implementation will depend on your project's setup, e.g., using a real email service client or an in-memory version for testing.)*
7372

74-
## License
7573

76-
This package is licensed under the [PolyForm Free Trial](LICENSE). Please review the terms before use.
74+
75+
76+
## 🔑 Licensing
77+
78+
This package is source-available and licensed under the [PolyForm Free Trial 1.0.0](LICENSE). Please review the terms before use.
79+
80+
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.

coverage/lcov.info

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
SF:lib\src\ht_email_repository.dart
1+
SF:lib\src\email_repository.dart
22
DA:15,1
3-
DA:32,1
4-
DA:38,2
5-
DA:41,1
6-
DA:45,1
3+
DA:33,1
4+
DA:40,2
5+
DA:44,1
6+
DA:46,1
77
LF:5
88
LH:5
99
end_of_record

lib/email_repository.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/// A repository that provides an abstraction layer over email operations.
2+
library;
3+
4+
export 'src/email_repository.dart';

lib/ht_email_repository.dart

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

lib/src/ht_email_repository.dart renamed to lib/src/email_repository.dart

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
import 'package:ht_email_client/ht_email_client.dart';
2-
import 'package:ht_shared/ht_shared.dart'; // For HtHttpException
1+
import 'package:core/core.dart'; // For HttpException
2+
import 'package:email_client/email_client.dart';
33

4-
/// {@template ht_email_repository}
4+
/// {@template email_repository}
55
/// A repository that handles email sending operations.
66
///
7-
/// This repository interacts with an underlying [HtEmailClient]
7+
/// This repository interacts with an underlying [EmailClient]
88
/// to send emails, such as One-Time Passwords (OTPs).
99
/// {@endtemplate}
10-
class HtEmailRepository {
11-
/// {@macro ht_email_repository}
10+
class EmailRepository {
11+
/// {@macro email_repository}
1212
///
13-
/// Requires an instance of [HtEmailClient] to handle the actual
13+
/// Requires an instance of [EmailClient] to handle the actual
1414
/// email sending operations.
15-
const HtEmailRepository({required HtEmailClient emailClient})
15+
const EmailRepository({required EmailClient emailClient})
1616
: _emailClient = emailClient;
1717

18-
final HtEmailClient _emailClient;
18+
final EmailClient _emailClient;
1919

2020
/// Sends a One-Time Password (OTP) email by calling the underlying client.
2121
///
2222
/// This method abstracts the specific details of sending an OTP email. It
2323
/// constructs the required `templateData` and calls the generic
24-
/// `sendTransactionalEmail` method on the injected [HtEmailClient].
24+
/// `sendTransactionalEmail` method on the injected [EmailClient].
2525
///
2626
/// - [senderEmail]: The email address of the sender.
2727
/// - [recipientEmail]: The email address of the recipient.
2828
/// - [otpCode]: The One-Time Password to be sent.
2929
/// - [templateId]: The ID of the transactional email template to use.
3030
///
31-
/// Throws [HtHttpException] subtypes on failure, as propagated from the
31+
/// Throws [HttpException] subtypes on failure, as propagated from the
3232
/// client.
3333
Future<void> sendOtpEmail({
3434
required String senderEmail,
@@ -43,7 +43,7 @@ class HtEmailRepository {
4343
templateId: templateId,
4444
templateData: {'otp_code': otpCode},
4545
);
46-
} on HtHttpException {
46+
} on HttpException {
4747
rethrow; // Propagate client-level exceptions
4848
}
4949
}

pubspec.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
name: ht_email_repository
2-
description: A Dart package providing a repository layer for email operations within the Headlines Toolkit ecosystem.
3-
repository: https://github.com/headlines-toolkit/ht-email-repository
1+
name: email_repository
2+
description: A repository that provides an abstraction layer over email operations.
3+
repository: https://github.com/flutter-news-app-full-source-code/email-repository
44
publish_to: none
55

66
environment:
77
sdk: ^3.8.0
88

99
dependencies:
10-
ht_email_client:
10+
core:
1111
git:
12-
url: https://github.com/headlines-toolkit/ht-email-client.git
13-
ht_shared:
12+
url: https://github.com/flutter-news-app-full-source-code/core.git
13+
email_client:
1414
git:
15-
url: https://github.com/headlines-toolkit/ht-shared.git
15+
url: https://github.com/flutter-news-app-full-source-code/email-client.git
1616

1717
dev_dependencies:
1818
mocktail: ^1.0.4
1919
test: ^1.25.8
20-
very_good_analysis: ^7.0.0
20+
very_good_analysis: ^9.0.0

test/src/ht_email_repository_test.dart renamed to test/src/email_repository_test.dart

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
// test/src/ht_email_repository_test.dart
2-
import 'package:ht_email_client/ht_email_client.dart';
3-
import 'package:ht_email_repository/ht_email_repository.dart';
4-
import 'package:ht_shared/ht_shared.dart';
1+
// test/src/email_repository_test.dart
2+
import 'package:core/core.dart';
3+
import 'package:email_client/email_client.dart';
4+
import 'package:email_repository/email_repository.dart';
55
import 'package:mocktail/mocktail.dart';
66
import 'package:test/test.dart';
77

8-
// Mock for the HtEmailClient dependency
9-
class MockHtEmailClient extends Mock implements HtEmailClient {}
8+
// Mock for the EmailClient dependency
9+
class MockEmailClient extends Mock implements EmailClient {}
1010

1111
void main() {
12-
group('HtEmailRepository', () {
13-
late HtEmailClient mockEmailClient;
14-
late HtEmailRepository emailRepository;
12+
group('EmailRepository', () {
13+
late EmailClient mockEmailClient;
14+
late EmailRepository emailRepository;
1515

1616
const testSenderEmail = '[email protected]';
1717
const testEmail = '[email protected]';
1818
const testOtpCode = '123456';
1919
const testTemplateId = 'd-otp-template';
2020

2121
setUp(() {
22-
mockEmailClient = MockHtEmailClient();
23-
emailRepository = HtEmailRepository(emailClient: mockEmailClient);
22+
mockEmailClient = MockEmailClient();
23+
emailRepository = EmailRepository(emailClient: mockEmailClient);
2424
});
2525

2626
test('can be instantiated', () {
27-
expect(HtEmailRepository(emailClient: MockHtEmailClient()), isNotNull);
27+
expect(EmailRepository(emailClient: MockEmailClient()), isNotNull);
2828
});
2929

3030
group('sendOtpEmail', () {
@@ -62,7 +62,7 @@ void main() {
6262
},
6363
);
6464

65-
test('propagates HtHttpException from client', () async {
65+
test('propagates HttpException from client', () async {
6666
// Arrange
6767
const exception = NetworkException();
6868
when(
@@ -82,7 +82,7 @@ void main() {
8282
otpCode: testOtpCode,
8383
templateId: testTemplateId,
8484
),
85-
throwsA(isA<HtHttpException>()),
85+
throwsA(isA<HttpException>()),
8686
);
8787

8888
// Verify the client method was called

0 commit comments

Comments
 (0)