Skip to content

Commit 8510da6

Browse files
committed
docs: add README.md for package description and usage
- Include package description, features, and usage instructions - Add badges for coverage, style, and license - Provide installation guide and example code - Mention license information
1 parent 12bc2b4 commit 8510da6

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# ht_email_repository
2+
3+
![coverage: percentage](https://img.shields.io/badge/coverage-XX-green)
4+
[![style: very good analysis](https://img.shields.io/badge/style-very_good_analysis-B22C89.svg)](https://pub.dev/packages/very_good_analysis)
5+
[![License: PolyForm Free Trial](https://img.shields.io/badge/License-PolyForm%20Free%20Trial-blue)](https://polyformproject.org/licenses/free-trial/1.0.0)
6+
7+
A Dart package providing a repository layer for email operations within the
8+
Headlines Toolkit ecosystem.
9+
10+
## Description
11+
12+
This package contains the `HtEmailRepository`, which acts as an abstraction
13+
layer over an `HtEmailClient` implementation (from the `ht_email_client`
14+
package). Its primary purpose is to provide a clean interface for email-related
15+
tasks while ensuring consistent error handling according to the project's
16+
standards (propagating `HtHttpException` subtypes from `ht_shared`).
17+
18+
Currently, it focuses on sending One-Time Password (OTP) emails.
19+
20+
## Getting Started
21+
22+
Add the package to your `pubspec.yaml`:
23+
24+
```yaml
25+
dependencies:
26+
ht_email_repository:
27+
git:
28+
url: https://github.com/headlines-toolkit/ht-email-repository.git
29+
# ref: <specific_tag_or_commit> # Optional: Pin to a specific version
30+
```
31+
32+
Then, import the library:
33+
34+
```dart
35+
import 'package:ht_email_repository/ht_email_repository.dart';
36+
```
37+
38+
## Features
39+
40+
* Provides the `HtEmailRepository` class.
41+
* Offers a `sendOtpEmail` method to facilitate sending OTPs via an injected
42+
`HtEmailClient`.
43+
44+
## Usage
45+
46+
To use this repository, you need to provide an instance of a concrete
47+
`HtEmailClient` implementation during instantiation.
48+
49+
```dart
50+
// Example (assuming you have an HtEmailClient instance named 'myEmailClient')
51+
final emailRepository = HtEmailRepository(emailClient: myEmailClient);
52+
53+
// Now you can use the repository methods
54+
try {
55+
await emailRepository.sendOtpEmail(
56+
recipientEmail: '[email protected]',
57+
otpCode: '123456',****
58+
);
59+
print('OTP email sent successfully!');
60+
} on HtHttpException catch (e) {
61+
print('Failed to send OTP email: $e');
62+
}
63+
```
64+
65+
*(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.)*
66+
67+
## License
68+
69+
This package is licensed under the [PolyForm Free Trial](LICENSE). Please review the terms before use.

0 commit comments

Comments
 (0)