Skip to content

Commit a68acd9

Browse files
authored
Merge pull request #4 from flutter-news-app-full-source-code/build/update-docs
Build/update docs
2 parents f09f786 + 7040ecb commit a68acd9

File tree

5 files changed

+493
-80
lines changed

5 files changed

+493
-80
lines changed

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# See https://www.dartlang.org/guides/libraries/private-files
2-
3-
# Files and directories created by pub
41
.dart_tool/
52
.packages
63
build/
7-
pubspec.lock
4+
coverage/

README.md

Lines changed: 27 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,41 @@
1-
# email_repository
1+
<div align="center">
2+
<img src="https://avatars.githubusercontent.com/u/202675624?s=400&u=dc72a2b53e8158956a3b672f8e52e39394b6b610&v=4" alt="Flutter News App Toolkit Logo" width="220">
3+
<h1>Email Repository</h1>
4+
<p><strong>A repository that provides an abstraction layer over email operations for the Flutter News App Toolkit.</strong></p>
5+
</div>
26

3-
![coverage: percentage](https://img.shields.io/badge/coverage-100-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)
7+
<p align="center">
8+
<img src="https://img.shields.io/badge/coverage-100%25-green?style=for-the-badge" alt="coverage">
9+
<a href="https://flutter-news-app-full-source-code.github.io/docs/"><img src="https://img.shields.io/badge/LIVE_DOCS-VIEW-slategray?style=for-the-badge" alt="Live Docs: View"></a>
10+
<a href="https://github.com/flutter-news-app-full-source-code"><img src="https://img.shields.io/badge/MAIN_PROJECT-BROWSE-purple?style=for-the-badge" alt="Main Project: Browse"></a>
11+
</p>
612

7-
A repository that provides an abstraction layer over email operations.
13+
This `email_repository` package contains the `EmailRepository` class, which acts as an abstraction layer over an `EmailClient` implementation (from the `email_client` package) within the [**Flutter News App Full Source Code Toolkit**](https://github.com/flutter-news-app-full-source-code). Its primary purpose is to provide a clean, business-focused interface for email-related tasks while ensuring consistent error handling. The repository translates business-specific requests (e.g., "send an OTP") into generic, template-based calls to the underlying `EmailClient`, effectively decoupling the application's core logic from the specifics of email formatting and delivery.
814

9-
## Description
15+
## ⭐ Feature Showcase: Business-Focused Email Management
1016

11-
This package contains the `EmailRepository`, which acts as an abstraction
12-
layer over an `EmailClient` implementation (from the `email_client`
13-
package). Its primary purpose is to provide a clean, business-focused interface
14-
for email-related tasks while ensuring consistent error handling.
17+
This package offers a comprehensive set of features for managing email operations.
1518

16-
The repository translates business-specific requests (e.g., "send an OTP")
17-
into generic, template-based calls to the underlying `EmailClient`,
18-
decoupling the application's core logic from the specifics of email
19-
formatting and delivery.
19+
<details>
20+
<summary><strong>🧱 Core Functionality</strong></summary>
2021

21-
## Getting Started
22+
### 🚀 `EmailRepository` Class
23+
- **`EmailRepository`:** Provides a clean, business-focused interface for email-related tasks, abstracting the underlying `EmailClient` implementation.
24+
- **`sendOtpEmail` Method:** Offers a dedicated method for sending One-Time Password (OTP) emails, abstracting the details of template ID and data construction.
2225

23-
Add the package to your `pubspec.yaml`:
26+
### 🌐 Decoupled Email Logic
27+
- **Abstraction over `EmailClient`:** Decouples the application's core logic from the specifics of email formatting and delivery by translating business requests into generic, template-based calls to the `EmailClient`.
2428

25-
```yaml
26-
dependencies:
27-
email_repository:
28-
git:
29-
url: https://github.com/flutter-news-app-full-source-code/email-repository.git
30-
# ref: <specific_tag_or_commit> # Optional: Pin to a specific version
31-
```
32-
33-
Then, import the library:
34-
35-
```dart
36-
import 'package:email_repository/email_repository.dart';
37-
```
38-
39-
## Features
40-
41-
* Provides the `EmailRepository` class.
42-
* Offers a `sendOtpEmail` method that abstracts the process of sending an
43-
OTP. It calls the underlying client's `sendTransactionalEmail` method,
44-
passing the required template ID and data.
45-
46-
## Usage
47-
48-
To use this repository, you need to provide an instance of a concrete
49-
`EmailClient` implementation during instantiation. The consumer of the
50-
repository is responsible for providing the template ID.
51-
52-
```dart
53-
// Example (in a service that has access to config)
54-
final emailRepository = EmailRepository(emailClient: myEmailClient);
55-
const otpTemplateId = 'd-123456789'; // This would come from config
56-
57-
// Now you can use the repository methods
58-
try {
59-
await emailRepository.sendOtpEmail(
60-
senderEmail: 'noreply@yourdomain.com',
61-
recipientEmail: 'user@example.com',
62-
subject: 'Your One-Time Password',
63-
otpCode: '123456',
64-
templateId: otpTemplateId,
65-
);
66-
print('OTP email sent successfully!');
67-
} on HttpException catch (e) {
68-
print('Failed to send OTP email: $e');
69-
}
70-
```
71-
72-
*(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.)*
29+
### 🛡️ Standardized Error Handling
30+
- **`HttpException` Propagation:** Catches and re-throws `HttpException` subtypes (from `core`) propagated from the underlying `EmailClient`, ensuring consistent and predictable error management across the application layers.
7331

32+
### 💉 Dependency Injection Ready
33+
- **`EmailClient` Dependency:** Requires an instance of `EmailClient` (from the `email_client` package) via its constructor, promoting loose coupling and testability.
7434

35+
> **💡 Your Advantage:** This package provides a business-focused abstraction for email operations, simplifying the integration of email sending into your application logic. It ensures consistent error handling and decouples your core application from the specifics of email service providers, enhancing maintainability and flexibility.
7536
37+
</details>
7638

7739
## 🔑 Licensing
7840

79-
This package is source-available and licensed under the [PolyForm Free Trial 1.0.0](LICENSE). Please review the terms before use.
80-
81-
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.
41+
This `email_repository` package is an integral part of the [**Flutter News App Full Source Code Toolkit**](https://github.com/flutter-news-app-full-source-code). For comprehensive details regarding licensing, including trial and commercial options for the entire toolkit, please refer to the main toolkit organization page.

coverage/lcov.info

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

0 commit comments

Comments
 (0)