1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//! # pleme-providers
//!
//! Multi-provider integration library for Pleme platform services.
//!
//! ## Philosophy
//!
//! This library implements the **Strategy Pattern** for integrating multiple external providers:
//! - Single interface for multiple implementations
//! - Runtime provider selection via registry
//! - Consistent error handling across providers
//! - Capability negotiation
//!
//! ## Use Cases
//!
//! - **Product Catalog**: Multiple dropshipping providers (CJ, EPROLO, Alibaba, etc.)
//! - **Payment Processing**: Multiple payment gateways (Stripe, PayPal, Mercado Pago, PIX)
//! - **Shipping**: Multiple carriers (Correios, FedEx, DHL)
//! - **Email**: Multiple email services (SES, SendGrid, Mailgun)
//! - **SMS**: Multiple SMS providers (Twilio, Vonage)
//!
//! ## Usage
//!
//! ```rust
//! use pleme_providers::{Provider, ProviderRegistry, ProviderCapabilities, ProviderBatch, ProviderError};
//! use async_trait::async_trait;
//!
//! // Define your domain-specific item type
//! #[derive(Clone)]
//! struct Product {
//! id: String,
//! name: String,
//! }
//!
//! // Implement the Provider trait for your specific provider
//! struct MyDropshipProvider;
//!
//! #[async_trait]
//! impl Provider for MyDropshipProvider {
//! type Item = Product;
//! type Filter = ();
//! type Pagination = ();
//!
//! fn provider_id(&self) -> &str { "my-provider" }
//! fn provider_name(&self) -> &str { "My Provider" }
//! fn capabilities(&self) -> ProviderCapabilities {
//! ProviderCapabilities::default()
//! }
//!
//! async fn fetch_items(
//! &self,
//! _filter: Self::Filter,
//! _pagination: Self::Pagination,
//! ) -> Result<ProviderBatch<Self::Item>, ProviderError> {
//! Ok(ProviderBatch::empty())
//! }
//!
//! async fn validate_credentials(&self) -> Result<(), ProviderError> {
//! Ok(())
//! }
//! }
//!
//! // Use the registry to manage multiple providers
//! # async fn example() {
//! let mut registry = ProviderRegistry::new();
//! registry.register(std::sync::Arc::new(MyDropshipProvider));
//!
//! let provider = registry.get("my-provider").expect("Provider not found");
//! # }
//! ```
pub use Provider;
pub use ProviderRegistry;
pub use ProviderCapabilities;
pub use ProviderError;
pub use ProviderBatch;
/// Result type for provider operations
pub type Result<T> = Result;