@@ -52,7 +52,7 @@ The **Messaging SDK** is a Python library that allows developers to interact wit
52
52
53
53
1 . Clone the repository:
54
54
``` bash
55
- git clone https://github.com/your-repo /messaging-sdk.git
55
+ git clone https://github.com/shiningflash /messaging-sdk.git
56
56
cd messaging-sdk
57
57
```
58
58
@@ -64,40 +64,22 @@ The **Messaging SDK** is a Python library that allows developers to interact wit
64
64
```
65
65
66
66
3 . Configure environment variables:
67
- - Copy ` .env.example ` to ` .env ` :
68
- ``` bash
69
- cp .env.example .env
70
- ```
71
- - Edit ` .env` and adjust the values:
72
- ` ` ` env
73
- BASE_URL=http://localhost:3000
74
- API_KEY=your-api-key
75
- WEBHOOK_SECRET=mySecret
76
- ` ` `
77
-
78
- 4. ** Browse the API:**
79
- - The repository includes an ** OpenAPI Specification** file located at: ` ./docs/openapi.yaml` . This file describes the API' s endpoints and can be viewed using tools like **SwaggerUI** or **Redocly**.
67
+ - Copy ` .env.example ` to ` .env ` : ` cp .env.example .env `
68
+ - Edit ` .env ` and adjust the values.
80
69
70
+ 4 . Browse the API:
71
+ - The repository includes an ** OpenAPI Specification** file located at: ` ./docs/openapi.yaml ` .
81
72
- To explore the API visually, you can use Docker to run the provided tools:
82
73
1 . Ensure Docker is installed on your machine.
83
- 2. Start the servers:
84
- ```bash
85
- docker compose up
86
- ```
87
- (If prompted, update the Docker images using `docker compose pull`).
88
-
89
- 3. The following servers will be available:
90
- - **Swagger UI**: [http://localhost:8080](http://localhost:8080)
91
- - **Redocly**: [http://localhost:8090](http://localhost:8090)
92
- - **API Server**: [http://localhost:3000](http://localhost:3000) (uses a local database).
93
-
94
- You can use either SwaggerUI or Redocly to browse and understand the API endpoints.
74
+ 2 . Start the servers: ` docker compose up ` .
75
+ 3 . The following servers will be available: ** Swagger UI** : [ http://localhost:8080 ] ( http://localhost:8080 ) , ** Redocly** : [ http://localhost:8090 ] ( http://localhost:8090 ) , ** API Server** : [ http://localhost:3000 ] ( http://localhost:3000 ) (uses a local database).
95
76
96
77
---
97
78
98
79
## Usage Guide
99
80
100
81
### SDK Usage
82
+
101
83
1 . Initialize the SDK:
102
84
``` python
103
85
from src.sdk.client import ApiClient
@@ -121,19 +103,22 @@ The **Messaging SDK** is a Python library that allows developers to interact wit
121
103
print (response)
122
104
```
123
105
124
- #### Comprehensive User Guide for **[SDK Usage](docs/sdk_usage.md)**
125
- For detailed usage and examples, please refer to the **[User Guide](docs/sdk_usage.md)** 👈.
106
+ #### Comprehensive User Guide for SDK Usage
107
+
108
+ [ ![ SDK Usage Documentation] ( https://img.shields.io/badge/Docs-SDK%20Usage%20Guide-blue?style=for-the-badge )] ( docs/sdk_usage.md )
126
109
127
110
### Webhook Setup
111
+
128
112
1 . Run the webhook server:
129
113
``` bash
130
114
uvicorn src.server.app:app --reload --port 3010
131
115
```
132
116
133
117
2 . Configure the API to send events to your webhook endpoint (e.g., ` http://localhost:3010/webhooks ` ).
134
118
135
- #### Comprehensive User Guide for **[Webhook](docs/webhook_guide.md)**
136
- For detailed usage and examples, please refer to the **[User Guide](docs/webhook_guide.md)** 👈.
119
+ #### Comprehensive User Guide for Webhook
120
+
121
+ [ ![ Webhook Documentation] ( https://img.shields.io/badge/Docs-Webhook%20Guide-blue?style=for-the-badge )] ( docs/webhook_guide.md )
137
122
138
123
---
139
124
@@ -161,86 +146,76 @@ For detailed usage and examples, please refer to the **[User Guide](docs/webhook
161
146
162
147
A detailed overview of the project structure, including descriptions of key files and directories.
163
148
164
- ## Root Directory
165
-
166
- ```
149
+ ``` plaintext
150
+ .
167
151
├── .github/ # GitHub workflows for CI/CD
152
+ │ └── workflows/
153
+ │ └── ci.yml # Continuous Integration pipeline configuration
168
154
├── src/ # Source code directory
155
+ │ ├── core/ # Core modules for shared logic
156
+ │ │ ├── __init__.py # Core module initialization
157
+ │ │ ├── exceptions/ # Exception handling modules
158
+ │ │ │ ├── __init__.py # Consolidated exception imports
159
+ │ │ │ ├── api.py # API-specific exceptions
160
+ │ │ │ ├── decorators.py # Decorators for exception handling
161
+ │ │ │ └── resource.py # Resource-specific exceptions
162
+ │ │ ├── config.py # Global configuration file for SDK and server
163
+ │ │ ├── logger.py # Logging utilities
164
+ │ │ ├── requests.py # Request helpers for SDK
165
+ │ │ ├── retry.py # Retry logic for transient failures
166
+ │ │ ├── security.py # HMAC validation and signature generation
167
+ │ │ └── validators.py # Common validation logic
168
+ │ ├── schemas/ # Schema definitions for request/response
169
+ │ │ ├── __init__.py # Schemas initialization
170
+ │ │ ├── contacts.py # Contact-related schemas
171
+ │ │ ├── errors.py # Error schemas (aligned with OpenAPI specs)
172
+ │ │ ├── messages.py # Message-related schemas
173
+ │ │ └── webhook.py # Webhook payload schemas
174
+ │ ├── sdk/ # SDK-related functionalities
175
+ │ │ ├── __init__.py # SDK initialization
176
+ │ │ ├── client.py # API client for interacting with the server
177
+ │ │ └── features/ # API feature modules
178
+ │ │ ├── __init__.py # Features initialization
179
+ │ │ ├── contacts.py # Contacts-related SDK operations
180
+ │ │ └── messages.py # Messages-related SDK operations
181
+ │ ├── server/ # Webhook server implementation
182
+ │ │ ├── __init__.py # Server initialization
183
+ │ │ ├── app.py # Main FastAPI application
184
+ │ │ └── schemas.py # Schemas specific to the webhook server
169
185
├── tests/ # Testing files for unit, integration, and E2E
186
+ │ ├── __init__.py # Test package initialization
187
+ │ ├── conftest.py # Pytest fixtures and test setup
188
+ │ ├── e2e/ # End-to-End (E2E) tests
189
+ │ │ ├── __init__.py # E2E tests initialization
190
+ │ │ ├── test_contacts_e2e.py # E2E tests for contacts feature
191
+ │ │ └── test_messages_e2e.py # E2E tests for messages feature
192
+ │ ├── integration/ # Integration tests
193
+ │ │ ├── __init__.py # Integration tests initialization
194
+ │ │ ├── test_contacts_integration.py # Integration tests for contacts
195
+ │ │ ├── test_messages_integration.py # Integration tests for messages
196
+ │ │ └── test_webhook.py # Integration tests for webhook functionality
197
+ │ └── unit/ # Unit tests for SDK and server
198
+ │ ├── test_sdk/ # SDK-specific unit tests
199
+ │ │ ├── __init__.py # SDK unit tests initialization
200
+ │ │ ├── test_client.py # Unit tests for API client
201
+ │ │ ├── test_contacts.py # Unit tests for contacts module
202
+ │ │ └── test_messages.py # Unit tests for messages module
203
+ │ └── test_server/ # Server-specific unit tests
204
+ │ ├── __init__.py # Server unit tests initialization
205
+ │ ├── test_route.py # Unit tests for API routes
206
+ │ └── test_signature_validation.py # Unit tests for signature validation
170
207
├── venv/ # Python virtual environment (not versioned)
171
208
├── .env.example # Example environment variables
172
- ├── config.py # Global configuration file for SDK and server
173
209
├── docker-compose.yml # Docker Compose configuration
174
210
├── pytest.ini # Pytest configuration
175
211
├── requirements.in # Base Python dependencies
176
212
├── requirements.txt # Locked Python dependencies
177
213
├── README.md # Project documentation and usage guide
178
214
├── docs/ # Additional documentation
215
+ │ ├── openapi.yaml # OpenAPI docs
179
216
│ ├── sdk_usage.md # Comprehensive SDK usage documentation
180
217
│ └── webhook_guide.md # Webhook-specific documentation
181
- ```
182
-
183
- ---
184
-
185
- #### `/src` Directory
186
-
187
- The main application source code is organized as follows:
188
-
189
- ```
190
- /src
191
- ├── sdk/ # SDK-related functionalities
192
- │ ├── __init__.py # SDK initialization
193
- │ ├── client.py # API client for interacting with the server
194
- │ ├── features/ # API feature modules
195
- │ │ ├── __init__.py # Features initialization
196
- │ │ ├── contacts.py # Contacts-related SDK operations
197
- │ │ └── messages.py # Messages-related SDK operations
198
- │ ├── schemas/ # Schema definitions for request/response
199
- │ │ ├── __init__.py # Schemas initialization
200
- │ │ ├── contacts.py # Contact-related schemas
201
- │ │ └── messages.py # Message-related schemas
202
- │ └── utils/ # Utility modules
203
- │ ├── __init__.py # Utilities initialization
204
- │ ├── exceptions.py # Custom exceptions for error handling
205
- │ ├── logger.py # Logging utilities
206
- │ ├── requests.py # Request helpers for SDK
207
- │ ├── retry.py # Retry logic for transient failures
208
- │ └── validators.py # Validators for request/response data
209
- ├── server/ # Webhook server implementation
210
- │ ├── __init__.py # Server initialization
211
- │ ├── app.py # Main FastAPI application
212
- │ └── schemas.py # Schemas specific to the webhook server
213
- ```
214
218
215
- ---
216
-
217
- #### `/tests` Directory
218
-
219
- The testing framework is organized as follows:
220
-
221
- ```
222
- /tests
223
- ├── __init__.py # Test package initialization
224
- ├── conftest.py # Pytest fixtures and test setup
225
- ├── e2e/ # End-to-End (E2E) tests
226
- │ ├── __init__.py # E2E tests initialization
227
- │ ├── test_contacts_e2e.py # E2E tests for contacts feature
228
- │ └── test_messages_e2e.py # E2E tests for messages feature
229
- ├── integration/ # Integration tests
230
- │ ├── __init__.py # Integration tests initialization
231
- │ ├── test_contacts_integration.py # Integration tests for contacts
232
- │ ├── test_end_to_end_workflows.py # Comprehensive workflow tests
233
- │ ├── test_messages_integration.py # Integration tests for messages
234
- │ └── test_webhook.py # Integration tests for webhook functionality
235
- └── unit/ # Unit tests for SDK and server
236
- ├── test_sdk/ # SDK-specific unit tests
237
- │ ├── __init__.py # SDK unit tests initialization
238
- │ ├── test_client.py # Unit tests for API client
239
- │ ├── test_contacts.py # Unit tests for contacts module
240
- │ └── test_messages.py # Unit tests for messages module
241
- └── test_server/ # Server-specific unit tests
242
- ├── test_route.py # Unit tests for API routes
243
- └── test_signature_validation.py # Unit tests for signature validation
244
219
```
245
220
246
221
---
0 commit comments